diff options
Diffstat (limited to 'arch/arm/mach-davinci/devices-da8xx.c')
-rw-r--r-- | arch/arm/mach-davinci/devices-da8xx.c | 146 |
1 files changed, 131 insertions, 15 deletions
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index a5105f03fd86..0a96791d3b0f 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c | |||
@@ -24,8 +24,10 @@ | |||
24 | #include "clock.h" | 24 | #include "clock.h" |
25 | 25 | ||
26 | #define DA8XX_TPCC_BASE 0x01c00000 | 26 | #define DA8XX_TPCC_BASE 0x01c00000 |
27 | #define DA850_TPCC1_BASE 0x01e30000 | ||
27 | #define DA8XX_TPTC0_BASE 0x01c08000 | 28 | #define DA8XX_TPTC0_BASE 0x01c08000 |
28 | #define DA8XX_TPTC1_BASE 0x01c08400 | 29 | #define DA8XX_TPTC1_BASE 0x01c08400 |
30 | #define DA850_TPTC2_BASE 0x01e38000 | ||
29 | #define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */ | 31 | #define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */ |
30 | #define DA8XX_I2C0_BASE 0x01c22000 | 32 | #define DA8XX_I2C0_BASE 0x01c22000 |
31 | #define DA8XX_RTC_BASE 0x01C23000 | 33 | #define DA8XX_RTC_BASE 0x01C23000 |
@@ -42,7 +44,8 @@ | |||
42 | #define DA8XX_MDIO_REG_OFFSET 0x4000 | 44 | #define DA8XX_MDIO_REG_OFFSET 0x4000 |
43 | #define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K | 45 | #define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K |
44 | 46 | ||
45 | void __iomem *da8xx_syscfg_base; | 47 | void __iomem *da8xx_syscfg0_base; |
48 | void __iomem *da8xx_syscfg1_base; | ||
46 | 49 | ||
47 | static struct plat_serial8250_port da8xx_serial_pdata[] = { | 50 | static struct plat_serial8250_port da8xx_serial_pdata[] = { |
48 | { | 51 | { |
@@ -82,11 +85,6 @@ struct platform_device da8xx_serial_device = { | |||
82 | }, | 85 | }, |
83 | }; | 86 | }; |
84 | 87 | ||
85 | static const s8 da8xx_dma_chan_no_event[] = { | ||
86 | 20, 21, | ||
87 | -1 | ||
88 | }; | ||
89 | |||
90 | static const s8 da8xx_queue_tc_mapping[][2] = { | 88 | static const s8 da8xx_queue_tc_mapping[][2] = { |
91 | /* {event queue no, TC no} */ | 89 | /* {event queue no, TC no} */ |
92 | {0, 0}, | 90 | {0, 0}, |
@@ -101,20 +99,52 @@ static const s8 da8xx_queue_priority_mapping[][2] = { | |||
101 | {-1, -1} | 99 | {-1, -1} |
102 | }; | 100 | }; |
103 | 101 | ||
104 | static struct edma_soc_info da8xx_edma_info[] = { | 102 | static const s8 da850_queue_tc_mapping[][2] = { |
103 | /* {event queue no, TC no} */ | ||
104 | {0, 0}, | ||
105 | {-1, -1} | ||
106 | }; | ||
107 | |||
108 | static const s8 da850_queue_priority_mapping[][2] = { | ||
109 | /* {event queue no, Priority} */ | ||
110 | {0, 3}, | ||
111 | {-1, -1} | ||
112 | }; | ||
113 | |||
114 | static struct edma_soc_info da830_edma_info[] = { | ||
105 | { | 115 | { |
106 | .n_channel = 32, | 116 | .n_channel = 32, |
107 | .n_region = 4, | 117 | .n_region = 4, |
108 | .n_slot = 128, | 118 | .n_slot = 128, |
109 | .n_tc = 2, | 119 | .n_tc = 2, |
110 | .n_cc = 1, | 120 | .n_cc = 1, |
111 | .noevent = da8xx_dma_chan_no_event, | ||
112 | .queue_tc_mapping = da8xx_queue_tc_mapping, | 121 | .queue_tc_mapping = da8xx_queue_tc_mapping, |
113 | .queue_priority_mapping = da8xx_queue_priority_mapping, | 122 | .queue_priority_mapping = da8xx_queue_priority_mapping, |
114 | }, | 123 | }, |
115 | }; | 124 | }; |
116 | 125 | ||
117 | static struct resource da8xx_edma_resources[] = { | 126 | static struct edma_soc_info da850_edma_info[] = { |
127 | { | ||
128 | .n_channel = 32, | ||
129 | .n_region = 4, | ||
130 | .n_slot = 128, | ||
131 | .n_tc = 2, | ||
132 | .n_cc = 1, | ||
133 | .queue_tc_mapping = da8xx_queue_tc_mapping, | ||
134 | .queue_priority_mapping = da8xx_queue_priority_mapping, | ||
135 | }, | ||
136 | { | ||
137 | .n_channel = 32, | ||
138 | .n_region = 4, | ||
139 | .n_slot = 128, | ||
140 | .n_tc = 1, | ||
141 | .n_cc = 1, | ||
142 | .queue_tc_mapping = da850_queue_tc_mapping, | ||
143 | .queue_priority_mapping = da850_queue_priority_mapping, | ||
144 | }, | ||
145 | }; | ||
146 | |||
147 | static struct resource da830_edma_resources[] = { | ||
118 | { | 148 | { |
119 | .name = "edma_cc0", | 149 | .name = "edma_cc0", |
120 | .start = DA8XX_TPCC_BASE, | 150 | .start = DA8XX_TPCC_BASE, |
@@ -145,19 +175,91 @@ static struct resource da8xx_edma_resources[] = { | |||
145 | }, | 175 | }, |
146 | }; | 176 | }; |
147 | 177 | ||
148 | static struct platform_device da8xx_edma_device = { | 178 | static struct resource da850_edma_resources[] = { |
179 | { | ||
180 | .name = "edma_cc0", | ||
181 | .start = DA8XX_TPCC_BASE, | ||
182 | .end = DA8XX_TPCC_BASE + SZ_32K - 1, | ||
183 | .flags = IORESOURCE_MEM, | ||
184 | }, | ||
185 | { | ||
186 | .name = "edma_tc0", | ||
187 | .start = DA8XX_TPTC0_BASE, | ||
188 | .end = DA8XX_TPTC0_BASE + SZ_1K - 1, | ||
189 | .flags = IORESOURCE_MEM, | ||
190 | }, | ||
191 | { | ||
192 | .name = "edma_tc1", | ||
193 | .start = DA8XX_TPTC1_BASE, | ||
194 | .end = DA8XX_TPTC1_BASE + SZ_1K - 1, | ||
195 | .flags = IORESOURCE_MEM, | ||
196 | }, | ||
197 | { | ||
198 | .name = "edma_cc1", | ||
199 | .start = DA850_TPCC1_BASE, | ||
200 | .end = DA850_TPCC1_BASE + SZ_32K - 1, | ||
201 | .flags = IORESOURCE_MEM, | ||
202 | }, | ||
203 | { | ||
204 | .name = "edma_tc2", | ||
205 | .start = DA850_TPTC2_BASE, | ||
206 | .end = DA850_TPTC2_BASE + SZ_1K - 1, | ||
207 | .flags = IORESOURCE_MEM, | ||
208 | }, | ||
209 | { | ||
210 | .name = "edma0", | ||
211 | .start = IRQ_DA8XX_CCINT0, | ||
212 | .flags = IORESOURCE_IRQ, | ||
213 | }, | ||
214 | { | ||
215 | .name = "edma0_err", | ||
216 | .start = IRQ_DA8XX_CCERRINT, | ||
217 | .flags = IORESOURCE_IRQ, | ||
218 | }, | ||
219 | { | ||
220 | .name = "edma1", | ||
221 | .start = IRQ_DA850_CCINT1, | ||
222 | .flags = IORESOURCE_IRQ, | ||
223 | }, | ||
224 | { | ||
225 | .name = "edma1_err", | ||
226 | .start = IRQ_DA850_CCERRINT1, | ||
227 | .flags = IORESOURCE_IRQ, | ||
228 | }, | ||
229 | }; | ||
230 | |||
231 | static struct platform_device da830_edma_device = { | ||
149 | .name = "edma", | 232 | .name = "edma", |
150 | .id = -1, | 233 | .id = -1, |
151 | .dev = { | 234 | .dev = { |
152 | .platform_data = da8xx_edma_info, | 235 | .platform_data = da830_edma_info, |
153 | }, | 236 | }, |
154 | .num_resources = ARRAY_SIZE(da8xx_edma_resources), | 237 | .num_resources = ARRAY_SIZE(da830_edma_resources), |
155 | .resource = da8xx_edma_resources, | 238 | .resource = da830_edma_resources, |
239 | }; | ||
240 | |||
241 | static struct platform_device da850_edma_device = { | ||
242 | .name = "edma", | ||
243 | .id = -1, | ||
244 | .dev = { | ||
245 | .platform_data = da850_edma_info, | ||
246 | }, | ||
247 | .num_resources = ARRAY_SIZE(da850_edma_resources), | ||
248 | .resource = da850_edma_resources, | ||
156 | }; | 249 | }; |
157 | 250 | ||
158 | int __init da8xx_register_edma(void) | 251 | int __init da8xx_register_edma(void) |
159 | { | 252 | { |
160 | return platform_device_register(&da8xx_edma_device); | 253 | struct platform_device *pdev; |
254 | |||
255 | if (cpu_is_davinci_da830()) | ||
256 | pdev = &da830_edma_device; | ||
257 | else if (cpu_is_davinci_da850()) | ||
258 | pdev = &da850_edma_device; | ||
259 | else | ||
260 | return -ENODEV; | ||
261 | |||
262 | return platform_device_register(pdev); | ||
161 | } | 263 | } |
162 | 264 | ||
163 | static struct resource da8xx_i2c_resources0[] = { | 265 | static struct resource da8xx_i2c_resources0[] = { |
@@ -495,6 +597,19 @@ int da8xx_register_rtc(void) | |||
495 | return ret; | 597 | return ret; |
496 | } | 598 | } |
497 | 599 | ||
600 | static void __iomem *da8xx_ddr2_ctlr_base; | ||
601 | void __iomem * __init da8xx_get_mem_ctlr(void) | ||
602 | { | ||
603 | if (da8xx_ddr2_ctlr_base) | ||
604 | return da8xx_ddr2_ctlr_base; | ||
605 | |||
606 | da8xx_ddr2_ctlr_base = ioremap(DA8XX_DDR2_CTL_BASE, SZ_32K); | ||
607 | if (!da8xx_ddr2_ctlr_base) | ||
608 | pr_warning("%s: Unable to map DDR2 controller", __func__); | ||
609 | |||
610 | return da8xx_ddr2_ctlr_base; | ||
611 | } | ||
612 | |||
498 | static struct resource da8xx_cpuidle_resources[] = { | 613 | static struct resource da8xx_cpuidle_resources[] = { |
499 | { | 614 | { |
500 | .start = DA8XX_DDR2_CTL_BASE, | 615 | .start = DA8XX_DDR2_CTL_BASE, |
@@ -520,6 +635,7 @@ static struct platform_device da8xx_cpuidle_device = { | |||
520 | 635 | ||
521 | int __init da8xx_register_cpuidle(void) | 636 | int __init da8xx_register_cpuidle(void) |
522 | { | 637 | { |
638 | da8xx_cpuidle_pdata.ddr2_ctlr_base = da8xx_get_mem_ctlr(); | ||
639 | |||
523 | return platform_device_register(&da8xx_cpuidle_device); | 640 | return platform_device_register(&da8xx_cpuidle_device); |
524 | } | 641 | } |
525 | |||