blob: 35f5c6437f66e58d06e13735110a1e303ea0e65b [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>
Jordan Crouse914de9b2012-07-09 13:49:46 -060016#include <mach/kgsl.h>
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +053017#include <mach/msm_bus_board.h>
18#include <mach/board.h>
Sudhakara Rao Tentu87c4e8e2012-06-20 14:42:58 +053019#include <mach/socinfo.h>
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +053020
21#include "devices.h"
22#include "board-8930.h"
23
24#ifdef CONFIG_MSM_BUS_SCALING
25static struct msm_bus_vectors grp3d_init_vectors[] = {
26 {
27 .src = MSM_BUS_MASTER_GRAPHICS_3D,
28 .dst = MSM_BUS_SLAVE_EBI_CH0,
29 .ab = 0,
30 .ib = 0,
31 },
32};
33
34static struct msm_bus_vectors grp3d_low_vectors[] = {
35 {
36 .src = MSM_BUS_MASTER_GRAPHICS_3D,
37 .dst = MSM_BUS_SLAVE_EBI_CH0,
38 .ab = 0,
Lucille Sylvester26615342012-06-26 17:55:10 -060039 .ib = KGSL_CONVERT_TO_MBPS(1000),
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +053040 },
41};
42
43static struct msm_bus_vectors grp3d_nominal_vectors[] = {
44 {
45 .src = MSM_BUS_MASTER_GRAPHICS_3D,
46 .dst = MSM_BUS_SLAVE_EBI_CH0,
47 .ab = 0,
Lucille Sylvester26615342012-06-26 17:55:10 -060048 .ib = KGSL_CONVERT_TO_MBPS(2656),
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +053049 },
50};
51
52static struct msm_bus_vectors grp3d_max_vectors[] = {
53 {
54 .src = MSM_BUS_MASTER_GRAPHICS_3D,
55 .dst = MSM_BUS_SLAVE_EBI_CH0,
56 .ab = 0,
Sudhakara Rao Tentuef9d75e2012-03-30 09:21:42 -070057 .ib = KGSL_CONVERT_TO_MBPS(4264),
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +053058 },
59};
60
61static struct msm_bus_paths grp3d_bus_scale_usecases[] = {
62 {
63 ARRAY_SIZE(grp3d_init_vectors),
64 grp3d_init_vectors,
65 },
66 {
67 ARRAY_SIZE(grp3d_low_vectors),
68 grp3d_low_vectors,
69 },
70 {
71 ARRAY_SIZE(grp3d_nominal_vectors),
72 grp3d_nominal_vectors,
73 },
74 {
75 ARRAY_SIZE(grp3d_max_vectors),
76 grp3d_max_vectors,
77 },
78};
79
80static struct msm_bus_scale_pdata grp3d_bus_scale_pdata = {
81 grp3d_bus_scale_usecases,
82 ARRAY_SIZE(grp3d_bus_scale_usecases),
83 .name = "grp3d",
84};
85#endif
86
87static struct resource kgsl_3d0_resources[] = {
88 {
89 .name = KGSL_3D0_REG_MEMORY,
90 .start = 0x04300000, /* GFX3D address */
91 .end = 0x0431ffff,
92 .flags = IORESOURCE_MEM,
93 },
94 {
95 .name = KGSL_3D0_IRQ,
96 .start = GFX3D_IRQ,
97 .end = GFX3D_IRQ,
98 .flags = IORESOURCE_IRQ,
99 },
100};
101
Shubhraprakash Daseb6df1d2012-05-01 00:55:35 -0600102static const struct kgsl_iommu_ctx kgsl_3d0_iommu0_ctxs[] = {
103 { "gfx3d_user", 0 },
104 { "gfx3d_priv", 1 },
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530105};
106
107static struct kgsl_device_iommu_data kgsl_3d0_iommu_data[] = {
108 {
Shubhraprakash Daseb6df1d2012-05-01 00:55:35 -0600109 .iommu_ctxs = kgsl_3d0_iommu0_ctxs,
110 .iommu_ctx_count = ARRAY_SIZE(kgsl_3d0_iommu0_ctxs),
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530111 .physstart = 0x07C00000,
112 .physend = 0x07C00000 + SZ_1M - 1,
113 },
114};
115
116static struct kgsl_device_platform_data kgsl_3d0_pdata = {
117 .pwrlevel = {
118 {
Sudhakara Rao Tentu18481ea2012-04-25 03:51:50 -0700119 .gpu_freq = 400000000,
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530120 .bus_freq = 3,
121 .io_fraction = 0,
122 },
123 {
Sudhakara Rao Tentuef9d75e2012-03-30 09:21:42 -0700124 .gpu_freq = 320000000,
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530125 .bus_freq = 2,
126 .io_fraction = 33,
127 },
128 {
Sudhakara Rao Tentuef9d75e2012-03-30 09:21:42 -0700129 .gpu_freq = 192000000,
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530130 .bus_freq = 1,
131 .io_fraction = 100,
132 },
133 {
134 .gpu_freq = 27000000,
135 .bus_freq = 0,
136 },
137 },
Lucille Sylvester7e3941b2012-06-29 11:57:43 -0600138 .init_level = 1,
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530139 .num_levels = 4,
140 .set_grp_async = NULL,
Sudhakara Rao Tentuef9d75e2012-03-30 09:21:42 -0700141 .idle_timeout = HZ/12,
142 .nap_allowed = true,
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530143 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM_IFACE,
144#ifdef CONFIG_MSM_BUS_SCALING
145 .bus_scale_table = &grp3d_bus_scale_pdata,
146#endif
147 .iommu_data = kgsl_3d0_iommu_data,
148 .iommu_count = ARRAY_SIZE(kgsl_3d0_iommu_data),
149};
150
151static struct platform_device device_kgsl_3d0 = {
152 .name = "kgsl-3d0",
153 .id = 0,
154 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
155 .resource = kgsl_3d0_resources,
156 .dev = {
157 .platform_data = &kgsl_3d0_pdata,
158 },
159};
160
161void __init msm8930_init_gpu(void)
162{
Sudhakara Rao Tentu87c4e8e2012-06-20 14:42:58 +0530163 if (cpu_is_msm8627())
164 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 400000000;
165
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +0530166 platform_device_register(&device_kgsl_3d0);
167}