From 27a4c659c1c665b877c032d3409b0c593cd0463b Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Mon, 10 Oct 2011 11:18:08 -0500 Subject: [PATCH 04/13] expansion: add zippy2 Signed-off-by: Robert Nelson --- arch/arm/mach-omap2/board-omap3beagle.c | 51 +++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 6ffafd6..259e6e7 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -201,6 +201,48 @@ static void __init omap3beagle_enc28j60_init(void) static inline void __init omap3beagle_enc28j60_init(void) { return; } #endif +#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) + +#include +#include + +#define OMAP3BEAGLE_GPIO_KS8851_IRQ 157 + +static struct omap2_mcspi_device_config ks8851_spi_chip_info = { + .turbo_mode = 0, + .single_channel = 1, /* 0: slave, 1: master */ +}; + +static struct spi_board_info omap3beagle_zippy2_spi_board_info[] __initdata = { + { + .modalias = "ks8851", + .bus_num = 4, + .chip_select = 0, + .max_speed_hz = 36000000, + .controller_data = &ks8851_spi_chip_info, + }, +}; + +static void __init omap3beagle_ks8851_init(void) +{ + if ((gpio_request(OMAP3BEAGLE_GPIO_KS8851_IRQ, "KS8851_IRQ") == 0) && + (gpio_direction_input(OMAP3BEAGLE_GPIO_KS8851_IRQ) == 0)) { + gpio_export(OMAP3BEAGLE_GPIO_KS8851_IRQ, 0); + omap3beagle_zippy2_spi_board_info[0].irq = OMAP_GPIO_IRQ(OMAP3BEAGLE_GPIO_KS8851_IRQ); + irq_set_irq_type(omap3beagle_zippy2_spi_board_info[0].irq, IRQ_TYPE_EDGE_FALLING); + } else { + printk(KERN_ERR "could not obtain gpio for KS8851_IRQ\n"); + return; + } + + spi_register_board_info(omap3beagle_zippy2_spi_board_info, + ARRAY_SIZE(omap3beagle_zippy2_spi_board_info)); +} + +#else +static inline void __init omap3beagle_ks8851_init(void) { return; } +#endif + static struct mtd_partition omap3beagle_nand_partitions[] = { /* All the partition sizes are listed in terms of NAND block size */ { @@ -618,6 +660,15 @@ static void __init omap3_beagle_init(void) mmc[1].gpio_cd = 162; } + if(!strcmp(expansionboard_name, "zippy2")) + { + printk(KERN_INFO "Beagle expansionboard: initializing ks_8851\n"); + omap3beagle_ks8851_init(); + printk(KERN_INFO "Beagle expansionboard: assigning GPIO 141 and 162 to MMC1\n"); + mmc[1].gpio_wp = 141; + mmc[1].gpio_cd = 162; + } + usb_musb_init(NULL); usbhs_init(&usbhs_bdata); omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions, -- 1.7.7.4