diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3evm.c')
-rw-r--r-- | arch/arm/mach-omap2/board-omap3evm.c | 179 |
1 files changed, 160 insertions, 19 deletions
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 25ca5f6a0d3d..5efc2e9068db 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -22,34 +22,74 @@ | |||
22 | #include <linux/input.h> | 22 | #include <linux/input.h> |
23 | #include <linux/input/matrix_keypad.h> | 23 | #include <linux/input/matrix_keypad.h> |
24 | #include <linux/leds.h> | 24 | #include <linux/leds.h> |
25 | #include <linux/interrupt.h> | ||
25 | 26 | ||
26 | #include <linux/spi/spi.h> | 27 | #include <linux/spi/spi.h> |
27 | #include <linux/spi/ads7846.h> | 28 | #include <linux/spi/ads7846.h> |
28 | #include <linux/i2c/twl4030.h> | 29 | #include <linux/i2c/twl4030.h> |
29 | #include <linux/usb/otg.h> | 30 | #include <linux/usb/otg.h> |
31 | #include <linux/smsc911x.h> | ||
32 | |||
33 | #include <linux/regulator/machine.h> | ||
30 | 34 | ||
31 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
32 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
33 | #include <asm/mach/arch.h> | 37 | #include <asm/mach/arch.h> |
34 | #include <asm/mach/map.h> | 38 | #include <asm/mach/map.h> |
35 | 39 | ||
36 | #include <mach/board.h> | 40 | #include <plat/board.h> |
37 | #include <mach/mux.h> | 41 | #include <plat/mux.h> |
38 | #include <mach/usb.h> | 42 | #include <plat/usb.h> |
39 | #include <mach/common.h> | 43 | #include <plat/common.h> |
40 | #include <mach/mcspi.h> | 44 | #include <plat/mcspi.h> |
41 | 45 | ||
42 | #include "sdram-micron-mt46h32m32lf-6.h" | 46 | #include "sdram-micron-mt46h32m32lf-6.h" |
43 | #include "mmc-twl4030.h" | 47 | #include "mmc-twl4030.h" |
44 | 48 | ||
45 | #define OMAP3_EVM_TS_GPIO 175 | 49 | #define OMAP3_EVM_TS_GPIO 175 |
50 | #define OMAP3_EVM_EHCI_VBUS 22 | ||
51 | #define OMAP3_EVM_EHCI_SELECT 61 | ||
46 | 52 | ||
47 | #define OMAP3EVM_ETHR_START 0x2c000000 | 53 | #define OMAP3EVM_ETHR_START 0x2c000000 |
48 | #define OMAP3EVM_ETHR_SIZE 1024 | 54 | #define OMAP3EVM_ETHR_SIZE 1024 |
55 | #define OMAP3EVM_ETHR_ID_REV 0x50 | ||
49 | #define OMAP3EVM_ETHR_GPIO_IRQ 176 | 56 | #define OMAP3EVM_ETHR_GPIO_IRQ 176 |
50 | #define OMAP3EVM_SMC911X_CS 5 | 57 | #define OMAP3EVM_SMSC911X_CS 5 |
58 | |||
59 | static u8 omap3_evm_version; | ||
60 | |||
61 | u8 get_omap3_evm_rev(void) | ||
62 | { | ||
63 | return omap3_evm_version; | ||
64 | } | ||
65 | EXPORT_SYMBOL(get_omap3_evm_rev); | ||
66 | |||
67 | static void __init omap3_evm_get_revision(void) | ||
68 | { | ||
69 | void __iomem *ioaddr; | ||
70 | unsigned int smsc_id; | ||
71 | |||
72 | /* Ethernet PHY ID is stored at ID_REV register */ | ||
73 | ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K); | ||
74 | if (!ioaddr) | ||
75 | return; | ||
76 | smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000; | ||
77 | iounmap(ioaddr); | ||
78 | |||
79 | switch (smsc_id) { | ||
80 | /*SMSC9115 chipset*/ | ||
81 | case 0x01150000: | ||
82 | omap3_evm_version = OMAP3EVM_BOARD_GEN_1; | ||
83 | break; | ||
84 | /*SMSC 9220 chipset*/ | ||
85 | case 0x92200000: | ||
86 | default: | ||
87 | omap3_evm_version = OMAP3EVM_BOARD_GEN_2; | ||
88 | } | ||
89 | } | ||
51 | 90 | ||
52 | static struct resource omap3evm_smc911x_resources[] = { | 91 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
92 | static struct resource omap3evm_smsc911x_resources[] = { | ||
53 | [0] = { | 93 | [0] = { |
54 | .start = OMAP3EVM_ETHR_START, | 94 | .start = OMAP3EVM_ETHR_START, |
55 | .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1), | 95 | .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1), |
@@ -58,24 +98,34 @@ static struct resource omap3evm_smc911x_resources[] = { | |||
58 | [1] = { | 98 | [1] = { |
59 | .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), | 99 | .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), |
60 | .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), | 100 | .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), |
61 | .flags = IORESOURCE_IRQ, | 101 | .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW), |
62 | }, | 102 | }, |
63 | }; | 103 | }; |
64 | 104 | ||
65 | static struct platform_device omap3evm_smc911x_device = { | 105 | static struct smsc911x_platform_config smsc911x_config = { |
66 | .name = "smc911x", | 106 | .phy_interface = PHY_INTERFACE_MODE_MII, |
107 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
108 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | ||
109 | .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), | ||
110 | }; | ||
111 | |||
112 | static struct platform_device omap3evm_smsc911x_device = { | ||
113 | .name = "smsc911x", | ||
67 | .id = -1, | 114 | .id = -1, |
68 | .num_resources = ARRAY_SIZE(omap3evm_smc911x_resources), | 115 | .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources), |
69 | .resource = &omap3evm_smc911x_resources[0], | 116 | .resource = &omap3evm_smsc911x_resources[0], |
117 | .dev = { | ||
118 | .platform_data = &smsc911x_config, | ||
119 | }, | ||
70 | }; | 120 | }; |
71 | 121 | ||
72 | static inline void __init omap3evm_init_smc911x(void) | 122 | static inline void __init omap3evm_init_smsc911x(void) |
73 | { | 123 | { |
74 | int eth_cs; | 124 | int eth_cs; |
75 | struct clk *l3ck; | 125 | struct clk *l3ck; |
76 | unsigned int rate; | 126 | unsigned int rate; |
77 | 127 | ||
78 | eth_cs = OMAP3EVM_SMC911X_CS; | 128 | eth_cs = OMAP3EVM_SMSC911X_CS; |
79 | 129 | ||
80 | l3ck = clk_get(NULL, "l3_ck"); | 130 | l3ck = clk_get(NULL, "l3_ck"); |
81 | if (IS_ERR(l3ck)) | 131 | if (IS_ERR(l3ck)) |
@@ -83,15 +133,58 @@ static inline void __init omap3evm_init_smc911x(void) | |||
83 | else | 133 | else |
84 | rate = clk_get_rate(l3ck); | 134 | rate = clk_get_rate(l3ck); |
85 | 135 | ||
86 | if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMC911x irq") < 0) { | 136 | if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) { |
87 | printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n", | 137 | printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", |
88 | OMAP3EVM_ETHR_GPIO_IRQ); | 138 | OMAP3EVM_ETHR_GPIO_IRQ); |
89 | return; | 139 | return; |
90 | } | 140 | } |
91 | 141 | ||
92 | gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); | 142 | gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); |
143 | platform_device_register(&omap3evm_smsc911x_device); | ||
93 | } | 144 | } |
94 | 145 | ||
146 | #else | ||
147 | static inline void __init omap3evm_init_smsc911x(void) { return; } | ||
148 | #endif | ||
149 | |||
150 | static struct regulator_consumer_supply omap3evm_vmmc1_supply = { | ||
151 | .supply = "vmmc", | ||
152 | }; | ||
153 | |||
154 | static struct regulator_consumer_supply omap3evm_vsim_supply = { | ||
155 | .supply = "vmmc_aux", | ||
156 | }; | ||
157 | |||
158 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ | ||
159 | static struct regulator_init_data omap3evm_vmmc1 = { | ||
160 | .constraints = { | ||
161 | .min_uV = 1850000, | ||
162 | .max_uV = 3150000, | ||
163 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
164 | | REGULATOR_MODE_STANDBY, | ||
165 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
166 | | REGULATOR_CHANGE_MODE | ||
167 | | REGULATOR_CHANGE_STATUS, | ||
168 | }, | ||
169 | .num_consumer_supplies = 1, | ||
170 | .consumer_supplies = &omap3evm_vmmc1_supply, | ||
171 | }; | ||
172 | |||
173 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ | ||
174 | static struct regulator_init_data omap3evm_vsim = { | ||
175 | .constraints = { | ||
176 | .min_uV = 1800000, | ||
177 | .max_uV = 3000000, | ||
178 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
179 | | REGULATOR_MODE_STANDBY, | ||
180 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
181 | | REGULATOR_CHANGE_MODE | ||
182 | | REGULATOR_CHANGE_STATUS, | ||
183 | }, | ||
184 | .num_consumer_supplies = 1, | ||
185 | .consumer_supplies = &omap3evm_vsim_supply, | ||
186 | }; | ||
187 | |||
95 | static struct twl4030_hsmmc_info mmc[] = { | 188 | static struct twl4030_hsmmc_info mmc[] = { |
96 | { | 189 | { |
97 | .mmc = 1, | 190 | .mmc = 1, |
@@ -134,6 +227,10 @@ static int omap3evm_twl_gpio_setup(struct device *dev, | |||
134 | mmc[0].gpio_cd = gpio + 0; | 227 | mmc[0].gpio_cd = gpio + 0; |
135 | twl4030_mmc_init(mmc); | 228 | twl4030_mmc_init(mmc); |
136 | 229 | ||
230 | /* link regulators to MMC adapters */ | ||
231 | omap3evm_vmmc1_supply.dev = mmc[0].dev; | ||
232 | omap3evm_vsim_supply.dev = mmc[0].dev; | ||
233 | |||
137 | /* | 234 | /* |
138 | * Most GPIOs are for USB OTG. Some are mostly sent to | 235 | * Most GPIOs are for USB OTG. Some are mostly sent to |
139 | * the P2 connector; notably LEDA for the LCD backlight. | 236 | * the P2 connector; notably LEDA for the LCD backlight. |
@@ -226,6 +323,13 @@ static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = { | |||
226 | 323 | ||
227 | static int __init omap3_evm_i2c_init(void) | 324 | static int __init omap3_evm_i2c_init(void) |
228 | { | 325 | { |
326 | /* | ||
327 | * REVISIT: These entries can be set in omap3evm_twl_data | ||
328 | * after a merge with MFD tree | ||
329 | */ | ||
330 | omap3evm_twldata.vmmc1 = &omap3evm_vmmc1; | ||
331 | omap3evm_twldata.vsim = &omap3evm_vsim; | ||
332 | |||
229 | omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo, | 333 | omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo, |
230 | ARRAY_SIZE(omap3evm_i2c_boardinfo)); | 334 | ARRAY_SIZE(omap3evm_i2c_boardinfo)); |
231 | omap_register_i2c_bus(2, 400, NULL, 0); | 335 | omap_register_i2c_bus(2, 400, NULL, 0); |
@@ -299,16 +403,29 @@ static void __init omap3_evm_init_irq(void) | |||
299 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL); | 403 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL); |
300 | omap_init_irq(); | 404 | omap_init_irq(); |
301 | omap_gpio_init(); | 405 | omap_gpio_init(); |
302 | omap3evm_init_smc911x(); | ||
303 | } | 406 | } |
304 | 407 | ||
305 | static struct platform_device *omap3_evm_devices[] __initdata = { | 408 | static struct platform_device *omap3_evm_devices[] __initdata = { |
306 | &omap3_evm_lcd_device, | 409 | &omap3_evm_lcd_device, |
307 | &omap3evm_smc911x_device, | 410 | }; |
411 | |||
412 | static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | ||
413 | |||
414 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
415 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | ||
416 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
417 | |||
418 | .phy_reset = true, | ||
419 | /* PHY reset GPIO will be runtime programmed based on EVM version */ | ||
420 | .reset_gpio_port[0] = -EINVAL, | ||
421 | .reset_gpio_port[1] = -EINVAL, | ||
422 | .reset_gpio_port[2] = -EINVAL | ||
308 | }; | 423 | }; |
309 | 424 | ||
310 | static void __init omap3_evm_init(void) | 425 | static void __init omap3_evm_init(void) |
311 | { | 426 | { |
427 | omap3_evm_get_revision(); | ||
428 | |||
312 | omap3_evm_i2c_init(); | 429 | omap3_evm_i2c_init(); |
313 | 430 | ||
314 | platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices)); | 431 | platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices)); |
@@ -321,8 +438,32 @@ static void __init omap3_evm_init(void) | |||
321 | /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ | 438 | /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ |
322 | usb_nop_xceiv_register(); | 439 | usb_nop_xceiv_register(); |
323 | #endif | 440 | #endif |
441 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { | ||
442 | /* enable EHCI VBUS using GPIO22 */ | ||
443 | omap_cfg_reg(AF9_34XX_GPIO22); | ||
444 | gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS"); | ||
445 | gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0); | ||
446 | gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1); | ||
447 | |||
448 | /* Select EHCI port on main board */ | ||
449 | omap_cfg_reg(U3_34XX_GPIO61); | ||
450 | gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); | ||
451 | gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); | ||
452 | gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); | ||
453 | |||
454 | /* setup EHCI phy reset config */ | ||
455 | omap_cfg_reg(AH14_34XX_GPIO21); | ||
456 | ehci_pdata.reset_gpio_port[1] = 21; | ||
457 | |||
458 | } else { | ||
459 | /* setup EHCI phy reset on MDC */ | ||
460 | omap_cfg_reg(AF4_34XX_GPIO135_OUT); | ||
461 | ehci_pdata.reset_gpio_port[1] = 135; | ||
462 | } | ||
324 | usb_musb_init(); | 463 | usb_musb_init(); |
464 | usb_ehci_init(&ehci_pdata); | ||
325 | ads7846_dev_init(); | 465 | ads7846_dev_init(); |
466 | omap3evm_init_smsc911x(); | ||
326 | } | 467 | } |
327 | 468 | ||
328 | static void __init omap3_evm_map_io(void) | 469 | static void __init omap3_evm_map_io(void) |
@@ -334,7 +475,7 @@ static void __init omap3_evm_map_io(void) | |||
334 | MACHINE_START(OMAP3EVM, "OMAP3 EVM") | 475 | MACHINE_START(OMAP3EVM, "OMAP3 EVM") |
335 | /* Maintainer: Syed Mohammed Khasim - Texas Instruments */ | 476 | /* Maintainer: Syed Mohammed Khasim - Texas Instruments */ |
336 | .phys_io = 0x48000000, | 477 | .phys_io = 0x48000000, |
337 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, | 478 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
338 | .boot_params = 0x80000100, | 479 | .boot_params = 0x80000100, |
339 | .map_io = omap3_evm_map_io, | 480 | .map_io = omap3_evm_map_io, |
340 | .init_irq = omap3_evm_init_irq, | 481 | .init_irq = omap3_evm_init_irq, |