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