diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-devkit8000.c')
-rw-r--r-- | arch/arm/mach-omap2/board-devkit8000.c | 676 |
1 files changed, 676 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c new file mode 100644 index 000000000000..47e3af2166d4 --- /dev/null +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
@@ -0,0 +1,676 @@ | |||
1 | /* | ||
2 | * board-devkit8000.c - TimLL Devkit8000 | ||
3 | * | ||
4 | * Copyright (C) 2009 Kim Botherway | ||
5 | * Copyright (C) 2010 Thomas Weber | ||
6 | * | ||
7 | * Modified from mach-omap2/board-omap3beagle.c | ||
8 | * | ||
9 | * Initial code: Syed Mohammed Khasim | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/err.h> | ||
21 | #include <linux/clk.h> | ||
22 | #include <linux/io.h> | ||
23 | #include <linux/leds.h> | ||
24 | #include <linux/gpio.h> | ||
25 | #include <linux/input.h> | ||
26 | #include <linux/gpio_keys.h> | ||
27 | |||
28 | #include <linux/mtd/mtd.h> | ||
29 | #include <linux/mtd/partitions.h> | ||
30 | #include <linux/mtd/nand.h> | ||
31 | |||
32 | #include <linux/regulator/machine.h> | ||
33 | #include <linux/i2c/twl.h> | ||
34 | |||
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 | |||
41 | #include <plat/board.h> | ||
42 | #include <plat/common.h> | ||
43 | #include <plat/gpmc.h> | ||
44 | #include <plat/nand.h> | ||
45 | #include <plat/usb.h> | ||
46 | #include <plat/timer-gp.h> | ||
47 | #include <plat/display.h> | ||
48 | |||
49 | #include <plat/mcspi.h> | ||
50 | #include <linux/input/matrix_keypad.h> | ||
51 | #include <linux/spi/spi.h> | ||
52 | #include <linux/spi/ads7846.h> | ||
53 | #include <linux/dm9000.h> | ||
54 | #include <linux/interrupt.h> | ||
55 | |||
56 | #include "sdram-micron-mt46h32m32lf-6.h" | ||
57 | |||
58 | #include "mux.h" | ||
59 | #include "hsmmc.h" | ||
60 | |||
61 | #define GPMC_CS0_BASE 0x60 | ||
62 | #define GPMC_CS_SIZE 0x30 | ||
63 | |||
64 | #define NAND_BLOCK_SIZE SZ_128K | ||
65 | |||
66 | #define OMAP_DM9000_GPIO_IRQ 25 | ||
67 | #define OMAP3_DEVKIT_TS_GPIO 27 | ||
68 | |||
69 | static struct mtd_partition devkit8000_nand_partitions[] = { | ||
70 | /* All the partition sizes are listed in terms of NAND block size */ | ||
71 | { | ||
72 | .name = "X-Loader", | ||
73 | .offset = 0, | ||
74 | .size = 4 * NAND_BLOCK_SIZE, | ||
75 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
76 | }, | ||
77 | { | ||
78 | .name = "U-Boot", | ||
79 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */ | ||
80 | .size = 15 * NAND_BLOCK_SIZE, | ||
81 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
82 | }, | ||
83 | { | ||
84 | .name = "U-Boot Env", | ||
85 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */ | ||
86 | .size = 1 * NAND_BLOCK_SIZE, | ||
87 | }, | ||
88 | { | ||
89 | .name = "Kernel", | ||
90 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */ | ||
91 | .size = 32 * NAND_BLOCK_SIZE, | ||
92 | }, | ||
93 | { | ||
94 | .name = "File System", | ||
95 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ | ||
96 | .size = MTDPART_SIZ_FULL, | ||
97 | }, | ||
98 | }; | ||
99 | |||
100 | static struct omap_nand_platform_data devkit8000_nand_data = { | ||
101 | .options = NAND_BUSWIDTH_16, | ||
102 | .parts = devkit8000_nand_partitions, | ||
103 | .nr_parts = ARRAY_SIZE(devkit8000_nand_partitions), | ||
104 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ | ||
105 | }; | ||
106 | |||
107 | static struct resource devkit8000_nand_resource = { | ||
108 | .flags = IORESOURCE_MEM, | ||
109 | }; | ||
110 | |||
111 | static struct platform_device devkit8000_nand_device = { | ||
112 | .name = "omap2-nand", | ||
113 | .id = -1, | ||
114 | .dev = { | ||
115 | .platform_data = &devkit8000_nand_data, | ||
116 | }, | ||
117 | .num_resources = 1, | ||
118 | .resource = &devkit8000_nand_resource, | ||
119 | }; | ||
120 | |||
121 | static struct omap2_hsmmc_info mmc[] = { | ||
122 | { | ||
123 | .mmc = 1, | ||
124 | .wires = 8, | ||
125 | .gpio_wp = 29, | ||
126 | }, | ||
127 | {} /* Terminator */ | ||
128 | }; | ||
129 | static struct omap_board_config_kernel devkit8000_config[] __initdata = { | ||
130 | }; | ||
131 | |||
132 | static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
133 | { | ||
134 | twl_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80, REG_GPIODATADIR1); | ||
135 | twl_i2c_write_u8(TWL4030_MODULE_LED, 0x0, 0x0); | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | static void devkit8000_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
141 | { | ||
142 | } | ||
143 | static int devkit8000_panel_enable_dvi(struct omap_dss_device *dssdev) | ||
144 | { | ||
145 | return 0; | ||
146 | } | ||
147 | |||
148 | static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev) | ||
149 | { | ||
150 | } | ||
151 | |||
152 | static int devkit8000_panel_enable_tv(struct omap_dss_device *dssdev) | ||
153 | { | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | static void devkit8000_panel_disable_tv(struct omap_dss_device *dssdev) | ||
159 | { | ||
160 | } | ||
161 | |||
162 | |||
163 | static struct regulator_consumer_supply devkit8000_vmmc1_supply = { | ||
164 | .supply = "vmmc", | ||
165 | }; | ||
166 | |||
167 | static struct regulator_consumer_supply devkit8000_vsim_supply = { | ||
168 | .supply = "vmmc_aux", | ||
169 | }; | ||
170 | |||
171 | |||
172 | static struct omap_dss_device devkit8000_lcd_device = { | ||
173 | .name = "lcd", | ||
174 | .driver_name = "innolux_at_panel", | ||
175 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
176 | .phy.dpi.data_lines = 24, | ||
177 | .platform_enable = devkit8000_panel_enable_lcd, | ||
178 | .platform_disable = devkit8000_panel_disable_lcd, | ||
179 | }; | ||
180 | static struct omap_dss_device devkit8000_dvi_device = { | ||
181 | .name = "dvi", | ||
182 | .driver_name = "generic_panel", | ||
183 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
184 | .phy.dpi.data_lines = 24, | ||
185 | .platform_enable = devkit8000_panel_enable_dvi, | ||
186 | .platform_disable = devkit8000_panel_disable_dvi, | ||
187 | }; | ||
188 | |||
189 | static struct omap_dss_device devkit8000_tv_device = { | ||
190 | .name = "tv", | ||
191 | .driver_name = "venc", | ||
192 | .type = OMAP_DISPLAY_TYPE_VENC, | ||
193 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | ||
194 | .platform_enable = devkit8000_panel_enable_tv, | ||
195 | .platform_disable = devkit8000_panel_disable_tv, | ||
196 | }; | ||
197 | |||
198 | |||
199 | static struct omap_dss_device *devkit8000_dss_devices[] = { | ||
200 | &devkit8000_lcd_device, | ||
201 | &devkit8000_dvi_device, | ||
202 | &devkit8000_tv_device, | ||
203 | }; | ||
204 | |||
205 | static struct omap_dss_board_info devkit8000_dss_data = { | ||
206 | .num_devices = ARRAY_SIZE(devkit8000_dss_devices), | ||
207 | .devices = devkit8000_dss_devices, | ||
208 | .default_device = &devkit8000_lcd_device, | ||
209 | }; | ||
210 | |||
211 | static struct platform_device devkit8000_dss_device = { | ||
212 | .name = "omapdss", | ||
213 | .id = -1, | ||
214 | .dev = { | ||
215 | .platform_data = &devkit8000_dss_data, | ||
216 | }, | ||
217 | }; | ||
218 | |||
219 | static struct regulator_consumer_supply devkit8000_vdda_dac_supply = { | ||
220 | .supply = "vdda_dac", | ||
221 | .dev = &devkit8000_dss_device.dev, | ||
222 | }; | ||
223 | |||
224 | static int board_keymap[] = { | ||
225 | KEY(0, 0, KEY_1), | ||
226 | KEY(1, 0, KEY_2), | ||
227 | KEY(2, 0, KEY_3), | ||
228 | KEY(0, 1, KEY_4), | ||
229 | KEY(1, 1, KEY_5), | ||
230 | KEY(2, 1, KEY_6), | ||
231 | KEY(3, 1, KEY_F5), | ||
232 | KEY(0, 2, KEY_7), | ||
233 | KEY(1, 2, KEY_8), | ||
234 | KEY(2, 2, KEY_9), | ||
235 | KEY(3, 2, KEY_F6), | ||
236 | KEY(0, 3, KEY_F7), | ||
237 | KEY(1, 3, KEY_0), | ||
238 | KEY(2, 3, KEY_F8), | ||
239 | PERSISTENT_KEY(4, 5), | ||
240 | KEY(4, 4, KEY_VOLUMEUP), | ||
241 | KEY(5, 5, KEY_VOLUMEDOWN), | ||
242 | 0 | ||
243 | }; | ||
244 | |||
245 | static struct matrix_keymap_data board_map_data = { | ||
246 | .keymap = board_keymap, | ||
247 | .keymap_size = ARRAY_SIZE(board_keymap), | ||
248 | }; | ||
249 | |||
250 | static struct twl4030_keypad_data devkit8000_kp_data = { | ||
251 | .keymap_data = &board_map_data, | ||
252 | .rows = 6, | ||
253 | .cols = 6, | ||
254 | .rep = 1, | ||
255 | }; | ||
256 | |||
257 | static struct gpio_led gpio_leds[]; | ||
258 | |||
259 | static int devkit8000_twl_gpio_setup(struct device *dev, | ||
260 | unsigned gpio, unsigned ngpio) | ||
261 | { | ||
262 | omap_mux_init_gpio(29, OMAP_PIN_INPUT); | ||
263 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | ||
264 | mmc[0].gpio_cd = gpio + 0; | ||
265 | omap2_hsmmc_init(mmc); | ||
266 | |||
267 | /* link regulators to MMC adapters */ | ||
268 | devkit8000_vmmc1_supply.dev = mmc[0].dev; | ||
269 | devkit8000_vsim_supply.dev = mmc[0].dev; | ||
270 | |||
271 | return 0; | ||
272 | } | ||
273 | |||
274 | static struct twl4030_gpio_platform_data devkit8000_gpio_data = { | ||
275 | .gpio_base = OMAP_MAX_GPIO_LINES, | ||
276 | .irq_base = TWL4030_GPIO_IRQ_BASE, | ||
277 | .irq_end = TWL4030_GPIO_IRQ_END, | ||
278 | .use_leds = true, | ||
279 | .pullups = BIT(1), | ||
280 | .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13) | ||
281 | | BIT(15) | BIT(16) | BIT(17), | ||
282 | .setup = devkit8000_twl_gpio_setup, | ||
283 | }; | ||
284 | |||
285 | static struct regulator_consumer_supply devkit8000_vpll2_supplies[] = { | ||
286 | { | ||
287 | .supply = "vdvi", | ||
288 | .dev = &devkit8000_lcd_device.dev, | ||
289 | }, | ||
290 | { | ||
291 | .supply = "vdds_dsi", | ||
292 | .dev = &devkit8000_dss_device.dev, | ||
293 | } | ||
294 | }; | ||
295 | |||
296 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ | ||
297 | static struct regulator_init_data devkit8000_vmmc1 = { | ||
298 | .constraints = { | ||
299 | .min_uV = 1850000, | ||
300 | .max_uV = 3150000, | ||
301 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
302 | | REGULATOR_MODE_STANDBY, | ||
303 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
304 | | REGULATOR_CHANGE_MODE | ||
305 | | REGULATOR_CHANGE_STATUS, | ||
306 | }, | ||
307 | .num_consumer_supplies = 1, | ||
308 | .consumer_supplies = &devkit8000_vmmc1_supply, | ||
309 | }; | ||
310 | |||
311 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ | ||
312 | static struct regulator_init_data devkit8000_vsim = { | ||
313 | .constraints = { | ||
314 | .min_uV = 1800000, | ||
315 | .max_uV = 3000000, | ||
316 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
317 | | REGULATOR_MODE_STANDBY, | ||
318 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
319 | | REGULATOR_CHANGE_MODE | ||
320 | | REGULATOR_CHANGE_STATUS, | ||
321 | }, | ||
322 | .num_consumer_supplies = 1, | ||
323 | .consumer_supplies = &devkit8000_vsim_supply, | ||
324 | }; | ||
325 | |||
326 | /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */ | ||
327 | static struct regulator_init_data devkit8000_vdac = { | ||
328 | .constraints = { | ||
329 | .min_uV = 1800000, | ||
330 | .max_uV = 1800000, | ||
331 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
332 | | REGULATOR_MODE_STANDBY, | ||
333 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
334 | | REGULATOR_CHANGE_STATUS, | ||
335 | }, | ||
336 | .num_consumer_supplies = 1, | ||
337 | .consumer_supplies = &devkit8000_vdda_dac_supply, | ||
338 | }; | ||
339 | |||
340 | /* VPLL2 for digital video outputs */ | ||
341 | static struct regulator_init_data devkit8000_vpll2 = { | ||
342 | .constraints = { | ||
343 | .name = "VDVI", | ||
344 | .min_uV = 1800000, | ||
345 | .max_uV = 1800000, | ||
346 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
347 | | REGULATOR_MODE_STANDBY, | ||
348 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
349 | | REGULATOR_CHANGE_STATUS, | ||
350 | }, | ||
351 | .num_consumer_supplies = ARRAY_SIZE(devkit8000_vpll2_supplies), | ||
352 | .consumer_supplies = devkit8000_vpll2_supplies, | ||
353 | }; | ||
354 | |||
355 | static struct twl4030_usb_data devkit8000_usb_data = { | ||
356 | .usb_mode = T2_USB_MODE_ULPI, | ||
357 | }; | ||
358 | |||
359 | static struct twl4030_codec_audio_data devkit8000_audio_data = { | ||
360 | .audio_mclk = 26000000, | ||
361 | }; | ||
362 | |||
363 | static struct twl4030_codec_data devkit8000_codec_data = { | ||
364 | .audio_mclk = 26000000, | ||
365 | .audio = &devkit8000_audio_data, | ||
366 | }; | ||
367 | |||
368 | static struct twl4030_platform_data devkit8000_twldata = { | ||
369 | .irq_base = TWL4030_IRQ_BASE, | ||
370 | .irq_end = TWL4030_IRQ_END, | ||
371 | |||
372 | /* platform_data for children goes here */ | ||
373 | .usb = &devkit8000_usb_data, | ||
374 | .gpio = &devkit8000_gpio_data, | ||
375 | .codec = &devkit8000_codec_data, | ||
376 | .vmmc1 = &devkit8000_vmmc1, | ||
377 | .vsim = &devkit8000_vsim, | ||
378 | .vdac = &devkit8000_vdac, | ||
379 | .vpll2 = &devkit8000_vpll2, | ||
380 | .keypad = &devkit8000_kp_data, | ||
381 | }; | ||
382 | |||
383 | static struct i2c_board_info __initdata devkit8000_i2c_boardinfo[] = { | ||
384 | { | ||
385 | I2C_BOARD_INFO("twl4030", 0x48), | ||
386 | .flags = I2C_CLIENT_WAKE, | ||
387 | .irq = INT_34XX_SYS_NIRQ, | ||
388 | .platform_data = &devkit8000_twldata, | ||
389 | }, | ||
390 | }; | ||
391 | |||
392 | static int __init devkit8000_i2c_init(void) | ||
393 | { | ||
394 | omap_register_i2c_bus(1, 2600, devkit8000_i2c_boardinfo, | ||
395 | ARRAY_SIZE(devkit8000_i2c_boardinfo)); | ||
396 | /* Bus 3 is attached to the DVI port where devices like the pico DLP | ||
397 | * projector don't work reliably with 400kHz */ | ||
398 | omap_register_i2c_bus(3, 400, NULL, 0); | ||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | static struct gpio_led gpio_leds[] = { | ||
403 | { | ||
404 | .name = "led1", | ||
405 | .default_trigger = "heartbeat", | ||
406 | .gpio = 186, | ||
407 | .active_low = true, | ||
408 | }, | ||
409 | { | ||
410 | .name = "led2", | ||
411 | .default_trigger = "mmc0", | ||
412 | .gpio = 163, | ||
413 | .active_low = true, | ||
414 | }, | ||
415 | { | ||
416 | .name = "ledB", | ||
417 | .default_trigger = "none", | ||
418 | .gpio = 153, | ||
419 | .active_low = true, | ||
420 | }, | ||
421 | { | ||
422 | .name = "led3", | ||
423 | .default_trigger = "none", | ||
424 | .gpio = 164, | ||
425 | .active_low = true, | ||
426 | }, | ||
427 | }; | ||
428 | |||
429 | static struct gpio_led_platform_data gpio_led_info = { | ||
430 | .leds = gpio_leds, | ||
431 | .num_leds = ARRAY_SIZE(gpio_leds), | ||
432 | }; | ||
433 | |||
434 | static struct platform_device leds_gpio = { | ||
435 | .name = "leds-gpio", | ||
436 | .id = -1, | ||
437 | .dev = { | ||
438 | .platform_data = &gpio_led_info, | ||
439 | }, | ||
440 | }; | ||
441 | |||
442 | static struct gpio_keys_button gpio_buttons[] = { | ||
443 | { | ||
444 | .code = BTN_EXTRA, | ||
445 | .gpio = 26, | ||
446 | .desc = "user", | ||
447 | .wakeup = 1, | ||
448 | }, | ||
449 | }; | ||
450 | |||
451 | static struct gpio_keys_platform_data gpio_key_info = { | ||
452 | .buttons = gpio_buttons, | ||
453 | .nbuttons = ARRAY_SIZE(gpio_buttons), | ||
454 | }; | ||
455 | |||
456 | static struct platform_device keys_gpio = { | ||
457 | .name = "gpio-keys", | ||
458 | .id = -1, | ||
459 | .dev = { | ||
460 | .platform_data = &gpio_key_info, | ||
461 | }, | ||
462 | }; | ||
463 | |||
464 | |||
465 | static void __init devkit8000_init_irq(void) | ||
466 | { | ||
467 | omap_board_config = devkit8000_config; | ||
468 | omap_board_config_size = ARRAY_SIZE(devkit8000_config); | ||
469 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, | ||
470 | mt46h32m32lf6_sdrc_params); | ||
471 | omap_init_irq(); | ||
472 | #ifdef CONFIG_OMAP_32K_TIMER | ||
473 | omap2_gp_clockevent_set_gptimer(12); | ||
474 | #endif | ||
475 | omap_gpio_init(); | ||
476 | } | ||
477 | |||
478 | static void __init devkit8000_ads7846_init(void) | ||
479 | { | ||
480 | int gpio = OMAP3_DEVKIT_TS_GPIO; | ||
481 | int ret; | ||
482 | |||
483 | ret = gpio_request(gpio, "ads7846_pen_down"); | ||
484 | if (ret < 0) { | ||
485 | printk(KERN_ERR "Failed to request GPIO %d for " | ||
486 | "ads7846 pen down IRQ\n", gpio); | ||
487 | return; | ||
488 | } | ||
489 | |||
490 | gpio_direction_input(gpio); | ||
491 | } | ||
492 | |||
493 | static int ads7846_get_pendown_state(void) | ||
494 | { | ||
495 | return !gpio_get_value(OMAP3_DEVKIT_TS_GPIO); | ||
496 | } | ||
497 | |||
498 | static struct ads7846_platform_data ads7846_config = { | ||
499 | .x_max = 0x0fff, | ||
500 | .y_max = 0x0fff, | ||
501 | .x_plate_ohms = 180, | ||
502 | .pressure_max = 255, | ||
503 | .debounce_max = 10, | ||
504 | .debounce_tol = 5, | ||
505 | .debounce_rep = 1, | ||
506 | .get_pendown_state = ads7846_get_pendown_state, | ||
507 | .keep_vref_on = 1, | ||
508 | .settle_delay_usecs = 150, | ||
509 | }; | ||
510 | |||
511 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | ||
512 | .turbo_mode = 0, | ||
513 | .single_channel = 1, /* 0: slave, 1: master */ | ||
514 | }; | ||
515 | |||
516 | static struct spi_board_info devkit8000_spi_board_info[] __initdata = { | ||
517 | { | ||
518 | .modalias = "ads7846", | ||
519 | .bus_num = 2, | ||
520 | .chip_select = 0, | ||
521 | .max_speed_hz = 1500000, | ||
522 | .controller_data = &ads7846_mcspi_config, | ||
523 | .irq = OMAP_GPIO_IRQ(OMAP3_DEVKIT_TS_GPIO), | ||
524 | .platform_data = &ads7846_config, | ||
525 | } | ||
526 | }; | ||
527 | |||
528 | #define OMAP_DM9000_BASE 0x2c000000 | ||
529 | |||
530 | static struct resource omap_dm9000_resources[] = { | ||
531 | [0] = { | ||
532 | .start = OMAP_DM9000_BASE, | ||
533 | .end = (OMAP_DM9000_BASE + 0x4 - 1), | ||
534 | .flags = IORESOURCE_MEM, | ||
535 | }, | ||
536 | [1] = { | ||
537 | .start = (OMAP_DM9000_BASE + 0x400), | ||
538 | .end = (OMAP_DM9000_BASE + 0x400 + 0x4 - 1), | ||
539 | .flags = IORESOURCE_MEM, | ||
540 | }, | ||
541 | [2] = { | ||
542 | .start = OMAP_GPIO_IRQ(OMAP_DM9000_GPIO_IRQ), | ||
543 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, | ||
544 | }, | ||
545 | }; | ||
546 | |||
547 | static struct dm9000_plat_data omap_dm9000_platdata = { | ||
548 | .flags = DM9000_PLATF_16BITONLY, | ||
549 | }; | ||
550 | |||
551 | static struct platform_device omap_dm9000_dev = { | ||
552 | .name = "dm9000", | ||
553 | .id = -1, | ||
554 | .num_resources = ARRAY_SIZE(omap_dm9000_resources), | ||
555 | .resource = omap_dm9000_resources, | ||
556 | .dev = { | ||
557 | .platform_data = &omap_dm9000_platdata, | ||
558 | }, | ||
559 | }; | ||
560 | |||
561 | static void __init omap_dm9000_init(void) | ||
562 | { | ||
563 | if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) { | ||
564 | printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n", | ||
565 | OMAP_DM9000_GPIO_IRQ); | ||
566 | return; | ||
567 | } | ||
568 | |||
569 | gpio_direction_input(OMAP_DM9000_GPIO_IRQ); | ||
570 | } | ||
571 | |||
572 | static struct platform_device *devkit8000_devices[] __initdata = { | ||
573 | &devkit8000_dss_device, | ||
574 | &leds_gpio, | ||
575 | &keys_gpio, | ||
576 | &omap_dm9000_dev, | ||
577 | }; | ||
578 | |||
579 | static void __init devkit8000_flash_init(void) | ||
580 | { | ||
581 | u8 cs = 0; | ||
582 | u8 nandcs = GPMC_CS_NUM + 1; | ||
583 | |||
584 | u32 gpmc_base_add = OMAP34XX_GPMC_VIRT; | ||
585 | |||
586 | /* find out the chip-select on which NAND exists */ | ||
587 | while (cs < GPMC_CS_NUM) { | ||
588 | u32 ret = 0; | ||
589 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
590 | |||
591 | if ((ret & 0xC00) == 0x800) { | ||
592 | printk(KERN_INFO "Found NAND on CS%d\n", cs); | ||
593 | if (nandcs > GPMC_CS_NUM) | ||
594 | nandcs = cs; | ||
595 | } | ||
596 | cs++; | ||
597 | } | ||
598 | |||
599 | if (nandcs > GPMC_CS_NUM) { | ||
600 | printk(KERN_INFO "NAND: Unable to find configuration " | ||
601 | "in GPMC\n "); | ||
602 | return; | ||
603 | } | ||
604 | |||
605 | if (nandcs < GPMC_CS_NUM) { | ||
606 | devkit8000_nand_data.cs = nandcs; | ||
607 | devkit8000_nand_data.gpmc_cs_baseaddr = (void *) | ||
608 | (gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE); | ||
609 | devkit8000_nand_data.gpmc_baseaddr = (void *) | ||
610 | (gpmc_base_add); | ||
611 | |||
612 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); | ||
613 | if (platform_device_register(&devkit8000_nand_device) < 0) | ||
614 | printk(KERN_ERR "Unable to register NAND device\n"); | ||
615 | } | ||
616 | } | ||
617 | |||
618 | static struct omap_musb_board_data musb_board_data = { | ||
619 | .interface_type = MUSB_INTERFACE_ULPI, | ||
620 | .mode = MUSB_OTG, | ||
621 | .power = 100, | ||
622 | }; | ||
623 | |||
624 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | ||
625 | |||
626 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, | ||
627 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
628 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
629 | |||
630 | .phy_reset = true, | ||
631 | .reset_gpio_port[0] = -EINVAL, | ||
632 | .reset_gpio_port[1] = -EINVAL, | ||
633 | .reset_gpio_port[2] = -EINVAL | ||
634 | }; | ||
635 | |||
636 | static void __init devkit8000_init(void) | ||
637 | { | ||
638 | omap_serial_init(); | ||
639 | |||
640 | omap_dm9000_init(); | ||
641 | |||
642 | devkit8000_i2c_init(); | ||
643 | platform_add_devices(devkit8000_devices, | ||
644 | ARRAY_SIZE(devkit8000_devices)); | ||
645 | omap_board_config = devkit8000_config; | ||
646 | omap_board_config_size = ARRAY_SIZE(devkit8000_config); | ||
647 | |||
648 | spi_register_board_info(devkit8000_spi_board_info, | ||
649 | ARRAY_SIZE(devkit8000_spi_board_info)); | ||
650 | |||
651 | devkit8000_ads7846_init(); | ||
652 | |||
653 | usb_musb_init(&musb_board_data); | ||
654 | usb_ehci_init(&ehci_pdata); | ||
655 | devkit8000_flash_init(); | ||
656 | |||
657 | /* Ensure SDRC pins are mux'd for self-refresh */ | ||
658 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | ||
659 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | ||
660 | } | ||
661 | |||
662 | static void __init devkit8000_map_io(void) | ||
663 | { | ||
664 | omap2_set_globals_343x(); | ||
665 | omap34xx_map_common_io(); | ||
666 | } | ||
667 | |||
668 | MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000") | ||
669 | .phys_io = 0x48000000, | ||
670 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, | ||
671 | .boot_params = 0x80000100, | ||
672 | .map_io = devkit8000_map_io, | ||
673 | .init_irq = devkit8000_init_irq, | ||
674 | .init_machine = devkit8000_init, | ||
675 | .timer = &omap_timer, | ||
676 | MACHINE_END | ||