blob: 7b84a68a45843687159958238dbc43be9857a948 [file] [log] [blame]
Jordan Crouseb3115fe2012-02-01 22:11:12 -07001/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/msm_kgsl.h>
17#include <mach/msm_bus_board.h>
18#include <mach/board.h>
Lucille Sylvester6e362412011-12-09 16:21:42 -070019#include <mach/msm_dcvs.h>
Jordan Crouseb3115fe2012-02-01 22:11:12 -070020
21#include "devices.h"
22#include "board-8064.h"
23
Lucille Sylvester6e362412011-12-09 16:21:42 -070024#ifdef CONFIG_MSM_DCVS
25static struct msm_dcvs_freq_entry grp3d_freq[] = {
26 {0, 0, 333932},
27 {0, 0, 497532},
28 {0, 0, 707610},
29 {0, 0, 844545},
30};
31
32static struct msm_dcvs_core_info grp3d_core_info = {
33 .freq_tbl = &grp3d_freq[0],
34 .core_param = {
35 .max_time_us = 100000,
36 .num_freq = ARRAY_SIZE(grp3d_freq),
37 },
38 .algo_param = {
39 .slack_time_us = 39000,
40 .disable_pc_threshold = 86000,
41 .ss_window_size = 1000000,
42 .ss_util_pct = 95,
43 .em_max_util_pct = 97,
44 .ss_iobusy_conv = 100,
45 },
46};
47#endif /* CONFIG_MSM_DCVS */
48
Jordan Crouseb3115fe2012-02-01 22:11:12 -070049#ifdef CONFIG_MSM_BUS_SCALING
50static struct msm_bus_vectors grp3d_init_vectors[] = {
51 {
52 .src = MSM_BUS_MASTER_GRAPHICS_3D,
53 .dst = MSM_BUS_SLAVE_EBI_CH0,
54 .ab = 0,
55 .ib = 0,
56 },
57 {
58 .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1,
59 .dst = MSM_BUS_SLAVE_EBI_CH0,
60 .ab = 0,
61 .ib = 0,
62 },
63};
64
65static struct msm_bus_vectors grp3d_low_vectors[] = {
66 {
67 .src = MSM_BUS_MASTER_GRAPHICS_3D,
68 .dst = MSM_BUS_SLAVE_EBI_CH0,
69 .ab = 0,
70 .ib = KGSL_CONVERT_TO_MBPS(2000),
71 },
72 {
73 .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1,
74 .dst = MSM_BUS_SLAVE_EBI_CH0,
75 .ab = 0,
76 .ib = KGSL_CONVERT_TO_MBPS(2000),
77 },
78};
79
80static struct msm_bus_vectors grp3d_nominal_high_vectors[] = {
81 {
82 .src = MSM_BUS_MASTER_GRAPHICS_3D,
83 .dst = MSM_BUS_SLAVE_EBI_CH0,
84 .ab = 0,
85 .ib = KGSL_CONVERT_TO_MBPS(3200),
86 },
87 {
88 .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1,
89 .dst = MSM_BUS_SLAVE_EBI_CH0,
90 .ab = 0,
91 .ib = KGSL_CONVERT_TO_MBPS(3200),
92 },
93};
94
95static struct msm_bus_vectors grp3d_max_vectors[] = {
96 {
97 .src = MSM_BUS_MASTER_GRAPHICS_3D,
98 .dst = MSM_BUS_SLAVE_EBI_CH0,
99 .ab = 0,
100 .ib = KGSL_CONVERT_TO_MBPS(4264),
101 },
102 {
103 .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1,
104 .dst = MSM_BUS_SLAVE_EBI_CH0,
105 .ab = 0,
106 .ib = KGSL_CONVERT_TO_MBPS(4264),
107 },
108};
109
110static struct msm_bus_paths grp3d_bus_scale_usecases[] = {
111 {
112 ARRAY_SIZE(grp3d_init_vectors),
113 grp3d_init_vectors,
114 },
115 {
116 ARRAY_SIZE(grp3d_low_vectors),
117 grp3d_low_vectors,
118 },
119 {
120 ARRAY_SIZE(grp3d_nominal_high_vectors),
121 grp3d_nominal_high_vectors,
122 },
123 {
124 ARRAY_SIZE(grp3d_max_vectors),
125 grp3d_max_vectors,
126 },
127};
128
129static struct msm_bus_scale_pdata grp3d_bus_scale_pdata = {
130 grp3d_bus_scale_usecases,
131 ARRAY_SIZE(grp3d_bus_scale_usecases),
132 .name = "grp3d",
133};
134#endif
135
136static struct resource kgsl_3d0_resources[] = {
137 {
138 .name = KGSL_3D0_REG_MEMORY,
139 .start = 0x04300000, /* GFX3D address */
140 .end = 0x0431ffff,
141 .flags = IORESOURCE_MEM,
142 },
143 {
144 .name = KGSL_3D0_IRQ,
145 .start = GFX3D_IRQ,
146 .end = GFX3D_IRQ,
147 .flags = IORESOURCE_IRQ,
148 },
149};
150
Jordan Crouse46cf4bb2012-02-21 08:54:52 -0700151static const char *kgsl_3d0_iommu0_ctx_names[] = {
152 "gfx3d_user",
153 /* priv_ctx goes here */
154};
155
156static const char *kgsl_3d0_iommu1_ctx_names[] = {
157 "gfx3d1_user",
158 /* priv_ctx goes here */
159};
160
161static struct kgsl_device_iommu_data kgsl_3d0_iommu_data[] = {
162 {
163 .iommu_ctx_names = kgsl_3d0_iommu0_ctx_names,
164 .iommu_ctx_count = ARRAY_SIZE(kgsl_3d0_iommu0_ctx_names),
165 .physstart = 0x07C00000,
166 .physend = 0x07C00000 + SZ_1M - 1,
167 },
168 {
169 .iommu_ctx_names = kgsl_3d0_iommu1_ctx_names,
170 .iommu_ctx_count = ARRAY_SIZE(kgsl_3d0_iommu1_ctx_names),
171 .physstart = 0x07D00000,
172 .physend = 0x07D00000 + SZ_1M - 1,
173 },
174};
175
Jordan Crouseb3115fe2012-02-01 22:11:12 -0700176static struct kgsl_device_platform_data kgsl_3d0_pdata = {
177 .pwrlevel = {
178 {
Tarun Karra3c2cc9e2012-02-17 14:58:07 -0800179 .gpu_freq = 400000000,
Tarun Karra71853702012-02-17 15:21:59 -0800180 .bus_freq = 3,
Tarun Karra3c2cc9e2012-02-17 14:58:07 -0800181 .io_fraction = 0,
Jordan Crouseb3115fe2012-02-01 22:11:12 -0700182 },
183 {
Lucille Sylvester0c779a92012-03-30 16:51:27 -0600184 .gpu_freq = 325000000,
Tarun Karra71853702012-02-17 15:21:59 -0800185 .bus_freq = 2,
Tarun Karra3c2cc9e2012-02-17 14:58:07 -0800186 .io_fraction = 33,
Jordan Crouseb3115fe2012-02-01 22:11:12 -0700187 },
188 {
Lucille Sylvester0c779a92012-03-30 16:51:27 -0600189 .gpu_freq = 200000000,
Tarun Karra71853702012-02-17 15:21:59 -0800190 .bus_freq = 1,
Jordan Crouseb3115fe2012-02-01 22:11:12 -0700191 .io_fraction = 100,
192 },
193 {
Tarun Karra3c2cc9e2012-02-17 14:58:07 -0800194 .gpu_freq = 27000000,
195 .bus_freq = 0,
Jordan Crouseb3115fe2012-02-01 22:11:12 -0700196 },
197 },
198 .init_level = 0,
199 .num_levels = 4,
200 .set_grp_async = NULL,
201 .idle_timeout = HZ/20,
202 .nap_allowed = true,
203 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM_IFACE,
204#ifdef CONFIG_MSM_BUS_SCALING
205 .bus_scale_table = &grp3d_bus_scale_pdata,
206#endif
Jordan Crouse46cf4bb2012-02-21 08:54:52 -0700207 .iommu_data = kgsl_3d0_iommu_data,
208 .iommu_count = ARRAY_SIZE(kgsl_3d0_iommu_data),
Lucille Sylvester6e362412011-12-09 16:21:42 -0700209#ifdef CONFIG_MSM_DCVS
210 .core_info = &grp3d_core_info,
211#endif
Jordan Crouseb3115fe2012-02-01 22:11:12 -0700212};
213
214struct platform_device device_kgsl_3d0 = {
215 .name = "kgsl-3d0",
216 .id = 0,
217 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
218 .resource = kgsl_3d0_resources,
219 .dev = {
220 .platform_data = &kgsl_3d0_pdata,
221 },
222};
223
224void __init apq8064_init_gpu(void)
225{
226 platform_device_register(&device_kgsl_3d0);
227}