aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-omap3evm.c
diff options
context:
space:
mode:
authorMike Rapoport <mike@compulab.co.il>2011-04-16 18:29:30 -0400
committerTony Lindgren <tony@atomide.com>2011-04-20 11:54:09 -0400
commit21b42731e6ab1ccbbe9ad1b639c5d78eecad8432 (patch)
treec5ce62ea21eafb712c8d20fa0b683b1ec2e4e737 /arch/arm/mach-omap2/board-omap3evm.c
parentf0949f73a75093fb86d6554101bd79046633a297 (diff)
omap: convert boards that use SMSC911x to use gpmc-smsc911x
Convert boards that use SMSC911x to use gpmc-smsc911x. Also allocate struct platform_device dynamically. Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> [tony@atomide.com: folded in a fix from Igor Grindberg] Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3evm.c')
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c71
1 files changed, 11 insertions, 60 deletions
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 5a1a916e5cc8..3fc85c6fc559 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -101,49 +101,20 @@ static void __init omap3_evm_get_revision(void)
101} 101}
102 102
103#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 103#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
104static struct resource omap3evm_smsc911x_resources[] = { 104#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 105
117static struct smsc911x_platform_config smsc911x_config = { 106static struct omap_smsc911x_platform_data smsc911x_cfg = {
118 .phy_interface = PHY_INTERFACE_MODE_MII, 107 .cs = OMAP3EVM_SMSC911X_CS,
119 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 108 .gpio_irq = OMAP3EVM_ETHR_GPIO_IRQ,
120 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 109 .gpio_reset = -EINVAL,
121 .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), 110 .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}; 111};
133 112
134static inline void __init omap3evm_init_smsc911x(void) 113static inline void __init omap3evm_init_smsc911x(void)
135{ 114{
136 int eth_cs, eth_rst;
137 struct clk *l3ck; 115 struct clk *l3ck;
138 unsigned int rate; 116 unsigned int rate;
139 117
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"); 118 l3ck = clk_get(NULL, "l3_ck");
148 if (IS_ERR(l3ck)) 119 if (IS_ERR(l3ck))
149 rate = 100000000; 120 rate = 100000000;
@@ -152,33 +123,13 @@ static inline void __init omap3evm_init_smsc911x(void)
152 123
153 /* Configure ethernet controller reset gpio */ 124 /* Configure ethernet controller reset gpio */
154 if (cpu_is_omap3430()) { 125 if (cpu_is_omap3430()) {
155 if (gpio_request(eth_rst, "SMSC911x gpio") < 0) { 126 if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
156 pr_err(KERN_ERR "Failed to request %d for smsc911x\n", 127 smsc911x_cfg.gpio_reset = OMAP3EVM_GEN1_ETHR_GPIO_RST;
157 eth_rst); 128 else
158 return; 129 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 } 130 }
179 131
180 gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); 132 gpmc_smsc911x_init(&smsc911x_cfg);
181 platform_device_register(&omap3evm_smsc911x_device);
182} 133}
183 134
184#else 135#else