[ARM] JIVE: Add SPI bus definitions for LCD controller
authorBen Dooks <ben-linux@fluff.org>
Thu, 3 Jul 2008 10:24:32 +0000 (11:24 +0100)
committerBen Dooks <ben-linux@fluff.org>
Thu, 3 Jul 2008 15:51:25 +0000 (16:51 +0100)
Add the definitions for the VGG2432A4 intelligent
LCD display conneected via an GPIO-based SPI bus
on the Logitech Jive.

Signed-of-by: Ben Dooks <ben-linux@fluff.org>
arch/arm/mach-s3c2412/mach-jive.c

index b528ed93773c348f1e081ff43d9f35ef62af8199..ad6b942a2a8f8a127eed4b2d1146ae152cc5918f 100644 (file)
@@ -20,6 +20,8 @@
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
 
+#include <linux/spi/spi.h>
+
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 
@@ -34,6 +36,7 @@
 #include <asm/arch/regs-gpio.h>
 #include <asm/arch/regs-mem.h>
 #include <asm/arch/regs-lcd.h>
+#include <asm/arch/spi-gpio.h>
 #include <asm/arch/fb.h>
 
 #include <asm/mach-types.h>
@@ -346,12 +349,48 @@ struct s3c2410fb_mach_info jive_lcd_config = {
                           S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
 };
 
+/* LCD SPI support */
+
+static void jive_lcd_spi_chipselect(struct s3c2410_spigpio_info *spi, int cs)
+{
+       s3c2410_gpio_setpin(S3C2410_GPB7, cs ? 0 : 1);
+}
+
+static struct s3c2410_spigpio_info jive_lcd_spi = {
+       .bus_num        = 1,
+       .pin_clk        = S3C2410_GPG8,
+       .pin_mosi       = S3C2410_GPB8,
+       .chip_select    = jive_lcd_spi_chipselect,
+};
+
+static struct platform_device jive_device_lcdspi = {
+       .name           = "s3c24xx-spi-gpio",
+       .id             = 1,
+       .num_resources  = 0,
+       .dev.platform_data = &jive_lcd_spi,
+};
+
+/* JIVE SPI devices. */
+
+
+static struct spi_board_info __initdata jive_spi_devs[] = {
+       [0] = {
+               .modalias       = "VGG2432A4",
+               .bus_num        = 1,
+               .chip_select    = 0,
+               .mode           = SPI_MODE_3,   /* CPOL=1, CPHA=1 */
+               .max_speed_hz   = 100000,
+       },
+};
+
+
 static struct platform_device *jive_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_rtc,
        &s3c_device_wdt,
        &s3c_device_i2c,
        &s3c_device_lcd,
+       &jive_device_lcdspi,
        &s3c_device_nand,
        &s3c_device_usbgadget,
 };
@@ -502,6 +541,20 @@ static void __init jive_machine_init(void)
 
        s3c_device_nand.dev.platform_data = &jive_nand_info;
 
+       /* initialise the spi */
+
+       s3c2410_gpio_setpin(S3C2410_GPG13, 0);
+       s3c2410_gpio_cfgpin(S3C2410_GPG13, S3C2410_GPIO_OUTPUT);
+
+       s3c2410_gpio_setpin(S3C2410_GPB7, 1);
+       s3c2410_gpio_cfgpin(S3C2410_GPB7, S3C2410_GPIO_OUTPUT);
+
+       s3c2410_gpio_setpin(S3C2410_GPB6, 0);
+       s3c2410_gpio_cfgpin(S3C2410_GPB6, S3C2410_GPIO_OUTPUT);
+
+       s3c2410_gpio_setpin(S3C2410_GPG8, 1);
+       s3c2410_gpio_cfgpin(S3C2410_GPG8, S3C2410_GPIO_OUTPUT);
+
        /* Turn off suspend on both USB ports, and switch the
         * selectable USB port to USB device mode. */
 
@@ -512,6 +565,8 @@ static void __init jive_machine_init(void)
        s3c24xx_udc_set_platdata(&jive_udc_cfg);
        s3c24xx_fb_set_platdata(&jive_lcd_config);
 
+       spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs));
+
        platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
 }