Commit | Line | Data |
---|---|---|
476544ca TW |
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> | |
3a63833e | 31 | #include <linux/mmc/host.h> |
476544ca TW |
32 | |
33 | #include <linux/regulator/machine.h> | |
34 | #include <linux/i2c/twl.h> | |
35 | ||
36 | #include <mach/hardware.h> | |
f535daed | 37 | #include <mach/id.h> |
476544ca TW |
38 | #include <asm/mach-types.h> |
39 | #include <asm/mach/arch.h> | |
40 | #include <asm/mach/map.h> | |
41 | #include <asm/mach/flash.h> | |
42 | ||
43 | #include <plat/board.h> | |
44 | #include <plat/common.h> | |
45 | #include <plat/gpmc.h> | |
46 | #include <plat/nand.h> | |
47 | #include <plat/usb.h> | |
476544ca | 48 | #include <plat/display.h> |
89747c91 | 49 | #include <plat/panel-generic-dpi.h> |
476544ca TW |
50 | |
51 | #include <plat/mcspi.h> | |
52 | #include <linux/input/matrix_keypad.h> | |
53 | #include <linux/spi/spi.h> | |
54 | #include <linux/spi/ads7846.h> | |
476544ca TW |
55 | #include <linux/dm9000.h> |
56 | #include <linux/interrupt.h> | |
57 | ||
58 | #include "sdram-micron-mt46h32m32lf-6.h" | |
59 | ||
60 | #include "mux.h" | |
61 | #include "hsmmc.h" | |
04aeae77 | 62 | #include "timer-gp.h" |
476544ca | 63 | |
476544ca TW |
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 | ||
476544ca TW |
107 | static struct omap2_hsmmc_info mmc[] = { |
108 | { | |
109 | .mmc = 1, | |
3a63833e | 110 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
476544ca TW |
111 | .gpio_wp = 29, |
112 | }, | |
113 | {} /* Terminator */ | |
114 | }; | |
476544ca TW |
115 | |
116 | static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev) | |
117 | { | |
09c0721e | 118 | if (gpio_is_valid(dssdev->reset_gpio)) |
d858addf | 119 | gpio_set_value_cansleep(dssdev->reset_gpio, 1); |
476544ca TW |
120 | return 0; |
121 | } | |
122 | ||
123 | static void devkit8000_panel_disable_lcd(struct omap_dss_device *dssdev) | |
124 | { | |
09c0721e | 125 | if (gpio_is_valid(dssdev->reset_gpio)) |
d858addf | 126 | gpio_set_value_cansleep(dssdev->reset_gpio, 0); |
476544ca | 127 | } |
31c73f74 | 128 | |
476544ca TW |
129 | static int devkit8000_panel_enable_dvi(struct omap_dss_device *dssdev) |
130 | { | |
09c0721e | 131 | if (gpio_is_valid(dssdev->reset_gpio)) |
d858addf | 132 | gpio_set_value_cansleep(dssdev->reset_gpio, 1); |
476544ca TW |
133 | return 0; |
134 | } | |
135 | ||
136 | static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev) | |
137 | { | |
09c0721e | 138 | if (gpio_is_valid(dssdev->reset_gpio)) |
d858addf | 139 | gpio_set_value_cansleep(dssdev->reset_gpio, 0); |
476544ca TW |
140 | } |
141 | ||
1f489f9e TW |
142 | static struct regulator_consumer_supply devkit8000_vmmc1_supply = |
143 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0"); | |
144 | ||
476544ca | 145 | |
5fd58b51 | 146 | /* ads7846 on SPI */ |
1f489f9e TW |
147 | static struct regulator_consumer_supply devkit8000_vio_supply = |
148 | REGULATOR_SUPPLY("vcc", "spi2.0"); | |
476544ca | 149 | |
89747c91 BW |
150 | static struct panel_generic_dpi_data lcd_panel = { |
151 | .name = "generic", | |
152 | .platform_enable = devkit8000_panel_enable_lcd, | |
153 | .platform_disable = devkit8000_panel_disable_lcd, | |
154 | }; | |
155 | ||
476544ca TW |
156 | static struct omap_dss_device devkit8000_lcd_device = { |
157 | .name = "lcd", | |
476544ca | 158 | .type = OMAP_DISPLAY_TYPE_DPI, |
89747c91 BW |
159 | .driver_name = "generic_dpi_panel", |
160 | .data = &lcd_panel, | |
476544ca | 161 | .phy.dpi.data_lines = 24, |
476544ca | 162 | }; |
89747c91 BW |
163 | |
164 | static struct panel_generic_dpi_data dvi_panel = { | |
165 | .name = "generic", | |
166 | .platform_enable = devkit8000_panel_enable_dvi, | |
167 | .platform_disable = devkit8000_panel_disable_dvi, | |
168 | }; | |
169 | ||
476544ca TW |
170 | static struct omap_dss_device devkit8000_dvi_device = { |
171 | .name = "dvi", | |
476544ca | 172 | .type = OMAP_DISPLAY_TYPE_DPI, |
89747c91 BW |
173 | .driver_name = "generic_dpi_panel", |
174 | .data = &dvi_panel, | |
476544ca | 175 | .phy.dpi.data_lines = 24, |
476544ca TW |
176 | }; |
177 | ||
178 | static struct omap_dss_device devkit8000_tv_device = { | |
179 | .name = "tv", | |
180 | .driver_name = "venc", | |
181 | .type = OMAP_DISPLAY_TYPE_VENC, | |
182 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | |
476544ca TW |
183 | }; |
184 | ||
185 | ||
186 | static struct omap_dss_device *devkit8000_dss_devices[] = { | |
187 | &devkit8000_lcd_device, | |
188 | &devkit8000_dvi_device, | |
189 | &devkit8000_tv_device, | |
190 | }; | |
191 | ||
192 | static struct omap_dss_board_info devkit8000_dss_data = { | |
193 | .num_devices = ARRAY_SIZE(devkit8000_dss_devices), | |
194 | .devices = devkit8000_dss_devices, | |
195 | .default_device = &devkit8000_lcd_device, | |
196 | }; | |
197 | ||
198 | static struct platform_device devkit8000_dss_device = { | |
199 | .name = "omapdss", | |
200 | .id = -1, | |
201 | .dev = { | |
202 | .platform_data = &devkit8000_dss_data, | |
203 | }, | |
204 | }; | |
205 | ||
1f489f9e TW |
206 | static struct regulator_consumer_supply devkit8000_vdda_dac_supply = |
207 | REGULATOR_SUPPLY("vdda_dac", "omapdss"); | |
476544ca | 208 | |
bead4375 | 209 | static uint32_t board_keymap[] = { |
476544ca TW |
210 | KEY(0, 0, KEY_1), |
211 | KEY(1, 0, KEY_2), | |
212 | KEY(2, 0, KEY_3), | |
213 | KEY(0, 1, KEY_4), | |
214 | KEY(1, 1, KEY_5), | |
215 | KEY(2, 1, KEY_6), | |
216 | KEY(3, 1, KEY_F5), | |
217 | KEY(0, 2, KEY_7), | |
218 | KEY(1, 2, KEY_8), | |
219 | KEY(2, 2, KEY_9), | |
220 | KEY(3, 2, KEY_F6), | |
221 | KEY(0, 3, KEY_F7), | |
222 | KEY(1, 3, KEY_0), | |
223 | KEY(2, 3, KEY_F8), | |
224 | PERSISTENT_KEY(4, 5), | |
225 | KEY(4, 4, KEY_VOLUMEUP), | |
226 | KEY(5, 5, KEY_VOLUMEDOWN), | |
227 | 0 | |
228 | }; | |
229 | ||
230 | static struct matrix_keymap_data board_map_data = { | |
231 | .keymap = board_keymap, | |
232 | .keymap_size = ARRAY_SIZE(board_keymap), | |
233 | }; | |
234 | ||
235 | static struct twl4030_keypad_data devkit8000_kp_data = { | |
236 | .keymap_data = &board_map_data, | |
237 | .rows = 6, | |
238 | .cols = 6, | |
239 | .rep = 1, | |
240 | }; | |
241 | ||
242 | static struct gpio_led gpio_leds[]; | |
243 | ||
244 | static int devkit8000_twl_gpio_setup(struct device *dev, | |
245 | unsigned gpio, unsigned ngpio) | |
246 | { | |
daf7aabc TW |
247 | int ret; |
248 | ||
476544ca TW |
249 | omap_mux_init_gpio(29, OMAP_PIN_INPUT); |
250 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | |
251 | mmc[0].gpio_cd = gpio + 0; | |
252 | omap2_hsmmc_init(mmc); | |
253 | ||
31c73f74 KRC |
254 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ |
255 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | |
256 | ||
daf7aabc TW |
257 | /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ |
258 | devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0; | |
259 | ret = gpio_request_one(devkit8000_lcd_device.reset_gpio, | |
260 | GPIOF_DIR_OUT | GPIOF_INIT_LOW, "LCD_PWREN"); | |
261 | if (ret < 0) { | |
262 | devkit8000_lcd_device.reset_gpio = -EINVAL; | |
263 | printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n"); | |
264 | } | |
40986098 | 265 | |
31c73f74 KRC |
266 | /* gpio + 7 is "DVI_PD" (out, active low) */ |
267 | devkit8000_dvi_device.reset_gpio = gpio + 7; | |
daf7aabc TW |
268 | ret = gpio_request_one(devkit8000_dvi_device.reset_gpio, |
269 | GPIOF_DIR_OUT | GPIOF_INIT_LOW, "DVI PowerDown"); | |
270 | if (ret < 0) { | |
271 | devkit8000_dvi_device.reset_gpio = -EINVAL; | |
272 | printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n"); | |
273 | } | |
31c73f74 | 274 | |
476544ca TW |
275 | return 0; |
276 | } | |
277 | ||
278 | static struct twl4030_gpio_platform_data devkit8000_gpio_data = { | |
279 | .gpio_base = OMAP_MAX_GPIO_LINES, | |
280 | .irq_base = TWL4030_GPIO_IRQ_BASE, | |
281 | .irq_end = TWL4030_GPIO_IRQ_END, | |
282 | .use_leds = true, | |
35a78fa4 | 283 | .pulldowns = BIT(1) | BIT(2) | BIT(6) | BIT(8) | BIT(13) |
476544ca TW |
284 | | BIT(15) | BIT(16) | BIT(17), |
285 | .setup = devkit8000_twl_gpio_setup, | |
286 | }; | |
287 | ||
1f489f9e TW |
288 | static struct regulator_consumer_supply devkit8000_vpll1_supply = |
289 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"); | |
476544ca TW |
290 | |
291 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ | |
292 | static struct regulator_init_data devkit8000_vmmc1 = { | |
293 | .constraints = { | |
294 | .min_uV = 1850000, | |
295 | .max_uV = 3150000, | |
296 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
297 | | REGULATOR_MODE_STANDBY, | |
298 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
299 | | REGULATOR_CHANGE_MODE | |
300 | | REGULATOR_CHANGE_STATUS, | |
301 | }, | |
302 | .num_consumer_supplies = 1, | |
303 | .consumer_supplies = &devkit8000_vmmc1_supply, | |
304 | }; | |
305 | ||
476544ca TW |
306 | /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */ |
307 | static struct regulator_init_data devkit8000_vdac = { | |
308 | .constraints = { | |
309 | .min_uV = 1800000, | |
310 | .max_uV = 1800000, | |
311 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
312 | | REGULATOR_MODE_STANDBY, | |
313 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
314 | | REGULATOR_CHANGE_STATUS, | |
315 | }, | |
316 | .num_consumer_supplies = 1, | |
317 | .consumer_supplies = &devkit8000_vdda_dac_supply, | |
318 | }; | |
319 | ||
5fd58b51 TW |
320 | /* VPLL1 for digital video outputs */ |
321 | static struct regulator_init_data devkit8000_vpll1 = { | |
476544ca | 322 | .constraints = { |
476544ca TW |
323 | .min_uV = 1800000, |
324 | .max_uV = 1800000, | |
325 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
326 | | REGULATOR_MODE_STANDBY, | |
327 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
328 | | REGULATOR_CHANGE_STATUS, | |
329 | }, | |
1f489f9e TW |
330 | .num_consumer_supplies = 1, |
331 | .consumer_supplies = &devkit8000_vpll1_supply, | |
5fd58b51 TW |
332 | }; |
333 | ||
334 | /* VAUX4 for ads7846 and nubs */ | |
335 | static struct regulator_init_data devkit8000_vio = { | |
336 | .constraints = { | |
337 | .min_uV = 1800000, | |
338 | .max_uV = 1800000, | |
339 | .apply_uV = true, | |
340 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
341 | | REGULATOR_MODE_STANDBY, | |
342 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
343 | | REGULATOR_CHANGE_STATUS, | |
344 | }, | |
1f489f9e TW |
345 | .num_consumer_supplies = 1, |
346 | .consumer_supplies = &devkit8000_vio_supply, | |
476544ca TW |
347 | }; |
348 | ||
349 | static struct twl4030_usb_data devkit8000_usb_data = { | |
350 | .usb_mode = T2_USB_MODE_ULPI, | |
351 | }; | |
352 | ||
353 | static struct twl4030_codec_audio_data devkit8000_audio_data = { | |
354 | .audio_mclk = 26000000, | |
355 | }; | |
356 | ||
357 | static struct twl4030_codec_data devkit8000_codec_data = { | |
358 | .audio_mclk = 26000000, | |
359 | .audio = &devkit8000_audio_data, | |
360 | }; | |
361 | ||
362 | static struct twl4030_platform_data devkit8000_twldata = { | |
363 | .irq_base = TWL4030_IRQ_BASE, | |
364 | .irq_end = TWL4030_IRQ_END, | |
365 | ||
366 | /* platform_data for children goes here */ | |
367 | .usb = &devkit8000_usb_data, | |
368 | .gpio = &devkit8000_gpio_data, | |
369 | .codec = &devkit8000_codec_data, | |
370 | .vmmc1 = &devkit8000_vmmc1, | |
476544ca | 371 | .vdac = &devkit8000_vdac, |
5fd58b51 TW |
372 | .vpll1 = &devkit8000_vpll1, |
373 | .vio = &devkit8000_vio, | |
476544ca TW |
374 | .keypad = &devkit8000_kp_data, |
375 | }; | |
376 | ||
377 | static struct i2c_board_info __initdata devkit8000_i2c_boardinfo[] = { | |
378 | { | |
0cbe70ee | 379 | I2C_BOARD_INFO("tps65930", 0x48), |
476544ca TW |
380 | .flags = I2C_CLIENT_WAKE, |
381 | .irq = INT_34XX_SYS_NIRQ, | |
382 | .platform_data = &devkit8000_twldata, | |
383 | }, | |
384 | }; | |
385 | ||
386 | static int __init devkit8000_i2c_init(void) | |
387 | { | |
388 | omap_register_i2c_bus(1, 2600, devkit8000_i2c_boardinfo, | |
389 | ARRAY_SIZE(devkit8000_i2c_boardinfo)); | |
390 | /* Bus 3 is attached to the DVI port where devices like the pico DLP | |
391 | * projector don't work reliably with 400kHz */ | |
392 | omap_register_i2c_bus(3, 400, NULL, 0); | |
393 | return 0; | |
394 | } | |
395 | ||
396 | static struct gpio_led gpio_leds[] = { | |
397 | { | |
398 | .name = "led1", | |
399 | .default_trigger = "heartbeat", | |
400 | .gpio = 186, | |
401 | .active_low = true, | |
402 | }, | |
403 | { | |
404 | .name = "led2", | |
405 | .default_trigger = "mmc0", | |
406 | .gpio = 163, | |
407 | .active_low = true, | |
408 | }, | |
409 | { | |
410 | .name = "ledB", | |
411 | .default_trigger = "none", | |
412 | .gpio = 153, | |
413 | .active_low = true, | |
414 | }, | |
415 | { | |
416 | .name = "led3", | |
417 | .default_trigger = "none", | |
418 | .gpio = 164, | |
419 | .active_low = true, | |
420 | }, | |
421 | }; | |
422 | ||
423 | static struct gpio_led_platform_data gpio_led_info = { | |
424 | .leds = gpio_leds, | |
425 | .num_leds = ARRAY_SIZE(gpio_leds), | |
426 | }; | |
427 | ||
428 | static struct platform_device leds_gpio = { | |
429 | .name = "leds-gpio", | |
430 | .id = -1, | |
431 | .dev = { | |
432 | .platform_data = &gpio_led_info, | |
433 | }, | |
434 | }; | |
435 | ||
436 | static struct gpio_keys_button gpio_buttons[] = { | |
437 | { | |
438 | .code = BTN_EXTRA, | |
439 | .gpio = 26, | |
440 | .desc = "user", | |
441 | .wakeup = 1, | |
442 | }, | |
443 | }; | |
444 | ||
445 | static struct gpio_keys_platform_data gpio_key_info = { | |
446 | .buttons = gpio_buttons, | |
447 | .nbuttons = ARRAY_SIZE(gpio_buttons), | |
448 | }; | |
449 | ||
450 | static struct platform_device keys_gpio = { | |
451 | .name = "gpio-keys", | |
452 | .id = -1, | |
453 | .dev = { | |
454 | .platform_data = &gpio_key_info, | |
455 | }, | |
456 | }; | |
457 | ||
458 | ||
459 | static void __init devkit8000_init_irq(void) | |
460 | { | |
4805734b PW |
461 | omap2_init_common_infrastructure(); |
462 | omap2_init_common_devices(mt46h32m32lf6_sdrc_params, | |
463 | mt46h32m32lf6_sdrc_params); | |
476544ca TW |
464 | omap_init_irq(); |
465 | #ifdef CONFIG_OMAP_32K_TIMER | |
466 | omap2_gp_clockevent_set_gptimer(12); | |
467 | #endif | |
476544ca TW |
468 | } |
469 | ||
470 | static void __init devkit8000_ads7846_init(void) | |
471 | { | |
472 | int gpio = OMAP3_DEVKIT_TS_GPIO; | |
473 | int ret; | |
474 | ||
475 | ret = gpio_request(gpio, "ads7846_pen_down"); | |
476 | if (ret < 0) { | |
477 | printk(KERN_ERR "Failed to request GPIO %d for " | |
478 | "ads7846 pen down IRQ\n", gpio); | |
479 | return; | |
480 | } | |
481 | ||
482 | gpio_direction_input(gpio); | |
483 | } | |
484 | ||
485 | static int ads7846_get_pendown_state(void) | |
486 | { | |
487 | return !gpio_get_value(OMAP3_DEVKIT_TS_GPIO); | |
488 | } | |
489 | ||
490 | static struct ads7846_platform_data ads7846_config = { | |
491 | .x_max = 0x0fff, | |
492 | .y_max = 0x0fff, | |
493 | .x_plate_ohms = 180, | |
494 | .pressure_max = 255, | |
495 | .debounce_max = 10, | |
496 | .debounce_tol = 5, | |
497 | .debounce_rep = 1, | |
498 | .get_pendown_state = ads7846_get_pendown_state, | |
499 | .keep_vref_on = 1, | |
500 | .settle_delay_usecs = 150, | |
501 | }; | |
502 | ||
503 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | |
504 | .turbo_mode = 0, | |
505 | .single_channel = 1, /* 0: slave, 1: master */ | |
506 | }; | |
507 | ||
508 | static struct spi_board_info devkit8000_spi_board_info[] __initdata = { | |
509 | { | |
510 | .modalias = "ads7846", | |
511 | .bus_num = 2, | |
512 | .chip_select = 0, | |
513 | .max_speed_hz = 1500000, | |
514 | .controller_data = &ads7846_mcspi_config, | |
515 | .irq = OMAP_GPIO_IRQ(OMAP3_DEVKIT_TS_GPIO), | |
516 | .platform_data = &ads7846_config, | |
517 | } | |
518 | }; | |
519 | ||
520 | #define OMAP_DM9000_BASE 0x2c000000 | |
521 | ||
522 | static struct resource omap_dm9000_resources[] = { | |
523 | [0] = { | |
524 | .start = OMAP_DM9000_BASE, | |
525 | .end = (OMAP_DM9000_BASE + 0x4 - 1), | |
526 | .flags = IORESOURCE_MEM, | |
527 | }, | |
528 | [1] = { | |
529 | .start = (OMAP_DM9000_BASE + 0x400), | |
530 | .end = (OMAP_DM9000_BASE + 0x400 + 0x4 - 1), | |
531 | .flags = IORESOURCE_MEM, | |
532 | }, | |
533 | [2] = { | |
534 | .start = OMAP_GPIO_IRQ(OMAP_DM9000_GPIO_IRQ), | |
535 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, | |
536 | }, | |
537 | }; | |
538 | ||
539 | static struct dm9000_plat_data omap_dm9000_platdata = { | |
540 | .flags = DM9000_PLATF_16BITONLY, | |
541 | }; | |
542 | ||
543 | static struct platform_device omap_dm9000_dev = { | |
544 | .name = "dm9000", | |
545 | .id = -1, | |
546 | .num_resources = ARRAY_SIZE(omap_dm9000_resources), | |
547 | .resource = omap_dm9000_resources, | |
548 | .dev = { | |
549 | .platform_data = &omap_dm9000_platdata, | |
550 | }, | |
551 | }; | |
552 | ||
553 | static void __init omap_dm9000_init(void) | |
554 | { | |
f535daed KRC |
555 | unsigned char *eth_addr = omap_dm9000_platdata.dev_addr; |
556 | struct omap_die_id odi; | |
557 | ||
476544ca TW |
558 | if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) { |
559 | printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n", | |
560 | OMAP_DM9000_GPIO_IRQ); | |
561 | return; | |
562 | } | |
563 | ||
564 | gpio_direction_input(OMAP_DM9000_GPIO_IRQ); | |
f535daed KRC |
565 | |
566 | /* init the mac address using DIE id */ | |
567 | omap_get_die_id(&odi); | |
568 | ||
569 | eth_addr[0] = 0x02; /* locally administered */ | |
570 | eth_addr[1] = odi.id_1 & 0xff; | |
571 | eth_addr[2] = (odi.id_0 & 0xff000000) >> 24; | |
572 | eth_addr[3] = (odi.id_0 & 0x00ff0000) >> 16; | |
573 | eth_addr[4] = (odi.id_0 & 0x0000ff00) >> 8; | |
574 | eth_addr[5] = (odi.id_0 & 0x000000ff); | |
476544ca TW |
575 | } |
576 | ||
577 | static struct platform_device *devkit8000_devices[] __initdata = { | |
578 | &devkit8000_dss_device, | |
579 | &leds_gpio, | |
580 | &keys_gpio, | |
581 | &omap_dm9000_dev, | |
582 | }; | |
583 | ||
584 | static void __init devkit8000_flash_init(void) | |
585 | { | |
586 | u8 cs = 0; | |
587 | u8 nandcs = GPMC_CS_NUM + 1; | |
588 | ||
476544ca TW |
589 | /* find out the chip-select on which NAND exists */ |
590 | while (cs < GPMC_CS_NUM) { | |
591 | u32 ret = 0; | |
592 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | |
593 | ||
594 | if ((ret & 0xC00) == 0x800) { | |
595 | printk(KERN_INFO "Found NAND on CS%d\n", cs); | |
596 | if (nandcs > GPMC_CS_NUM) | |
597 | nandcs = cs; | |
598 | } | |
599 | cs++; | |
600 | } | |
601 | ||
602 | if (nandcs > GPMC_CS_NUM) { | |
603 | printk(KERN_INFO "NAND: Unable to find configuration " | |
604 | "in GPMC\n "); | |
605 | return; | |
606 | } | |
607 | ||
608 | if (nandcs < GPMC_CS_NUM) { | |
609 | devkit8000_nand_data.cs = nandcs; | |
476544ca TW |
610 | |
611 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); | |
f450d867 | 612 | if (gpmc_nand_init(&devkit8000_nand_data) < 0) |
476544ca TW |
613 | printk(KERN_ERR "Unable to register NAND device\n"); |
614 | } | |
615 | } | |
616 | ||
884b8369 MM |
617 | static struct omap_musb_board_data musb_board_data = { |
618 | .interface_type = MUSB_INTERFACE_ULPI, | |
619 | .mode = MUSB_OTG, | |
620 | .power = 100, | |
621 | }; | |
622 | ||
181b250c | 623 | static const struct usbhs_omap_board_data usbhs_bdata __initconst = { |
476544ca | 624 | |
181b250c KM |
625 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
626 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, | |
627 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | |
476544ca TW |
628 | |
629 | .phy_reset = true, | |
630 | .reset_gpio_port[0] = -EINVAL, | |
2135bb53 | 631 | .reset_gpio_port[1] = -EINVAL, |
476544ca TW |
632 | .reset_gpio_port[2] = -EINVAL |
633 | }; | |
634 | ||
018e075c TW |
635 | static struct omap_board_mux board_mux[] __initdata = { |
636 | /* nCS and IRQ for Devkit8000 ethernet */ | |
637 | OMAP3_MUX(GPMC_NCS6, OMAP_MUX_MODE0), | |
638 | OMAP3_MUX(ETK_D11, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP), | |
639 | ||
640 | /* McSPI 2*/ | |
641 | OMAP3_MUX(MCSPI2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
642 | OMAP3_MUX(MCSPI2_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
643 | OMAP3_MUX(MCSPI2_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
644 | OMAP3_MUX(MCSPI2_CS0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
645 | OMAP3_MUX(MCSPI2_CS1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
646 | ||
647 | /* PENDOWN GPIO */ | |
648 | OMAP3_MUX(ETK_D13, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), | |
649 | ||
650 | /* mUSB */ | |
651 | OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
652 | OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
653 | OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
654 | OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
655 | OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
656 | OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
657 | OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
658 | OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
659 | OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
660 | OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
661 | OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
662 | OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
663 | ||
664 | /* USB 1 */ | |
665 | OMAP3_MUX(ETK_CTL, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
666 | OMAP3_MUX(ETK_CLK, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT), | |
667 | OMAP3_MUX(ETK_D8, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
668 | OMAP3_MUX(ETK_D9, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
669 | OMAP3_MUX(ETK_D0, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
670 | OMAP3_MUX(ETK_D1, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
671 | OMAP3_MUX(ETK_D2, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
672 | OMAP3_MUX(ETK_D3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
673 | OMAP3_MUX(ETK_D4, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
674 | OMAP3_MUX(ETK_D5, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
675 | OMAP3_MUX(ETK_D6, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
676 | OMAP3_MUX(ETK_D7, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), | |
677 | ||
678 | /* MMC 1 */ | |
679 | OMAP3_MUX(SDMMC1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
680 | OMAP3_MUX(SDMMC1_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
681 | OMAP3_MUX(SDMMC1_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
682 | OMAP3_MUX(SDMMC1_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
683 | OMAP3_MUX(SDMMC1_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
684 | OMAP3_MUX(SDMMC1_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
685 | OMAP3_MUX(SDMMC1_DAT4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
686 | OMAP3_MUX(SDMMC1_DAT5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
687 | OMAP3_MUX(SDMMC1_DAT6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
688 | OMAP3_MUX(SDMMC1_DAT7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
689 | ||
690 | /* McBSP 2 */ | |
691 | OMAP3_MUX(MCBSP2_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
692 | OMAP3_MUX(MCBSP2_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
693 | OMAP3_MUX(MCBSP2_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
694 | OMAP3_MUX(MCBSP2_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
695 | ||
696 | /* I2C 1 */ | |
697 | OMAP3_MUX(I2C1_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
698 | OMAP3_MUX(I2C1_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
699 | ||
700 | /* I2C 2 */ | |
701 | OMAP3_MUX(I2C2_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
702 | OMAP3_MUX(I2C2_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
703 | ||
704 | /* I2C 3 */ | |
705 | OMAP3_MUX(I2C3_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
706 | OMAP3_MUX(I2C3_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
707 | ||
708 | /* I2C 4 */ | |
709 | OMAP3_MUX(I2C4_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
710 | OMAP3_MUX(I2C4_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
711 | ||
712 | /* serial ports */ | |
713 | OMAP3_MUX(MCBSP3_CLKX, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), | |
714 | OMAP3_MUX(MCBSP3_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), | |
715 | OMAP3_MUX(UART1_TX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
716 | OMAP3_MUX(UART1_RX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
717 | ||
718 | /* DSS */ | |
719 | OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
720 | OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
721 | OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
722 | OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
723 | OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
724 | OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
725 | OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
726 | OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
727 | OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
728 | OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
729 | OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
730 | OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
731 | OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
732 | OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
733 | OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
734 | OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
735 | OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
736 | OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
737 | OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
738 | OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
739 | OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
740 | OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
741 | OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
742 | OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
743 | OMAP3_MUX(DSS_DATA20, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
744 | OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
745 | OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
746 | OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | |
747 | ||
748 | /* expansion port */ | |
749 | /* McSPI 1 */ | |
750 | OMAP3_MUX(MCSPI1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
751 | OMAP3_MUX(MCSPI1_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
752 | OMAP3_MUX(MCSPI1_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
753 | OMAP3_MUX(MCSPI1_CS0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN), | |
754 | OMAP3_MUX(MCSPI1_CS3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN), | |
755 | ||
756 | /* HDQ */ | |
757 | OMAP3_MUX(HDQ_SIO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
758 | ||
759 | /* McSPI4 */ | |
760 | OMAP3_MUX(MCBSP1_CLKR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), | |
761 | OMAP3_MUX(MCBSP1_DX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), | |
762 | OMAP3_MUX(MCBSP1_DR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), | |
763 | OMAP3_MUX(MCBSP1_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP), | |
764 | ||
765 | /* MMC 2 */ | |
766 | OMAP3_MUX(SDMMC2_DAT4, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), | |
767 | OMAP3_MUX(SDMMC2_DAT5, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), | |
768 | OMAP3_MUX(SDMMC2_DAT6, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), | |
769 | OMAP3_MUX(SDMMC2_DAT7, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), | |
770 | ||
771 | /* I2C3 */ | |
772 | OMAP3_MUX(I2C3_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
773 | OMAP3_MUX(I2C3_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | |
774 | ||
775 | OMAP3_MUX(MCBSP1_CLKX, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), | |
776 | OMAP3_MUX(MCBSP_CLKS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), | |
777 | OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), | |
778 | ||
779 | OMAP3_MUX(GPMC_NCS7, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), | |
780 | OMAP3_MUX(GPMC_NCS3, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), | |
781 | ||
782 | /* TPS IRQ */ | |
783 | OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \ | |
784 | OMAP_PIN_INPUT_PULLUP), | |
785 | ||
786 | { .reg_offset = OMAP_MUX_TERMINATOR }, | |
787 | }; | |
788 | ||
476544ca TW |
789 | static void __init devkit8000_init(void) |
790 | { | |
018e075c | 791 | omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); |
faec32e5 TW |
792 | omap_serial_init(); |
793 | ||
794 | omap_dm9000_init(); | |
795 | ||
476544ca TW |
796 | devkit8000_i2c_init(); |
797 | platform_add_devices(devkit8000_devices, | |
798 | ARRAY_SIZE(devkit8000_devices)); | |
476544ca TW |
799 | |
800 | spi_register_board_info(devkit8000_spi_board_info, | |
801 | ARRAY_SIZE(devkit8000_spi_board_info)); | |
802 | ||
476544ca TW |
803 | devkit8000_ads7846_init(); |
804 | ||
884b8369 | 805 | usb_musb_init(&musb_board_data); |
181b250c | 806 | usb_ehci_init(&usbhs_bdata); |
476544ca TW |
807 | devkit8000_flash_init(); |
808 | ||
809 | /* Ensure SDRC pins are mux'd for self-refresh */ | |
3cdc6ee5 TW |
810 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
811 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | |
476544ca TW |
812 | } |
813 | ||
476544ca | 814 | MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000") |
476544ca | 815 | .boot_params = 0x80000100, |
869fef41 | 816 | .map_io = omap3_map_io, |
71ee7dad | 817 | .reserve = omap_reserve, |
476544ca TW |
818 | .init_irq = devkit8000_init_irq, |
819 | .init_machine = devkit8000_init, | |
820 | .timer = &omap_timer, | |
821 | MACHINE_END |