blob: 2ed804073f3518aa68bc85e8fbdae59bbd786d4a [file] [log] [blame]
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +03001/*
2 * linux/arch/arm/mach-omap2/board-omap3beagle.c
3 *
4 * Copyright (C) 2008 Texas Instruments
5 *
6 * Modified from mach-omap2/board-3430sdp.c
7 *
8 * Initial code: Syed Mohammed Khasim
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/delay.h>
19#include <linux/err.h>
20#include <linux/clk.h>
21#include <linux/io.h>
22#include <linux/leds.h>
23#include <linux/gpio.h>
24#include <linux/input.h>
25#include <linux/gpio_keys.h>
26
27#include <linux/mtd/mtd.h>
28#include <linux/mtd/partitions.h>
29#include <linux/mtd/nand.h>
Sukumar Ghorai3a638332010-09-15 14:49:23 +000030#include <linux/mmc/host.h>
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +030031
David Brownellbb3b9d82009-05-28 14:04:03 -070032#include <linux/regulator/machine.h>
Santosh Shilimkarb07682b2009-12-13 20:05:51 +010033#include <linux/i2c/twl.h>
Tony Lindgren145d9c92009-01-15 13:09:53 +020034
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +030035#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
Tony Lindgrence491cf2009-10-20 09:40:47 -070041#include <plat/board.h>
42#include <plat/common.h>
Koen Kooi044d32f2010-04-22 10:23:42 +020043#include <plat/display.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070044#include <plat/gpmc.h>
45#include <plat/nand.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070046#include <plat/usb.h>
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +030047
Tony Lindgrenca5742b2009-12-11 16:16:32 -080048#include "mux.h"
Adrian Hunterd02a9002010-02-15 10:03:34 -080049#include "hsmmc.h"
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070050#include "timer-gp.h"
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +030051
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +030052#define NAND_BLOCK_SIZE SZ_128K
53
Robert Nelson954bed02010-09-23 18:22:47 -070054/*
55 * OMAP3 Beagle revision
56 * Run time detection of Beagle revision is done by reading GPIO.
57 * GPIO ID -
58 * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1
59 * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0
60 * C4 = GPIO173, GPIO172, GPIO171: 1 0 1
61 * XM = GPIO173, GPIO172, GPIO171: 0 0 0
62 */
63enum {
64 OMAP3BEAGLE_BOARD_UNKN = 0,
65 OMAP3BEAGLE_BOARD_AXBX,
66 OMAP3BEAGLE_BOARD_C1_3,
67 OMAP3BEAGLE_BOARD_C4,
68 OMAP3BEAGLE_BOARD_XM,
69};
70
71static u8 omap3_beagle_version;
72
73static u8 omap3_beagle_get_rev(void)
74{
75 return omap3_beagle_version;
76}
77
78static void __init omap3_beagle_init_rev(void)
79{
80 int ret;
81 u16 beagle_rev = 0;
82
83 omap_mux_init_gpio(171, OMAP_PIN_INPUT_PULLUP);
84 omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP);
85 omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP);
86
87 ret = gpio_request(171, "rev_id_0");
88 if (ret < 0)
89 goto fail0;
90
91 ret = gpio_request(172, "rev_id_1");
92 if (ret < 0)
93 goto fail1;
94
95 ret = gpio_request(173, "rev_id_2");
96 if (ret < 0)
97 goto fail2;
98
99 gpio_direction_input(171);
100 gpio_direction_input(172);
101 gpio_direction_input(173);
102
103 beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1)
104 | (gpio_get_value(173) << 2);
105
106 switch (beagle_rev) {
107 case 7:
108 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
109 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
110 break;
111 case 6:
112 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
113 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
114 break;
115 case 5:
116 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
117 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
118 break;
119 case 0:
120 printk(KERN_INFO "OMAP3 Beagle Rev: xM\n");
121 omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
122 break;
123 default:
124 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
125 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
126 }
127
128 return;
129
130fail2:
131 gpio_free(172);
132fail1:
133 gpio_free(171);
134fail0:
135 printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
136 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
137
138 return;
139}
140
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300141static struct mtd_partition omap3beagle_nand_partitions[] = {
142 /* All the partition sizes are listed in terms of NAND block size */
143 {
144 .name = "X-Loader",
145 .offset = 0,
146 .size = 4 * NAND_BLOCK_SIZE,
147 .mask_flags = MTD_WRITEABLE, /* force read-only */
148 },
149 {
150 .name = "U-Boot",
151 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
152 .size = 15 * NAND_BLOCK_SIZE,
153 .mask_flags = MTD_WRITEABLE, /* force read-only */
154 },
155 {
156 .name = "U-Boot Env",
157 .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */
158 .size = 1 * NAND_BLOCK_SIZE,
159 },
160 {
161 .name = "Kernel",
162 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
163 .size = 32 * NAND_BLOCK_SIZE,
164 },
165 {
166 .name = "File System",
167 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
168 .size = MTDPART_SIZ_FULL,
169 },
170};
171
172static struct omap_nand_platform_data omap3beagle_nand_data = {
173 .options = NAND_BUSWIDTH_16,
174 .parts = omap3beagle_nand_partitions,
175 .nr_parts = ARRAY_SIZE(omap3beagle_nand_partitions),
176 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
177 .nand_setup = NULL,
178 .dev_ready = NULL,
179};
180
Koen Kooi044d32f2010-04-22 10:23:42 +0200181/* DSS */
182
183static int beagle_enable_dvi(struct omap_dss_device *dssdev)
184{
185 if (gpio_is_valid(dssdev->reset_gpio))
186 gpio_set_value(dssdev->reset_gpio, 1);
187
188 return 0;
189}
190
191static void beagle_disable_dvi(struct omap_dss_device *dssdev)
192{
193 if (gpio_is_valid(dssdev->reset_gpio))
194 gpio_set_value(dssdev->reset_gpio, 0);
195}
196
197static struct omap_dss_device beagle_dvi_device = {
198 .type = OMAP_DISPLAY_TYPE_DPI,
199 .name = "dvi",
200 .driver_name = "generic_panel",
201 .phy.dpi.data_lines = 24,
Koen Kooif8362d22011-01-11 17:13:36 +0000202 .reset_gpio = -EINVAL,
Koen Kooi044d32f2010-04-22 10:23:42 +0200203 .platform_enable = beagle_enable_dvi,
204 .platform_disable = beagle_disable_dvi,
205};
206
207static struct omap_dss_device beagle_tv_device = {
208 .name = "tv",
209 .driver_name = "venc",
210 .type = OMAP_DISPLAY_TYPE_VENC,
211 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
212};
213
214static struct omap_dss_device *beagle_dss_devices[] = {
215 &beagle_dvi_device,
216 &beagle_tv_device,
217};
218
219static struct omap_dss_board_info beagle_dss_data = {
220 .num_devices = ARRAY_SIZE(beagle_dss_devices),
221 .devices = beagle_dss_devices,
222 .default_device = &beagle_dvi_device,
223};
224
225static struct platform_device beagle_dss_device = {
226 .name = "omapdss",
227 .id = -1,
228 .dev = {
229 .platform_data = &beagle_dss_data,
230 },
231};
232
233static struct regulator_consumer_supply beagle_vdac_supply =
234 REGULATOR_SUPPLY("vdda_dac", "omapdss");
235
236static struct regulator_consumer_supply beagle_vdvi_supply =
237 REGULATOR_SUPPLY("vdds_dsi", "omapdss");
238
239static void __init beagle_display_init(void)
240{
241 int r;
242
243 r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset");
244 if (r < 0) {
245 printk(KERN_ERR "Unable to get DVI reset GPIO\n");
246 return;
247 }
248
249 gpio_direction_output(beagle_dvi_device.reset_gpio, 0);
250}
251
Paul Walmsley2e12bd72009-05-28 14:03:59 -0700252#include "sdram-micron-mt46h32m32lf-6.h"
253
Adrian Hunter68ff0422010-02-15 10:03:34 -0800254static struct omap2_hsmmc_info mmc[] = {
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800255 {
256 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000257 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800258 .gpio_wp = 29,
259 },
260 {} /* Terminator */
261};
262
David Brownellbb3b9d82009-05-28 14:04:03 -0700263static struct regulator_consumer_supply beagle_vmmc1_supply = {
264 .supply = "vmmc",
265};
266
267static struct regulator_consumer_supply beagle_vsim_supply = {
268 .supply = "vmmc_aux",
269};
270
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800271static struct gpio_led gpio_leds[];
272
273static int beagle_twl_gpio_setup(struct device *dev,
274 unsigned gpio, unsigned ngpio)
275{
Koen Kooi1bd9ef12011-01-12 00:23:29 +0000276 int r;
277
Robert Nelsoncf74d412010-09-23 18:22:48 -0700278 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
279 mmc[0].gpio_wp = -EINVAL;
280 } else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) ||
Robert Nelsone4916e12010-09-23 18:22:48 -0700281 (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800282 omap_mux_init_gpio(23, OMAP_PIN_INPUT);
Jarkko Nikula44e74842009-09-24 16:23:17 -0700283 mmc[0].gpio_wp = 23;
284 } else {
Tony Lindgren4896e392009-12-11 16:16:32 -0800285 omap_mux_init_gpio(29, OMAP_PIN_INPUT);
Jarkko Nikula44e74842009-09-24 16:23:17 -0700286 }
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800287 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
Tony Lindgren145d9c92009-01-15 13:09:53 +0200288 mmc[0].gpio_cd = gpio + 0;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800289 omap2_hsmmc_init(mmc);
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800290
David Brownellbb3b9d82009-05-28 14:04:03 -0700291 /* link regulators to MMC adapters */
292 beagle_vmmc1_supply.dev = mmc[0].dev;
293 beagle_vsim_supply.dev = mmc[0].dev;
294
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800295 /* REVISIT: need ehci-omap hooks for external VBUS
296 * power switch and overcurrent detect
297 */
Koen Kooi1bd9ef12011-01-12 00:23:29 +0000298 if (omap3_beagle_get_rev() != OMAP3BEAGLE_BOARD_XM) {
299 r = gpio_request(gpio + 1, "EHCI_nOC");
300 if (!r) {
301 r = gpio_direction_input(gpio + 1);
302 if (r)
303 gpio_free(gpio + 1);
304 }
305 if (r)
306 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
307 }
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800308
Koen Kooi68fc3e12011-01-11 17:13:35 +0000309 /*
310 * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active
311 * high / others active low)
312 */
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800313 gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR");
Koen Kooi68fc3e12011-01-11 17:13:35 +0000314 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM)
315 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1);
316 else
317 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800318
Koen Kooif8362d22011-01-11 17:13:36 +0000319 /* DVI reset GPIO is different between beagle revisions */
320 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM)
321 beagle_dvi_device.reset_gpio = 129;
322 else
323 beagle_dvi_device.reset_gpio = 170;
324
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800325 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
326 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
327
Koen Kooi1bd9ef12011-01-12 00:23:29 +0000328 /*
329 * gpio + 1 on Xm controls the TFP410's enable line (active low)
330 * gpio + 2 control varies depending on the board rev as follows:
331 * P7/P8 revisions(prototype): Camera EN
332 * A2+ revisions (production): LDO (supplies DVI, serial, led blocks)
333 */
334 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
335 r = gpio_request(gpio + 1, "nDVI_PWR_EN");
336 if (!r) {
337 r = gpio_direction_output(gpio + 1, 0);
338 if (r)
339 gpio_free(gpio + 1);
340 }
341 if (r)
342 pr_err("%s: unable to configure nDVI_PWR_EN\n",
343 __func__);
344 r = gpio_request(gpio + 2, "DVI_LDO_EN");
345 if (!r) {
346 r = gpio_direction_output(gpio + 2, 1);
347 if (r)
348 gpio_free(gpio + 2);
349 }
350 if (r)
351 pr_err("%s: unable to configure DVI_LDO_EN\n",
352 __func__);
353 }
354
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800355 return 0;
356}
357
358static struct twl4030_gpio_platform_data beagle_gpio_data = {
359 .gpio_base = OMAP_MAX_GPIO_LINES,
360 .irq_base = TWL4030_GPIO_IRQ_BASE,
361 .irq_end = TWL4030_GPIO_IRQ_END,
362 .use_leds = true,
363 .pullups = BIT(1),
364 .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13)
365 | BIT(15) | BIT(16) | BIT(17),
366 .setup = beagle_twl_gpio_setup,
367};
368
David Brownellbb3b9d82009-05-28 14:04:03 -0700369/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
370static struct regulator_init_data beagle_vmmc1 = {
371 .constraints = {
372 .min_uV = 1850000,
373 .max_uV = 3150000,
374 .valid_modes_mask = REGULATOR_MODE_NORMAL
375 | REGULATOR_MODE_STANDBY,
376 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
377 | REGULATOR_CHANGE_MODE
378 | REGULATOR_CHANGE_STATUS,
379 },
380 .num_consumer_supplies = 1,
381 .consumer_supplies = &beagle_vmmc1_supply,
382};
383
384/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
385static struct regulator_init_data beagle_vsim = {
386 .constraints = {
387 .min_uV = 1800000,
388 .max_uV = 3000000,
389 .valid_modes_mask = REGULATOR_MODE_NORMAL
390 | REGULATOR_MODE_STANDBY,
391 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
392 | REGULATOR_CHANGE_MODE
393 | REGULATOR_CHANGE_STATUS,
394 },
395 .num_consumer_supplies = 1,
396 .consumer_supplies = &beagle_vsim_supply,
397};
398
399/* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
400static struct regulator_init_data beagle_vdac = {
401 .constraints = {
402 .min_uV = 1800000,
403 .max_uV = 1800000,
404 .valid_modes_mask = REGULATOR_MODE_NORMAL
405 | REGULATOR_MODE_STANDBY,
406 .valid_ops_mask = REGULATOR_CHANGE_MODE
407 | REGULATOR_CHANGE_STATUS,
408 },
409 .num_consumer_supplies = 1,
410 .consumer_supplies = &beagle_vdac_supply,
411};
412
413/* VPLL2 for digital video outputs */
414static struct regulator_init_data beagle_vpll2 = {
415 .constraints = {
416 .name = "VDVI",
417 .min_uV = 1800000,
418 .max_uV = 1800000,
419 .valid_modes_mask = REGULATOR_MODE_NORMAL
420 | REGULATOR_MODE_STANDBY,
421 .valid_ops_mask = REGULATOR_CHANGE_MODE
422 | REGULATOR_CHANGE_STATUS,
423 },
424 .num_consumer_supplies = 1,
425 .consumer_supplies = &beagle_vdvi_supply,
426};
427
Felipe Balbibd04e462009-08-28 11:24:15 -0700428static struct twl4030_usb_data beagle_usb_data = {
429 .usb_mode = T2_USB_MODE_ULPI,
430};
431
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300432static struct twl4030_codec_audio_data beagle_audio_data = {
433 .audio_mclk = 26000000,
434};
435
436static struct twl4030_codec_data beagle_codec_data = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200437 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300438 .audio = &beagle_audio_data,
439};
440
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800441static struct twl4030_platform_data beagle_twldata = {
442 .irq_base = TWL4030_IRQ_BASE,
443 .irq_end = TWL4030_IRQ_END,
444
445 /* platform_data for children goes here */
Felipe Balbibd04e462009-08-28 11:24:15 -0700446 .usb = &beagle_usb_data,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800447 .gpio = &beagle_gpio_data,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300448 .codec = &beagle_codec_data,
David Brownellbb3b9d82009-05-28 14:04:03 -0700449 .vmmc1 = &beagle_vmmc1,
450 .vsim = &beagle_vsim,
451 .vdac = &beagle_vdac,
452 .vpll2 = &beagle_vpll2,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800453};
454
455static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
456 {
457 I2C_BOARD_INFO("twl4030", 0x48),
458 .flags = I2C_CLIENT_WAKE,
459 .irq = INT_34XX_SYS_NIRQ,
460 .platform_data = &beagle_twldata,
461 },
462};
463
Mathieu J. Poiriere3333f42010-09-23 18:22:48 -0700464static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
465 {
466 I2C_BOARD_INFO("eeprom", 0x50),
467 },
468};
469
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800470static int __init omap3_beagle_i2c_init(void)
471{
472 omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo,
473 ARRAY_SIZE(beagle_i2c_boardinfo));
Koen Kooi8ca7fe22009-03-04 10:07:42 -0800474 /* Bus 3 is attached to the DVI port where devices like the pico DLP
475 * projector don't work reliably with 400kHz */
Mathieu J. Poiriere3333f42010-09-23 18:22:48 -0700476 omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom));
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800477 return 0;
478}
479
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300480static struct gpio_led gpio_leds[] = {
481 {
482 .name = "beagleboard::usr0",
483 .default_trigger = "heartbeat",
484 .gpio = 150,
485 },
486 {
487 .name = "beagleboard::usr1",
488 .default_trigger = "mmc0",
489 .gpio = 149,
490 },
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800491 {
492 .name = "beagleboard::pmu_stat",
493 .gpio = -EINVAL, /* gets replaced */
494 .active_low = true,
495 },
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300496};
497
498static struct gpio_led_platform_data gpio_led_info = {
499 .leds = gpio_leds,
500 .num_leds = ARRAY_SIZE(gpio_leds),
501};
502
503static struct platform_device leds_gpio = {
504 .name = "leds-gpio",
505 .id = -1,
506 .dev = {
507 .platform_data = &gpio_led_info,
508 },
509};
510
511static struct gpio_keys_button gpio_buttons[] = {
512 {
513 .code = BTN_EXTRA,
514 .gpio = 7,
515 .desc = "user",
516 .wakeup = 1,
517 },
518};
519
520static struct gpio_keys_platform_data gpio_key_info = {
521 .buttons = gpio_buttons,
522 .nbuttons = ARRAY_SIZE(gpio_buttons),
523};
524
525static struct platform_device keys_gpio = {
526 .name = "gpio-keys",
527 .id = -1,
528 .dev = {
529 .platform_data = &gpio_key_info,
530 },
531};
532
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300533static void __init omap3_beagle_init_irq(void)
534{
Paul Walmsley48057342010-12-21 15:25:10 -0700535 omap2_init_common_infrastructure();
536 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
537 mt46h32m32lf6_sdrc_params);
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300538 omap_init_irq();
539#ifdef CONFIG_OMAP_32K_TIMER
540 omap2_gp_clockevent_set_gptimer(12);
541#endif
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300542}
543
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300544static struct platform_device *omap3_beagle_devices[] __initdata = {
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300545 &leds_gpio,
546 &keys_gpio,
Koen Kooi044d32f2010-04-22 10:23:42 +0200547 &beagle_dss_device,
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300548};
549
550static void __init omap3beagle_flash_init(void)
551{
552 u8 cs = 0;
553 u8 nandcs = GPMC_CS_NUM + 1;
554
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300555 /* find out the chip-select on which NAND exists */
556 while (cs < GPMC_CS_NUM) {
557 u32 ret = 0;
558 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
559
560 if ((ret & 0xC00) == 0x800) {
561 printk(KERN_INFO "Found NAND on CS%d\n", cs);
562 if (nandcs > GPMC_CS_NUM)
563 nandcs = cs;
564 }
565 cs++;
566 }
567
568 if (nandcs > GPMC_CS_NUM) {
569 printk(KERN_INFO "NAND: Unable to find configuration "
570 "in GPMC\n ");
571 return;
572 }
573
574 if (nandcs < GPMC_CS_NUM) {
575 omap3beagle_nand_data.cs = nandcs;
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300576
577 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
Sukumar Ghoraif450d862010-07-09 09:14:46 +0000578 if (gpmc_nand_init(&omap3beagle_nand_data) < 0)
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300579 printk(KERN_ERR "Unable to register NAND device\n");
580 }
581}
582
Felipe Balbi6f69a182010-03-04 09:45:53 +0200583static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
Felipe Balbi58a54912009-11-22 10:11:01 -0800584
585 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
586 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
587 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
588
589 .phy_reset = true,
590 .reset_gpio_port[0] = -EINVAL,
591 .reset_gpio_port[1] = 147,
592 .reset_gpio_port[2] = -EINVAL
593};
594
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800595#ifdef CONFIG_OMAP_MUX
596static struct omap_board_mux board_mux[] __initdata = {
597 { .reg_offset = OMAP_MUX_TERMINATOR },
598};
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800599#endif
600
Maulik Mankad884b8362010-02-17 14:09:30 -0800601static struct omap_musb_board_data musb_board_data = {
602 .interface_type = MUSB_INTERFACE_ULPI,
603 .mode = MUSB_OTG,
604 .power = 100,
605};
606
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300607static void __init omap3_beagle_init(void)
608{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800609 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Robert Nelson954bed02010-09-23 18:22:47 -0700610 omap3_beagle_init_rev();
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800611 omap3_beagle_i2c_init();
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300612 platform_add_devices(omap3_beagle_devices,
613 ARRAY_SIZE(omap3_beagle_devices));
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300614 omap_serial_init();
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800615
Tony Lindgren4896e392009-12-11 16:16:32 -0800616 omap_mux_init_gpio(170, OMAP_PIN_INPUT);
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800617 gpio_request(170, "DVI_nPD");
618 /* REVISIT leave DVI powered down until it's needed ... */
619 gpio_direction_output(170, true);
620
Maulik Mankad884b8362010-02-17 14:09:30 -0800621 usb_musb_init(&musb_board_data);
Felipe Balbi58a54912009-11-22 10:11:01 -0800622 usb_ehci_init(&ehci_pdata);
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300623 omap3beagle_flash_init();
Jean Pihet9fb97412009-07-24 19:43:25 -0600624
625 /* Ensure SDRC pins are mux'd for self-refresh */
Tony Lindgren4896e392009-12-11 16:16:32 -0800626 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
627 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
Koen Kooi044d32f2010-04-22 10:23:42 +0200628
629 beagle_display_init();
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300630}
631
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300632MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
633 /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300634 .boot_params = 0x80000100,
Mike Rapoport869fef42010-08-04 14:43:18 +0300635 .map_io = omap3_map_io,
Russell King71ee7da2010-05-23 10:18:16 +0100636 .reserve = omap_reserve,
Syed Mohammed, Khasim2885f002008-10-09 17:51:42 +0300637 .init_irq = omap3_beagle_init_irq,
638 .init_machine = omap3_beagle_init,
639 .timer = &omap_timer,
640MACHINE_END