aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-cm-t35.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-cm-t35.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-cm-t35.c')
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c84
1 files changed, 13 insertions, 71 deletions
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 02a12b41c0ff..7c70f56d628c 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -66,86 +66,28 @@
66 66
67#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 67#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
68#include <linux/smsc911x.h> 68#include <linux/smsc911x.h>
69#include <plat/gpmc-smsc911x.h>
69 70
70static struct smsc911x_platform_config cm_t35_smsc911x_config = { 71static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg = {
71 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
72 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
73 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
74 .phy_interface = PHY_INTERFACE_MODE_MII,
75};
76
77static struct resource cm_t35_smsc911x_resources[] = {
78 {
79 .flags = IORESOURCE_MEM,
80 },
81 {
82 .start = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
83 .end = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
84 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
85 },
86};
87
88static struct platform_device cm_t35_smsc911x_device = {
89 .name = "smsc911x",
90 .id = 0, 72 .id = 0,
91 .num_resources = ARRAY_SIZE(cm_t35_smsc911x_resources), 73 .cs = CM_T35_SMSC911X_CS,
92 .resource = cm_t35_smsc911x_resources, 74 .gpio_irq = CM_T35_SMSC911X_GPIO,
93 .dev = { 75 .gpio_reset = -EINVAL,
94 .platform_data = &cm_t35_smsc911x_config, 76 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
95 },
96};
97
98static struct resource sb_t35_smsc911x_resources[] = {
99 {
100 .flags = IORESOURCE_MEM,
101 },
102 {
103 .start = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
104 .end = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
105 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
106 },
107}; 77};
108 78
109static struct platform_device sb_t35_smsc911x_device = { 79static struct omap_smsc911x_platform_data sb_t35_smsc911x_cfg = {
110 .name = "smsc911x",
111 .id = 1, 80 .id = 1,
112 .num_resources = ARRAY_SIZE(sb_t35_smsc911x_resources), 81 .cs = SB_T35_SMSC911X_CS,
113 .resource = sb_t35_smsc911x_resources, 82 .gpio_irq = SB_T35_SMSC911X_GPIO,
114 .dev = { 83 .gpio_reset = -EINVAL,
115 .platform_data = &cm_t35_smsc911x_config, 84 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
116 },
117}; 85};
118 86
119static void __init cm_t35_init_smsc911x(struct platform_device *dev,
120 int cs, int irq_gpio)
121{
122 unsigned long cs_mem_base;
123
124 if (gpmc_cs_request(cs, SZ_16M, &cs_mem_base) < 0) {
125 pr_err("CM-T35: Failed request for GPMC mem for smsc911x\n");
126 return;
127 }
128
129 dev->resource[0].start = cs_mem_base + 0x0;
130 dev->resource[0].end = cs_mem_base + 0xff;
131
132 if ((gpio_request(irq_gpio, "ETH IRQ") == 0) &&
133 (gpio_direction_input(irq_gpio) == 0)) {
134 gpio_export(irq_gpio, 0);
135 } else {
136 pr_err("CM-T35: could not obtain gpio for SMSC911X IRQ\n");
137 return;
138 }
139
140 platform_device_register(dev);
141}
142
143static void __init cm_t35_init_ethernet(void) 87static void __init cm_t35_init_ethernet(void)
144{ 88{
145 cm_t35_init_smsc911x(&cm_t35_smsc911x_device, 89 gpmc_smsc911x_init(&cm_t35_smsc911x_cfg);
146 CM_T35_SMSC911X_CS, CM_T35_SMSC911X_GPIO); 90 gpmc_smsc911x_init(&sb_t35_smsc911x_cfg);
147 cm_t35_init_smsc911x(&sb_t35_smsc911x_device,
148 SB_T35_SMSC911X_CS, SB_T35_SMSC911X_GPIO);
149} 91}
150#else 92#else
151static inline void __init cm_t35_init_ethernet(void) { return; } 93static inline void __init cm_t35_init_ethernet(void) { return; }