Commit | Line | Data |
---|---|---|
2885f000 SMK |
1 | /* |
2 | * linux/arch/arm/mach-omap2/board-omap3beagle.c | |
3 | * | |
4 | * Copyright (C) 2008 Texas Instruments | |
5 | * | |
6 | * Modified from mach-omap2/board-3430sdp.c | |
7 | * | |
8 | * Initial code: Syed Mohammed Khasim | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License version 2 as | |
12 | * published by the Free Software Foundation. | |
13 | */ | |
14 | ||
15 | #include <linux/kernel.h> | |
16 | #include <linux/init.h> | |
17 | #include <linux/platform_device.h> | |
18 | #include <linux/delay.h> | |
19 | #include <linux/err.h> | |
20 | #include <linux/clk.h> | |
21 | #include <linux/io.h> | |
22 | #include <linux/leds.h> | |
23 | #include <linux/gpio.h> | |
24 | #include <linux/input.h> | |
25 | #include <linux/gpio_keys.h> | |
26 | ||
27 | #include <linux/mtd/mtd.h> | |
28 | #include <linux/mtd/partitions.h> | |
29 | #include <linux/mtd/nand.h> | |
3a63833e | 30 | #include <linux/mmc/host.h> |
2885f000 | 31 | |
bb3b9d8e | 32 | #include <linux/regulator/machine.h> |
b07682b6 | 33 | #include <linux/i2c/twl.h> |
145d9c94 | 34 | |
2885f000 SMK |
35 | #include <mach/hardware.h> |
36 | #include <asm/mach-types.h> | |
37 | #include <asm/mach/arch.h> | |
38 | #include <asm/mach/map.h> | |
39 | #include <asm/mach/flash.h> | |
40 | ||
ce491cf8 TL |
41 | #include <plat/board.h> |
42 | #include <plat/common.h> | |
044d32ff | 43 | #include <plat/display.h> |
89747c91 | 44 | #include <plat/panel-generic-dpi.h> |
ce491cf8 TL |
45 | #include <plat/gpmc.h> |
46 | #include <plat/nand.h> | |
ce491cf8 | 47 | #include <plat/usb.h> |
2885f000 | 48 | |
ca5742bd | 49 | #include "mux.h" |
d02a900b | 50 | #include "hsmmc.h" |
04aeae77 | 51 | #include "timer-gp.h" |
2885f000 | 52 | |
2885f000 SMK |
53 | #define NAND_BLOCK_SIZE SZ_128K |
54 | ||
954bed04 RN |
55 | /* |
56 | * OMAP3 Beagle revision | |
57 | * Run time detection of Beagle revision is done by reading GPIO. | |
58 | * GPIO ID - | |
59 | * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1 | |
60 | * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0 | |
61 | * C4 = GPIO173, GPIO172, GPIO171: 1 0 1 | |
62 | * XM = GPIO173, GPIO172, GPIO171: 0 0 0 | |
63 | */ | |
64 | enum { | |
65 | OMAP3BEAGLE_BOARD_UNKN = 0, | |
66 | OMAP3BEAGLE_BOARD_AXBX, | |
67 | OMAP3BEAGLE_BOARD_C1_3, | |
68 | OMAP3BEAGLE_BOARD_C4, | |
69 | OMAP3BEAGLE_BOARD_XM, | |
70 | }; | |
71 | ||
72 | static u8 omap3_beagle_version; | |
73 | ||
74 | static u8 omap3_beagle_get_rev(void) | |
75 | { | |
76 | return omap3_beagle_version; | |
77 | } | |
78 | ||
79 | static void __init omap3_beagle_init_rev(void) | |
80 | { | |
81 | int ret; | |
82 | u16 beagle_rev = 0; | |
83 | ||
84 | omap_mux_init_gpio(171, OMAP_PIN_INPUT_PULLUP); | |
85 | omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP); | |
86 | omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP); | |
87 | ||
88 | ret = gpio_request(171, "rev_id_0"); | |
89 | if (ret < 0) | |
90 | goto fail0; | |
91 | ||
92 | ret = gpio_request(172, "rev_id_1"); | |
93 | if (ret < 0) | |
94 | goto fail1; | |
95 | ||
96 | ret = gpio_request(173, "rev_id_2"); | |
97 | if (ret < 0) | |
98 | goto fail2; | |
99 | ||
100 | gpio_direction_input(171); | |
101 | gpio_direction_input(172); | |
102 | gpio_direction_input(173); | |
103 | ||
104 | beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) | |
105 | | (gpio_get_value(173) << 2); | |
106 | ||
107 | switch (beagle_rev) { | |
108 | case 7: | |
109 | printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n"); | |
110 | omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX; | |
111 | break; | |
112 | case 6: | |
113 | printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n"); | |
114 | omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3; | |
115 | break; | |
116 | case 5: | |
117 | printk(KERN_INFO "OMAP3 Beagle Rev: C4\n"); | |
118 | omap3_beagle_version = OMAP3BEAGLE_BOARD_C4; | |
119 | break; | |
120 | case 0: | |
121 | printk(KERN_INFO "OMAP3 Beagle Rev: xM\n"); | |
122 | omap3_beagle_version = OMAP3BEAGLE_BOARD_XM; | |
123 | break; | |
124 | default: | |
125 | printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); | |
126 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; | |
127 | } | |
128 | ||
129 | return; | |
130 | ||
131 | fail2: | |
132 | gpio_free(172); | |
133 | fail1: | |
134 | gpio_free(171); | |
135 | fail0: | |
136 | printk(KERN_ERR "Unable to get revision detection GPIO pins\n"); | |
137 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; | |
138 | ||
139 | return; | |
140 | } | |
141 | ||
2885f000 SMK |
142 | static struct mtd_partition omap3beagle_nand_partitions[] = { |
143 | /* All the partition sizes are listed in terms of NAND block size */ | |
144 | { | |
145 | .name = "X-Loader", | |
146 | .offset = 0, | |
147 | .size = 4 * NAND_BLOCK_SIZE, | |
148 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
149 | }, | |
150 | { | |
151 | .name = "U-Boot", | |
152 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */ | |
153 | .size = 15 * NAND_BLOCK_SIZE, | |
154 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
155 | }, | |
156 | { | |
157 | .name = "U-Boot Env", | |
158 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */ | |
159 | .size = 1 * NAND_BLOCK_SIZE, | |
160 | }, | |
161 | { | |
162 | .name = "Kernel", | |
163 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */ | |
164 | .size = 32 * NAND_BLOCK_SIZE, | |
165 | }, | |
166 | { | |
167 | .name = "File System", | |
168 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ | |
169 | .size = MTDPART_SIZ_FULL, | |
170 | }, | |
171 | }; | |
172 | ||
173 | static struct omap_nand_platform_data omap3beagle_nand_data = { | |
174 | .options = NAND_BUSWIDTH_16, | |
175 | .parts = omap3beagle_nand_partitions, | |
176 | .nr_parts = ARRAY_SIZE(omap3beagle_nand_partitions), | |
177 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ | |
178 | .nand_setup = NULL, | |
179 | .dev_ready = NULL, | |
180 | }; | |
181 | ||
044d32ff KK |
182 | /* DSS */ |
183 | ||
184 | static int beagle_enable_dvi(struct omap_dss_device *dssdev) | |
185 | { | |
186 | if (gpio_is_valid(dssdev->reset_gpio)) | |
187 | gpio_set_value(dssdev->reset_gpio, 1); | |
188 | ||
189 | return 0; | |
190 | } | |
191 | ||
192 | static void beagle_disable_dvi(struct omap_dss_device *dssdev) | |
193 | { | |
194 | if (gpio_is_valid(dssdev->reset_gpio)) | |
195 | gpio_set_value(dssdev->reset_gpio, 0); | |
196 | } | |
197 | ||
89747c91 BW |
198 | static struct panel_generic_dpi_data dvi_panel = { |
199 | .name = "generic", | |
200 | .platform_enable = beagle_enable_dvi, | |
201 | .platform_disable = beagle_disable_dvi, | |
202 | }; | |
203 | ||
044d32ff KK |
204 | static struct omap_dss_device beagle_dvi_device = { |
205 | .type = OMAP_DISPLAY_TYPE_DPI, | |
206 | .name = "dvi", | |
89747c91 BW |
207 | .driver_name = "generic_dpi_panel", |
208 | .data = &dvi_panel, | |
044d32ff | 209 | .phy.dpi.data_lines = 24, |
f8362d21 | 210 | .reset_gpio = -EINVAL, |
044d32ff KK |
211 | }; |
212 | ||
213 | static struct omap_dss_device beagle_tv_device = { | |
214 | .name = "tv", | |
215 | .driver_name = "venc", | |
216 | .type = OMAP_DISPLAY_TYPE_VENC, | |
217 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | |
218 | }; | |
219 | ||
220 | static struct omap_dss_device *beagle_dss_devices[] = { | |
221 | &beagle_dvi_device, | |
222 | &beagle_tv_device, | |
223 | }; | |
224 | ||
225 | static struct omap_dss_board_info beagle_dss_data = { | |
226 | .num_devices = ARRAY_SIZE(beagle_dss_devices), | |
227 | .devices = beagle_dss_devices, | |
228 | .default_device = &beagle_dvi_device, | |
229 | }; | |
230 | ||
231 | static struct platform_device beagle_dss_device = { | |
232 | .name = "omapdss", | |
233 | .id = -1, | |
234 | .dev = { | |
235 | .platform_data = &beagle_dss_data, | |
236 | }, | |
237 | }; | |
238 | ||
239 | static struct regulator_consumer_supply beagle_vdac_supply = | |
240 | REGULATOR_SUPPLY("vdda_dac", "omapdss"); | |
241 | ||
242 | static struct regulator_consumer_supply beagle_vdvi_supply = | |
243 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"); | |
244 | ||
245 | static void __init beagle_display_init(void) | |
246 | { | |
247 | int r; | |
248 | ||
249 | r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset"); | |
250 | if (r < 0) { | |
251 | printk(KERN_ERR "Unable to get DVI reset GPIO\n"); | |
252 | return; | |
253 | } | |
254 | ||
255 | gpio_direction_output(beagle_dvi_device.reset_gpio, 0); | |
256 | } | |
257 | ||
2e12bd7e PW |
258 | #include "sdram-micron-mt46h32m32lf-6.h" |
259 | ||
68ff0423 | 260 | static struct omap2_hsmmc_info mmc[] = { |
90c62bf0 TL |
261 | { |
262 | .mmc = 1, | |
3a63833e | 263 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
90c62bf0 TL |
264 | .gpio_wp = 29, |
265 | }, | |
266 | {} /* Terminator */ | |
267 | }; | |
268 | ||
bb3b9d8e DB |
269 | static struct regulator_consumer_supply beagle_vmmc1_supply = { |
270 | .supply = "vmmc", | |
271 | }; | |
272 | ||
273 | static struct regulator_consumer_supply beagle_vsim_supply = { | |
274 | .supply = "vmmc_aux", | |
275 | }; | |
276 | ||
90c62bf0 TL |
277 | static struct gpio_led gpio_leds[]; |
278 | ||
279 | static int beagle_twl_gpio_setup(struct device *dev, | |
280 | unsigned gpio, unsigned ngpio) | |
281 | { | |
1bd9ef19 KK |
282 | int r; |
283 | ||
cf74d41e RN |
284 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { |
285 | mmc[0].gpio_wp = -EINVAL; | |
286 | } else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) || | |
e4916e11 | 287 | (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) { |
4896e394 | 288 | omap_mux_init_gpio(23, OMAP_PIN_INPUT); |
44e74840 JN |
289 | mmc[0].gpio_wp = 23; |
290 | } else { | |
4896e394 | 291 | omap_mux_init_gpio(29, OMAP_PIN_INPUT); |
44e74840 | 292 | } |
90c62bf0 | 293 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
145d9c94 | 294 | mmc[0].gpio_cd = gpio + 0; |
68ff0423 | 295 | omap2_hsmmc_init(mmc); |
90c62bf0 | 296 | |
bb3b9d8e DB |
297 | /* link regulators to MMC adapters */ |
298 | beagle_vmmc1_supply.dev = mmc[0].dev; | |
299 | beagle_vsim_supply.dev = mmc[0].dev; | |
300 | ||
90c62bf0 TL |
301 | /* REVISIT: need ehci-omap hooks for external VBUS |
302 | * power switch and overcurrent detect | |
303 | */ | |
1bd9ef19 KK |
304 | if (omap3_beagle_get_rev() != OMAP3BEAGLE_BOARD_XM) { |
305 | r = gpio_request(gpio + 1, "EHCI_nOC"); | |
306 | if (!r) { | |
307 | r = gpio_direction_input(gpio + 1); | |
308 | if (r) | |
309 | gpio_free(gpio + 1); | |
310 | } | |
311 | if (r) | |
312 | pr_err("%s: unable to configure EHCI_nOC\n", __func__); | |
313 | } | |
90c62bf0 | 314 | |
68fc3e15 KK |
315 | /* |
316 | * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active | |
317 | * high / others active low) | |
318 | */ | |
90c62bf0 | 319 | gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); |
68fc3e15 KK |
320 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) |
321 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1); | |
322 | else | |
323 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); | |
90c62bf0 | 324 | |
f8362d21 KK |
325 | /* DVI reset GPIO is different between beagle revisions */ |
326 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) | |
327 | beagle_dvi_device.reset_gpio = 129; | |
328 | else | |
329 | beagle_dvi_device.reset_gpio = 170; | |
90c62bf0 TL |
330 | |
331 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | |
332 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | |
333 | ||
1bd9ef19 KK |
334 | /* |
335 | * gpio + 1 on Xm controls the TFP410's enable line (active low) | |
336 | * gpio + 2 control varies depending on the board rev as follows: | |
337 | * P7/P8 revisions(prototype): Camera EN | |
338 | * A2+ revisions (production): LDO (supplies DVI, serial, led blocks) | |
339 | */ | |
340 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { | |
341 | r = gpio_request(gpio + 1, "nDVI_PWR_EN"); | |
342 | if (!r) { | |
343 | r = gpio_direction_output(gpio + 1, 0); | |
344 | if (r) | |
345 | gpio_free(gpio + 1); | |
346 | } | |
347 | if (r) | |
348 | pr_err("%s: unable to configure nDVI_PWR_EN\n", | |
349 | __func__); | |
350 | r = gpio_request(gpio + 2, "DVI_LDO_EN"); | |
351 | if (!r) { | |
352 | r = gpio_direction_output(gpio + 2, 1); | |
353 | if (r) | |
354 | gpio_free(gpio + 2); | |
355 | } | |
356 | if (r) | |
357 | pr_err("%s: unable to configure DVI_LDO_EN\n", | |
358 | __func__); | |
359 | } | |
360 | ||
90c62bf0 TL |
361 | return 0; |
362 | } | |
363 | ||
364 | static struct twl4030_gpio_platform_data beagle_gpio_data = { | |
365 | .gpio_base = OMAP_MAX_GPIO_LINES, | |
366 | .irq_base = TWL4030_GPIO_IRQ_BASE, | |
367 | .irq_end = TWL4030_GPIO_IRQ_END, | |
368 | .use_leds = true, | |
369 | .pullups = BIT(1), | |
370 | .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13) | |
371 | | BIT(15) | BIT(16) | BIT(17), | |
372 | .setup = beagle_twl_gpio_setup, | |
373 | }; | |
374 | ||
bb3b9d8e DB |
375 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
376 | static struct regulator_init_data beagle_vmmc1 = { | |
377 | .constraints = { | |
378 | .min_uV = 1850000, | |
379 | .max_uV = 3150000, | |
380 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
381 | | REGULATOR_MODE_STANDBY, | |
382 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
383 | | REGULATOR_CHANGE_MODE | |
384 | | REGULATOR_CHANGE_STATUS, | |
385 | }, | |
386 | .num_consumer_supplies = 1, | |
387 | .consumer_supplies = &beagle_vmmc1_supply, | |
388 | }; | |
389 | ||
390 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ | |
391 | static struct regulator_init_data beagle_vsim = { | |
392 | .constraints = { | |
393 | .min_uV = 1800000, | |
394 | .max_uV = 3000000, | |
395 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
396 | | REGULATOR_MODE_STANDBY, | |
397 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
398 | | REGULATOR_CHANGE_MODE | |
399 | | REGULATOR_CHANGE_STATUS, | |
400 | }, | |
401 | .num_consumer_supplies = 1, | |
402 | .consumer_supplies = &beagle_vsim_supply, | |
403 | }; | |
404 | ||
405 | /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */ | |
406 | static struct regulator_init_data beagle_vdac = { | |
407 | .constraints = { | |
408 | .min_uV = 1800000, | |
409 | .max_uV = 1800000, | |
410 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
411 | | REGULATOR_MODE_STANDBY, | |
412 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
413 | | REGULATOR_CHANGE_STATUS, | |
414 | }, | |
415 | .num_consumer_supplies = 1, | |
416 | .consumer_supplies = &beagle_vdac_supply, | |
417 | }; | |
418 | ||
419 | /* VPLL2 for digital video outputs */ | |
420 | static struct regulator_init_data beagle_vpll2 = { | |
421 | .constraints = { | |
422 | .name = "VDVI", | |
423 | .min_uV = 1800000, | |
424 | .max_uV = 1800000, | |
425 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
426 | | REGULATOR_MODE_STANDBY, | |
427 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
428 | | REGULATOR_CHANGE_STATUS, | |
429 | }, | |
430 | .num_consumer_supplies = 1, | |
431 | .consumer_supplies = &beagle_vdvi_supply, | |
432 | }; | |
433 | ||
bd04e465 FB |
434 | static struct twl4030_usb_data beagle_usb_data = { |
435 | .usb_mode = T2_USB_MODE_ULPI, | |
436 | }; | |
437 | ||
e86fa0b4 PU |
438 | static struct twl4030_codec_audio_data beagle_audio_data = { |
439 | .audio_mclk = 26000000, | |
440 | }; | |
441 | ||
442 | static struct twl4030_codec_data beagle_codec_data = { | |
6df74efb | 443 | .audio_mclk = 26000000, |
e86fa0b4 PU |
444 | .audio = &beagle_audio_data, |
445 | }; | |
446 | ||
90c62bf0 TL |
447 | static struct twl4030_platform_data beagle_twldata = { |
448 | .irq_base = TWL4030_IRQ_BASE, | |
449 | .irq_end = TWL4030_IRQ_END, | |
450 | ||
451 | /* platform_data for children goes here */ | |
bd04e465 | 452 | .usb = &beagle_usb_data, |
90c62bf0 | 453 | .gpio = &beagle_gpio_data, |
e86fa0b4 | 454 | .codec = &beagle_codec_data, |
bb3b9d8e DB |
455 | .vmmc1 = &beagle_vmmc1, |
456 | .vsim = &beagle_vsim, | |
457 | .vdac = &beagle_vdac, | |
458 | .vpll2 = &beagle_vpll2, | |
90c62bf0 TL |
459 | }; |
460 | ||
461 | static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { | |
462 | { | |
463 | I2C_BOARD_INFO("twl4030", 0x48), | |
464 | .flags = I2C_CLIENT_WAKE, | |
465 | .irq = INT_34XX_SYS_NIRQ, | |
466 | .platform_data = &beagle_twldata, | |
467 | }, | |
468 | }; | |
469 | ||
e3333f48 MP |
470 | static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { |
471 | { | |
472 | I2C_BOARD_INFO("eeprom", 0x50), | |
473 | }, | |
474 | }; | |
475 | ||
90c62bf0 TL |
476 | static int __init omap3_beagle_i2c_init(void) |
477 | { | |
478 | omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo, | |
479 | ARRAY_SIZE(beagle_i2c_boardinfo)); | |
8ca7fe26 KK |
480 | /* Bus 3 is attached to the DVI port where devices like the pico DLP |
481 | * projector don't work reliably with 400kHz */ | |
e3333f48 | 482 | omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom)); |
90c62bf0 TL |
483 | return 0; |
484 | } | |
485 | ||
2885f000 SMK |
486 | static struct gpio_led gpio_leds[] = { |
487 | { | |
488 | .name = "beagleboard::usr0", | |
489 | .default_trigger = "heartbeat", | |
490 | .gpio = 150, | |
491 | }, | |
492 | { | |
493 | .name = "beagleboard::usr1", | |
494 | .default_trigger = "mmc0", | |
495 | .gpio = 149, | |
496 | }, | |
90c62bf0 TL |
497 | { |
498 | .name = "beagleboard::pmu_stat", | |
499 | .gpio = -EINVAL, /* gets replaced */ | |
500 | .active_low = true, | |
501 | }, | |
2885f000 SMK |
502 | }; |
503 | ||
504 | static struct gpio_led_platform_data gpio_led_info = { | |
505 | .leds = gpio_leds, | |
506 | .num_leds = ARRAY_SIZE(gpio_leds), | |
507 | }; | |
508 | ||
509 | static struct platform_device leds_gpio = { | |
510 | .name = "leds-gpio", | |
511 | .id = -1, | |
512 | .dev = { | |
513 | .platform_data = &gpio_led_info, | |
514 | }, | |
515 | }; | |
516 | ||
517 | static struct gpio_keys_button gpio_buttons[] = { | |
518 | { | |
519 | .code = BTN_EXTRA, | |
520 | .gpio = 7, | |
521 | .desc = "user", | |
522 | .wakeup = 1, | |
523 | }, | |
524 | }; | |
525 | ||
526 | static struct gpio_keys_platform_data gpio_key_info = { | |
527 | .buttons = gpio_buttons, | |
528 | .nbuttons = ARRAY_SIZE(gpio_buttons), | |
529 | }; | |
530 | ||
531 | static struct platform_device keys_gpio = { | |
532 | .name = "gpio-keys", | |
533 | .id = -1, | |
534 | .dev = { | |
535 | .platform_data = &gpio_key_info, | |
536 | }, | |
537 | }; | |
538 | ||
3dc3bad6 | 539 | static void __init omap3_beagle_init_early(void) |
b3c6df3a | 540 | { |
4805734b PW |
541 | omap2_init_common_infrastructure(); |
542 | omap2_init_common_devices(mt46h32m32lf6_sdrc_params, | |
543 | mt46h32m32lf6_sdrc_params); | |
3dc3bad6 RKAL |
544 | } |
545 | ||
546 | static void __init omap3_beagle_init_irq(void) | |
547 | { | |
b3c6df3a PW |
548 | omap_init_irq(); |
549 | #ifdef CONFIG_OMAP_32K_TIMER | |
550 | omap2_gp_clockevent_set_gptimer(12); | |
551 | #endif | |
b3c6df3a PW |
552 | } |
553 | ||
2885f000 | 554 | static struct platform_device *omap3_beagle_devices[] __initdata = { |
2885f000 SMK |
555 | &leds_gpio, |
556 | &keys_gpio, | |
044d32ff | 557 | &beagle_dss_device, |
2885f000 SMK |
558 | }; |
559 | ||
560 | static void __init omap3beagle_flash_init(void) | |
561 | { | |
562 | u8 cs = 0; | |
563 | u8 nandcs = GPMC_CS_NUM + 1; | |
564 | ||
2885f000 SMK |
565 | /* find out the chip-select on which NAND exists */ |
566 | while (cs < GPMC_CS_NUM) { | |
567 | u32 ret = 0; | |
568 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | |
569 | ||
570 | if ((ret & 0xC00) == 0x800) { | |
571 | printk(KERN_INFO "Found NAND on CS%d\n", cs); | |
572 | if (nandcs > GPMC_CS_NUM) | |
573 | nandcs = cs; | |
574 | } | |
575 | cs++; | |
576 | } | |
577 | ||
578 | if (nandcs > GPMC_CS_NUM) { | |
579 | printk(KERN_INFO "NAND: Unable to find configuration " | |
580 | "in GPMC\n "); | |
581 | return; | |
582 | } | |
583 | ||
584 | if (nandcs < GPMC_CS_NUM) { | |
585 | omap3beagle_nand_data.cs = nandcs; | |
2885f000 SMK |
586 | |
587 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); | |
f450d867 | 588 | if (gpmc_nand_init(&omap3beagle_nand_data) < 0) |
2885f000 SMK |
589 | printk(KERN_ERR "Unable to register NAND device\n"); |
590 | } | |
591 | } | |
592 | ||
6f69a181 | 593 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
58a5491c FB |
594 | |
595 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, | |
596 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | |
597 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | |
598 | ||
599 | .phy_reset = true, | |
600 | .reset_gpio_port[0] = -EINVAL, | |
601 | .reset_gpio_port[1] = 147, | |
602 | .reset_gpio_port[2] = -EINVAL | |
603 | }; | |
604 | ||
ca5742bd TL |
605 | #ifdef CONFIG_OMAP_MUX |
606 | static struct omap_board_mux board_mux[] __initdata = { | |
607 | { .reg_offset = OMAP_MUX_TERMINATOR }, | |
608 | }; | |
ca5742bd TL |
609 | #endif |
610 | ||
884b8369 MM |
611 | static struct omap_musb_board_data musb_board_data = { |
612 | .interface_type = MUSB_INTERFACE_ULPI, | |
613 | .mode = MUSB_OTG, | |
614 | .power = 100, | |
615 | }; | |
616 | ||
2885f000 SMK |
617 | static void __init omap3_beagle_init(void) |
618 | { | |
ca5742bd | 619 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
954bed04 | 620 | omap3_beagle_init_rev(); |
90c62bf0 | 621 | omap3_beagle_i2c_init(); |
2885f000 SMK |
622 | platform_add_devices(omap3_beagle_devices, |
623 | ARRAY_SIZE(omap3_beagle_devices)); | |
2885f000 | 624 | omap_serial_init(); |
90c62bf0 | 625 | |
4896e394 | 626 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); |
90c62bf0 TL |
627 | gpio_request(170, "DVI_nPD"); |
628 | /* REVISIT leave DVI powered down until it's needed ... */ | |
629 | gpio_direction_output(170, true); | |
630 | ||
884b8369 | 631 | usb_musb_init(&musb_board_data); |
58a5491c | 632 | usb_ehci_init(&ehci_pdata); |
2885f000 | 633 | omap3beagle_flash_init(); |
9fb97412 JP |
634 | |
635 | /* Ensure SDRC pins are mux'd for self-refresh */ | |
4896e394 TL |
636 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
637 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | |
044d32ff KK |
638 | |
639 | beagle_display_init(); | |
2885f000 SMK |
640 | } |
641 | ||
2885f000 SMK |
642 | MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board") |
643 | /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */ | |
2885f000 | 644 | .boot_params = 0x80000100, |
71ee7dad | 645 | .reserve = omap_reserve, |
3dc3bad6 RKAL |
646 | .map_io = omap3_map_io, |
647 | .init_early = omap3_beagle_init_early, | |
2885f000 SMK |
648 | .init_irq = omap3_beagle_init_irq, |
649 | .init_machine = omap3_beagle_init, | |
650 | .timer = &omap_timer, | |
651 | MACHINE_END |