diff options
author | Mike Rapoport <mike@compulab.co.il> | 2011-04-16 18:29:30 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-04-20 11:54:09 -0400 |
commit | 21b42731e6ab1ccbbe9ad1b639c5d78eecad8432 (patch) | |
tree | c5ce62ea21eafb712c8d20fa0b683b1ec2e4e737 /arch/arm/mach-omap2/board-ldp.c | |
parent | f0949f73a75093fb86d6554101bd79046633a297 (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-ldp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-ldp.c | 65 |
1 files changed, 9 insertions, 56 deletions
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index e2ba77957a8c..ea9f049f9965 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c | |||
@@ -43,6 +43,7 @@ | |||
43 | 43 | ||
44 | #include <asm/delay.h> | 44 | #include <asm/delay.h> |
45 | #include <plat/usb.h> | 45 | #include <plat/usb.h> |
46 | #include <plat/gpmc-smsc911x.h> | ||
46 | 47 | ||
47 | #include "board-flash.h" | 48 | #include "board-flash.h" |
48 | #include "mux.h" | 49 | #include "mux.h" |
@@ -54,36 +55,6 @@ | |||
54 | #define DEBUG_BASE 0x08000000 | 55 | #define DEBUG_BASE 0x08000000 |
55 | #define LDP_ETHR_START DEBUG_BASE | 56 | #define LDP_ETHR_START DEBUG_BASE |
56 | 57 | ||
57 | static struct resource ldp_smsc911x_resources[] = { | ||
58 | [0] = { | ||
59 | .start = LDP_ETHR_START, | ||
60 | .end = LDP_ETHR_START + SZ_4K, | ||
61 | .flags = IORESOURCE_MEM, | ||
62 | }, | ||
63 | [1] = { | ||
64 | .start = 0, | ||
65 | .end = 0, | ||
66 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | ||
67 | }, | ||
68 | }; | ||
69 | |||
70 | static struct smsc911x_platform_config ldp_smsc911x_config = { | ||
71 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
72 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | ||
73 | .flags = SMSC911X_USE_32BIT, | ||
74 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
75 | }; | ||
76 | |||
77 | static struct platform_device ldp_smsc911x_device = { | ||
78 | .name = "smsc911x", | ||
79 | .id = -1, | ||
80 | .num_resources = ARRAY_SIZE(ldp_smsc911x_resources), | ||
81 | .resource = ldp_smsc911x_resources, | ||
82 | .dev = { | ||
83 | .platform_data = &ldp_smsc911x_config, | ||
84 | }, | ||
85 | }; | ||
86 | |||
87 | static uint32_t board_keymap[] = { | 58 | static uint32_t board_keymap[] = { |
88 | KEY(0, 0, KEY_1), | 59 | KEY(0, 0, KEY_1), |
89 | KEY(1, 0, KEY_2), | 60 | KEY(1, 0, KEY_2), |
@@ -246,33 +217,16 @@ static struct spi_board_info ldp_spi_board_info[] __initdata = { | |||
246 | }, | 217 | }, |
247 | }; | 218 | }; |
248 | 219 | ||
220 | static struct omap_smsc911x_platform_data smsc911x_cfg = { | ||
221 | .cs = LDP_SMSC911X_CS, | ||
222 | .gpio_irq = LDP_SMSC911X_GPIO, | ||
223 | .gpio_reset = -EINVAL, | ||
224 | .flags = SMSC911X_USE_32BIT, | ||
225 | }; | ||
226 | |||
249 | static inline void __init ldp_init_smsc911x(void) | 227 | static inline void __init ldp_init_smsc911x(void) |
250 | { | 228 | { |
251 | int eth_cs; | 229 | gpmc_smsc911x_init(&smsc911x_cfg); |
252 | unsigned long cs_mem_base; | ||
253 | int eth_gpio = 0; | ||
254 | |||
255 | eth_cs = LDP_SMSC911X_CS; | ||
256 | |||
257 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | ||
258 | printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n"); | ||
259 | return; | ||
260 | } | ||
261 | |||
262 | ldp_smsc911x_resources[0].start = cs_mem_base + 0x0; | ||
263 | ldp_smsc911x_resources[0].end = cs_mem_base + 0xff; | ||
264 | udelay(100); | ||
265 | |||
266 | eth_gpio = LDP_SMSC911X_GPIO; | ||
267 | |||
268 | ldp_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio); | ||
269 | |||
270 | if (gpio_request(eth_gpio, "smsc911x irq") < 0) { | ||
271 | printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", | ||
272 | eth_gpio); | ||
273 | return; | ||
274 | } | ||
275 | gpio_direction_input(eth_gpio); | ||
276 | } | 230 | } |
277 | 231 | ||
278 | static struct platform_device ldp_lcd_device = { | 232 | static struct platform_device ldp_lcd_device = { |
@@ -389,7 +343,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = { | |||
389 | }; | 343 | }; |
390 | 344 | ||
391 | static struct platform_device *ldp_devices[] __initdata = { | 345 | static struct platform_device *ldp_devices[] __initdata = { |
392 | &ldp_smsc911x_device, | ||
393 | &ldp_lcd_device, | 346 | &ldp_lcd_device, |
394 | &ldp_gpio_keys_device, | 347 | &ldp_gpio_keys_device, |
395 | }; | 348 | }; |