aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-zoom-debugboard.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-zoom-debugboard.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-zoom-debugboard.c')
-rw-r--r--arch/arm/mach-omap2/board-zoom-debugboard.c56
1 files changed, 6 insertions, 50 deletions
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
index 007ebdc6c993..2ee9ab92e0c1 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -15,6 +15,7 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16 16
17#include <plat/gpmc.h> 17#include <plat/gpmc.h>
18#include <plat/gpmc-smsc911x.h>
18 19
19#include <mach/board-zoom.h> 20#include <mach/board-zoom.h>
20 21
@@ -26,60 +27,16 @@
26#define DEBUG_BASE 0x08000000 27#define DEBUG_BASE 0x08000000
27#define ZOOM_ETHR_START DEBUG_BASE 28#define ZOOM_ETHR_START DEBUG_BASE
28 29
29static struct resource zoom_smsc911x_resources[] = { 30static struct omap_smsc911x_platform_data zoom_smsc911x_cfg = {
30 [0] = { 31 .cs = ZOOM_SMSC911X_CS,
31 .start = ZOOM_ETHR_START, 32 .gpio_irq = ZOOM_SMSC911X_GPIO,
32 .end = ZOOM_ETHR_START + SZ_4K, 33 .gpio_reset = -EINVAL,
33 .flags = IORESOURCE_MEM,
34 },
35 [1] = {
36 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
37 },
38};
39
40static struct smsc911x_platform_config zoom_smsc911x_config = {
41 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
42 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
43 .flags = SMSC911X_USE_32BIT, 34 .flags = SMSC911X_USE_32BIT,
44 .phy_interface = PHY_INTERFACE_MODE_MII,
45};
46
47static struct platform_device zoom_smsc911x_device = {
48 .name = "smsc911x",
49 .id = -1,
50 .num_resources = ARRAY_SIZE(zoom_smsc911x_resources),
51 .resource = zoom_smsc911x_resources,
52 .dev = {
53 .platform_data = &zoom_smsc911x_config,
54 },
55}; 35};
56 36
57static inline void __init zoom_init_smsc911x(void) 37static inline void __init zoom_init_smsc911x(void)
58{ 38{
59 int eth_cs; 39 gpmc_smsc911x_init(&zoom_smsc911x_cfg);
60 unsigned long cs_mem_base;
61 int eth_gpio = 0;
62
63 eth_cs = ZOOM_SMSC911X_CS;
64
65 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
66 printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n");
67 return;
68 }
69
70 zoom_smsc911x_resources[0].start = cs_mem_base + 0x0;
71 zoom_smsc911x_resources[0].end = cs_mem_base + 0xff;
72
73 eth_gpio = ZOOM_SMSC911X_GPIO;
74
75 zoom_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
76
77 if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
78 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
79 eth_gpio);
80 return;
81 }
82 gpio_direction_input(eth_gpio);
83} 40}
84 41
85static struct plat_serial8250_port serial_platform_data[] = { 42static struct plat_serial8250_port serial_platform_data[] = {
@@ -150,7 +107,6 @@ static inline int omap_zoom_debugboard_detect(void)
150} 107}
151 108
152static struct platform_device *zoom_devices[] __initdata = { 109static struct platform_device *zoom_devices[] __initdata = {
153 &zoom_smsc911x_device,
154 &zoom_debugboard_serial_device, 110 &zoom_debugboard_serial_device,
155}; 111};
156 112