diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-4430sdp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-4430sdp.c | 360 |
1 files changed, 314 insertions, 46 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index b88f28c5814b..e4a5d66b83b8 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -18,8 +18,12 @@ | |||
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/usb/otg.h> | 20 | #include <linux/usb/otg.h> |
21 | #include <linux/spi/spi.h> | ||
22 | #include <linux/i2c/twl.h> | ||
23 | #include <linux/regulator/machine.h> | ||
21 | 24 | ||
22 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
26 | #include <mach/omap4-common.h> | ||
23 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
24 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
25 | #include <asm/mach/map.h> | 29 | #include <asm/mach/map.h> |
@@ -29,8 +33,77 @@ | |||
29 | #include <plat/control.h> | 33 | #include <plat/control.h> |
30 | #include <plat/timer-gp.h> | 34 | #include <plat/timer-gp.h> |
31 | #include <plat/usb.h> | 35 | #include <plat/usb.h> |
32 | #include <asm/hardware/gic.h> | 36 | #include <plat/mmc.h> |
33 | #include <asm/hardware/cache-l2x0.h> | 37 | #include "hsmmc.h" |
38 | |||
39 | #define ETH_KS8851_IRQ 34 | ||
40 | #define ETH_KS8851_POWER_ON 48 | ||
41 | #define ETH_KS8851_QUART 138 | ||
42 | |||
43 | static struct spi_board_info sdp4430_spi_board_info[] __initdata = { | ||
44 | { | ||
45 | .modalias = "ks8851", | ||
46 | .bus_num = 1, | ||
47 | .chip_select = 0, | ||
48 | .max_speed_hz = 24000000, | ||
49 | .irq = ETH_KS8851_IRQ, | ||
50 | }, | ||
51 | }; | ||
52 | |||
53 | static int omap_ethernet_init(void) | ||
54 | { | ||
55 | int status; | ||
56 | |||
57 | /* Request of GPIO lines */ | ||
58 | |||
59 | status = gpio_request(ETH_KS8851_POWER_ON, "eth_power"); | ||
60 | if (status) { | ||
61 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON); | ||
62 | return status; | ||
63 | } | ||
64 | |||
65 | status = gpio_request(ETH_KS8851_QUART, "quart"); | ||
66 | if (status) { | ||
67 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART); | ||
68 | goto error1; | ||
69 | } | ||
70 | |||
71 | status = gpio_request(ETH_KS8851_IRQ, "eth_irq"); | ||
72 | if (status) { | ||
73 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ); | ||
74 | goto error2; | ||
75 | } | ||
76 | |||
77 | /* Configuration of requested GPIO lines */ | ||
78 | |||
79 | status = gpio_direction_output(ETH_KS8851_POWER_ON, 1); | ||
80 | if (status) { | ||
81 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ); | ||
82 | goto error3; | ||
83 | } | ||
84 | |||
85 | status = gpio_direction_output(ETH_KS8851_QUART, 1); | ||
86 | if (status) { | ||
87 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART); | ||
88 | goto error3; | ||
89 | } | ||
90 | |||
91 | status = gpio_direction_input(ETH_KS8851_IRQ); | ||
92 | if (status) { | ||
93 | pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ); | ||
94 | goto error3; | ||
95 | } | ||
96 | |||
97 | return 0; | ||
98 | |||
99 | error3: | ||
100 | gpio_free(ETH_KS8851_IRQ); | ||
101 | error2: | ||
102 | gpio_free(ETH_KS8851_QUART); | ||
103 | error1: | ||
104 | gpio_free(ETH_KS8851_POWER_ON); | ||
105 | return status; | ||
106 | } | ||
34 | 107 | ||
35 | static struct platform_device sdp4430_lcd_device = { | 108 | static struct platform_device sdp4430_lcd_device = { |
36 | .name = "sdp4430_lcd", | 109 | .name = "sdp4430_lcd", |
@@ -49,50 +122,6 @@ static struct omap_board_config_kernel sdp4430_config[] __initdata = { | |||
49 | { OMAP_TAG_LCD, &sdp4430_lcd_config }, | 122 | { OMAP_TAG_LCD, &sdp4430_lcd_config }, |
50 | }; | 123 | }; |
51 | 124 | ||
52 | #ifdef CONFIG_CACHE_L2X0 | ||
53 | static int __init omap_l2_cache_init(void) | ||
54 | { | ||
55 | extern void omap_smc1(u32 fn, u32 arg); | ||
56 | void __iomem *l2cache_base; | ||
57 | |||
58 | /* To avoid code running on other OMAPs in | ||
59 | * multi-omap builds | ||
60 | */ | ||
61 | if (!cpu_is_omap44xx()) | ||
62 | return -ENODEV; | ||
63 | |||
64 | /* Static mapping, never released */ | ||
65 | l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K); | ||
66 | BUG_ON(!l2cache_base); | ||
67 | |||
68 | /* Enable PL310 L2 Cache controller */ | ||
69 | omap_smc1(0x102, 0x1); | ||
70 | |||
71 | /* 32KB way size, 16-way associativity, | ||
72 | * parity disabled | ||
73 | */ | ||
74 | l2x0_init(l2cache_base, 0x0e050000, 0xc0000fff); | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | early_initcall(omap_l2_cache_init); | ||
79 | #endif | ||
80 | |||
81 | static void __init gic_init_irq(void) | ||
82 | { | ||
83 | void __iomem *base; | ||
84 | |||
85 | /* Static mapping, never released */ | ||
86 | base = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K); | ||
87 | BUG_ON(!base); | ||
88 | gic_dist_init(0, base, 29); | ||
89 | |||
90 | /* Static mapping, never released */ | ||
91 | gic_cpu_base_addr = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); | ||
92 | BUG_ON(!gic_cpu_base_addr); | ||
93 | gic_cpu_init(0, gic_cpu_base_addr); | ||
94 | } | ||
95 | |||
96 | static void __init omap_4430sdp_init_irq(void) | 125 | static void __init omap_4430sdp_init_irq(void) |
97 | { | 126 | { |
98 | omap_board_config = sdp4430_config; | 127 | omap_board_config = sdp4430_config; |
@@ -111,15 +140,254 @@ static struct omap_musb_board_data musb_board_data = { | |||
111 | .power = 100, | 140 | .power = 100, |
112 | }; | 141 | }; |
113 | 142 | ||
143 | static struct omap2_hsmmc_info mmc[] = { | ||
144 | { | ||
145 | .mmc = 1, | ||
146 | .wires = 8, | ||
147 | .gpio_wp = -EINVAL, | ||
148 | }, | ||
149 | { | ||
150 | .mmc = 2, | ||
151 | .wires = 8, | ||
152 | .gpio_cd = -EINVAL, | ||
153 | .gpio_wp = -EINVAL, | ||
154 | .nonremovable = true, | ||
155 | }, | ||
156 | {} /* Terminator */ | ||
157 | }; | ||
158 | |||
159 | static struct regulator_consumer_supply sdp4430_vmmc_supply[] = { | ||
160 | { | ||
161 | .supply = "vmmc", | ||
162 | .dev_name = "mmci-omap-hs.0", | ||
163 | }, | ||
164 | { | ||
165 | .supply = "vmmc", | ||
166 | .dev_name = "mmci-omap-hs.1", | ||
167 | }, | ||
168 | }; | ||
169 | |||
170 | static int omap4_twl6030_hsmmc_late_init(struct device *dev) | ||
171 | { | ||
172 | int ret = 0; | ||
173 | struct platform_device *pdev = container_of(dev, | ||
174 | struct platform_device, dev); | ||
175 | struct omap_mmc_platform_data *pdata = dev->platform_data; | ||
176 | |||
177 | /* Setting MMC1 Card detect Irq */ | ||
178 | if (pdev->id == 0) | ||
179 | pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE + | ||
180 | MMCDETECT_INTR_OFFSET; | ||
181 | return ret; | ||
182 | } | ||
183 | |||
184 | static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) | ||
185 | { | ||
186 | struct omap_mmc_platform_data *pdata = dev->platform_data; | ||
187 | |||
188 | pdata->init = omap4_twl6030_hsmmc_late_init; | ||
189 | } | ||
190 | |||
191 | static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) | ||
192 | { | ||
193 | struct omap2_hsmmc_info *c; | ||
194 | |||
195 | omap2_hsmmc_init(controllers); | ||
196 | for (c = controllers; c->mmc; c++) | ||
197 | omap4_twl6030_hsmmc_set_late_init(c->dev); | ||
198 | |||
199 | return 0; | ||
200 | } | ||
201 | |||
202 | static struct regulator_init_data sdp4430_vaux1 = { | ||
203 | .constraints = { | ||
204 | .min_uV = 1000000, | ||
205 | .max_uV = 3000000, | ||
206 | .apply_uV = true, | ||
207 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
208 | | REGULATOR_MODE_STANDBY, | ||
209 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
210 | | REGULATOR_CHANGE_MODE | ||
211 | | REGULATOR_CHANGE_STATUS, | ||
212 | }, | ||
213 | }; | ||
214 | |||
215 | static struct regulator_init_data sdp4430_vaux2 = { | ||
216 | .constraints = { | ||
217 | .min_uV = 1200000, | ||
218 | .max_uV = 2800000, | ||
219 | .apply_uV = true, | ||
220 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
221 | | REGULATOR_MODE_STANDBY, | ||
222 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
223 | | REGULATOR_CHANGE_MODE | ||
224 | | REGULATOR_CHANGE_STATUS, | ||
225 | }, | ||
226 | }; | ||
227 | |||
228 | static struct regulator_init_data sdp4430_vaux3 = { | ||
229 | .constraints = { | ||
230 | .min_uV = 1000000, | ||
231 | .max_uV = 3000000, | ||
232 | .apply_uV = true, | ||
233 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
234 | | REGULATOR_MODE_STANDBY, | ||
235 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
236 | | REGULATOR_CHANGE_MODE | ||
237 | | REGULATOR_CHANGE_STATUS, | ||
238 | }, | ||
239 | }; | ||
240 | |||
241 | /* VMMC1 for MMC1 card */ | ||
242 | static struct regulator_init_data sdp4430_vmmc = { | ||
243 | .constraints = { | ||
244 | .min_uV = 1200000, | ||
245 | .max_uV = 3000000, | ||
246 | .apply_uV = true, | ||
247 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
248 | | REGULATOR_MODE_STANDBY, | ||
249 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
250 | | REGULATOR_CHANGE_MODE | ||
251 | | REGULATOR_CHANGE_STATUS, | ||
252 | }, | ||
253 | .num_consumer_supplies = 2, | ||
254 | .consumer_supplies = sdp4430_vmmc_supply, | ||
255 | }; | ||
256 | |||
257 | static struct regulator_init_data sdp4430_vpp = { | ||
258 | .constraints = { | ||
259 | .min_uV = 1800000, | ||
260 | .max_uV = 2500000, | ||
261 | .apply_uV = true, | ||
262 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
263 | | REGULATOR_MODE_STANDBY, | ||
264 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
265 | | REGULATOR_CHANGE_MODE | ||
266 | | REGULATOR_CHANGE_STATUS, | ||
267 | }, | ||
268 | }; | ||
269 | |||
270 | static struct regulator_init_data sdp4430_vusim = { | ||
271 | .constraints = { | ||
272 | .min_uV = 1200000, | ||
273 | .max_uV = 2900000, | ||
274 | .apply_uV = true, | ||
275 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
276 | | REGULATOR_MODE_STANDBY, | ||
277 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
278 | | REGULATOR_CHANGE_MODE | ||
279 | | REGULATOR_CHANGE_STATUS, | ||
280 | }, | ||
281 | }; | ||
282 | |||
283 | static struct regulator_init_data sdp4430_vana = { | ||
284 | .constraints = { | ||
285 | .min_uV = 2100000, | ||
286 | .max_uV = 2100000, | ||
287 | .apply_uV = true, | ||
288 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
289 | | REGULATOR_MODE_STANDBY, | ||
290 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
291 | | REGULATOR_CHANGE_STATUS, | ||
292 | }, | ||
293 | }; | ||
294 | |||
295 | static struct regulator_init_data sdp4430_vcxio = { | ||
296 | .constraints = { | ||
297 | .min_uV = 1800000, | ||
298 | .max_uV = 1800000, | ||
299 | .apply_uV = true, | ||
300 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
301 | | REGULATOR_MODE_STANDBY, | ||
302 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
303 | | REGULATOR_CHANGE_STATUS, | ||
304 | }, | ||
305 | }; | ||
306 | |||
307 | static struct regulator_init_data sdp4430_vdac = { | ||
308 | .constraints = { | ||
309 | .min_uV = 1800000, | ||
310 | .max_uV = 1800000, | ||
311 | .apply_uV = true, | ||
312 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
313 | | REGULATOR_MODE_STANDBY, | ||
314 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
315 | | REGULATOR_CHANGE_STATUS, | ||
316 | }, | ||
317 | }; | ||
318 | |||
319 | static struct regulator_init_data sdp4430_vusb = { | ||
320 | .constraints = { | ||
321 | .min_uV = 3300000, | ||
322 | .max_uV = 3300000, | ||
323 | .apply_uV = true, | ||
324 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
325 | | REGULATOR_MODE_STANDBY, | ||
326 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
327 | | REGULATOR_CHANGE_STATUS, | ||
328 | }, | ||
329 | }; | ||
330 | |||
331 | static struct twl4030_platform_data sdp4430_twldata = { | ||
332 | .irq_base = TWL6030_IRQ_BASE, | ||
333 | .irq_end = TWL6030_IRQ_END, | ||
334 | |||
335 | /* Regulators */ | ||
336 | .vmmc = &sdp4430_vmmc, | ||
337 | .vpp = &sdp4430_vpp, | ||
338 | .vusim = &sdp4430_vusim, | ||
339 | .vana = &sdp4430_vana, | ||
340 | .vcxio = &sdp4430_vcxio, | ||
341 | .vdac = &sdp4430_vdac, | ||
342 | .vusb = &sdp4430_vusb, | ||
343 | .vaux1 = &sdp4430_vaux1, | ||
344 | .vaux2 = &sdp4430_vaux2, | ||
345 | .vaux3 = &sdp4430_vaux3, | ||
346 | }; | ||
347 | |||
348 | static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = { | ||
349 | { | ||
350 | I2C_BOARD_INFO("twl6030", 0x48), | ||
351 | .flags = I2C_CLIENT_WAKE, | ||
352 | .irq = OMAP44XX_IRQ_SYS_1N, | ||
353 | .platform_data = &sdp4430_twldata, | ||
354 | }, | ||
355 | }; | ||
356 | static int __init omap4_i2c_init(void) | ||
357 | { | ||
358 | /* | ||
359 | * Phoenix Audio IC needs I2C1 to | ||
360 | * start with 400 KHz or less | ||
361 | */ | ||
362 | omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo, | ||
363 | ARRAY_SIZE(sdp4430_i2c_boardinfo)); | ||
364 | omap_register_i2c_bus(2, 400, NULL, 0); | ||
365 | omap_register_i2c_bus(3, 400, NULL, 0); | ||
366 | omap_register_i2c_bus(4, 400, NULL, 0); | ||
367 | return 0; | ||
368 | } | ||
114 | static void __init omap_4430sdp_init(void) | 369 | static void __init omap_4430sdp_init(void) |
115 | { | 370 | { |
371 | int status; | ||
372 | |||
373 | omap4_i2c_init(); | ||
116 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); | 374 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); |
117 | omap_serial_init(); | 375 | omap_serial_init(); |
376 | omap4_twl6030_hsmmc_init(mmc); | ||
118 | /* OMAP4 SDP uses internal transceiver so register nop transceiver */ | 377 | /* OMAP4 SDP uses internal transceiver so register nop transceiver */ |
119 | usb_nop_xceiv_register(); | 378 | usb_nop_xceiv_register(); |
120 | /* FIXME: allow multi-omap to boot until musb is updated for omap4 */ | 379 | /* FIXME: allow multi-omap to boot until musb is updated for omap4 */ |
121 | if (!cpu_is_omap44xx()) | 380 | if (!cpu_is_omap44xx()) |
122 | usb_musb_init(&musb_board_data); | 381 | usb_musb_init(&musb_board_data); |
382 | |||
383 | status = omap_ethernet_init(); | ||
384 | if (status) { | ||
385 | pr_err("Ethernet initialization failed: %d\n", status); | ||
386 | } else { | ||
387 | sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ); | ||
388 | spi_register_board_info(sdp4430_spi_board_info, | ||
389 | ARRAY_SIZE(sdp4430_spi_board_info)); | ||
390 | } | ||
123 | } | 391 | } |
124 | 392 | ||
125 | static void __init omap_4430sdp_map_io(void) | 393 | static void __init omap_4430sdp_map_io(void) |