aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-overo.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-overo.c')
-rw-r--r--arch/arm/mach-omap2/board-overo.c106
1 files changed, 14 insertions, 92 deletions
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 59ca33326b8c..165e1faea1b7 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -146,106 +146,28 @@ static inline void __init overo_ads7846_init(void) { return; }
146#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 146#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
147 147
148#include <linux/smsc911x.h> 148#include <linux/smsc911x.h>
149#include <plat/gpmc-smsc911x.h>
149 150
150static struct resource overo_smsc911x_resources[] = { 151static struct omap_smsc911x_platform_data smsc911x_cfg = {
151 {
152 .name = "smsc911x-memory",
153 .flags = IORESOURCE_MEM,
154 },
155 {
156 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
157 },
158};
159
160static struct resource overo_smsc911x2_resources[] = {
161 {
162 .name = "smsc911x2-memory",
163 .flags = IORESOURCE_MEM,
164 },
165 {
166 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
167 },
168};
169
170static struct smsc911x_platform_config overo_smsc911x_config = {
171 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
172 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
173 .flags = SMSC911X_USE_32BIT ,
174 .phy_interface = PHY_INTERFACE_MODE_MII,
175};
176
177static struct platform_device overo_smsc911x_device = {
178 .name = "smsc911x",
179 .id = 0, 152 .id = 0,
180 .num_resources = ARRAY_SIZE(overo_smsc911x_resources), 153 .cs = OVERO_SMSC911X_CS,
181 .resource = overo_smsc911x_resources, 154 .gpio_irq = OVERO_SMSC911X_GPIO,
182 .dev = { 155 .gpio_reset = -EINVAL,
183 .platform_data = &overo_smsc911x_config, 156 .flags = SMSC911X_USE_32BIT,
184 },
185}; 157};
186 158
187static struct platform_device overo_smsc911x2_device = { 159static struct omap_smsc911x_platform_data smsc911x2_cfg = {
188 .name = "smsc911x",
189 .id = 1, 160 .id = 1,
190 .num_resources = ARRAY_SIZE(overo_smsc911x2_resources), 161 .cs = OVERO_SMSC911X2_CS,
191 .resource = overo_smsc911x2_resources, 162 .gpio_irq = OVERO_SMSC911X2_GPIO,
192 .dev = { 163 .gpio_reset = -EINVAL,
193 .platform_data = &overo_smsc911x_config, 164 .flags = SMSC911X_USE_32BIT,
194 },
195};
196
197static struct platform_device *smsc911x_devices[] = {
198 &overo_smsc911x_device,
199 &overo_smsc911x2_device,
200}; 165};
201 166
202static inline void __init overo_init_smsc911x(void) 167static void __init overo_init_smsc911x(void)
203{ 168{
204 unsigned long cs_mem_base, cs_mem_base2; 169 gpmc_smsc911x_init(&smsc911x_cfg);
205 170 gpmc_smsc911x_init(&smsc911x2_cfg);
206 /* set up first smsc911x chip */
207
208 if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
209 printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n");
210 return;
211 }
212
213 overo_smsc911x_resources[0].start = cs_mem_base + 0x0;
214 overo_smsc911x_resources[0].end = cs_mem_base + 0xff;
215
216 if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
217 (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) {
218 gpio_export(OVERO_SMSC911X_GPIO, 0);
219 } else {
220 printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n");
221 return;
222 }
223
224 overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO);
225 overo_smsc911x_resources[1].end = 0;
226
227 /* set up second smsc911x chip */
228
229 if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) {
230 printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n");
231 return;
232 }
233
234 overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0;
235 overo_smsc911x2_resources[0].end = cs_mem_base2 + 0xff;
236
237 if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) &&
238 (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) {
239 gpio_export(OVERO_SMSC911X2_GPIO, 0);
240 } else {
241 printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n");
242 return;
243 }
244
245 overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO);
246 overo_smsc911x2_resources[1].end = 0;
247
248 platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices));
249} 171}
250 172
251#else 173#else