ar71xx: rb91x: register a gpio-latch platform device
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 22 Feb 2014 18:05:32 +0000 (18:05 +0000)
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 22 Feb 2014 18:05:32 +0000 (18:05 +0000)
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39699 3c298f89-4303-0410-b956-a3cf2f4a3e73

target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c

index 3cbffed..1da447b 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/spi/flash.h>
 #include <linux/routerboot.h>
 #include <linux/gpio.h>
+#include <linux/platform_data/gpio-latch.h>
 
 #include <asm/prom.h>
 #include <asm/mach-ath79/ath79.h>
@@ -50,6 +51,9 @@
 #define RB91X_FLAG_USB         BIT(0)
 #define RB91X_FLAG_PCIE                BIT(1)
 
+#define RB91X_LATCH_GPIO_BASE  AR934X_GPIO_COUNT
+#define RB91X_LATCH_GPIO(_x)   (RB91X_LATCH_GPIO_BASE + (_x))
+
 struct rb_board_info {
        const char *name;
        u32 flags;
@@ -80,6 +84,19 @@ static struct flash_platform_data rb711gr100_spi_flash_data = {
        .nr_parts       = ARRAY_SIZE(rb711gr100_spi_partitions),
 };
 
+static int rb711gr100_gpio_latch_gpios[AR934X_GPIO_COUNT] __initdata = {
+       0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+       12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22
+};
+
+static struct gpio_latch_platform_data rb711gr100_gpio_latch_data __initdata = {
+       .base = RB91X_LATCH_GPIO_BASE,
+       .num_gpios = ARRAY_SIZE(rb711gr100_gpio_latch_gpios),
+       .gpios = rb711gr100_gpio_latch_gpios,
+       .le_gpio_index = 11,
+       .le_active_low = true,
+};
+
 static void __init rb711gr100_init_partitions(const struct rb_info *info)
 {
        rb711gr100_spi_partitions[0].size = info->hard_cfg_offs;
@@ -164,6 +181,10 @@ static void __init rb711gr100_setup(void)
 
        platform_device_register_simple("rb91x-nand", -1, NULL, 0);
 
+       platform_device_register_data(NULL, "gpio-latch", -1,
+                                     &rb711gr100_gpio_latch_data,
+                                     sizeof(rb711gr100_gpio_latch_data));
+
        flags = rb711gr100_get_flags(info);
 
        if (flags & RB91X_FLAG_USB)