blob: a86d00105d59143caa820fe308fe196e9986c638 [file] [log] [blame]
Thomas Weber476544c2010-02-17 14:09:28 -08001/*
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>
Thomas Weber476544c2010-02-17 14:09:28 -080053#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
69static 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
100static 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
107static struct resource devkit8000_nand_resource = {
108 .flags = IORESOURCE_MEM,
109};
110
111static 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
121static struct omap2_hsmmc_info mmc[] = {
122 {
123 .mmc = 1,
124 .wires = 8,
125 .gpio_wp = 29,
126 },
127 {} /* Terminator */
128};
129static struct omap_board_config_kernel devkit8000_config[] __initdata = {
130};
131
132static 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
Kan-Ru Chen40986092010-07-05 17:04:40 +0300137 if (dssdev->reset_gpio != -EINVAL)
138 gpio_set_value(dssdev->reset_gpio, 1);
Thomas Weber476544c2010-02-17 14:09:28 -0800139 return 0;
140}
141
142static void devkit8000_panel_disable_lcd(struct omap_dss_device *dssdev)
143{
Kan-Ru Chen40986092010-07-05 17:04:40 +0300144 if (dssdev->reset_gpio != -EINVAL)
145 gpio_set_value(dssdev->reset_gpio, 0);
Thomas Weber476544c2010-02-17 14:09:28 -0800146}
Kan-Ru Chen31c73f72010-07-05 17:04:40 +0300147
Thomas Weber476544c2010-02-17 14:09:28 -0800148static int devkit8000_panel_enable_dvi(struct omap_dss_device *dssdev)
149{
Kan-Ru Chen31c73f72010-07-05 17:04:40 +0300150 if (dssdev->reset_gpio != -EINVAL)
151 gpio_set_value(dssdev->reset_gpio, 1);
Thomas Weber476544c2010-02-17 14:09:28 -0800152 return 0;
153}
154
155static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev)
156{
Kan-Ru Chen31c73f72010-07-05 17:04:40 +0300157 if (dssdev->reset_gpio != -EINVAL)
158 gpio_set_value(dssdev->reset_gpio, 0);
Thomas Weber476544c2010-02-17 14:09:28 -0800159}
160
161static int devkit8000_panel_enable_tv(struct omap_dss_device *dssdev)
162{
163
164 return 0;
165}
166
167static void devkit8000_panel_disable_tv(struct omap_dss_device *dssdev)
168{
169}
170
171
172static struct regulator_consumer_supply devkit8000_vmmc1_supply = {
173 .supply = "vmmc",
174};
175
176static struct regulator_consumer_supply devkit8000_vsim_supply = {
177 .supply = "vmmc_aux",
178};
179
Thomas Weber5fd58b52010-07-05 17:04:39 +0300180/* ads7846 on SPI */
181static struct regulator_consumer_supply devkit8000_vio_supplies[] = {
182 REGULATOR_SUPPLY("vcc", "spi2.0")
183};
Thomas Weber476544c2010-02-17 14:09:28 -0800184
185static struct omap_dss_device devkit8000_lcd_device = {
186 .name = "lcd",
Thomas Weber61d07ef2010-07-05 17:04:40 +0300187 .driver_name = "generic_panel",
Thomas Weber476544c2010-02-17 14:09:28 -0800188 .type = OMAP_DISPLAY_TYPE_DPI,
189 .phy.dpi.data_lines = 24,
Kan-Ru Chen40986092010-07-05 17:04:40 +0300190 .reset_gpio = -EINVAL, /* will be replaced */
Thomas Weber476544c2010-02-17 14:09:28 -0800191 .platform_enable = devkit8000_panel_enable_lcd,
192 .platform_disable = devkit8000_panel_disable_lcd,
193};
194static struct omap_dss_device devkit8000_dvi_device = {
195 .name = "dvi",
196 .driver_name = "generic_panel",
197 .type = OMAP_DISPLAY_TYPE_DPI,
198 .phy.dpi.data_lines = 24,
Kan-Ru Chen31c73f72010-07-05 17:04:40 +0300199 .reset_gpio = -EINVAL, /* will be replaced */
Thomas Weber476544c2010-02-17 14:09:28 -0800200 .platform_enable = devkit8000_panel_enable_dvi,
201 .platform_disable = devkit8000_panel_disable_dvi,
202};
203
204static struct omap_dss_device devkit8000_tv_device = {
205 .name = "tv",
206 .driver_name = "venc",
207 .type = OMAP_DISPLAY_TYPE_VENC,
208 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
209 .platform_enable = devkit8000_panel_enable_tv,
210 .platform_disable = devkit8000_panel_disable_tv,
211};
212
213
214static struct omap_dss_device *devkit8000_dss_devices[] = {
215 &devkit8000_lcd_device,
216 &devkit8000_dvi_device,
217 &devkit8000_tv_device,
218};
219
220static struct omap_dss_board_info devkit8000_dss_data = {
221 .num_devices = ARRAY_SIZE(devkit8000_dss_devices),
222 .devices = devkit8000_dss_devices,
223 .default_device = &devkit8000_lcd_device,
224};
225
226static struct platform_device devkit8000_dss_device = {
227 .name = "omapdss",
228 .id = -1,
229 .dev = {
230 .platform_data = &devkit8000_dss_data,
231 },
232};
233
234static struct regulator_consumer_supply devkit8000_vdda_dac_supply = {
235 .supply = "vdda_dac",
236 .dev = &devkit8000_dss_device.dev,
237};
238
239static int board_keymap[] = {
240 KEY(0, 0, KEY_1),
241 KEY(1, 0, KEY_2),
242 KEY(2, 0, KEY_3),
243 KEY(0, 1, KEY_4),
244 KEY(1, 1, KEY_5),
245 KEY(2, 1, KEY_6),
246 KEY(3, 1, KEY_F5),
247 KEY(0, 2, KEY_7),
248 KEY(1, 2, KEY_8),
249 KEY(2, 2, KEY_9),
250 KEY(3, 2, KEY_F6),
251 KEY(0, 3, KEY_F7),
252 KEY(1, 3, KEY_0),
253 KEY(2, 3, KEY_F8),
254 PERSISTENT_KEY(4, 5),
255 KEY(4, 4, KEY_VOLUMEUP),
256 KEY(5, 5, KEY_VOLUMEDOWN),
257 0
258};
259
260static struct matrix_keymap_data board_map_data = {
261 .keymap = board_keymap,
262 .keymap_size = ARRAY_SIZE(board_keymap),
263};
264
265static struct twl4030_keypad_data devkit8000_kp_data = {
266 .keymap_data = &board_map_data,
267 .rows = 6,
268 .cols = 6,
269 .rep = 1,
270};
271
272static struct gpio_led gpio_leds[];
273
274static int devkit8000_twl_gpio_setup(struct device *dev,
275 unsigned gpio, unsigned ngpio)
276{
277 omap_mux_init_gpio(29, OMAP_PIN_INPUT);
278 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
279 mmc[0].gpio_cd = gpio + 0;
280 omap2_hsmmc_init(mmc);
281
282 /* link regulators to MMC adapters */
283 devkit8000_vmmc1_supply.dev = mmc[0].dev;
284 devkit8000_vsim_supply.dev = mmc[0].dev;
285
Kan-Ru Chen31c73f72010-07-05 17:04:40 +0300286 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
287 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
288
Kan-Ru Chen40986092010-07-05 17:04:40 +0300289 /* gpio + 1 is "LCD_PWREN" (out, active high) */
290 devkit8000_lcd_device.reset_gpio = gpio + 1;
291 gpio_request(devkit8000_lcd_device.reset_gpio, "LCD_PWREN");
292 /* Disable until needed */
293 gpio_direction_output(devkit8000_lcd_device.reset_gpio, 0);
294
Kan-Ru Chen31c73f72010-07-05 17:04:40 +0300295 /* gpio + 7 is "DVI_PD" (out, active low) */
296 devkit8000_dvi_device.reset_gpio = gpio + 7;
297 gpio_request(devkit8000_dvi_device.reset_gpio, "DVI PowerDown");
298 /* Disable until needed */
299 gpio_direction_output(devkit8000_dvi_device.reset_gpio, 0);
300
Thomas Weber476544c2010-02-17 14:09:28 -0800301 return 0;
302}
303
304static struct twl4030_gpio_platform_data devkit8000_gpio_data = {
305 .gpio_base = OMAP_MAX_GPIO_LINES,
306 .irq_base = TWL4030_GPIO_IRQ_BASE,
307 .irq_end = TWL4030_GPIO_IRQ_END,
308 .use_leds = true,
309 .pullups = BIT(1),
310 .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13)
311 | BIT(15) | BIT(16) | BIT(17),
312 .setup = devkit8000_twl_gpio_setup,
313};
314
Thomas Weber5fd58b52010-07-05 17:04:39 +0300315static struct regulator_consumer_supply devkit8000_vpll1_supplies[] = {
Thomas Weber476544c2010-02-17 14:09:28 -0800316 {
317 .supply = "vdvi",
318 .dev = &devkit8000_lcd_device.dev,
319 },
320 {
Thomas Weber6057db52010-03-24 12:52:10 +0000321 .supply = "vdds_dsi",
Thomas Weber476544c2010-02-17 14:09:28 -0800322 .dev = &devkit8000_dss_device.dev,
323 }
324};
325
326/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
327static struct regulator_init_data devkit8000_vmmc1 = {
328 .constraints = {
329 .min_uV = 1850000,
330 .max_uV = 3150000,
331 .valid_modes_mask = REGULATOR_MODE_NORMAL
332 | REGULATOR_MODE_STANDBY,
333 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
334 | REGULATOR_CHANGE_MODE
335 | REGULATOR_CHANGE_STATUS,
336 },
337 .num_consumer_supplies = 1,
338 .consumer_supplies = &devkit8000_vmmc1_supply,
339};
340
341/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
342static struct regulator_init_data devkit8000_vsim = {
343 .constraints = {
344 .min_uV = 1800000,
345 .max_uV = 3000000,
346 .valid_modes_mask = REGULATOR_MODE_NORMAL
347 | REGULATOR_MODE_STANDBY,
348 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
349 | REGULATOR_CHANGE_MODE
350 | REGULATOR_CHANGE_STATUS,
351 },
352 .num_consumer_supplies = 1,
353 .consumer_supplies = &devkit8000_vsim_supply,
354};
355
356/* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
357static struct regulator_init_data devkit8000_vdac = {
358 .constraints = {
359 .min_uV = 1800000,
360 .max_uV = 1800000,
361 .valid_modes_mask = REGULATOR_MODE_NORMAL
362 | REGULATOR_MODE_STANDBY,
363 .valid_ops_mask = REGULATOR_CHANGE_MODE
364 | REGULATOR_CHANGE_STATUS,
365 },
366 .num_consumer_supplies = 1,
367 .consumer_supplies = &devkit8000_vdda_dac_supply,
368};
369
Thomas Weber5fd58b52010-07-05 17:04:39 +0300370/* VPLL1 for digital video outputs */
371static struct regulator_init_data devkit8000_vpll1 = {
Thomas Weber476544c2010-02-17 14:09:28 -0800372 .constraints = {
373 .name = "VDVI",
374 .min_uV = 1800000,
375 .max_uV = 1800000,
376 .valid_modes_mask = REGULATOR_MODE_NORMAL
377 | REGULATOR_MODE_STANDBY,
378 .valid_ops_mask = REGULATOR_CHANGE_MODE
379 | REGULATOR_CHANGE_STATUS,
380 },
Thomas Weber5fd58b52010-07-05 17:04:39 +0300381 .num_consumer_supplies = ARRAY_SIZE(devkit8000_vpll1_supplies),
382 .consumer_supplies = devkit8000_vpll1_supplies,
383};
384
385/* VAUX4 for ads7846 and nubs */
386static struct regulator_init_data devkit8000_vio = {
387 .constraints = {
388 .min_uV = 1800000,
389 .max_uV = 1800000,
390 .apply_uV = true,
391 .valid_modes_mask = REGULATOR_MODE_NORMAL
392 | REGULATOR_MODE_STANDBY,
393 .valid_ops_mask = REGULATOR_CHANGE_MODE
394 | REGULATOR_CHANGE_STATUS,
395 },
396 .num_consumer_supplies = ARRAY_SIZE(devkit8000_vio_supplies),
397 .consumer_supplies = devkit8000_vio_supplies,
Thomas Weber476544c2010-02-17 14:09:28 -0800398};
399
400static struct twl4030_usb_data devkit8000_usb_data = {
401 .usb_mode = T2_USB_MODE_ULPI,
402};
403
404static struct twl4030_codec_audio_data devkit8000_audio_data = {
405 .audio_mclk = 26000000,
406};
407
408static struct twl4030_codec_data devkit8000_codec_data = {
409 .audio_mclk = 26000000,
410 .audio = &devkit8000_audio_data,
411};
412
413static struct twl4030_platform_data devkit8000_twldata = {
414 .irq_base = TWL4030_IRQ_BASE,
415 .irq_end = TWL4030_IRQ_END,
416
417 /* platform_data for children goes here */
418 .usb = &devkit8000_usb_data,
419 .gpio = &devkit8000_gpio_data,
420 .codec = &devkit8000_codec_data,
421 .vmmc1 = &devkit8000_vmmc1,
422 .vsim = &devkit8000_vsim,
423 .vdac = &devkit8000_vdac,
Thomas Weber5fd58b52010-07-05 17:04:39 +0300424 .vpll1 = &devkit8000_vpll1,
425 .vio = &devkit8000_vio,
Thomas Weber476544c2010-02-17 14:09:28 -0800426 .keypad = &devkit8000_kp_data,
427};
428
429static struct i2c_board_info __initdata devkit8000_i2c_boardinfo[] = {
430 {
431 I2C_BOARD_INFO("twl4030", 0x48),
432 .flags = I2C_CLIENT_WAKE,
433 .irq = INT_34XX_SYS_NIRQ,
434 .platform_data = &devkit8000_twldata,
435 },
436};
437
438static int __init devkit8000_i2c_init(void)
439{
440 omap_register_i2c_bus(1, 2600, devkit8000_i2c_boardinfo,
441 ARRAY_SIZE(devkit8000_i2c_boardinfo));
442 /* Bus 3 is attached to the DVI port where devices like the pico DLP
443 * projector don't work reliably with 400kHz */
444 omap_register_i2c_bus(3, 400, NULL, 0);
445 return 0;
446}
447
448static struct gpio_led gpio_leds[] = {
449 {
450 .name = "led1",
451 .default_trigger = "heartbeat",
452 .gpio = 186,
453 .active_low = true,
454 },
455 {
456 .name = "led2",
457 .default_trigger = "mmc0",
458 .gpio = 163,
459 .active_low = true,
460 },
461 {
462 .name = "ledB",
463 .default_trigger = "none",
464 .gpio = 153,
465 .active_low = true,
466 },
467 {
468 .name = "led3",
469 .default_trigger = "none",
470 .gpio = 164,
471 .active_low = true,
472 },
473};
474
475static struct gpio_led_platform_data gpio_led_info = {
476 .leds = gpio_leds,
477 .num_leds = ARRAY_SIZE(gpio_leds),
478};
479
480static struct platform_device leds_gpio = {
481 .name = "leds-gpio",
482 .id = -1,
483 .dev = {
484 .platform_data = &gpio_led_info,
485 },
486};
487
488static struct gpio_keys_button gpio_buttons[] = {
489 {
490 .code = BTN_EXTRA,
491 .gpio = 26,
492 .desc = "user",
493 .wakeup = 1,
494 },
495};
496
497static struct gpio_keys_platform_data gpio_key_info = {
498 .buttons = gpio_buttons,
499 .nbuttons = ARRAY_SIZE(gpio_buttons),
500};
501
502static struct platform_device keys_gpio = {
503 .name = "gpio-keys",
504 .id = -1,
505 .dev = {
506 .platform_data = &gpio_key_info,
507 },
508};
509
510
511static void __init devkit8000_init_irq(void)
512{
513 omap_board_config = devkit8000_config;
514 omap_board_config_size = ARRAY_SIZE(devkit8000_config);
515 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
516 mt46h32m32lf6_sdrc_params);
517 omap_init_irq();
518#ifdef CONFIG_OMAP_32K_TIMER
519 omap2_gp_clockevent_set_gptimer(12);
520#endif
521 omap_gpio_init();
522}
523
524static void __init devkit8000_ads7846_init(void)
525{
526 int gpio = OMAP3_DEVKIT_TS_GPIO;
527 int ret;
528
529 ret = gpio_request(gpio, "ads7846_pen_down");
530 if (ret < 0) {
531 printk(KERN_ERR "Failed to request GPIO %d for "
532 "ads7846 pen down IRQ\n", gpio);
533 return;
534 }
535
536 gpio_direction_input(gpio);
537}
538
539static int ads7846_get_pendown_state(void)
540{
541 return !gpio_get_value(OMAP3_DEVKIT_TS_GPIO);
542}
543
544static struct ads7846_platform_data ads7846_config = {
545 .x_max = 0x0fff,
546 .y_max = 0x0fff,
547 .x_plate_ohms = 180,
548 .pressure_max = 255,
549 .debounce_max = 10,
550 .debounce_tol = 5,
551 .debounce_rep = 1,
552 .get_pendown_state = ads7846_get_pendown_state,
553 .keep_vref_on = 1,
554 .settle_delay_usecs = 150,
555};
556
557static struct omap2_mcspi_device_config ads7846_mcspi_config = {
558 .turbo_mode = 0,
559 .single_channel = 1, /* 0: slave, 1: master */
560};
561
562static struct spi_board_info devkit8000_spi_board_info[] __initdata = {
563 {
564 .modalias = "ads7846",
565 .bus_num = 2,
566 .chip_select = 0,
567 .max_speed_hz = 1500000,
568 .controller_data = &ads7846_mcspi_config,
569 .irq = OMAP_GPIO_IRQ(OMAP3_DEVKIT_TS_GPIO),
570 .platform_data = &ads7846_config,
571 }
572};
573
574#define OMAP_DM9000_BASE 0x2c000000
575
576static struct resource omap_dm9000_resources[] = {
577 [0] = {
578 .start = OMAP_DM9000_BASE,
579 .end = (OMAP_DM9000_BASE + 0x4 - 1),
580 .flags = IORESOURCE_MEM,
581 },
582 [1] = {
583 .start = (OMAP_DM9000_BASE + 0x400),
584 .end = (OMAP_DM9000_BASE + 0x400 + 0x4 - 1),
585 .flags = IORESOURCE_MEM,
586 },
587 [2] = {
588 .start = OMAP_GPIO_IRQ(OMAP_DM9000_GPIO_IRQ),
589 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
590 },
591};
592
593static struct dm9000_plat_data omap_dm9000_platdata = {
594 .flags = DM9000_PLATF_16BITONLY,
595};
596
597static struct platform_device omap_dm9000_dev = {
598 .name = "dm9000",
599 .id = -1,
600 .num_resources = ARRAY_SIZE(omap_dm9000_resources),
601 .resource = omap_dm9000_resources,
602 .dev = {
603 .platform_data = &omap_dm9000_platdata,
604 },
605};
606
607static void __init omap_dm9000_init(void)
608{
609 if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) {
610 printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n",
611 OMAP_DM9000_GPIO_IRQ);
612 return;
613 }
614
615 gpio_direction_input(OMAP_DM9000_GPIO_IRQ);
616}
617
618static struct platform_device *devkit8000_devices[] __initdata = {
619 &devkit8000_dss_device,
620 &leds_gpio,
621 &keys_gpio,
622 &omap_dm9000_dev,
623};
624
625static void __init devkit8000_flash_init(void)
626{
627 u8 cs = 0;
628 u8 nandcs = GPMC_CS_NUM + 1;
629
630 u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
631
632 /* find out the chip-select on which NAND exists */
633 while (cs < GPMC_CS_NUM) {
634 u32 ret = 0;
635 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
636
637 if ((ret & 0xC00) == 0x800) {
638 printk(KERN_INFO "Found NAND on CS%d\n", cs);
639 if (nandcs > GPMC_CS_NUM)
640 nandcs = cs;
641 }
642 cs++;
643 }
644
645 if (nandcs > GPMC_CS_NUM) {
646 printk(KERN_INFO "NAND: Unable to find configuration "
647 "in GPMC\n ");
648 return;
649 }
650
651 if (nandcs < GPMC_CS_NUM) {
652 devkit8000_nand_data.cs = nandcs;
653 devkit8000_nand_data.gpmc_cs_baseaddr = (void *)
654 (gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
655 devkit8000_nand_data.gpmc_baseaddr = (void *)
656 (gpmc_base_add);
657
658 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
659 if (platform_device_register(&devkit8000_nand_device) < 0)
660 printk(KERN_ERR "Unable to register NAND device\n");
661 }
662}
663
Maulik Mankad884b8362010-02-17 14:09:30 -0800664static struct omap_musb_board_data musb_board_data = {
665 .interface_type = MUSB_INTERFACE_ULPI,
666 .mode = MUSB_OTG,
667 .power = 100,
668};
669
Felipe Balbi6f69a182010-03-04 09:45:53 +0200670static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
Thomas Weber476544c2010-02-17 14:09:28 -0800671
672 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
Thomas Weber2135bb52010-03-24 12:52:16 +0000673 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
Thomas Weber476544c2010-02-17 14:09:28 -0800674 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
675
676 .phy_reset = true,
677 .reset_gpio_port[0] = -EINVAL,
Thomas Weber2135bb52010-03-24 12:52:16 +0000678 .reset_gpio_port[1] = -EINVAL,
Thomas Weber476544c2010-02-17 14:09:28 -0800679 .reset_gpio_port[2] = -EINVAL
680};
681
Thomas Weber018e0752010-05-10 14:29:16 -0700682static struct omap_board_mux board_mux[] __initdata = {
683 /* nCS and IRQ for Devkit8000 ethernet */
684 OMAP3_MUX(GPMC_NCS6, OMAP_MUX_MODE0),
685 OMAP3_MUX(ETK_D11, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
686
687 /* McSPI 2*/
688 OMAP3_MUX(MCSPI2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
689 OMAP3_MUX(MCSPI2_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
690 OMAP3_MUX(MCSPI2_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
691 OMAP3_MUX(MCSPI2_CS0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
692 OMAP3_MUX(MCSPI2_CS1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
693
694 /* PENDOWN GPIO */
695 OMAP3_MUX(ETK_D13, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
696
697 /* mUSB */
698 OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
699 OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
700 OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
701 OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
702 OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
703 OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
704 OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
705 OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
706 OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
707 OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
708 OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
709 OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
710
711 /* USB 1 */
712 OMAP3_MUX(ETK_CTL, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
713 OMAP3_MUX(ETK_CLK, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
714 OMAP3_MUX(ETK_D8, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
715 OMAP3_MUX(ETK_D9, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
716 OMAP3_MUX(ETK_D0, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
717 OMAP3_MUX(ETK_D1, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
718 OMAP3_MUX(ETK_D2, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
719 OMAP3_MUX(ETK_D3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
720 OMAP3_MUX(ETK_D4, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
721 OMAP3_MUX(ETK_D5, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
722 OMAP3_MUX(ETK_D6, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
723 OMAP3_MUX(ETK_D7, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
724
725 /* MMC 1 */
726 OMAP3_MUX(SDMMC1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
727 OMAP3_MUX(SDMMC1_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
728 OMAP3_MUX(SDMMC1_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
729 OMAP3_MUX(SDMMC1_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
730 OMAP3_MUX(SDMMC1_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
731 OMAP3_MUX(SDMMC1_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
732 OMAP3_MUX(SDMMC1_DAT4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
733 OMAP3_MUX(SDMMC1_DAT5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
734 OMAP3_MUX(SDMMC1_DAT6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
735 OMAP3_MUX(SDMMC1_DAT7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
736
737 /* McBSP 2 */
738 OMAP3_MUX(MCBSP2_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
739 OMAP3_MUX(MCBSP2_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
740 OMAP3_MUX(MCBSP2_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
741 OMAP3_MUX(MCBSP2_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
742
743 /* I2C 1 */
744 OMAP3_MUX(I2C1_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
745 OMAP3_MUX(I2C1_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
746
747 /* I2C 2 */
748 OMAP3_MUX(I2C2_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
749 OMAP3_MUX(I2C2_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
750
751 /* I2C 3 */
752 OMAP3_MUX(I2C3_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
753 OMAP3_MUX(I2C3_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
754
755 /* I2C 4 */
756 OMAP3_MUX(I2C4_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
757 OMAP3_MUX(I2C4_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
758
759 /* serial ports */
760 OMAP3_MUX(MCBSP3_CLKX, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
761 OMAP3_MUX(MCBSP3_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
762 OMAP3_MUX(UART1_TX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
763 OMAP3_MUX(UART1_RX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
764
765 /* DSS */
766 OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
767 OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
768 OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
769 OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
770 OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
771 OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
772 OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
773 OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
774 OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
775 OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
776 OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
777 OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
778 OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
779 OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
780 OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
781 OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
782 OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
783 OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
784 OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
785 OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
786 OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
787 OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
788 OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
789 OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
790 OMAP3_MUX(DSS_DATA20, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
791 OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
792 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
793 OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
794
795 /* expansion port */
796 /* McSPI 1 */
797 OMAP3_MUX(MCSPI1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
798 OMAP3_MUX(MCSPI1_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
799 OMAP3_MUX(MCSPI1_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
800 OMAP3_MUX(MCSPI1_CS0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
801 OMAP3_MUX(MCSPI1_CS3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
802
803 /* HDQ */
804 OMAP3_MUX(HDQ_SIO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
805
806 /* McSPI4 */
807 OMAP3_MUX(MCBSP1_CLKR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
808 OMAP3_MUX(MCBSP1_DX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
809 OMAP3_MUX(MCBSP1_DR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
810 OMAP3_MUX(MCBSP1_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP),
811
812 /* MMC 2 */
813 OMAP3_MUX(SDMMC2_DAT4, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
814 OMAP3_MUX(SDMMC2_DAT5, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
815 OMAP3_MUX(SDMMC2_DAT6, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
816 OMAP3_MUX(SDMMC2_DAT7, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
817
818 /* I2C3 */
819 OMAP3_MUX(I2C3_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
820 OMAP3_MUX(I2C3_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
821
822 OMAP3_MUX(MCBSP1_CLKX, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
823 OMAP3_MUX(MCBSP_CLKS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
824 OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
825
826 OMAP3_MUX(GPMC_NCS7, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
827 OMAP3_MUX(GPMC_NCS3, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
828
829 /* TPS IRQ */
830 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \
831 OMAP_PIN_INPUT_PULLUP),
832
833 { .reg_offset = OMAP_MUX_TERMINATOR },
834};
835
Thomas Weber476544c2010-02-17 14:09:28 -0800836static void __init devkit8000_init(void)
837{
Thomas Weber018e0752010-05-10 14:29:16 -0700838 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
Thomas Weberfaec32e2010-03-24 12:52:14 +0000839 omap_serial_init();
840
841 omap_dm9000_init();
842
Thomas Weber476544c2010-02-17 14:09:28 -0800843 devkit8000_i2c_init();
844 platform_add_devices(devkit8000_devices,
845 ARRAY_SIZE(devkit8000_devices));
846 omap_board_config = devkit8000_config;
847 omap_board_config_size = ARRAY_SIZE(devkit8000_config);
848
849 spi_register_board_info(devkit8000_spi_board_info,
850 ARRAY_SIZE(devkit8000_spi_board_info));
851
Thomas Weber476544c2010-02-17 14:09:28 -0800852 devkit8000_ads7846_init();
853
Maulik Mankad884b8362010-02-17 14:09:30 -0800854 usb_musb_init(&musb_board_data);
Thomas Weber476544c2010-02-17 14:09:28 -0800855 usb_ehci_init(&ehci_pdata);
856 devkit8000_flash_init();
857
858 /* Ensure SDRC pins are mux'd for self-refresh */
Thomas Weber3cdc6ee2010-03-24 12:52:12 +0000859 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
860 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
Thomas Weber476544c2010-02-17 14:09:28 -0800861}
862
863static void __init devkit8000_map_io(void)
864{
865 omap2_set_globals_343x();
866 omap34xx_map_common_io();
867}
868
869MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
870 .phys_io = 0x48000000,
871 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
872 .boot_params = 0x80000100,
873 .map_io = devkit8000_map_io,
874 .init_irq = devkit8000_init_irq,
875 .init_machine = devkit8000_init,
876 .timer = &omap_timer,
877MACHINE_END