diff options
author | Abraham Arce <x0066660@ti.com> | 2010-05-14 15:05:26 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-05-20 14:17:51 -0400 |
commit | b2aa5e5757b2fd33c47fc52dfd6d5b0dbcda6492 (patch) | |
tree | bf9955b3e24f8985cb69bd4a33026dee20a198d6 /arch | |
parent | 8ebeb545a875b1961ede82800711ab31d2ce5782 (diff) |
OMAP4: Ethernet: KS8851 Board Support
Enable Micrel KS8851 SPI network chip for OMAP4430
Signed-off-by: Abraham Arce <x0066660@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/board-4430sdp.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index b88f28c5814b..be7a7868d210 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/usb/otg.h> | 20 | #include <linux/usb/otg.h> |
21 | #include <linux/spi/spi.h> | ||
21 | 22 | ||
22 | #include <mach/hardware.h> | 23 | #include <mach/hardware.h> |
23 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
@@ -32,6 +33,75 @@ | |||
32 | #include <asm/hardware/gic.h> | 33 | #include <asm/hardware/gic.h> |
33 | #include <asm/hardware/cache-l2x0.h> | 34 | #include <asm/hardware/cache-l2x0.h> |
34 | 35 | ||
36 | #define ETH_KS8851_IRQ 34 | ||
37 | #define ETH_KS8851_POWER_ON 48 | ||
38 | #define ETH_KS8851_QUART 138 | ||
39 | |||
40 | static struct spi_board_info sdp4430_spi_board_info[] __initdata = { | ||
41 | { | ||
42 | .modalias = "ks8851", | ||
43 | .bus_num = 1, | ||
44 | .chip_select = 0, | ||
45 | .max_speed_hz = 24000000, | ||
46 | .irq = ETH_KS8851_IRQ, | ||
47 | }, | ||
48 | }; | ||
49 | |||
50 | static int omap_ethernet_init(void) | ||
51 | { | ||
52 | int status; | ||
53 | |||
54 | /* Request of GPIO lines */ | ||
55 | |||
56 | status = gpio_request(ETH_KS8851_POWER_ON, "eth_power"); | ||
57 | if (status) { | ||
58 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON); | ||
59 | return status; | ||
60 | } | ||
61 | |||
62 | status = gpio_request(ETH_KS8851_QUART, "quart"); | ||
63 | if (status) { | ||
64 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART); | ||
65 | goto error1; | ||
66 | } | ||
67 | |||
68 | status = gpio_request(ETH_KS8851_IRQ, "eth_irq"); | ||
69 | if (status) { | ||
70 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ); | ||
71 | goto error2; | ||
72 | } | ||
73 | |||
74 | /* Configuration of requested GPIO lines */ | ||
75 | |||
76 | status = gpio_direction_output(ETH_KS8851_POWER_ON, 1); | ||
77 | if (status) { | ||
78 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ); | ||
79 | goto error3; | ||
80 | } | ||
81 | |||
82 | status = gpio_direction_output(ETH_KS8851_QUART, 1); | ||
83 | if (status) { | ||
84 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART); | ||
85 | goto error3; | ||
86 | } | ||
87 | |||
88 | status = gpio_direction_input(ETH_KS8851_IRQ); | ||
89 | if (status) { | ||
90 | pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ); | ||
91 | goto error3; | ||
92 | } | ||
93 | |||
94 | return 0; | ||
95 | |||
96 | error3: | ||
97 | gpio_free(ETH_KS8851_IRQ); | ||
98 | error2: | ||
99 | gpio_free(ETH_KS8851_QUART); | ||
100 | error1: | ||
101 | gpio_free(ETH_KS8851_POWER_ON); | ||
102 | return status; | ||
103 | } | ||
104 | |||
35 | static struct platform_device sdp4430_lcd_device = { | 105 | static struct platform_device sdp4430_lcd_device = { |
36 | .name = "sdp4430_lcd", | 106 | .name = "sdp4430_lcd", |
37 | .id = -1, | 107 | .id = -1, |
@@ -113,6 +183,8 @@ static struct omap_musb_board_data musb_board_data = { | |||
113 | 183 | ||
114 | static void __init omap_4430sdp_init(void) | 184 | static void __init omap_4430sdp_init(void) |
115 | { | 185 | { |
186 | int status; | ||
187 | |||
116 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); | 188 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); |
117 | omap_serial_init(); | 189 | omap_serial_init(); |
118 | /* OMAP4 SDP uses internal transceiver so register nop transceiver */ | 190 | /* OMAP4 SDP uses internal transceiver so register nop transceiver */ |
@@ -120,6 +192,15 @@ static void __init omap_4430sdp_init(void) | |||
120 | /* FIXME: allow multi-omap to boot until musb is updated for omap4 */ | 192 | /* FIXME: allow multi-omap to boot until musb is updated for omap4 */ |
121 | if (!cpu_is_omap44xx()) | 193 | if (!cpu_is_omap44xx()) |
122 | usb_musb_init(&musb_board_data); | 194 | usb_musb_init(&musb_board_data); |
195 | |||
196 | status = omap_ethernet_init(); | ||
197 | if (status) { | ||
198 | pr_err("Ethernet initialization failed: %d\n", status); | ||
199 | } else { | ||
200 | sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ); | ||
201 | spi_register_board_info(sdp4430_spi_board_info, | ||
202 | ARRAY_SIZE(sdp4430_spi_board_info)); | ||
203 | } | ||
123 | } | 204 | } |
124 | 205 | ||
125 | static void __init omap_4430sdp_map_io(void) | 206 | static void __init omap_4430sdp_map_io(void) |