diff options
author | Imre Kaloz <kaloz@openwrt.org> | 2012-09-28 17:34:18 +0000 |
---|---|---|
committer | Imre Kaloz <kaloz@openwrt.org> | 2012-09-28 17:34:18 +0000 |
commit | 55b1f50e03de1b4ef9397c000ddf80de4fe0b33d (patch) | |
tree | d2b71a539115902c7c865a46a0c2350dc9dcc990 /target/linux/cns3xxx | |
parent | c0a60594a849b5cba6ae54abe0f0896b8fe6d87a (diff) | |
download | upstream-55b1f50e03de1b4ef9397c000ddf80de4fe0b33d.tar.gz upstream-55b1f50e03de1b4ef9397c000ddf80de4fe0b33d.tar.bz2 upstream-55b1f50e03de1b4ef9397c000ddf80de4fe0b33d.zip |
Update board support for Gateworks Laguna Product family
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33580 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/cns3xxx')
-rw-r--r-- | target/linux/cns3xxx/patches-3.3/300-laguna_support.patch | 170 |
1 files changed, 162 insertions, 8 deletions
diff --git a/target/linux/cns3xxx/patches-3.3/300-laguna_support.patch b/target/linux/cns3xxx/patches-3.3/300-laguna_support.patch index 24bad3ab34..06f302a0d4 100644 --- a/target/linux/cns3xxx/patches-3.3/300-laguna_support.patch +++ b/target/linux/cns3xxx/patches-3.3/300-laguna_support.patch @@ -1,6 +1,6 @@ --- /dev/null +++ b/arch/arm/mach-cns3xxx/laguna.c -@@ -0,0 +1,765 @@ +@@ -0,0 +1,919 @@ +/* + * Gateworks Corporation Laguna Platform + * @@ -12,6 +12,8 @@ + * Anton Vorontsov <avorontsov@mvista.com> + * Copyright 2011 Gateworks Corporation + * Chris Lang <clang@gateworks.com> ++ * Copyright 2012 Gateworks Corporation ++ * Tim Harvey <tharvey@gateworks.com> + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, Version 2, as @@ -22,6 +24,7 @@ +#include <linux/kernel.h> +#include <linux/compiler.h> +#include <linux/io.h> ++#include <linux/gpio.h> +#include <linux/dma-mapping.h> +#include <linux/serial_core.h> +#include <linux/serial_8250.h> @@ -49,6 +52,8 @@ +#include "core.h" +#include "devices.h" + ++#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) ++ +// Config 1 Bitmap +#define ETH0_LOAD BIT(0) +#define ETH1_LOAD BIT(1) @@ -99,7 +104,7 @@ + u8 spi_flash_size; +}; + -+static struct laguna_board_info laguna_info; ++static struct laguna_board_info laguna_info __initdata; + +/* + * NOR Flash @@ -577,9 +582,110 @@ +}; + +/* -+ * Initialization ++ * GPIO + */ ++static struct platform_device laguna_gpio_dev = { ++ .name = "GPIODEV", ++ .id = -1, ++}; + ++static struct gpio laguna_gpio_gw2391[] = { ++ { 0, GPIOF_IN , "*GPS_PPS" }, ++ { 1, GPIOF_IN , "*GSC_IRQ#" }, ++ { 2, GPIOF_IN , "*USB_FAULT#" }, ++ { 5, GPIOF_OUT_INIT_LOW , "*USB0_PCI_SEL" }, ++ { 6, GPIOF_OUT_INIT_HIGH, "*USB_VBUS_EN" }, ++ { 7, GPIOF_OUT_INIT_LOW , "*USB1_PCI_SEL" }, ++ { 8, GPIOF_OUT_INIT_HIGH, "*PERST#" }, ++ { 9, GPIOF_OUT_INIT_LOW , "*FP_SER_EN#" }, ++ { 100, GPIOF_IN , "*USER_PB#" }, ++ { 103, GPIOF_OUT_INIT_HIGH, "*V5_EN" }, ++ { 108, GPIOF_IN , "DIO0" }, ++ { 109, GPIOF_IN , "DIO1" }, ++ { 110, GPIOF_IN , "DIO2" }, ++ { 111, GPIOF_IN , "DIO3" }, ++ { 112, GPIOF_IN , "DIO4" }, ++}; ++ ++static struct gpio laguna_gpio_gw2388[] = { ++ { 0, GPIOF_IN , "*GPS_PPS" }, ++ { 1, GPIOF_IN , "*GSC_IRQ#" }, ++ { 3, GPIOF_IN , "*USB_FAULT#" }, ++ { 6, GPIOF_OUT_INIT_HIGH, "*USB_VBUS_EN" }, ++ { 7, GPIOF_OUT_INIT_LOW , "*GSM_SEL0" }, ++ { 8, GPIOF_OUT_INIT_LOW , "*GSM_SEL1" }, ++ { 9, GPIOF_OUT_INIT_LOW , "*FP_SER_EN" }, ++ { 100, GPIOF_OUT_INIT_HIGH, "*USER_PB#" }, ++ { 108, GPIOF_IN , "DIO0" }, ++ { 109, GPIOF_IN , "DIO1" }, ++ { 110, GPIOF_IN , "DIO2" }, ++ { 111, GPIOF_IN , "DIO3" }, ++ { 112, GPIOF_IN , "DIO4" }, ++}; ++ ++static struct gpio laguna_gpio_gw2387[] = { ++ { 0, GPIOF_IN , "*GPS_PPS" }, ++ { 1, GPIOF_IN , "*GSC_IRQ#" }, ++ { 2, GPIOF_IN , "*USB_FAULT#" }, ++ { 5, GPIOF_OUT_INIT_LOW , "*USB_PCI_SEL" }, ++ { 6, GPIOF_OUT_INIT_HIGH, "*USB_VBUS_EN" }, ++ { 7, GPIOF_OUT_INIT_LOW , "*GSM_SEL0" }, ++ { 8, GPIOF_OUT_INIT_LOW , "*GSM_SEL1" }, ++ { 9, GPIOF_OUT_INIT_LOW , "*FP_SER_EN" }, ++ { 100, GPIOF_IN , "*USER_PB#" }, ++ { 103, GPIOF_OUT_INIT_HIGH, "*V5_EN" }, ++ { 108, GPIOF_IN , "DIO0" }, ++ { 109, GPIOF_IN , "DIO1" }, ++ { 110, GPIOF_IN , "DIO2" }, ++ { 111, GPIOF_IN , "DIO3" }, ++ { 112, GPIOF_IN , "DIO4" }, ++ { 113, GPIOF_IN , "DIO5" }, ++}; ++ ++static struct gpio laguna_gpio_gw2384[] = { ++ { 0, GPIOF_IN , "*GSC_IRQ#" }, ++ { 1, GPIOF_OUT_INIT_HIGH, "*USB_HST_VBUS_EN" }, ++ { 2, GPIOF_IN , "*USB_HST_FAULT#" }, ++ { 5, GPIOF_IN , "*USB_OTG_FAULT#" }, ++ { 6, GPIOF_OUT_INIT_LOW , "*USB_HST_PCI_SEL" }, ++ { 7, GPIOF_OUT_INIT_LOW , "*GSM_SEL0" }, ++ { 8, GPIOF_OUT_INIT_LOW , "*GSM_SEL1" }, ++ { 9, GPIOF_OUT_INIT_LOW , "*FP_SER_EN" }, ++ { 12, GPIOF_OUT_INIT_LOW , "J10_DIOLED0" }, ++ { 13, GPIOF_OUT_INIT_HIGH, "*I2CMUX_RST#" }, ++ { 14, GPIOF_OUT_INIT_LOW , "J10_DIOLED1" }, ++ { 15, GPIOF_OUT_INIT_LOW , "J10_DIOLED2" }, ++ { 100, GPIOF_IN , "*USER_PB#" }, ++ { 103, GPIOF_OUT_INIT_HIGH, "V5_EN" }, ++ { 108, GPIOF_IN , "J9_DIOGSC0" }, ++}; ++ ++static struct gpio laguna_gpio_gw2382[] = { ++ { 0, GPIOF_IN , "*GPS_PPS" }, ++ { 1, GPIOF_IN , "*GSC_IRQ#" }, ++ { 2, GPIOF_OUT_INIT_HIGH, "*PCIE_RST#" }, ++ { 3, GPIOF_IN , "GPIO0" }, ++ { 4, GPIOF_IN , "GPIO1" }, ++ { 9, GPIOF_OUT_INIT_HIGH, "*USB_VBUS_EN" }, ++ { 10, GPIOF_OUT_INIT_HIGH, "*USB_PCI_SEL#" }, ++ { 100, GPIOF_IN , "DIO0" }, ++ { 101, GPIOF_IN , "DIO1" }, ++}; ++ ++static struct gpio laguna_gpio_gw2380[] = { ++ { 0, GPIOF_IN , "*GPS_PPS" }, ++ { 1, GPIOF_IN , "*GSC_IRQ#" }, ++ { 3, GPIOF_IN , "GPIO0" }, ++ { 8, GPIOF_IN , "GPIO1" }, ++ { 100, GPIOF_IN , "DIO0" }, ++ { 101, GPIOF_IN , "DIO1" }, ++ { 102, GPIOF_IN , "DIO2" }, ++ { 103, GPIOF_IN , "DIO3" }, ++}; ++ ++/* ++ * Initialization ++ */ +static void __init laguna_init(void) +{ + cns3xxx_l2x0_init(); @@ -588,8 +694,7 @@ + + platform_device_register(&laguna_i2c_controller); + -+ i2c_register_board_info(0, laguna_i2c_devices, -+ ARRAY_SIZE(laguna_i2c_devices)); ++ i2c_register_board_info(0, ARRAY_AND_SIZE(laguna_i2c_devices)); + + pm_power_off = cns3xxx_power_off; +} @@ -617,10 +722,29 @@ +{ + cns3xxx_common_init(); + cns3xxx_pcie_iotable_init(0x3); -+ iotable_init(laguna_io_desc, ARRAY_SIZE(laguna_io_desc)); ++ iotable_init(ARRAY_AND_SIZE(laguna_io_desc)); + laguna_early_serial_setup(); +} + ++static int laguna_register_gpio(struct gpio *array, size_t num) ++{ ++ int i, err, ret; ++ ++ ret = 0; ++ for (i = 0; i < num; i++, array++) { ++ const char *label = array->label; ++ if (label[0] == '*') ++ label++; ++ err = gpio_request_one(array->gpio, array->flags, label); ++ if (err) ++ ret = err; ++ else { ++ err = gpio_export(array->gpio, array->label[0] != '*'); ++ } ++ } ++ return ret; ++} ++ +static int __init laguna_model_setup(void) +{ + u32 __iomem *mem; @@ -729,7 +853,7 @@ + laguna_spi_partitions[3].size = SZ_64M - SZ_2M; + break; + } -+ spi_register_board_info(laguna_spi_devices, ARRAY_SIZE(laguna_spi_devices)); ++ spi_register_board_info(ARRAY_AND_SIZE(laguna_spi_devices)); + } + + if ((laguna_info.config_bitmap & SPI0_LOAD) || @@ -741,14 +865,44 @@ + * the first 6 characters of the model name + */ + -+ if (strncmp(laguna_info.model, "GW2388", 6) == 0) { ++ if ( (strncmp(laguna_info.model, "GW2388", 6) == 0) ++ || (strncmp(laguna_info.model, "GW2389", 6) == 0) ) ++ { ++ // configure GPIO's ++ laguna_register_gpio(ARRAY_AND_SIZE(laguna_gpio_gw2388)); ++ // configure LED's ++ laguna_gpio_leds_data.num_leds = 2; ++ } else if (strncmp(laguna_info.model, "GW2387", 6) == 0) { ++ // configure GPIO's ++ laguna_register_gpio(ARRAY_AND_SIZE(laguna_gpio_gw2387)); ++ // configure LED's + laguna_gpio_leds_data.num_leds = 2; ++ } else if (strncmp(laguna_info.model, "GW2384", 6) == 0) { ++ // configure GPIO's ++ laguna_register_gpio(ARRAY_AND_SIZE(laguna_gpio_gw2384)); ++ // configure LED's ++ laguna_gpio_leds_data.num_leds = 1; ++ } else if (strncmp(laguna_info.model, "GW2382", 6) == 0) { ++ // configure GPIO's ++ laguna_register_gpio(ARRAY_AND_SIZE(laguna_gpio_gw2382)); ++ // configure LED's ++ laguna_gpio_leds[0].gpio = 107; ++ laguna_gpio_leds_data.num_leds = 1; + } else if (strncmp(laguna_info.model, "GW2380", 6) == 0) { ++ // configure GPIO's ++ laguna_register_gpio(ARRAY_AND_SIZE(laguna_gpio_gw2380)); ++ // configure LED's + laguna_gpio_leds[0].gpio = 107; + laguna_gpio_leds[1].gpio = 106; + laguna_gpio_leds_data.num_leds = 2; ++ } else if (strncmp(laguna_info.model, "GW2391", 6) == 0) { ++ // configure GPIO's ++ laguna_register_gpio(ARRAY_AND_SIZE(laguna_gpio_gw2391)); ++ // configure LED's ++ laguna_gpio_leds_data.num_leds = 2; + } + platform_device_register(&laguna_gpio_leds_device); ++ platform_device_register(&laguna_gpio_dev); + } else { + // Do some defaults here, not sure what yet + } |