Jordan Crouse | b3115fe | 2012-02-01 22:11:12 -0700 | [diff] [blame] | 1 | /* 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-8064.h" |
| 22 | |
| 23 | #ifdef CONFIG_MSM_BUS_SCALING |
| 24 | static 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 | .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1, |
| 33 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 34 | .ab = 0, |
| 35 | .ib = 0, |
| 36 | }, |
| 37 | }; |
| 38 | |
| 39 | static struct msm_bus_vectors grp3d_low_vectors[] = { |
| 40 | { |
| 41 | .src = MSM_BUS_MASTER_GRAPHICS_3D, |
| 42 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 43 | .ab = 0, |
| 44 | .ib = KGSL_CONVERT_TO_MBPS(2000), |
| 45 | }, |
| 46 | { |
| 47 | .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1, |
| 48 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 49 | .ab = 0, |
| 50 | .ib = KGSL_CONVERT_TO_MBPS(2000), |
| 51 | }, |
| 52 | }; |
| 53 | |
| 54 | static struct msm_bus_vectors grp3d_nominal_high_vectors[] = { |
| 55 | { |
| 56 | .src = MSM_BUS_MASTER_GRAPHICS_3D, |
| 57 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 58 | .ab = 0, |
| 59 | .ib = KGSL_CONVERT_TO_MBPS(3200), |
| 60 | }, |
| 61 | { |
| 62 | .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1, |
| 63 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 64 | .ab = 0, |
| 65 | .ib = KGSL_CONVERT_TO_MBPS(3200), |
| 66 | }, |
| 67 | }; |
| 68 | |
| 69 | static struct msm_bus_vectors grp3d_max_vectors[] = { |
| 70 | { |
| 71 | .src = MSM_BUS_MASTER_GRAPHICS_3D, |
| 72 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 73 | .ab = 0, |
| 74 | .ib = KGSL_CONVERT_TO_MBPS(4264), |
| 75 | }, |
| 76 | { |
| 77 | .src = MSM_BUS_MASTER_GRAPHICS_3D_PORT1, |
| 78 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 79 | .ab = 0, |
| 80 | .ib = KGSL_CONVERT_TO_MBPS(4264), |
| 81 | }, |
| 82 | }; |
| 83 | |
| 84 | static struct msm_bus_paths grp3d_bus_scale_usecases[] = { |
| 85 | { |
| 86 | ARRAY_SIZE(grp3d_init_vectors), |
| 87 | grp3d_init_vectors, |
| 88 | }, |
| 89 | { |
| 90 | ARRAY_SIZE(grp3d_low_vectors), |
| 91 | grp3d_low_vectors, |
| 92 | }, |
| 93 | { |
| 94 | ARRAY_SIZE(grp3d_nominal_high_vectors), |
| 95 | grp3d_nominal_high_vectors, |
| 96 | }, |
| 97 | { |
| 98 | ARRAY_SIZE(grp3d_max_vectors), |
| 99 | grp3d_max_vectors, |
| 100 | }, |
| 101 | }; |
| 102 | |
| 103 | static struct msm_bus_scale_pdata grp3d_bus_scale_pdata = { |
| 104 | grp3d_bus_scale_usecases, |
| 105 | ARRAY_SIZE(grp3d_bus_scale_usecases), |
| 106 | .name = "grp3d", |
| 107 | }; |
| 108 | #endif |
| 109 | |
| 110 | static struct resource kgsl_3d0_resources[] = { |
| 111 | { |
| 112 | .name = KGSL_3D0_REG_MEMORY, |
| 113 | .start = 0x04300000, /* GFX3D address */ |
| 114 | .end = 0x0431ffff, |
| 115 | .flags = IORESOURCE_MEM, |
| 116 | }, |
| 117 | { |
| 118 | .name = KGSL_3D0_IRQ, |
| 119 | .start = GFX3D_IRQ, |
| 120 | .end = GFX3D_IRQ, |
| 121 | .flags = IORESOURCE_IRQ, |
| 122 | }, |
| 123 | }; |
| 124 | |
| 125 | static struct kgsl_device_platform_data kgsl_3d0_pdata = { |
| 126 | .pwrlevel = { |
| 127 | { |
| 128 | .gpu_freq = 400000000, |
| 129 | .bus_freq = 4, |
| 130 | .io_fraction = 0, |
| 131 | }, |
| 132 | { |
| 133 | .gpu_freq = 320000000, |
| 134 | .bus_freq = 3, |
| 135 | .io_fraction = 33, |
| 136 | }, |
| 137 | { |
| 138 | .gpu_freq = 1920000000, |
| 139 | .bus_freq = 2, |
| 140 | .io_fraction = 100, |
| 141 | }, |
| 142 | { |
| 143 | .gpu_freq = 27000000, |
| 144 | .bus_freq = 0, |
| 145 | }, |
| 146 | }, |
| 147 | .init_level = 0, |
| 148 | .num_levels = 4, |
| 149 | .set_grp_async = NULL, |
| 150 | .idle_timeout = HZ/20, |
| 151 | .nap_allowed = true, |
| 152 | .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM_IFACE, |
| 153 | #ifdef CONFIG_MSM_BUS_SCALING |
| 154 | .bus_scale_table = &grp3d_bus_scale_pdata, |
| 155 | #endif |
| 156 | .iommu_user_ctx_name = "gfx3d_user", |
| 157 | .iommu_priv_ctx_name = NULL, |
| 158 | }; |
| 159 | |
| 160 | struct platform_device device_kgsl_3d0 = { |
| 161 | .name = "kgsl-3d0", |
| 162 | .id = 0, |
| 163 | .num_resources = ARRAY_SIZE(kgsl_3d0_resources), |
| 164 | .resource = kgsl_3d0_resources, |
| 165 | .dev = { |
| 166 | .platform_data = &kgsl_3d0_pdata, |
| 167 | }, |
| 168 | }; |
| 169 | |
| 170 | void __init apq8064_init_gpu(void) |
| 171 | { |
| 172 | platform_device_register(&device_kgsl_3d0); |
| 173 | } |