Enable Micrel KS8851 SPI network chip for OMAP4430

Signed-off-by: Abraham Arce <[email protected]>
---
 arch/arm/mach-omap2/board-4430sdp.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index b88f28c..801c2a7 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -18,6 +18,7 @@
 #include <linux/io.h>
 #include <linux/gpio.h>
 #include <linux/usb/otg.h>
+#include <linux/spi/spi.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -32,6 +33,30 @@
 #include <asm/hardware/gic.h>
 #include <asm/hardware/cache-l2x0.h>
 
+#define ETHERNET_KS8851_IRQ            34
+#define ETHERNET_KS8851_POWER_ENABLE   48
+#define ETHERNET_KS8851_QUART          138
+
+static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
+       {
+               .modalias               = "ks8851",
+               .bus_num                = 1,
+               .chip_select            = 0,
+               .max_speed_hz           = 24000000,
+               .irq                    = ETHERNET_KS8851_IRQ,
+       },
+};
+
+static void omap_ethernet_init(void)
+{
+       gpio_request(ETHERNET_KS8851_POWER_ENABLE, "ethernet");
+       gpio_direction_output(ETHERNET_KS8851_POWER_ENABLE, 1);
+       gpio_request(ETHERNET_KS8851_QUART, "quart");
+       gpio_direction_output(ETHERNET_KS8851_QUART, 1);
+       gpio_request(ETHERNET_KS8851_IRQ, "ks8851");
+       gpio_direction_input(ETHERNET_KS8851_IRQ);
+}
+
 static struct platform_device sdp4430_lcd_device = {
        .name           = "sdp4430_lcd",
        .id             = -1,
@@ -120,6 +145,11 @@ static void __init omap_4430sdp_init(void)
        /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
        if (!cpu_is_omap44xx())
                usb_musb_init(&musb_board_data);
+
+       omap_ethernet_init();
+       sdp4430_spi_board_info[0].irq = gpio_to_irq(ETHERNET_KS8851_IRQ);
+       spi_register_board_info(sdp4430_spi_board_info,
+                       ARRAY_SIZE(sdp4430_spi_board_info));
 }
 
 static void __init omap_4430sdp_map_io(void)
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to