diff options
author | Tony Lindgren <tony@atomide.com> | 2009-05-28 16:23:52 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-05-28 16:23:52 -0400 |
commit | 1a48e1575188d4023b3428b623caeefe8c599e79 (patch) | |
tree | 50bdac2821ab3c9f769c204cd15bc303f08d6670 /arch/arm/mach-omap2/board-3430sdp.c | |
parent | aa62e90fe0700c037675926fff9f75b0b1c00d78 (diff) |
ARM: OMAP2/3: Add generic smc91x support when connected to GPMC
Convert the board-rx51 smc91x code to be generic and make
the boards to use it. This allows future recalculation of the
timings when the source clock gets scaled.
Also correct the rx51 interrupt to be IORESOURCE_IRQ_HIGHLEVEL.
Thanks to Paul Walmsley <paul@pwsan.com> for better GPMC timing
calculations.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-3430sdp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-3430sdp.c | 84 |
1 files changed, 28 insertions, 56 deletions
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index ed9274972122..0e6369583958 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -39,15 +39,12 @@ | |||
39 | 39 | ||
40 | #include <mach/control.h> | 40 | #include <mach/control.h> |
41 | #include <mach/keypad.h> | 41 | #include <mach/keypad.h> |
42 | #include <mach/gpmc-smc91x.h> | ||
42 | 43 | ||
43 | #include "mmc-twl4030.h" | 44 | #include "mmc-twl4030.h" |
44 | 45 | ||
45 | #define CONFIG_DISABLE_HFCLK 1 | 46 | #define CONFIG_DISABLE_HFCLK 1 |
46 | 47 | ||
47 | #define SDP3430_ETHR_GPIO_IRQ_SDPV1 29 | ||
48 | #define SDP3430_ETHR_GPIO_IRQ_SDPV2 6 | ||
49 | #define SDP3430_SMC91X_CS 3 | ||
50 | |||
51 | #define SDP3430_TS_GPIO_IRQ_SDPV1 3 | 48 | #define SDP3430_TS_GPIO_IRQ_SDPV1 3 |
52 | #define SDP3430_TS_GPIO_IRQ_SDPV2 2 | 49 | #define SDP3430_TS_GPIO_IRQ_SDPV2 2 |
53 | 50 | ||
@@ -56,24 +53,6 @@ | |||
56 | 53 | ||
57 | #define TWL4030_MSECURE_GPIO 22 | 54 | #define TWL4030_MSECURE_GPIO 22 |
58 | 55 | ||
59 | static struct resource sdp3430_smc91x_resources[] = { | ||
60 | [0] = { | ||
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 platform_device sdp3430_smc91x_device = { | ||
71 | .name = "smc91x", | ||
72 | .id = -1, | ||
73 | .num_resources = ARRAY_SIZE(sdp3430_smc91x_resources), | ||
74 | .resource = sdp3430_smc91x_resources, | ||
75 | }; | ||
76 | |||
77 | static int sdp3430_keymap[] = { | 56 | static int sdp3430_keymap[] = { |
78 | KEY(0, 0, KEY_LEFT), | 57 | KEY(0, 0, KEY_LEFT), |
79 | KEY(0, 1, KEY_RIGHT), | 58 | KEY(0, 1, KEY_RIGHT), |
@@ -184,48 +163,14 @@ static struct regulator_consumer_supply sdp3430_vdvi_supply = { | |||
184 | }; | 163 | }; |
185 | 164 | ||
186 | static struct platform_device *sdp3430_devices[] __initdata = { | 165 | static struct platform_device *sdp3430_devices[] __initdata = { |
187 | &sdp3430_smc91x_device, | ||
188 | &sdp3430_lcd_device, | 166 | &sdp3430_lcd_device, |
189 | }; | 167 | }; |
190 | 168 | ||
191 | static inline void __init sdp3430_init_smc91x(void) | ||
192 | { | ||
193 | int eth_cs; | ||
194 | unsigned long cs_mem_base; | ||
195 | int eth_gpio = 0; | ||
196 | |||
197 | eth_cs = SDP3430_SMC91X_CS; | ||
198 | |||
199 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | ||
200 | printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); | ||
201 | return; | ||
202 | } | ||
203 | |||
204 | sdp3430_smc91x_resources[0].start = cs_mem_base + 0x300; | ||
205 | sdp3430_smc91x_resources[0].end = cs_mem_base + 0x30f; | ||
206 | udelay(100); | ||
207 | |||
208 | if (omap_rev() > OMAP3430_REV_ES1_0) | ||
209 | eth_gpio = SDP3430_ETHR_GPIO_IRQ_SDPV2; | ||
210 | else | ||
211 | eth_gpio = SDP3430_ETHR_GPIO_IRQ_SDPV1; | ||
212 | |||
213 | sdp3430_smc91x_resources[1].start = gpio_to_irq(eth_gpio); | ||
214 | |||
215 | if (gpio_request(eth_gpio, "SMC91x irq") < 0) { | ||
216 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", | ||
217 | eth_gpio); | ||
218 | return; | ||
219 | } | ||
220 | gpio_direction_input(eth_gpio); | ||
221 | } | ||
222 | |||
223 | static void __init omap_3430sdp_init_irq(void) | 169 | static void __init omap_3430sdp_init_irq(void) |
224 | { | 170 | { |
225 | omap2_init_common_hw(NULL); | 171 | omap2_init_common_hw(NULL); |
226 | omap_init_irq(); | 172 | omap_init_irq(); |
227 | omap_gpio_init(); | 173 | omap_gpio_init(); |
228 | sdp3430_init_smc91x(); | ||
229 | } | 174 | } |
230 | 175 | ||
231 | static struct omap_uart_config sdp3430_uart_config __initdata = { | 176 | static struct omap_uart_config sdp3430_uart_config __initdata = { |
@@ -506,6 +451,32 @@ static int __init omap3430_i2c_init(void) | |||
506 | return 0; | 451 | return 0; |
507 | } | 452 | } |
508 | 453 | ||
454 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) | ||
455 | |||
456 | static struct omap_smc91x_platform_data board_smc91x_data = { | ||
457 | .cs = 3, | ||
458 | .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 | | ||
459 | IORESOURCE_IRQ_LOWLEVEL, | ||
460 | }; | ||
461 | |||
462 | static void __init board_smc91x_init(void) | ||
463 | { | ||
464 | if (omap_rev() > OMAP3430_REV_ES1_0) | ||
465 | board_smc91x_data.gpio_irq = 6; | ||
466 | else | ||
467 | board_smc91x_data.gpio_irq = 29; | ||
468 | |||
469 | gpmc_smc91x_init(&board_smc91x_data); | ||
470 | } | ||
471 | |||
472 | #else | ||
473 | |||
474 | static inline void board_smc91x_init(void) | ||
475 | { | ||
476 | } | ||
477 | |||
478 | #endif | ||
479 | |||
509 | static void __init omap_3430sdp_init(void) | 480 | static void __init omap_3430sdp_init(void) |
510 | { | 481 | { |
511 | omap3430_i2c_init(); | 482 | omap3430_i2c_init(); |
@@ -522,6 +493,7 @@ static void __init omap_3430sdp_init(void) | |||
522 | ads7846_dev_init(); | 493 | ads7846_dev_init(); |
523 | omap_serial_init(); | 494 | omap_serial_init(); |
524 | usb_musb_init(); | 495 | usb_musb_init(); |
496 | board_smc91x_init(); | ||
525 | } | 497 | } |
526 | 498 | ||
527 | static void __init omap_3430sdp_map_io(void) | 499 | static void __init omap_3430sdp_map_io(void) |