blob: 3c3843a4c1fe4aa9ea965fd05aa1dceb2cc44b3c [file] [log] [blame]
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05301/* 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>
19
20#include "devices.h"
21#include "board-8930.h"
22
23#ifdef CONFIG_MSM_BUS_SCALING
24static struct msm_bus_vectors grp3d_init_vectors[] = {
25 {
26 .src = MSM_BUS_MASTER_GRAPHICS_3D,
27 .dst = MSM_BUS_SLAVE_EBI_CH0,
28 .ab = 0,
29 .ib = 0,
30 },
31};
32
33static struct msm_bus_vectors grp3d_low_vectors[] = {
34 {
35 .src = MSM_BUS_MASTER_GRAPHICS_3D,
36 .dst = MSM_BUS_SLAVE_EBI_CH0,
37 .ab = 0,
38 .ib = KGSL_CONVERT_TO_MBPS(2000),
39 },
40};
41
42static struct msm_bus_vectors grp3d_nominal_vectors[] = {
43 {
44 .src = MSM_BUS_MASTER_GRAPHICS_3D,
45 .dst = MSM_BUS_SLAVE_EBI_CH0,
46 .ab = 0,
47 .ib = KGSL_CONVERT_TO_MBPS(3200),
48 },
49};
50
51static struct msm_bus_vectors grp3d_max_vectors[] = {
52 {
53 .src = MSM_BUS_MASTER_GRAPHICS_3D,
54 .dst = MSM_BUS_SLAVE_EBI_CH0,
55 .ab = 0,
Sudhakara Rao Tentuef9d75e2012-03-30 09:21:42 -070056 .ib = KGSL_CONVERT_TO_MBPS(4264),
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +053057 },
58};
59
60static struct msm_bus_paths grp3d_bus_scale_usecases[] = {
61 {
62 ARRAY_SIZE(grp3d_init_vectors),
63 grp3d_init_vectors,
64 },
65 {
66 ARRAY_SIZE(grp3d_low_vectors),
67 grp3d_low_vectors,
68 },
69 {
70 ARRAY_SIZE(grp3d_nominal_vectors),
71 grp3d_nominal_vectors,
72 },
73 {
74 ARRAY_SIZE(grp3d_max_vectors),
75 grp3d_max_vectors,
76 },
77};
78
79static struct msm_bus_scale_pdata grp3d_bus_scale_pdata = {
80 grp3d_bus_scale_usecases,
81 ARRAY_SIZE(grp3d_bus_scale_usecases),
82 .name = "grp3d",
83};
84#endif
85
86static struct resource kgsl_3d0_resources[] = {
87 {
88 .name = KGSL_3D0_REG_MEMORY,
89 .start = 0x04300000, /* GFX3D address */
90 .end = 0x0431ffff,
91 .flags = IORESOURCE_MEM,
92 },
93 {
94 .name = KGSL_3D0_IRQ,
95 .start = GFX3D_IRQ,
96 .end = GFX3D_IRQ,
97 .flags = IORESOURCE_IRQ,
98 },
99};
100
Shubhraprakash Daseb6df1d2012-05-01 00:55:35 -0600101static const struct kgsl_iommu_ctx kgsl_3d0_iommu0_ctxs[] = {
102 { "gfx3d_user", 0 },
103 { "gfx3d_priv", 1 },
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530104};
105
106static struct kgsl_device_iommu_data kgsl_3d0_iommu_data[] = {
107 {
Shubhraprakash Daseb6df1d2012-05-01 00:55:35 -0600108 .iommu_ctxs = kgsl_3d0_iommu0_ctxs,
109 .iommu_ctx_count = ARRAY_SIZE(kgsl_3d0_iommu0_ctxs),
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530110 .physstart = 0x07C00000,
111 .physend = 0x07C00000 + SZ_1M - 1,
112 },
113};
114
115static struct kgsl_device_platform_data kgsl_3d0_pdata = {
116 .pwrlevel = {
117 {
Sudhakara Rao Tentu6607e672012-05-22 12:07:04 +0530118 .gpu_freq = 450000000,
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530119 .bus_freq = 3,
120 .io_fraction = 0,
121 },
122 {
Sudhakara Rao Tentuef9d75e2012-03-30 09:21:42 -0700123 .gpu_freq = 320000000,
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530124 .bus_freq = 2,
125 .io_fraction = 33,
126 },
127 {
Sudhakara Rao Tentuef9d75e2012-03-30 09:21:42 -0700128 .gpu_freq = 192000000,
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530129 .bus_freq = 1,
130 .io_fraction = 100,
131 },
132 {
133 .gpu_freq = 27000000,
134 .bus_freq = 0,
135 },
136 },
137 .init_level = 0,
138 .num_levels = 4,
139 .set_grp_async = NULL,
Sudhakara Rao Tentuef9d75e2012-03-30 09:21:42 -0700140 .idle_timeout = HZ/12,
141 .nap_allowed = true,
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530142 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM_IFACE,
143#ifdef CONFIG_MSM_BUS_SCALING
144 .bus_scale_table = &grp3d_bus_scale_pdata,
145#endif
146 .iommu_data = kgsl_3d0_iommu_data,
147 .iommu_count = ARRAY_SIZE(kgsl_3d0_iommu_data),
148};
149
150static struct platform_device device_kgsl_3d0 = {
151 .name = "kgsl-3d0",
152 .id = 0,
153 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
154 .resource = kgsl_3d0_resources,
155 .dev = {
156 .platform_data = &kgsl_3d0_pdata,
157 },
158};
159
160void __init msm8930_init_gpu(void)
161{
162 platform_device_register(&device_kgsl_3d0);
163}