aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-omap3evm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3evm.c')
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c242
1 files changed, 44 insertions, 198 deletions
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 7f94cccdb07..b4d43464a30 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -50,6 +50,7 @@
50#include "mux.h" 50#include "mux.h"
51#include "sdram-micron-mt46h32m32lf-6.h" 51#include "sdram-micron-mt46h32m32lf-6.h"
52#include "hsmmc.h" 52#include "hsmmc.h"
53#include "common-board-devices.h"
53 54
54#define OMAP3_EVM_TS_GPIO 175 55#define OMAP3_EVM_TS_GPIO 175
55#define OMAP3_EVM_EHCI_VBUS 22 56#define OMAP3_EVM_EHCI_VBUS 22
@@ -101,49 +102,20 @@ static void __init omap3_evm_get_revision(void)
101} 102}
102 103
103#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 104#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
104static struct resource omap3evm_smsc911x_resources[] = { 105#include <plat/gpmc-smsc911x.h>
105 [0] = {
106 .start = OMAP3EVM_ETHR_START,
107 .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
108 .flags = IORESOURCE_MEM,
109 },
110 [1] = {
111 .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
112 .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
113 .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
114 },
115};
116 106
117static struct smsc911x_platform_config smsc911x_config = { 107static struct omap_smsc911x_platform_data smsc911x_cfg = {
118 .phy_interface = PHY_INTERFACE_MODE_MII, 108 .cs = OMAP3EVM_SMSC911X_CS,
119 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 109 .gpio_irq = OMAP3EVM_ETHR_GPIO_IRQ,
120 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 110 .gpio_reset = -EINVAL,
121 .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), 111 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
122};
123
124static struct platform_device omap3evm_smsc911x_device = {
125 .name = "smsc911x",
126 .id = -1,
127 .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources),
128 .resource = &omap3evm_smsc911x_resources[0],
129 .dev = {
130 .platform_data = &smsc911x_config,
131 },
132}; 112};
133 113
134static inline void __init omap3evm_init_smsc911x(void) 114static inline void __init omap3evm_init_smsc911x(void)
135{ 115{
136 int eth_cs, eth_rst;
137 struct clk *l3ck; 116 struct clk *l3ck;
138 unsigned int rate; 117 unsigned int rate;
139 118
140 if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
141 eth_rst = OMAP3EVM_GEN1_ETHR_GPIO_RST;
142 else
143 eth_rst = OMAP3EVM_GEN2_ETHR_GPIO_RST;
144
145 eth_cs = OMAP3EVM_SMSC911X_CS;
146
147 l3ck = clk_get(NULL, "l3_ck"); 119 l3ck = clk_get(NULL, "l3_ck");
148 if (IS_ERR(l3ck)) 120 if (IS_ERR(l3ck))
149 rate = 100000000; 121 rate = 100000000;
@@ -152,33 +124,13 @@ static inline void __init omap3evm_init_smsc911x(void)
152 124
153 /* Configure ethernet controller reset gpio */ 125 /* Configure ethernet controller reset gpio */
154 if (cpu_is_omap3430()) { 126 if (cpu_is_omap3430()) {
155 if (gpio_request(eth_rst, "SMSC911x gpio") < 0) { 127 if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
156 pr_err(KERN_ERR "Failed to request %d for smsc911x\n", 128 smsc911x_cfg.gpio_reset = OMAP3EVM_GEN1_ETHR_GPIO_RST;
157 eth_rst); 129 else
158 return; 130 smsc911x_cfg.gpio_reset = OMAP3EVM_GEN2_ETHR_GPIO_RST;
159 }
160
161 if (gpio_direction_output(eth_rst, 1) < 0) {
162 pr_err(KERN_ERR "Failed to set direction of %d for" \
163 " smsc911x\n", eth_rst);
164 return;
165 }
166 /* reset pulse to ethernet controller*/
167 usleep_range(150, 220);
168 gpio_set_value(eth_rst, 0);
169 usleep_range(150, 220);
170 gpio_set_value(eth_rst, 1);
171 usleep_range(1, 2);
172 }
173
174 if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
175 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
176 OMAP3EVM_ETHR_GPIO_IRQ);
177 return;
178 } 131 }
179 132
180 gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); 133 gpmc_smsc911x_init(&smsc911x_cfg);
181 platform_device_register(&omap3evm_smsc911x_device);
182} 134}
183 135
184#else 136#else
@@ -197,6 +149,15 @@ static inline void __init omap3evm_init_smsc911x(void) { return; }
197#define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 149#define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210
198#define OMAP3EVM_DVI_PANEL_EN_GPIO 199 150#define OMAP3EVM_DVI_PANEL_EN_GPIO 199
199 151
152static struct gpio omap3_evm_dss_gpios[] __initdata = {
153 { OMAP3EVM_LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH, "lcd_panel_resb" },
154 { OMAP3EVM_LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH, "lcd_panel_ini" },
155 { OMAP3EVM_LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW, "lcd_panel_qvga" },
156 { OMAP3EVM_LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH, "lcd_panel_lr" },
157 { OMAP3EVM_LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH, "lcd_panel_ud" },
158 { OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW, "lcd_panel_envdd" },
159};
160
200static int lcd_enabled; 161static int lcd_enabled;
201static int dvi_enabled; 162static int dvi_enabled;
202 163
@@ -204,61 +165,10 @@ static void __init omap3_evm_display_init(void)
204{ 165{
205 int r; 166 int r;
206 167
207 r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb"); 168 r = gpio_request_array(omap3_evm_dss_gpios,
208 if (r) { 169 ARRAY_SIZE(omap3_evm_dss_gpios));
209 printk(KERN_ERR "failed to get lcd_panel_resb\n"); 170 if (r)
210 return; 171 printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
211 }
212 gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1);
213
214 r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini");
215 if (r) {
216 printk(KERN_ERR "failed to get lcd_panel_ini\n");
217 goto err_1;
218 }
219 gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1);
220
221 r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga");
222 if (r) {
223 printk(KERN_ERR "failed to get lcd_panel_qvga\n");
224 goto err_2;
225 }
226 gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0);
227
228 r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr");
229 if (r) {
230 printk(KERN_ERR "failed to get lcd_panel_lr\n");
231 goto err_3;
232 }
233 gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1);
234
235 r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud");
236 if (r) {
237 printk(KERN_ERR "failed to get lcd_panel_ud\n");
238 goto err_4;
239 }
240 gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1);
241
242 r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd");
243 if (r) {
244 printk(KERN_ERR "failed to get lcd_panel_envdd\n");
245 goto err_5;
246 }
247 gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0);
248
249 return;
250
251err_5:
252 gpio_free(OMAP3EVM_LCD_PANEL_UD);
253err_4:
254 gpio_free(OMAP3EVM_LCD_PANEL_LR);
255err_3:
256 gpio_free(OMAP3EVM_LCD_PANEL_QVGA);
257err_2:
258 gpio_free(OMAP3EVM_LCD_PANEL_INI);
259err_1:
260 gpio_free(OMAP3EVM_LCD_PANEL_RESB);
261
262} 172}
263 173
264static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) 174static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev)
@@ -448,7 +358,7 @@ static struct platform_device leds_gpio = {
448static int omap3evm_twl_gpio_setup(struct device *dev, 358static int omap3evm_twl_gpio_setup(struct device *dev,
449 unsigned gpio, unsigned ngpio) 359 unsigned gpio, unsigned ngpio)
450{ 360{
451 int r; 361 int r, lcd_bl_en;
452 362
453 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 363 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
454 omap_mux_init_gpio(63, OMAP_PIN_INPUT); 364 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
@@ -465,16 +375,14 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
465 */ 375 */
466 376
467 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ 377 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
468 r = gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); 378 lcd_bl_en = get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2 ?
469 if (!r) 379 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
470 r = gpio_direction_output(gpio + TWL4030_GPIO_MAX, 380 r = gpio_request_one(gpio + TWL4030_GPIO_MAX, lcd_bl_en, "EN_LCD_BKL");
471 (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) ? 1 : 0);
472 if (r) 381 if (r)
473 printk(KERN_ERR "failed to get/set lcd_bkl gpio\n"); 382 printk(KERN_ERR "failed to get/set lcd_bkl gpio\n");
474 383
475 /* gpio + 7 == DVI Enable */ 384 /* gpio + 7 == DVI Enable */
476 gpio_request(gpio + 7, "EN_DVI"); 385 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
477 gpio_direction_output(gpio + 7, 0);
478 386
479 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 387 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
480 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 388 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -652,78 +560,18 @@ static struct twl4030_platform_data omap3evm_twldata = {
652 .vdac = &omap3_evm_vdac, 560 .vdac = &omap3_evm_vdac,
653 .vpll2 = &omap3_evm_vpll2, 561 .vpll2 = &omap3_evm_vpll2,
654 .vio = &omap3evm_vio, 562 .vio = &omap3evm_vio,
655}; 563 .vmmc1 = &omap3evm_vmmc1,
656 564 .vsim = &omap3evm_vsim,
657static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
658 {
659 I2C_BOARD_INFO("twl4030", 0x48),
660 .flags = I2C_CLIENT_WAKE,
661 .irq = INT_34XX_SYS_NIRQ,
662 .platform_data = &omap3evm_twldata,
663 },
664}; 565};
665 566
666static int __init omap3_evm_i2c_init(void) 567static int __init omap3_evm_i2c_init(void)
667{ 568{
668 /* 569 omap3_pmic_init("twl4030", &omap3evm_twldata);
669 * REVISIT: These entries can be set in omap3evm_twl_data
670 * after a merge with MFD tree
671 */
672 omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
673 omap3evm_twldata.vsim = &omap3evm_vsim;
674
675 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
676 ARRAY_SIZE(omap3evm_i2c_boardinfo));
677 omap_register_i2c_bus(2, 400, NULL, 0); 570 omap_register_i2c_bus(2, 400, NULL, 0);
678 omap_register_i2c_bus(3, 400, NULL, 0); 571 omap_register_i2c_bus(3, 400, NULL, 0);
679 return 0; 572 return 0;
680} 573}
681 574
682static void ads7846_dev_init(void)
683{
684 if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
685 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
686
687 gpio_direction_input(OMAP3_EVM_TS_GPIO);
688 gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310);
689}
690
691static int ads7846_get_pendown_state(void)
692{
693 return !gpio_get_value(OMAP3_EVM_TS_GPIO);
694}
695
696static struct ads7846_platform_data ads7846_config = {
697 .x_max = 0x0fff,
698 .y_max = 0x0fff,
699 .x_plate_ohms = 180,
700 .pressure_max = 255,
701 .debounce_max = 10,
702 .debounce_tol = 3,
703 .debounce_rep = 1,
704 .get_pendown_state = ads7846_get_pendown_state,
705 .keep_vref_on = 1,
706 .settle_delay_usecs = 150,
707 .wakeup = true,
708};
709
710static struct omap2_mcspi_device_config ads7846_mcspi_config = {
711 .turbo_mode = 0,
712 .single_channel = 1, /* 0: slave, 1: master */
713};
714
715static struct spi_board_info omap3evm_spi_board_info[] = {
716 [0] = {
717 .modalias = "ads7846",
718 .bus_num = 1,
719 .chip_select = 0,
720 .max_speed_hz = 1500000,
721 .controller_data = &ads7846_mcspi_config,
722 .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO),
723 .platform_data = &ads7846_config,
724 },
725};
726
727static struct omap_board_config_kernel omap3_evm_config[] __initdata = { 575static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
728}; 576};
729 577
@@ -825,6 +673,11 @@ static struct omap_musb_board_data musb_board_data = {
825 .power = 100, 673 .power = 100,
826}; 674};
827 675
676static struct gpio omap3_evm_ehci_gpios[] __initdata = {
677 { OMAP3_EVM_EHCI_VBUS, GPIOF_OUT_INIT_HIGH, "enable EHCI VBUS" },
678 { OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW, "select EHCI port" },
679};
680
828static void __init omap3_evm_init(void) 681static void __init omap3_evm_init(void)
829{ 682{
830 omap3_evm_get_revision(); 683 omap3_evm_get_revision();
@@ -841,9 +694,6 @@ static void __init omap3_evm_init(void)
841 694
842 omap_display_init(&omap3_evm_dss_data); 695 omap_display_init(&omap3_evm_dss_data);
843 696
844 spi_register_board_info(omap3evm_spi_board_info,
845 ARRAY_SIZE(omap3evm_spi_board_info));
846
847 omap_serial_init(); 697 omap_serial_init();
848 698
849 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ 699 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
@@ -851,16 +701,12 @@ static void __init omap3_evm_init(void)
851 701
852 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { 702 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
853 /* enable EHCI VBUS using GPIO22 */ 703 /* enable EHCI VBUS using GPIO22 */
854 omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP); 704 omap_mux_init_gpio(OMAP3_EVM_EHCI_VBUS, OMAP_PIN_INPUT_PULLUP);
855 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
856 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
857 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
858
859 /* Select EHCI port on main board */ 705 /* Select EHCI port on main board */
860 omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP); 706 omap_mux_init_gpio(OMAP3_EVM_EHCI_SELECT,
861 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); 707 OMAP_PIN_INPUT_PULLUP);
862 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); 708 gpio_request_array(omap3_evm_ehci_gpios,
863 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); 709 ARRAY_SIZE(omap3_evm_ehci_gpios));
864 710
865 /* setup EHCI phy reset config */ 711 /* setup EHCI phy reset config */
866 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); 712 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
@@ -876,7 +722,7 @@ static void __init omap3_evm_init(void)
876 } 722 }
877 usb_musb_init(&musb_board_data); 723 usb_musb_init(&musb_board_data);
878 usbhs_init(&usbhs_bdata); 724 usbhs_init(&usbhs_bdata);
879 ads7846_dev_init(); 725 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
880 omap3evm_init_smsc911x(); 726 omap3evm_init_smsc911x();
881 omap3_evm_display_init(); 727 omap3_evm_display_init();
882 728