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 | |
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')
-rw-r--r-- | arch/arm/mach-omap2/board-cm-t35.c | 84 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-igep0020.c | 53 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-ldp.c | 65 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-omap3evm.c | 71 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-omap3stalker.c | 48 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-overo.c | 106 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-zoom-debugboard.c | 56 | ||||
-rw-r--r-- | arch/arm/mach-omap2/gpmc-smsc911x.c | 16 |
8 files changed, 72 insertions, 427 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 | ||
70 | static struct smsc911x_platform_config cm_t35_smsc911x_config = { | 71 | static 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 | |||
77 | static 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 | |||
88 | static 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 | |||
98 | static 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 | ||
109 | static struct platform_device sb_t35_smsc911x_device = { | 79 | static 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 | ||
119 | static 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 | |||
143 | static void __init cm_t35_init_ethernet(void) | 87 | static 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 |
151 | static inline void __init cm_t35_init_ethernet(void) { return; } | 93 | static inline void __init cm_t35_init_ethernet(void) { return; } |
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 34cf982b9679..5b9bde74b6bf 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -192,57 +192,18 @@ static void __init igep2_flash_init(void) {} | |||
192 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | 192 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
193 | 193 | ||
194 | #include <linux/smsc911x.h> | 194 | #include <linux/smsc911x.h> |
195 | #include <plat/gpmc-smsc911x.h> | ||
195 | 196 | ||
196 | static struct smsc911x_platform_config igep2_smsc911x_config = { | 197 | static struct omap_smsc911x_platform_data smsc911x_cfg = { |
197 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | 198 | .cs = IGEP2_SMSC911X_CS, |
198 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | 199 | .gpio_irq = IGEP2_SMSC911X_GPIO, |
199 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS , | 200 | .gpio_reset = -EINVAL, |
200 | .phy_interface = PHY_INTERFACE_MODE_MII, | 201 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, |
201 | }; | ||
202 | |||
203 | static struct resource igep2_smsc911x_resources[] = { | ||
204 | { | ||
205 | .flags = IORESOURCE_MEM, | ||
206 | }, | ||
207 | { | ||
208 | .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO), | ||
209 | .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO), | ||
210 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | ||
211 | }, | ||
212 | }; | ||
213 | |||
214 | static struct platform_device igep2_smsc911x_device = { | ||
215 | .name = "smsc911x", | ||
216 | .id = 0, | ||
217 | .num_resources = ARRAY_SIZE(igep2_smsc911x_resources), | ||
218 | .resource = igep2_smsc911x_resources, | ||
219 | .dev = { | ||
220 | .platform_data = &igep2_smsc911x_config, | ||
221 | }, | ||
222 | }; | 202 | }; |
223 | 203 | ||
224 | static inline void __init igep2_init_smsc911x(void) | 204 | static inline void __init igep2_init_smsc911x(void) |
225 | { | 205 | { |
226 | unsigned long cs_mem_base; | 206 | gpmc_smsc911x_init(&smsc911x_cfg); |
227 | |||
228 | if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { | ||
229 | pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n"); | ||
230 | gpmc_cs_free(IGEP2_SMSC911X_CS); | ||
231 | return; | ||
232 | } | ||
233 | |||
234 | igep2_smsc911x_resources[0].start = cs_mem_base + 0x0; | ||
235 | igep2_smsc911x_resources[0].end = cs_mem_base + 0xff; | ||
236 | |||
237 | if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) && | ||
238 | (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) { | ||
239 | gpio_export(IGEP2_SMSC911X_GPIO, 0); | ||
240 | } else { | ||
241 | pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n"); | ||
242 | return; | ||
243 | } | ||
244 | |||
245 | platform_device_register(&igep2_smsc911x_device); | ||
246 | } | 207 | } |
247 | 208 | ||
248 | #else | 209 | #else |
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 | }; |
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) |
104 | static 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 | ||
117 | static struct smsc911x_platform_config smsc911x_config = { | 106 | static 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 | |||
124 | static 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 | ||
134 | static inline void __init omap3evm_init_smsc911x(void) | 113 | static 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 |
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index a6e0b9161c99..848016c6a245 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.c | |||
@@ -56,50 +56,25 @@ | |||
56 | #include "timer-gp.h" | 56 | #include "timer-gp.h" |
57 | 57 | ||
58 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | 58 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
59 | #include <plat/gpmc-smsc911x.h> | ||
60 | |||
59 | #define OMAP3STALKER_ETHR_START 0x2c000000 | 61 | #define OMAP3STALKER_ETHR_START 0x2c000000 |
60 | #define OMAP3STALKER_ETHR_SIZE 1024 | 62 | #define OMAP3STALKER_ETHR_SIZE 1024 |
61 | #define OMAP3STALKER_ETHR_GPIO_IRQ 19 | 63 | #define OMAP3STALKER_ETHR_GPIO_IRQ 19 |
62 | #define OMAP3STALKER_SMC911X_CS 5 | 64 | #define OMAP3STALKER_SMC911X_CS 5 |
63 | 65 | ||
64 | static struct resource omap3stalker_smsc911x_resources[] = { | 66 | static struct omap_smsc911x_platform_data smsc911x_cfg = { |
65 | [0] = { | 67 | .cs = OMAP3STALKER_SMC911X_CS, |
66 | .start = OMAP3STALKER_ETHR_START, | 68 | .gpio_irq = OMAP3STALKER_ETHR_GPIO_IRQ, |
67 | .end = | 69 | .gpio_reset = -EINVAL, |
68 | (OMAP3STALKER_ETHR_START + OMAP3STALKER_ETHR_SIZE - 1), | ||
69 | .flags = IORESOURCE_MEM, | ||
70 | }, | ||
71 | [1] = { | ||
72 | .start = OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ), | ||
73 | .end = OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ), | ||
74 | .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW), | ||
75 | }, | ||
76 | }; | ||
77 | |||
78 | static struct smsc911x_platform_config smsc911x_config = { | ||
79 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
80 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
81 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | ||
82 | .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), | 70 | .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), |
83 | }; | 71 | }; |
84 | 72 | ||
85 | static struct platform_device omap3stalker_smsc911x_device = { | ||
86 | .name = "smsc911x", | ||
87 | .id = -1, | ||
88 | .num_resources = ARRAY_SIZE(omap3stalker_smsc911x_resources), | ||
89 | .resource = &omap3stalker_smsc911x_resources[0], | ||
90 | .dev = { | ||
91 | .platform_data = &smsc911x_config, | ||
92 | }, | ||
93 | }; | ||
94 | |||
95 | static inline void __init omap3stalker_init_eth(void) | 73 | static inline void __init omap3stalker_init_eth(void) |
96 | { | 74 | { |
97 | int eth_cs; | ||
98 | struct clk *l3ck; | 75 | struct clk *l3ck; |
99 | unsigned int rate; | 76 | unsigned int rate; |
100 | 77 | ||
101 | eth_cs = OMAP3STALKER_SMC911X_CS; | ||
102 | |||
103 | l3ck = clk_get(NULL, "l3_ck"); | 78 | l3ck = clk_get(NULL, "l3_ck"); |
104 | if (IS_ERR(l3ck)) | 79 | if (IS_ERR(l3ck)) |
105 | rate = 100000000; | 80 | rate = 100000000; |
@@ -107,16 +82,7 @@ static inline void __init omap3stalker_init_eth(void) | |||
107 | rate = clk_get_rate(l3ck); | 82 | rate = clk_get_rate(l3ck); |
108 | 83 | ||
109 | omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP); | 84 | omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP); |
110 | if (gpio_request(OMAP3STALKER_ETHR_GPIO_IRQ, "SMC911x irq") < 0) { | 85 | gpmc_smsc911x_init(&smsc911x_cfg); |
111 | printk(KERN_ERR | ||
112 | "Failed to request GPIO%d for smc911x IRQ\n", | ||
113 | OMAP3STALKER_ETHR_GPIO_IRQ); | ||
114 | return; | ||
115 | } | ||
116 | |||
117 | gpio_direction_input(OMAP3STALKER_ETHR_GPIO_IRQ); | ||
118 | |||
119 | platform_device_register(&omap3stalker_smsc911x_device); | ||
120 | } | 86 | } |
121 | 87 | ||
122 | #else | 88 | #else |
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 | ||
150 | static struct resource overo_smsc911x_resources[] = { | 151 | static 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 | |||
160 | static 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 | |||
170 | static 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 | |||
177 | static 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 | ||
187 | static struct platform_device overo_smsc911x2_device = { | 159 | static 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 | |||
197 | static struct platform_device *smsc911x_devices[] = { | ||
198 | &overo_smsc911x_device, | ||
199 | &overo_smsc911x2_device, | ||
200 | }; | 165 | }; |
201 | 166 | ||
202 | static inline void __init overo_init_smsc911x(void) | 167 | static 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 |
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 | ||
29 | static struct resource zoom_smsc911x_resources[] = { | 30 | static 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 | |||
40 | static 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 | |||
47 | static 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 | ||
57 | static inline void __init zoom_init_smsc911x(void) | 37 | static 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 | ||
85 | static struct plat_serial8250_port serial_platform_data[] = { | 42 | static struct plat_serial8250_port serial_platform_data[] = { |
@@ -150,7 +107,6 @@ static inline int omap_zoom_debugboard_detect(void) | |||
150 | } | 107 | } |
151 | 108 | ||
152 | static struct platform_device *zoom_devices[] __initdata = { | 109 | static struct platform_device *zoom_devices[] __initdata = { |
153 | &zoom_smsc911x_device, | ||
154 | &zoom_debugboard_serial_device, | 110 | &zoom_debugboard_serial_device, |
155 | }; | 111 | }; |
156 | 112 | ||
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c index b331f3cd38f1..d30293a36494 100644 --- a/arch/arm/mach-omap2/gpmc-smsc911x.c +++ b/arch/arm/mach-omap2/gpmc-smsc911x.c | |||
@@ -41,16 +41,6 @@ static struct smsc911x_platform_config gpmc_smsc911x_config = { | |||
41 | .flags = SMSC911X_USE_16BIT, | 41 | .flags = SMSC911X_USE_16BIT, |
42 | }; | 42 | }; |
43 | 43 | ||
44 | static struct platform_device gpmc_smsc911x_device = { | ||
45 | .name = "smsc911x", | ||
46 | .id = -1, | ||
47 | .num_resources = ARRAY_SIZE(gpmc_smsc911x_resources), | ||
48 | .resource = gpmc_smsc911x_resources, | ||
49 | .dev = { | ||
50 | .platform_data = &gpmc_smsc911x_config, | ||
51 | }, | ||
52 | }; | ||
53 | |||
54 | /* | 44 | /* |
55 | * Initialize smsc911x device connected to the GPMC. Note that we | 45 | * Initialize smsc911x device connected to the GPMC. Note that we |
56 | * assume that pin multiplexing is done in the board-*.c file, | 46 | * assume that pin multiplexing is done in the board-*.c file, |
@@ -58,6 +48,7 @@ static struct platform_device gpmc_smsc911x_device = { | |||
58 | */ | 48 | */ |
59 | void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data) | 49 | void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data) |
60 | { | 50 | { |
51 | struct platform_device *pdev; | ||
61 | unsigned long cs_mem_base; | 52 | unsigned long cs_mem_base; |
62 | int ret; | 53 | int ret; |
63 | 54 | ||
@@ -97,7 +88,10 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data) | |||
97 | if (gpmc_cfg->flags) | 88 | if (gpmc_cfg->flags) |
98 | gpmc_smsc911x_config.flags = gpmc_cfg->flags; | 89 | gpmc_smsc911x_config.flags = gpmc_cfg->flags; |
99 | 90 | ||
100 | if (platform_device_register(&gpmc_smsc911x_device) < 0) { | 91 | pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id, |
92 | gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources), | ||
93 | &gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config)); | ||
94 | if (!pdev) { | ||
101 | printk(KERN_ERR "Unable to register smsc911x device\n"); | 95 | printk(KERN_ERR "Unable to register smsc911x device\n"); |
102 | gpio_free(gpmc_cfg->gpio_reset); | 96 | gpio_free(gpmc_cfg->gpio_reset); |
103 | goto free2; | 97 | goto free2; |