2 * linux/arch/arm/mach-omap2/board-omap3evm.c
4 * Copyright (C) 2008 Texas Instruments
6 * Modified from mach-omap2/board-3430sdp.c
8 * Initial code: Syed Mohammed Khasim
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.
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/gpio.h>
22 #include <linux/input.h>
23 #include <linux/input/matrix_keypad.h>
24 #include <linux/leds.h>
25 #include <linux/interrupt.h>
27 #include <linux/spi/spi.h>
28 #include <linux/spi/ads7846.h>
29 #include <linux/i2c/twl4030.h>
30 #include <linux/regulator/machine.h>
31 #include <linux/usb/otg.h>
32 #include <linux/smsc911x.h>
34 #include <linux/mtd/mtd.h>
35 #include <linux/mtd/partitions.h>
36 #include <linux/mtd/nand.h>
39 #include <linux/regulator/machine.h>
41 #include <mach/hardware.h>
42 #include <asm/mach-types.h>
43 #include <asm/mach/arch.h>
44 #include <asm/mach/map.h>
46 #include <plat/board.h>
48 #include <plat/gpmc.h>
49 #include <plat/nand.h>
51 #include <plat/common.h>
52 #include <plat/control.h>
53 #include <plat/mcspi.h>
54 #include <plat/clock.h>
55 #include <plat/omap-pm.h>
56 #include <plat/display.h>
58 #include "sdram-micron-mt46h32m32lf-6.h"
59 #include "mmc-twl4030.h"
61 #include "prm-regbits-34xx.h"
62 #include "omap3-opp.h"
63 #include "board-omap3evm-camera.h"
65 #include "board-omap35x-pmic.h"
67 #define GPMC_CS0_BASE 0x60
68 #define GPMC_CS_SIZE 0x30
70 #define NAND_BLOCK_SIZE SZ_128K
72 #define OMAP3_EVM_TS_GPIO 175
73 #define OMAP3_EVM_EHCI_VBUS 22
74 #define OMAP3_EVM_EHCI_SELECT 61
76 #define OMAP3EVM_ETHR_START 0x2c000000
77 #define OMAP3EVM_ETHR_SIZE 1024
78 #define OMAP3EVM_ETHR_ID_REV 0x50
79 #define OMAP3EVM_ETHR_GPIO_IRQ 176
80 #define OMAP3EVM_SMC911X_CS 5
83 static struct mtd_partition omap3evm_nand_partitions
[] = {
84 /* All the partition sizes are listed in terms of NAND block size */
86 .name
= "xloader-nand",
89 .mask_flags
= MTD_WRITEABLE
93 .offset
= MTDPART_OFS_APPEND
,
95 .mask_flags
= MTD_WRITEABLE
98 .name
= "params-nand",
99 .offset
= MTDPART_OFS_APPEND
,
103 .name
= "linux-nand",
104 .offset
= MTDPART_OFS_APPEND
,
108 .name
= "jffs2-nand",
109 .size
= MTDPART_SIZ_FULL
,
110 .offset
= MTDPART_OFS_APPEND
,
114 static struct omap_nand_platform_data omap3evm_nand_data
= {
115 .parts
= omap3evm_nand_partitions
,
116 .nr_parts
= ARRAY_SIZE(omap3evm_nand_partitions
),
118 .dma_channel
= -1, /* disable DMA in OMAP NAND driver */
122 static struct resource omap3evm_nand_resource
= {
123 .flags
= IORESOURCE_MEM
,
126 static struct platform_device omap3evm_nand_device
= {
127 .name
= "omap2-nand",
130 .platform_data
= &omap3evm_nand_data
,
133 .resource
= &omap3evm_nand_resource
,
137 void __init
omap3evm_flash_init(void)
140 u8 nandcs
= GPMC_CS_NUM
+ 1;
141 u32 gpmc_base_add
= OMAP34XX_GPMC_VIRT
;
143 while (cs
< GPMC_CS_NUM
) {
145 ret
= gpmc_cs_read_reg(cs
, GPMC_CS_CONFIG1
);
147 if ((ret
& 0xC00) == 0x800) {
149 if (nandcs
> GPMC_CS_NUM
)
154 if (nandcs
> GPMC_CS_NUM
) {
155 printk(KERN_INFO
"NAND: Unable to find configuration "
160 if (nandcs
< GPMC_CS_NUM
) {
161 omap3evm_nand_data
.cs
= nandcs
;
162 omap3evm_nand_data
.gpmc_cs_baseaddr
= (void *)(gpmc_base_add
+
163 GPMC_CS0_BASE
+ nandcs
*GPMC_CS_SIZE
);
164 omap3evm_nand_data
.gpmc_baseaddr
= (void *) (gpmc_base_add
);
166 if (platform_device_register(&omap3evm_nand_device
) < 0) {
167 printk(KERN_ERR
"Unable to register NAND device\n");
172 static u8 omap3_evm_version
;
174 u8
get_omap3_evm_rev(void)
176 return omap3_evm_version
;
178 EXPORT_SYMBOL(get_omap3_evm_rev
);
180 static void __init
omap3_evm_get_revision(void)
182 void __iomem
*ioaddr
;
183 unsigned int smsc_id
;
185 /* Ethernet PHY ID is stored at ID_REV register */
186 ioaddr
= ioremap_nocache(OMAP3EVM_ETHR_START
, SZ_1K
);
187 smsc_id
= readl(ioaddr
+ OMAP3EVM_ETHR_ID_REV
) & 0xFFFF0000;
193 omap3_evm_version
= OMAP3EVM_BOARD_GEN_1
;
195 /*SMSC 9220 chipset*/
198 omap3_evm_version
= OMAP3EVM_BOARD_GEN_2
;
202 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
203 static struct resource omap3evm_smsc911x_resources
[] = {
205 .start
= OMAP3EVM_ETHR_START
,
206 .end
= (OMAP3EVM_ETHR_START
+ OMAP3EVM_ETHR_SIZE
- 1),
207 .flags
= IORESOURCE_MEM
,
210 .start
= OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ
),
211 .end
= OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ
),
212 .flags
= (IORESOURCE_IRQ
| IRQF_TRIGGER_LOW
),
216 static struct smsc911x_platform_config smsc911x_config
= {
217 .phy_interface
= PHY_INTERFACE_MODE_MII
,
218 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_LOW
,
219 .irq_type
= SMSC911X_IRQ_TYPE_OPEN_DRAIN
,
220 .flags
= (SMSC911X_USE_32BIT
| SMSC911X_SAVE_MAC_ADDRESS
),
223 static struct platform_device omap3evm_smsc911x_device
= {
226 .num_resources
= ARRAY_SIZE(omap3evm_smsc911x_resources
),
227 .resource
= &omap3evm_smsc911x_resources
[0],
229 .platform_data
= &smsc911x_config
,
233 static inline void __init
omap3evm_init_smsc911x(void)
239 eth_cs
= OMAP3EVM_SMC911X_CS
;
241 l3ck
= clk_get(NULL
, "l3_ck");
245 rate
= clk_get_rate(l3ck
);
247 if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ
, "SMC911x irq") < 0) {
248 printk(KERN_ERR
"Failed to request GPIO%d for smc911x IRQ\n",
249 OMAP3EVM_ETHR_GPIO_IRQ
);
253 gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ
);
255 platform_device_register(&omap3evm_smsc911x_device
);
259 static inline void __init
omap3evm_init_smsc911x(void) { return; }
263 * OMAP3EVM LCD Panel control signals
265 #define OMAP3EVM_LCD_PANEL_LR 2
266 #define OMAP3EVM_LCD_PANEL_UD 3
267 #define OMAP3EVM_LCD_PANEL_INI 152
268 #define OMAP3EVM_LCD_PANEL_ENVDD 153
269 #define OMAP3EVM_LCD_PANEL_QVGA 154
270 #define OMAP3EVM_LCD_PANEL_RESB 155
271 #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210
272 #define OMAP3EVM_DVI_PANEL_EN_GPIO 199
274 #define ENABLE_VPLL2_DEV_GRP 0xE0
276 static int lcd_enabled
;
277 static int dvi_enabled
;
279 static void __init
omap3_evm_display_init(void)
283 r
= gpio_request(OMAP3EVM_LCD_PANEL_RESB
, "lcd_panel_resb");
285 printk(KERN_ERR
"failed to get lcd_panel_resb\n");
288 gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB
, 1);
290 r
= gpio_request(OMAP3EVM_LCD_PANEL_INI
, "lcd_panel_ini");
292 printk(KERN_ERR
"failed to get lcd_panel_ini\n");
295 gpio_direction_output(OMAP3EVM_LCD_PANEL_INI
, 1);
297 r
= gpio_request(OMAP3EVM_LCD_PANEL_QVGA
, "lcd_panel_qvga");
299 printk(KERN_ERR
"failed to get lcd_panel_qvga\n");
302 gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA
, 0);
304 r
= gpio_request(OMAP3EVM_LCD_PANEL_LR
, "lcd_panel_lr");
306 printk(KERN_ERR
"failed to get lcd_panel_lr\n");
309 gpio_direction_output(OMAP3EVM_LCD_PANEL_LR
, 1);
311 r
= gpio_request(OMAP3EVM_LCD_PANEL_UD
, "lcd_panel_ud");
313 printk(KERN_ERR
"failed to get lcd_panel_ud\n");
316 gpio_direction_output(OMAP3EVM_LCD_PANEL_UD
, 1);
318 r
= gpio_request(OMAP3EVM_LCD_PANEL_ENVDD
, "lcd_panel_envdd");
320 printk(KERN_ERR
"failed to get lcd_panel_envdd\n");
323 gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD
, 0);
328 gpio_free(OMAP3EVM_LCD_PANEL_UD
);
330 gpio_free(OMAP3EVM_LCD_PANEL_LR
);
332 gpio_free(OMAP3EVM_LCD_PANEL_QVGA
);
334 gpio_free(OMAP3EVM_LCD_PANEL_INI
);
336 gpio_free(OMAP3EVM_LCD_PANEL_RESB
);
340 static int omap3_evm_enable_lcd(struct omap_dss_device
*dssdev
)
343 printk(KERN_ERR
"cannot enable LCD, DVI is enabled\n");
346 gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD
, 0);
348 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2
)
349 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO
, 0);
351 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO
, 1);
358 static void omap3_evm_disable_lcd(struct omap_dss_device
*dssdev
)
360 gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD
, 1);
362 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2
)
363 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO
, 1);
365 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO
, 0);
370 static struct omap_dss_device omap3_evm_lcd_device
= {
372 .driver_name
= "sharp_ls_panel",
373 .type
= OMAP_DISPLAY_TYPE_DPI
,
374 .phy
.dpi
.data_lines
= 18,
375 .platform_enable
= omap3_evm_enable_lcd
,
376 .platform_disable
= omap3_evm_disable_lcd
,
379 static int omap3_evm_enable_tv(struct omap_dss_device
*dssdev
)
384 static void omap3_evm_disable_tv(struct omap_dss_device
*dssdev
)
388 static struct omap_dss_device omap3_evm_tv_device
= {
390 .driver_name
= "venc",
391 .type
= OMAP_DISPLAY_TYPE_VENC
,
392 #if defined(CONFIG_OMAP2_VENC_OUT_TYPE_SVIDEO)
393 .phy
.venc
.type
= OMAP_DSS_VENC_TYPE_SVIDEO
,
394 #elif defined(CONFIG_OMAP2_VENC_OUT_TYPE_COMPOSITE)
395 .u
.venc
.type
= OMAP_DSS_VENC_TYPE_COMPOSITE
,
397 .platform_enable
= omap3_evm_enable_tv
,
398 .platform_disable
= omap3_evm_disable_tv
,
401 static int omap3_evm_enable_dvi(struct omap_dss_device
*dssdev
)
404 printk(KERN_ERR
"cannot enable DVI, LCD is enabled\n");
408 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER
, ENABLE_VPLL2_DEV_GRP
,
409 TWL4030_VPLL2_DEV_GRP
);
410 gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO
, 1);
416 static void omap3_evm_disable_dvi(struct omap_dss_device
*dssdev
)
418 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER
, 0x0,
419 TWL4030_VPLL2_DEV_GRP
);
420 gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO
, 0);
425 static struct omap_dss_device omap3_evm_dvi_device
= {
427 .driver_name
= "generic_panel",
428 .type
= OMAP_DISPLAY_TYPE_DPI
,
429 .phy
.dpi
.data_lines
= 24,
430 .platform_enable
= omap3_evm_enable_dvi
,
431 .platform_disable
= omap3_evm_disable_dvi
,
434 static struct omap_dss_device
*omap3_evm_dss_devices
[] = {
435 &omap3_evm_lcd_device
,
436 &omap3_evm_tv_device
,
437 &omap3_evm_dvi_device
,
440 static struct omap_dss_board_info omap3_evm_dss_data
= {
441 .num_devices
= ARRAY_SIZE(omap3_evm_dss_devices
),
442 .devices
= omap3_evm_dss_devices
,
443 .default_device
= &omap3_evm_lcd_device
,
446 static struct platform_device omap3_evm_dss_device
= {
450 .platform_data
= &omap3_evm_dss_data
,
454 /* Create a single supply for VMMC1 */
455 REGULATOR_CONSUMER_SINGLE_SUPPLY(vmmc1
, vmmc
, NULL
);
457 /* Create a single supply for VSIM */
458 REGULATOR_CONSUMER_SINGLE_SUPPLY(vsim
, vmmc_aux
, NULL
);
460 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
461 REGULATOR_INIT_DATA(vmmc1
, VMMC1
, 1850000, 3150000,
462 TWL_REGULATOR_MODES_DEFAULT
,
463 TWL_REGULATOR_OPS_DEFAULT
| REGULATOR_CHANGE_VOLTAGE
,
466 /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
467 /* Create init data for VMMC1 */
468 REGULATOR_INIT_DATA(vsim
, VSIM
, 1800000, 3000000,
469 TWL_REGULATOR_MODES_DEFAULT
,
470 TWL_REGULATOR_OPS_DEFAULT
| REGULATOR_CHANGE_VOLTAGE
,
473 static struct platform_device omap3evm_camkit_device
= {
474 .name
= "omap3evm_camkit",
478 /* Create supplies for VAUX2 */
479 REGULATOR_CONSUMER_SINGLE_SUPPLY(vaux2
, hsusb1
, NULL
);
480 /* VAUX2 for EHCI module on OMAP3EVM Rev >= E */
483 /* Create supplies for VUSB1V5 */
484 REGULATOR_CONSUMER_SINGLE_SUPPLY(vusb1v5
, hsusb1
-aux
, NULL
);
485 /* VUSB1V5 for EHCI module on OMAP3EVM Rev < E*/
488 /* Create supplies for VUSB1V8 */
489 REGULATOR_CONSUMER_SINGLE_SUPPLY(vusb1v8
, hsusb1
, NULL
);
490 /* VUSB1V8 for EHCI module */
493 static struct twl4030_hsmmc_info mmc
[] = {
503 static struct gpio_led gpio_leds
[] = {
505 .name
= "omap3evm::ledb",
506 /* normally not visible (board underside) */
507 .default_trigger
= "default-on",
508 .gpio
= -EINVAL
, /* gets replaced */
513 static struct gpio_led_platform_data gpio_led_info
= {
515 .num_leds
= ARRAY_SIZE(gpio_leds
),
518 static struct platform_device leds_gpio
= {
522 .platform_data
= &gpio_led_info
,
528 * Save the state of keypad
530 * TODO: This definition should ideally be in a header file, but
531 * matrix_keypad.h is not the right one. Also, plat/keypad.h
534 struct omap_keypad_pm_state
{
542 * Board specific hook for keypad suspend
544 void omap3_evm_kp_suspend(void *ptr
)
546 struct omap_keypad_pm_state
*pstate
=
547 (struct omap_keypad_pm_state
*)ptr
;
551 * Set wake-enable bit
553 if (pstate
->wk_en
&& pstate
->wk_mask
) {
554 u32 v
= __raw_readl(pstate
->wk_en
);
555 v
|= pstate
->wk_mask
;
556 __raw_writel(v
, pstate
->wk_en
);
559 * Set corresponding IOPAD wakeup-enable
561 if (cpu_is_omap34xx() && pstate
->padconf
) {
562 u16 v
= omap_ctrl_readw(pstate
->padconf
);
563 v
|= OMAP3_PADCONF_WAKEUPENABLE0
;
564 omap_ctrl_writew(v
, pstate
->padconf
);
570 * Board specific hook for keypad resume
572 void omap3_evm_kp_resume(void *ptr
)
574 struct omap_keypad_pm_state
*pstate
=
575 (struct omap_keypad_pm_state
*)ptr
;
579 * Clear wake-enable bit
581 if (pstate
->wk_en
&& pstate
->wk_mask
) {
582 u32 v
= __raw_readl(pstate
->wk_en
);
583 v
&= ~pstate
->wk_mask
;
584 __raw_writel(v
, pstate
->wk_en
);
587 * Clear corresponding IOPAD wakeup-enable
589 if (cpu_is_omap34xx() && pstate
->padconf
) {
590 u16 v
= omap_ctrl_readw(pstate
->padconf
);
591 v
&= ~OMAP3_PADCONF_WAKEUPENABLE0
;
592 omap_ctrl_writew(v
, pstate
->padconf
);
597 static struct omap_keypad_pm_state omap3evm_kp_pm_state
= {
598 .wk_st
= OMAP34XX_PRM_REGADDR(WKUP_MOD
, PM_WKEN1
),
599 .wk_en
= OMAP34XX_PRM_REGADDR(WKUP_MOD
, PM_WKST1
),
600 .wk_mask
= OMAP3430_EN_GPIO1
,
603 #endif /* CONFIG_PM */
605 static int omap3evm_twl_gpio_setup(struct device
*dev
,
606 unsigned gpio
, unsigned ngpio
)
608 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
609 omap_cfg_reg(L8_34XX_GPIO63
);
610 mmc
[0].gpio_cd
= gpio
+ 0;
611 twl4030_mmc_init(mmc
);
613 /* link regulators to MMC adapters */
614 vmmc1_consumers
[0].dev
= mmc
[0].dev
;
615 vsim_consumers
[0].dev
= mmc
[0].dev
;
618 * Most GPIOs are for USB OTG. Some are mostly sent to
619 * the P2 connector; notably LEDA for the LCD backlight.
622 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
623 gpio_request(gpio
+ TWL4030_GPIO_MAX
, "EN_LCD_BKL");
624 gpio_direction_output(gpio
+ TWL4030_GPIO_MAX
, 0);
626 /* gpio + 7 == DVI Enable */
627 gpio_request(gpio
+ 7, "EN_DVI");
628 gpio_direction_output(gpio
+ 7, 0);
630 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
631 gpio_leds
[2].gpio
= gpio
+ TWL4030_GPIO_MAX
+ 1;
633 platform_device_register(&leds_gpio
);
638 static struct twl4030_gpio_platform_data omap3evm_gpio_data
= {
639 .gpio_base
= OMAP_MAX_GPIO_LINES
,
640 .irq_base
= TWL4030_GPIO_IRQ_BASE
,
641 .irq_end
= TWL4030_GPIO_IRQ_END
,
643 .setup
= omap3evm_twl_gpio_setup
,
646 static struct twl4030_usb_data omap3evm_usb_data
= {
647 .usb_mode
= T2_USB_MODE_ULPI
,
650 static int board_keymap
[] = {
653 KEY(0, 2, KEY_ENTER
),
656 KEY(1, 0, KEY_RIGHT
),
672 static struct matrix_keymap_data board_map_data
= {
673 .keymap
= board_keymap
,
674 .keymap_size
= ARRAY_SIZE(board_keymap
),
677 static struct twl4030_keypad_data omap3evm_kp_data
= {
678 .keymap_data
= &board_map_data
,
683 .pm_state
= (void *)&omap3evm_kp_pm_state
,
684 .on_suspend
= omap3_evm_kp_suspend
,
685 .on_resume
= omap3_evm_kp_resume
,
686 #endif /* CONFIG_PM */
689 static struct twl4030_madc_platform_data omap3evm_madc_data
= {
693 static struct twl4030_ins __initdata sleep_on_seq
[] = {
694 /* Turn off HFCLKOUT */
695 {MSG_SINGULAR(DEV_GRP_P1
, 0x19, RES_STATE_OFF
), 2},
697 {MSG_SINGULAR(DEV_GRP_P1
, 0xf, RES_STATE_OFF
), 2},
699 {MSG_SINGULAR(DEV_GRP_P1
, 0x10, RES_STATE_OFF
), 2},
701 {MSG_SINGULAR(DEV_GRP_P1
, 0x7, RES_STATE_OFF
), 2},
704 static struct twl4030_script sleep_on_script __initdata
= {
705 .script
= sleep_on_seq
,
706 .size
= ARRAY_SIZE(sleep_on_seq
),
707 .flags
= TWL4030_SLEEP_SCRIPT
,
710 static struct twl4030_ins wakeup_p12_seq
[] __initdata
= {
711 /* Turn on HFCLKOUT */
712 {MSG_SINGULAR(DEV_GRP_P1
, 0x19, RES_STATE_ACTIVE
), 2},
714 {MSG_SINGULAR(DEV_GRP_P1
, 0xf, RES_STATE_ACTIVE
), 2},
716 {MSG_SINGULAR(DEV_GRP_P1
, 0x10, RES_STATE_ACTIVE
), 2},
718 {MSG_SINGULAR(DEV_GRP_P1
, 0x7, RES_STATE_ACTIVE
), 2},
721 static struct twl4030_script wakeup_p12_script __initdata
= {
722 .script
= wakeup_p12_seq
,
723 .size
= ARRAY_SIZE(wakeup_p12_seq
),
724 .flags
= TWL4030_WAKEUP12_SCRIPT
,
727 static struct twl4030_ins wakeup_p3_seq
[] __initdata
= {
728 {MSG_SINGULAR(DEV_GRP_P1
, 0x19, RES_STATE_ACTIVE
), 2},
731 static struct twl4030_script wakeup_p3_script __initdata
= {
732 .script
= wakeup_p3_seq
,
733 .size
= ARRAY_SIZE(wakeup_p3_seq
),
734 .flags
= TWL4030_WAKEUP3_SCRIPT
,
737 static struct twl4030_ins wrst_seq
[] __initdata
= {
740 * Reset VDD1 regulator.
741 * Reset VDD2 regulator.
742 * Reset VPLL1 regulator.
743 * Enable sysclk output.
746 {MSG_SINGULAR(DEV_GRP_NULL
, 0x1b, RES_STATE_OFF
), 2},
747 {MSG_SINGULAR(DEV_GRP_P1
, 0xf, RES_STATE_WRST
), 15},
748 {MSG_SINGULAR(DEV_GRP_P1
, 0x10, RES_STATE_WRST
), 15},
749 {MSG_SINGULAR(DEV_GRP_P1
, 0x7, RES_STATE_WRST
), 0x60},
750 {MSG_SINGULAR(DEV_GRP_P1
, 0x19, RES_STATE_ACTIVE
), 2},
751 {MSG_SINGULAR(DEV_GRP_NULL
, 0x1b, RES_STATE_ACTIVE
), 2},
753 static struct twl4030_script wrst_script __initdata
= {
755 .size
= ARRAY_SIZE(wrst_seq
),
756 .flags
= TWL4030_WRST_SCRIPT
,
759 static struct twl4030_script
*twl4030_scripts
[] __initdata
= {
766 static struct twl4030_resconfig twl4030_rconfig
[] = {
767 { .resource
= RES_HFCLKOUT
, .devgroup
= DEV_GRP_P3
, .type
= -1,
769 { .resource
= RES_VDD1
, .devgroup
= DEV_GRP_P1
, .type
= -1,
771 { .resource
= RES_VDD2
, .devgroup
= DEV_GRP_P1
, .type
= -1,
776 static struct twl4030_power_data omap3evm_t2scripts_data __initdata
= {
777 .scripts
= twl4030_scripts
,
778 .num
= ARRAY_SIZE(twl4030_scripts
),
779 .resource_config
= twl4030_rconfig
,
782 REGULATOR_CONSUMER_SINGLE_SUPPLY(vdac
, vdda_dac
, &omap3_evm_dss_device
.dev
);
784 /* VDAC for DSS driving S-Video */
787 /* VPLL2 for digital video outputs */
788 REGULATOR_CONSUMER_SINGLE_SUPPLY(vpll2
, vdvi
, &omap3_evm_lcd_device
.dev
);
790 REGULATOR_INIT_DATA(vpll2
, VDVI
, 1800000, 1800000,
791 TWL_REGULATOR_MODES_DEFAULT
,
792 TWL_REGULATOR_OPS_DEFAULT
,
795 static struct twl4030_platform_data omap3evm_twldata __initdata
= {
796 .irq_base
= TWL4030_IRQ_BASE
,
797 .irq_end
= TWL4030_IRQ_END
,
799 /* platform_data for children goes here */
800 .keypad
= &omap3evm_kp_data
,
801 .madc
= &omap3evm_madc_data
,
802 .power
= &omap3evm_t2scripts_data
,
803 .usb
= &omap3evm_usb_data
,
804 .gpio
= &omap3evm_gpio_data
,
805 .vmmc1
= &vmmc1_data
[0],
806 .vdac
= &vdac_data
[0],
807 .vpll2
= &vpll2_data
[0],
808 .vsim
= &vsim_data
[0],
811 static struct i2c_board_info __initdata omap3evm_i2c_boardinfo
[] = {
813 I2C_BOARD_INFO("twl4030", 0x48),
814 .flags
= I2C_CLIENT_WAKE
,
815 .irq
= INT_34XX_SYS_NIRQ
,
816 .platform_data
= &omap3evm_twldata
,
820 static int __init
omap3_evm_i2c_init(void)
822 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo
,
823 ARRAY_SIZE(omap3evm_i2c_boardinfo
));
824 omap_register_i2c_bus(2, 400, NULL
, 0);
825 omap_register_i2c_bus(3, 400, NULL
, 0);
829 static void ads7846_dev_init(void)
831 if (gpio_request(OMAP3_EVM_TS_GPIO
, "ADS7846 pendown") < 0) {
832 printk(KERN_ERR
"can't get ads7846 pen down GPIO\n");
836 omap_cfg_reg(AC3_34XX_GPIO175
);
838 gpio_direction_input(OMAP3_EVM_TS_GPIO
);
840 omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO
, 1);
841 omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO
, 0xa);
844 static int ads7846_get_pendown_state(void)
846 return !gpio_get_value(OMAP3_EVM_TS_GPIO
);
849 struct ads7846_platform_data ads7846_config
= {
857 .get_pendown_state
= ads7846_get_pendown_state
,
859 .settle_delay_usecs
= 150,
862 static struct omap2_mcspi_device_config ads7846_mcspi_config
= {
864 .single_channel
= 1, /* 0: slave, 1: master */
867 struct spi_board_info omap3evm_spi_board_info
[] = {
869 .modalias
= "ads7846",
872 .max_speed_hz
= 1500000,
873 .controller_data
= &ads7846_mcspi_config
,
874 .irq
= OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO
),
875 .platform_data
= &ads7846_config
,
879 static struct omap_board_config_kernel omap3_evm_config
[] __initdata
= {
882 static void __init
omap3_evm_init_irq(void)
884 omap_board_config
= omap3_evm_config
;
885 omap_board_config_size
= ARRAY_SIZE(omap3_evm_config
);
886 omap2_init_common_hw(mt46h32m32lf6_sdrc_params
, NULL
, omap3_mpu_rate_table
,
887 omap3_dsp_rate_table
, omap3_l3_rate_table
);
892 static struct platform_device
*omap3_evm_devices
[] __initdata
= {
893 &omap3_evm_dss_device
,
894 &omap3evm_camkit_device
,
897 static struct ehci_hcd_omap_platform_data ehci_pdata __initconst
= {
899 .port_mode
[0] = EHCI_HCD_OMAP_MODE_UNKNOWN
,
900 .port_mode
[1] = EHCI_HCD_OMAP_MODE_PHY
,
901 .port_mode
[2] = EHCI_HCD_OMAP_MODE_UNKNOWN
,
904 /* PHY reset GPIO will be runtime programmed based on EVM version */
905 .reset_gpio_port
[0] = -EINVAL
,
906 .reset_gpio_port
[1] = -EINVAL
,
907 .reset_gpio_port
[2] = -EINVAL
,
915 * Set wakeup sources for the board
917 static void __init
omap3_evm_wakeup_sources(void)
919 pr_info("omap3evm: Adding wakeup sources");
921 omap_cfg_reg(AF26_34XX_SYS_NIRQ
);
924 static void __init
omap3_evm_init(void)
926 omap3_evm_get_revision();
928 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2
) {
929 omap3evm_twldata
.vaux2
= &vaux2_data
[0];
931 omap3evm_twldata
.vusb1v5
= &vusb1v5_data
[0];
932 omap3evm_twldata
.vusb1v8
= &vusb1v8_data
[0];
935 omap3_evm_i2c_init();
937 regulator_has_full_constraints();
939 platform_add_devices(omap3_evm_devices
, ARRAY_SIZE(omap3_evm_devices
));
941 spi_register_board_info(omap3evm_spi_board_info
,
942 ARRAY_SIZE(omap3evm_spi_board_info
));
945 #ifdef CONFIG_NOP_USB_XCEIV
946 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
947 usb_nop_xceiv_register();
949 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2
) {
950 /* enable EHCI VBUS using GPIO22 */
951 omap_cfg_reg(AF9_34XX_GPIO22
);
952 gpio_request(OMAP3_EVM_EHCI_VBUS
, "enable EHCI VBUS");
953 gpio_direction_output(OMAP3_EVM_EHCI_VBUS
, 0);
954 gpio_set_value(OMAP3_EVM_EHCI_VBUS
, 1);
956 /* Select EHCI port on main board */
957 omap_cfg_reg(U3_34XX_GPIO61
);
958 gpio_request(OMAP3_EVM_EHCI_SELECT
, "select EHCI port");
959 gpio_direction_output(OMAP3_EVM_EHCI_SELECT
, 0);
960 gpio_set_value(OMAP3_EVM_EHCI_SELECT
, 0);
962 /* setup EHCI phy reset config */
963 omap_cfg_reg(AH14_34XX_GPIO21
);
964 ehci_pdata
.reset_gpio_port
[1] = 21;
967 /* setup EHCI phy reset on MDC */
968 omap_cfg_reg(AF4_34XX_GPIO135_OUT
);
969 ehci_pdata
.reset_gpio_port
[1] = 135;
971 /* MDC also need VUSB1V5 regulator */
972 ehci_pdata
.aux
[1] = 1;
975 omap3evm_flash_init();
976 usb_ehci_init(&ehci_pdata
);
978 omap3evm_init_smsc911x();
979 omap3_evm_display_init();
981 omap3_evm_wakeup_sources();
984 static void __init
omap3_evm_map_io(void)
986 omap2_set_globals_343x();
987 omap2_map_common_io();
990 MACHINE_START(OMAP3EVM
, "OMAP3 EVM")
991 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
992 .phys_io
= 0x48000000,
993 .io_pg_offst
= ((0xfa000000) >> 18) & 0xfffc,
994 .boot_params
= 0x80000100,
995 .map_io
= omap3_evm_map_io
,
996 .init_irq
= omap3_evm_init_irq
,
997 .init_machine
= omap3_evm_init
,
998 .timer
= &omap_timer
,