blob: 9f8338d15a210578e35c7cea68f5a43c04916489 [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>
Sukumar Ghorai3a638332010-09-15 14:49:23 +000031#include <linux/mmc/host.h>
Thomas Weber476544c2010-02-17 14:09:28 -080032
33#include <linux/regulator/machine.h>
34#include <linux/i2c/twl.h>
35
36#include <mach/hardware.h>
Kan-Ru Chenf535dae2010-08-02 14:21:41 +030037#include <mach/id.h>
Thomas Weber476544c2010-02-17 14:09:28 -080038#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>
Thomas Weber476544c2010-02-17 14:09:28 -080048#include <plat/display.h>
Bryan Wu89747c92010-11-17 13:34:34 +000049#include <plat/panel-generic-dpi.h>
Thomas Weber476544c2010-02-17 14:09:28 -080050
51#include <plat/mcspi.h>
52#include <linux/input/matrix_keypad.h>
53#include <linux/spi/spi.h>
Thomas Weber476544c2010-02-17 14:09:28 -080054#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"
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070061#include "timer-gp.h"
Mike Rapoport96974a22011-04-25 01:09:05 +030062#include "common-board-devices.h"
Thomas Weber476544c2010-02-17 14:09:28 -080063
Thomas Weber476544c2010-02-17 14:09:28 -080064#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
Thomas Weber476544c2010-02-17 14:09:28 -0800107static struct omap2_hsmmc_info mmc[] = {
108 {
109 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000110 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Thomas Weber476544c2010-02-17 14:09:28 -0800111 .gpio_wp = 29,
112 },
113 {} /* Terminator */
114};
Thomas Weber476544c2010-02-17 14:09:28 -0800115
116static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev)
117{
Thomas Weber09c07212010-07-05 17:04:42 +0300118 if (gpio_is_valid(dssdev->reset_gpio))
Daniel Morsingd858add2010-12-21 10:23:13 +0000119 gpio_set_value_cansleep(dssdev->reset_gpio, 1);
Thomas Weber476544c2010-02-17 14:09:28 -0800120 return 0;
121}
122
123static void devkit8000_panel_disable_lcd(struct omap_dss_device *dssdev)
124{
Thomas Weber09c07212010-07-05 17:04:42 +0300125 if (gpio_is_valid(dssdev->reset_gpio))
Daniel Morsingd858add2010-12-21 10:23:13 +0000126 gpio_set_value_cansleep(dssdev->reset_gpio, 0);
Thomas Weber476544c2010-02-17 14:09:28 -0800127}
Kan-Ru Chen31c73f72010-07-05 17:04:40 +0300128
Thomas Weber476544c2010-02-17 14:09:28 -0800129static int devkit8000_panel_enable_dvi(struct omap_dss_device *dssdev)
130{
Thomas Weber09c07212010-07-05 17:04:42 +0300131 if (gpio_is_valid(dssdev->reset_gpio))
Daniel Morsingd858add2010-12-21 10:23:13 +0000132 gpio_set_value_cansleep(dssdev->reset_gpio, 1);
Thomas Weber476544c2010-02-17 14:09:28 -0800133 return 0;
134}
135
136static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev)
137{
Thomas Weber09c07212010-07-05 17:04:42 +0300138 if (gpio_is_valid(dssdev->reset_gpio))
Daniel Morsingd858add2010-12-21 10:23:13 +0000139 gpio_set_value_cansleep(dssdev->reset_gpio, 0);
Thomas Weber476544c2010-02-17 14:09:28 -0800140}
141
Thomas Weber1f489f92010-07-05 17:04:41 +0300142static struct regulator_consumer_supply devkit8000_vmmc1_supply =
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530143 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0");
Thomas Weber1f489f92010-07-05 17:04:41 +0300144
Thomas Weber476544c2010-02-17 14:09:28 -0800145
Thomas Weber5fd58b52010-07-05 17:04:39 +0300146/* ads7846 on SPI */
Thomas Weber1f489f92010-07-05 17:04:41 +0300147static struct regulator_consumer_supply devkit8000_vio_supply =
148 REGULATOR_SUPPLY("vcc", "spi2.0");
Thomas Weber476544c2010-02-17 14:09:28 -0800149
Bryan Wu89747c92010-11-17 13:34:34 +0000150static struct panel_generic_dpi_data lcd_panel = {
151 .name = "generic",
Thomas Weber476544c2010-02-17 14:09:28 -0800152 .platform_enable = devkit8000_panel_enable_lcd,
153 .platform_disable = devkit8000_panel_disable_lcd,
154};
Bryan Wu89747c92010-11-17 13:34:34 +0000155
156static struct omap_dss_device devkit8000_lcd_device = {
157 .name = "lcd",
Thomas Weber476544c2010-02-17 14:09:28 -0800158 .type = OMAP_DISPLAY_TYPE_DPI,
Bryan Wu89747c92010-11-17 13:34:34 +0000159 .driver_name = "generic_dpi_panel",
160 .data = &lcd_panel,
Thomas Weber476544c2010-02-17 14:09:28 -0800161 .phy.dpi.data_lines = 24,
Bryan Wu89747c92010-11-17 13:34:34 +0000162};
163
164static struct panel_generic_dpi_data dvi_panel = {
165 .name = "generic",
Thomas Weber476544c2010-02-17 14:09:28 -0800166 .platform_enable = devkit8000_panel_enable_dvi,
167 .platform_disable = devkit8000_panel_disable_dvi,
168};
169
Bryan Wu89747c92010-11-17 13:34:34 +0000170static struct omap_dss_device devkit8000_dvi_device = {
171 .name = "dvi",
172 .type = OMAP_DISPLAY_TYPE_DPI,
173 .driver_name = "generic_dpi_panel",
174 .data = &dvi_panel,
175 .phy.dpi.data_lines = 24,
176};
177
Thomas Weber476544c2010-02-17 14:09:28 -0800178static 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,
Thomas Weber476544c2010-02-17 14:09:28 -0800183};
184
185
186static struct omap_dss_device *devkit8000_dss_devices[] = {
187 &devkit8000_lcd_device,
188 &devkit8000_dvi_device,
189 &devkit8000_tv_device,
190};
191
192static 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
Thomas Weber1f489f92010-07-05 17:04:41 +0300198static struct regulator_consumer_supply devkit8000_vdda_dac_supply =
Senthilvadivu Guruswamy30ea50c2011-01-24 06:22:01 +0000199 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
Thomas Weber476544c2010-02-17 14:09:28 -0800200
Manjunath Kondaiah Gbead4372010-10-08 10:01:13 -0700201static uint32_t board_keymap[] = {
Thomas Weber476544c2010-02-17 14:09:28 -0800202 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
222static struct matrix_keymap_data board_map_data = {
223 .keymap = board_keymap,
224 .keymap_size = ARRAY_SIZE(board_keymap),
225};
226
227static struct twl4030_keypad_data devkit8000_kp_data = {
228 .keymap_data = &board_map_data,
229 .rows = 6,
230 .cols = 6,
231 .rep = 1,
232};
233
234static struct gpio_led gpio_leds[];
235
236static int devkit8000_twl_gpio_setup(struct device *dev,
237 unsigned gpio, unsigned ngpio)
238{
Thomas Weberdaf7aab2011-01-20 15:41:48 +0000239 int ret;
240
Thomas Weber476544c2010-02-17 14:09:28 -0800241 omap_mux_init_gpio(29, OMAP_PIN_INPUT);
242 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
243 mmc[0].gpio_cd = gpio + 0;
244 omap2_hsmmc_init(mmc);
245
Kan-Ru Chen31c73f72010-07-05 17:04:40 +0300246 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
247 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
248
Thomas Weberdaf7aab2011-01-20 15:41:48 +0000249 /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */
250 devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0;
251 ret = gpio_request_one(devkit8000_lcd_device.reset_gpio,
252 GPIOF_DIR_OUT | GPIOF_INIT_LOW, "LCD_PWREN");
253 if (ret < 0) {
254 devkit8000_lcd_device.reset_gpio = -EINVAL;
255 printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n");
256 }
Kan-Ru Chen40986092010-07-05 17:04:40 +0300257
Kan-Ru Chen31c73f72010-07-05 17:04:40 +0300258 /* gpio + 7 is "DVI_PD" (out, active low) */
259 devkit8000_dvi_device.reset_gpio = gpio + 7;
Thomas Weberdaf7aab2011-01-20 15:41:48 +0000260 ret = gpio_request_one(devkit8000_dvi_device.reset_gpio,
261 GPIOF_DIR_OUT | GPIOF_INIT_LOW, "DVI PowerDown");
262 if (ret < 0) {
263 devkit8000_dvi_device.reset_gpio = -EINVAL;
264 printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n");
265 }
Kan-Ru Chen31c73f72010-07-05 17:04:40 +0300266
Thomas Weber476544c2010-02-17 14:09:28 -0800267 return 0;
268}
269
270static struct twl4030_gpio_platform_data devkit8000_gpio_data = {
271 .gpio_base = OMAP_MAX_GPIO_LINES,
272 .irq_base = TWL4030_GPIO_IRQ_BASE,
273 .irq_end = TWL4030_GPIO_IRQ_END,
274 .use_leds = true,
Daniel Morsing35a78fa2011-01-19 08:19:24 +0000275 .pulldowns = BIT(1) | BIT(2) | BIT(6) | BIT(8) | BIT(13)
Thomas Weber476544c2010-02-17 14:09:28 -0800276 | BIT(15) | BIT(16) | BIT(17),
277 .setup = devkit8000_twl_gpio_setup,
278};
279
Senthilvadivu Guruswamyc8aac012011-01-24 06:22:02 +0000280static struct regulator_consumer_supply devkit8000_vpll1_supplies[] = {
281 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
282 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
283};
Thomas Weber476544c2010-02-17 14:09:28 -0800284
285/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
286static struct regulator_init_data devkit8000_vmmc1 = {
287 .constraints = {
288 .min_uV = 1850000,
289 .max_uV = 3150000,
290 .valid_modes_mask = REGULATOR_MODE_NORMAL
291 | REGULATOR_MODE_STANDBY,
292 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
293 | REGULATOR_CHANGE_MODE
294 | REGULATOR_CHANGE_STATUS,
295 },
296 .num_consumer_supplies = 1,
297 .consumer_supplies = &devkit8000_vmmc1_supply,
298};
299
Thomas Weber476544c2010-02-17 14:09:28 -0800300/* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
301static struct regulator_init_data devkit8000_vdac = {
302 .constraints = {
303 .min_uV = 1800000,
304 .max_uV = 1800000,
305 .valid_modes_mask = REGULATOR_MODE_NORMAL
306 | REGULATOR_MODE_STANDBY,
307 .valid_ops_mask = REGULATOR_CHANGE_MODE
308 | REGULATOR_CHANGE_STATUS,
309 },
310 .num_consumer_supplies = 1,
311 .consumer_supplies = &devkit8000_vdda_dac_supply,
312};
313
Thomas Weber5fd58b52010-07-05 17:04:39 +0300314/* VPLL1 for digital video outputs */
315static struct regulator_init_data devkit8000_vpll1 = {
Thomas Weber476544c2010-02-17 14:09:28 -0800316 .constraints = {
Thomas Weber476544c2010-02-17 14:09:28 -0800317 .min_uV = 1800000,
318 .max_uV = 1800000,
319 .valid_modes_mask = REGULATOR_MODE_NORMAL
320 | REGULATOR_MODE_STANDBY,
321 .valid_ops_mask = REGULATOR_CHANGE_MODE
322 | REGULATOR_CHANGE_STATUS,
323 },
Senthilvadivu Guruswamyc8aac012011-01-24 06:22:02 +0000324 .num_consumer_supplies = ARRAY_SIZE(devkit8000_vpll1_supplies),
325 .consumer_supplies = devkit8000_vpll1_supplies,
Thomas Weber5fd58b52010-07-05 17:04:39 +0300326};
327
328/* VAUX4 for ads7846 and nubs */
329static struct regulator_init_data devkit8000_vio = {
330 .constraints = {
331 .min_uV = 1800000,
332 .max_uV = 1800000,
333 .apply_uV = true,
334 .valid_modes_mask = REGULATOR_MODE_NORMAL
335 | REGULATOR_MODE_STANDBY,
336 .valid_ops_mask = REGULATOR_CHANGE_MODE
337 | REGULATOR_CHANGE_STATUS,
338 },
Thomas Weber1f489f92010-07-05 17:04:41 +0300339 .num_consumer_supplies = 1,
340 .consumer_supplies = &devkit8000_vio_supply,
Thomas Weber476544c2010-02-17 14:09:28 -0800341};
342
343static struct twl4030_usb_data devkit8000_usb_data = {
344 .usb_mode = T2_USB_MODE_ULPI,
345};
346
Ilkka Koskinen6a58baf2011-03-02 13:24:05 +0000347static struct twl4030_codec_audio_data devkit8000_audio_data;
Thomas Weber476544c2010-02-17 14:09:28 -0800348
349static struct twl4030_codec_data devkit8000_codec_data = {
350 .audio_mclk = 26000000,
351 .audio = &devkit8000_audio_data,
352};
353
354static struct twl4030_platform_data devkit8000_twldata = {
355 .irq_base = TWL4030_IRQ_BASE,
356 .irq_end = TWL4030_IRQ_END,
357
358 /* platform_data for children goes here */
359 .usb = &devkit8000_usb_data,
360 .gpio = &devkit8000_gpio_data,
361 .codec = &devkit8000_codec_data,
362 .vmmc1 = &devkit8000_vmmc1,
Thomas Weber476544c2010-02-17 14:09:28 -0800363 .vdac = &devkit8000_vdac,
Thomas Weber5fd58b52010-07-05 17:04:39 +0300364 .vpll1 = &devkit8000_vpll1,
365 .vio = &devkit8000_vio,
Thomas Weber476544c2010-02-17 14:09:28 -0800366 .keypad = &devkit8000_kp_data,
367};
368
369static struct i2c_board_info __initdata devkit8000_i2c_boardinfo[] = {
370 {
Thomas Weber0cbe70e2010-07-05 17:04:42 +0300371 I2C_BOARD_INFO("tps65930", 0x48),
Thomas Weber476544c2010-02-17 14:09:28 -0800372 .flags = I2C_CLIENT_WAKE,
373 .irq = INT_34XX_SYS_NIRQ,
374 .platform_data = &devkit8000_twldata,
375 },
376};
377
378static int __init devkit8000_i2c_init(void)
379{
380 omap_register_i2c_bus(1, 2600, devkit8000_i2c_boardinfo,
381 ARRAY_SIZE(devkit8000_i2c_boardinfo));
382 /* Bus 3 is attached to the DVI port where devices like the pico DLP
383 * projector don't work reliably with 400kHz */
384 omap_register_i2c_bus(3, 400, NULL, 0);
385 return 0;
386}
387
388static struct gpio_led gpio_leds[] = {
389 {
390 .name = "led1",
391 .default_trigger = "heartbeat",
392 .gpio = 186,
393 .active_low = true,
394 },
395 {
396 .name = "led2",
397 .default_trigger = "mmc0",
398 .gpio = 163,
399 .active_low = true,
400 },
401 {
402 .name = "ledB",
403 .default_trigger = "none",
404 .gpio = 153,
405 .active_low = true,
406 },
407 {
408 .name = "led3",
409 .default_trigger = "none",
410 .gpio = 164,
411 .active_low = true,
412 },
413};
414
415static struct gpio_led_platform_data gpio_led_info = {
416 .leds = gpio_leds,
417 .num_leds = ARRAY_SIZE(gpio_leds),
418};
419
420static struct platform_device leds_gpio = {
421 .name = "leds-gpio",
422 .id = -1,
423 .dev = {
424 .platform_data = &gpio_led_info,
425 },
426};
427
428static struct gpio_keys_button gpio_buttons[] = {
429 {
430 .code = BTN_EXTRA,
431 .gpio = 26,
432 .desc = "user",
433 .wakeup = 1,
434 },
435};
436
437static struct gpio_keys_platform_data gpio_key_info = {
438 .buttons = gpio_buttons,
439 .nbuttons = ARRAY_SIZE(gpio_buttons),
440};
441
442static struct platform_device keys_gpio = {
443 .name = "gpio-keys",
444 .id = -1,
445 .dev = {
446 .platform_data = &gpio_key_info,
447 },
448};
449
450
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800451static void __init devkit8000_init_early(void)
Thomas Weber476544c2010-02-17 14:09:28 -0800452{
Paul Walmsley48057342010-12-21 15:25:10 -0700453 omap2_init_common_infrastructure();
454 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
455 mt46h32m32lf6_sdrc_params);
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800456}
457
458static void __init devkit8000_init_irq(void)
459{
Thomas Weber476544c2010-02-17 14:09:28 -0800460 omap_init_irq();
461#ifdef CONFIG_OMAP_32K_TIMER
462 omap2_gp_clockevent_set_gptimer(12);
463#endif
Thomas Weber476544c2010-02-17 14:09:28 -0800464}
465
Thomas Weber476544c2010-02-17 14:09:28 -0800466#define OMAP_DM9000_BASE 0x2c000000
467
468static struct resource omap_dm9000_resources[] = {
469 [0] = {
470 .start = OMAP_DM9000_BASE,
471 .end = (OMAP_DM9000_BASE + 0x4 - 1),
472 .flags = IORESOURCE_MEM,
473 },
474 [1] = {
475 .start = (OMAP_DM9000_BASE + 0x400),
476 .end = (OMAP_DM9000_BASE + 0x400 + 0x4 - 1),
477 .flags = IORESOURCE_MEM,
478 },
479 [2] = {
480 .start = OMAP_GPIO_IRQ(OMAP_DM9000_GPIO_IRQ),
481 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
482 },
483};
484
485static struct dm9000_plat_data omap_dm9000_platdata = {
486 .flags = DM9000_PLATF_16BITONLY,
487};
488
489static struct platform_device omap_dm9000_dev = {
490 .name = "dm9000",
491 .id = -1,
492 .num_resources = ARRAY_SIZE(omap_dm9000_resources),
493 .resource = omap_dm9000_resources,
494 .dev = {
495 .platform_data = &omap_dm9000_platdata,
496 },
497};
498
499static void __init omap_dm9000_init(void)
500{
Kan-Ru Chenf535dae2010-08-02 14:21:41 +0300501 unsigned char *eth_addr = omap_dm9000_platdata.dev_addr;
502 struct omap_die_id odi;
503
Thomas Weber476544c2010-02-17 14:09:28 -0800504 if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) {
505 printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n",
506 OMAP_DM9000_GPIO_IRQ);
507 return;
508 }
509
510 gpio_direction_input(OMAP_DM9000_GPIO_IRQ);
Kan-Ru Chenf535dae2010-08-02 14:21:41 +0300511
512 /* init the mac address using DIE id */
513 omap_get_die_id(&odi);
514
515 eth_addr[0] = 0x02; /* locally administered */
516 eth_addr[1] = odi.id_1 & 0xff;
517 eth_addr[2] = (odi.id_0 & 0xff000000) >> 24;
518 eth_addr[3] = (odi.id_0 & 0x00ff0000) >> 16;
519 eth_addr[4] = (odi.id_0 & 0x0000ff00) >> 8;
520 eth_addr[5] = (odi.id_0 & 0x000000ff);
Thomas Weber476544c2010-02-17 14:09:28 -0800521}
522
523static struct platform_device *devkit8000_devices[] __initdata = {
Thomas Weber476544c2010-02-17 14:09:28 -0800524 &leds_gpio,
525 &keys_gpio,
526 &omap_dm9000_dev,
527};
528
529static void __init devkit8000_flash_init(void)
530{
531 u8 cs = 0;
532 u8 nandcs = GPMC_CS_NUM + 1;
533
Thomas Weber476544c2010-02-17 14:09:28 -0800534 /* find out the chip-select on which NAND exists */
535 while (cs < GPMC_CS_NUM) {
536 u32 ret = 0;
537 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
538
539 if ((ret & 0xC00) == 0x800) {
540 printk(KERN_INFO "Found NAND on CS%d\n", cs);
541 if (nandcs > GPMC_CS_NUM)
542 nandcs = cs;
543 }
544 cs++;
545 }
546
547 if (nandcs > GPMC_CS_NUM) {
548 printk(KERN_INFO "NAND: Unable to find configuration "
549 "in GPMC\n ");
550 return;
551 }
552
553 if (nandcs < GPMC_CS_NUM) {
554 devkit8000_nand_data.cs = nandcs;
Thomas Weber476544c2010-02-17 14:09:28 -0800555
556 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
Sukumar Ghoraif450d862010-07-09 09:14:46 +0000557 if (gpmc_nand_init(&devkit8000_nand_data) < 0)
Thomas Weber476544c2010-02-17 14:09:28 -0800558 printk(KERN_ERR "Unable to register NAND device\n");
559 }
560}
561
Maulik Mankad884b8362010-02-17 14:09:30 -0800562static struct omap_musb_board_data musb_board_data = {
563 .interface_type = MUSB_INTERFACE_ULPI,
564 .mode = MUSB_OTG,
565 .power = 100,
566};
567
Keshava Munegowda181b2502011-03-01 20:08:16 +0530568static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
Thomas Weber476544c2010-02-17 14:09:28 -0800569
Keshava Munegowda181b2502011-03-01 20:08:16 +0530570 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
571 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
572 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
Thomas Weber476544c2010-02-17 14:09:28 -0800573
574 .phy_reset = true,
575 .reset_gpio_port[0] = -EINVAL,
Thomas Weber2135bb52010-03-24 12:52:16 +0000576 .reset_gpio_port[1] = -EINVAL,
Thomas Weber476544c2010-02-17 14:09:28 -0800577 .reset_gpio_port[2] = -EINVAL
578};
579
Tony Lindgrenc7ecea22011-03-11 11:39:51 -0800580#ifdef CONFIG_OMAP_MUX
Thomas Weber018e0752010-05-10 14:29:16 -0700581static struct omap_board_mux board_mux[] __initdata = {
582 /* nCS and IRQ for Devkit8000 ethernet */
583 OMAP3_MUX(GPMC_NCS6, OMAP_MUX_MODE0),
584 OMAP3_MUX(ETK_D11, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
585
586 /* McSPI 2*/
587 OMAP3_MUX(MCSPI2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
588 OMAP3_MUX(MCSPI2_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
589 OMAP3_MUX(MCSPI2_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
590 OMAP3_MUX(MCSPI2_CS0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
591 OMAP3_MUX(MCSPI2_CS1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
592
593 /* PENDOWN GPIO */
594 OMAP3_MUX(ETK_D13, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
595
596 /* mUSB */
597 OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
598 OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
599 OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
600 OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
601 OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
602 OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
603 OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
604 OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
605 OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
606 OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
607 OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
608 OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
609
610 /* USB 1 */
611 OMAP3_MUX(ETK_CTL, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
612 OMAP3_MUX(ETK_CLK, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
613 OMAP3_MUX(ETK_D8, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
614 OMAP3_MUX(ETK_D9, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
615 OMAP3_MUX(ETK_D0, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
616 OMAP3_MUX(ETK_D1, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
617 OMAP3_MUX(ETK_D2, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
618 OMAP3_MUX(ETK_D3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
619 OMAP3_MUX(ETK_D4, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
620 OMAP3_MUX(ETK_D5, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
621 OMAP3_MUX(ETK_D6, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
622 OMAP3_MUX(ETK_D7, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
623
624 /* MMC 1 */
625 OMAP3_MUX(SDMMC1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
626 OMAP3_MUX(SDMMC1_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
627 OMAP3_MUX(SDMMC1_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
628 OMAP3_MUX(SDMMC1_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
629 OMAP3_MUX(SDMMC1_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
630 OMAP3_MUX(SDMMC1_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
631 OMAP3_MUX(SDMMC1_DAT4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
632 OMAP3_MUX(SDMMC1_DAT5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
633 OMAP3_MUX(SDMMC1_DAT6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
634 OMAP3_MUX(SDMMC1_DAT7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
635
636 /* McBSP 2 */
637 OMAP3_MUX(MCBSP2_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
638 OMAP3_MUX(MCBSP2_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
639 OMAP3_MUX(MCBSP2_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
640 OMAP3_MUX(MCBSP2_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
641
642 /* I2C 1 */
643 OMAP3_MUX(I2C1_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
644 OMAP3_MUX(I2C1_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
645
646 /* I2C 2 */
647 OMAP3_MUX(I2C2_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
648 OMAP3_MUX(I2C2_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
649
650 /* I2C 3 */
651 OMAP3_MUX(I2C3_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
652 OMAP3_MUX(I2C3_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
653
654 /* I2C 4 */
655 OMAP3_MUX(I2C4_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
656 OMAP3_MUX(I2C4_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
657
658 /* serial ports */
659 OMAP3_MUX(MCBSP3_CLKX, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
660 OMAP3_MUX(MCBSP3_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
661 OMAP3_MUX(UART1_TX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
662 OMAP3_MUX(UART1_RX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
663
664 /* DSS */
665 OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
666 OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
667 OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
668 OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
669 OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
670 OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
671 OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
672 OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
673 OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
674 OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
675 OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
676 OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
677 OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
678 OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
679 OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
680 OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
681 OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
682 OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
683 OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
684 OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
685 OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
686 OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
687 OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
688 OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
689 OMAP3_MUX(DSS_DATA20, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
690 OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
691 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
692 OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
693
694 /* expansion port */
695 /* McSPI 1 */
696 OMAP3_MUX(MCSPI1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
697 OMAP3_MUX(MCSPI1_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
698 OMAP3_MUX(MCSPI1_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
699 OMAP3_MUX(MCSPI1_CS0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
700 OMAP3_MUX(MCSPI1_CS3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
701
702 /* HDQ */
703 OMAP3_MUX(HDQ_SIO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
704
705 /* McSPI4 */
706 OMAP3_MUX(MCBSP1_CLKR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
707 OMAP3_MUX(MCBSP1_DX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
708 OMAP3_MUX(MCBSP1_DR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
709 OMAP3_MUX(MCBSP1_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP),
710
711 /* MMC 2 */
712 OMAP3_MUX(SDMMC2_DAT4, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
713 OMAP3_MUX(SDMMC2_DAT5, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
714 OMAP3_MUX(SDMMC2_DAT6, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
715 OMAP3_MUX(SDMMC2_DAT7, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
716
717 /* I2C3 */
718 OMAP3_MUX(I2C3_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
719 OMAP3_MUX(I2C3_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
720
721 OMAP3_MUX(MCBSP1_CLKX, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
722 OMAP3_MUX(MCBSP_CLKS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
723 OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
724
725 OMAP3_MUX(GPMC_NCS7, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
726 OMAP3_MUX(GPMC_NCS3, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
727
728 /* TPS IRQ */
729 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \
730 OMAP_PIN_INPUT_PULLUP),
731
732 { .reg_offset = OMAP_MUX_TERMINATOR },
733};
Tony Lindgrenc7ecea22011-03-11 11:39:51 -0800734#endif
Thomas Weber018e0752010-05-10 14:29:16 -0700735
Thomas Weber476544c2010-02-17 14:09:28 -0800736static void __init devkit8000_init(void)
737{
Thomas Weber018e0752010-05-10 14:29:16 -0700738 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
Thomas Weberfaec32e2010-03-24 12:52:14 +0000739 omap_serial_init();
740
741 omap_dm9000_init();
742
Thomas Weber476544c2010-02-17 14:09:28 -0800743 devkit8000_i2c_init();
744 platform_add_devices(devkit8000_devices,
745 ARRAY_SIZE(devkit8000_devices));
Thomas Weber476544c2010-02-17 14:09:28 -0800746
Senthilvadivu Guruswamyd5e13222011-02-22 11:24:50 +0200747 omap_display_init(&devkit8000_dss_data);
Thomas Weber476544c2010-02-17 14:09:28 -0800748
Mike Rapoport96974a22011-04-25 01:09:05 +0300749 omap_ads7846_init(2, OMAP3_DEVKIT_TS_GPIO, 0, NULL);
Thomas Weber476544c2010-02-17 14:09:28 -0800750
Maulik Mankad884b8362010-02-17 14:09:30 -0800751 usb_musb_init(&musb_board_data);
Keshava Munegowda9e64bb12011-03-01 20:08:19 +0530752 usbhs_init(&usbhs_bdata);
Thomas Weber476544c2010-02-17 14:09:28 -0800753 devkit8000_flash_init();
754
755 /* Ensure SDRC pins are mux'd for self-refresh */
Thomas Weber3cdc6ee2010-03-24 12:52:12 +0000756 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
757 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
Thomas Weber476544c2010-02-17 14:09:28 -0800758}
759
Thomas Weber476544c2010-02-17 14:09:28 -0800760MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
Thomas Weber476544c2010-02-17 14:09:28 -0800761 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100762 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800763 .map_io = omap3_map_io,
764 .init_early = devkit8000_init_early,
Thomas Weber476544c2010-02-17 14:09:28 -0800765 .init_irq = devkit8000_init_irq,
766 .init_machine = devkit8000_init,
767 .timer = &omap_timer,
768MACHINE_END