mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-09 09:11:34 +02:00
dd98c76b9a
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20418 3c298f89-4303-0410-b956-a3cf2f4a3e73
197 lines
6.3 KiB
Diff
197 lines
6.3 KiB
Diff
Index: linux-2.6.30.10/drivers/gpio/Kconfig
|
|
===================================================================
|
|
--- linux-2.6.30.10.orig/drivers/gpio/Kconfig 2010-03-24 21:55:56.000000000 +0100
|
|
+++ linux-2.6.30.10/drivers/gpio/Kconfig 2010-03-24 21:56:36.000000000 +0100
|
|
@@ -176,4 +176,12 @@
|
|
SPI driver for Microchip MCP23S08 I/O expander. This provides
|
|
a GPIO interface supporting inputs and outputs.
|
|
|
|
+comment "EBU GPIO expanders:"
|
|
+
|
|
+config GPIO_IFXMIPS_EBU
|
|
+ boolean "IFXMIPS EBU attached I/O expander"
|
|
+ depends on IFXMIPS
|
|
+ help
|
|
+ This driver allows you to drive latches attached to the SoCc External Bus Unit
|
|
+
|
|
endif
|
|
Index: linux-2.6.30.10/drivers/gpio/Makefile
|
|
===================================================================
|
|
--- linux-2.6.30.10.orig/drivers/gpio/Makefile 2010-03-24 21:55:56.000000000 +0100
|
|
+++ linux-2.6.30.10/drivers/gpio/Makefile 2010-03-24 21:56:36.000000000 +0100
|
|
@@ -12,3 +12,4 @@
|
|
obj-$(CONFIG_GPIO_TWL4030) += twl4030-gpio.o
|
|
obj-$(CONFIG_GPIO_XILINX) += xilinx_gpio.o
|
|
obj-$(CONFIG_GPIO_BT8XX) += bt8xxgpio.o
|
|
+obj-$(CONFIG_GPIO_IFXMIPS_EBU) += ifxmips_ebu_gpio.o
|
|
Index: linux-2.6.30.10/arch/mips/ifxmips/board.c
|
|
===================================================================
|
|
--- linux-2.6.30.10.orig/arch/mips/ifxmips/board.c 2010-03-25 10:43:06.000000000 +0100
|
|
+++ linux-2.6.30.10/arch/mips/ifxmips/board.c 2010-03-25 12:40:54.000000000 +0100
|
|
@@ -111,6 +111,11 @@
|
|
.name = "ifxmips_wdt",
|
|
};
|
|
|
|
+static struct platform_device ifxmips_ebu = {
|
|
+ .id = 0,
|
|
+ .name = "ifxmips_ebu",
|
|
+};
|
|
+
|
|
static struct resource ifxmips_mtd_resource = {
|
|
.start = IFXMIPS_FLASH_START,
|
|
.end = IFXMIPS_FLASH_START + IFXMIPS_FLASH_MAX - 1,
|
|
@@ -145,10 +150,18 @@
|
|
static struct gpio_led arv452_gpio_leds[] = {
|
|
{ .name = "ifx:blue:power", .gpio = 3, .active_low = 1, },
|
|
{ .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, },
|
|
- { .name = "ifx:pink:internet", .gpio = 5, .active_low = 1, },
|
|
+ { .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, },
|
|
{ .name = "ifx:red:power", .gpio = 6, .active_low = 1, },
|
|
{ .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, },
|
|
{ .name = "ifx:red:wps", .gpio = 9, .active_low = 1, },
|
|
+ { .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, },
|
|
+ { .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, },
|
|
+ { .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, },
|
|
+ { .name = "ifx:blue:fxo", .gpio = 35, .active_low = 1, },
|
|
+ { .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, },
|
|
+ { .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, },
|
|
+ { .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, },
|
|
+ { .name = "ifx:red:internet", .gpio = 41, .active_low = 1, },
|
|
};
|
|
|
|
static struct gpio_led_platform_data ifxmips_gpio_led_data;
|
|
@@ -205,6 +218,7 @@
|
|
struct platform_device *arv452_devs[] = {
|
|
&ifxmips_gpio, &ifxmips_mii, &ifxmips_mtd,
|
|
&ifxmips_gpio_dev, &ifxmips_wdt, &dwc_usb,
|
|
+ &ifxmips_ebu,
|
|
#ifdef CONFIG_LEDS_GPIO
|
|
&ifxmips_gpio_leds,
|
|
#endif
|
|
Index: linux-2.6.30.10/drivers/gpio/ifxmips_ebu_gpio.c
|
|
===================================================================
|
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
+++ linux-2.6.30.10/drivers/gpio/ifxmips_ebu_gpio.c 2010-03-25 12:47:07.000000000 +0100
|
|
@@ -0,0 +1,121 @@
|
|
+/*
|
|
+ * This program is free software; you can redistribute it and/or modify
|
|
+ * it under the terms of the GNU General Public License as published by
|
|
+ * the Free Software Foundation; either version 2 of the License, or
|
|
+ * (at your option) any later version.
|
|
+ *
|
|
+ * This program is distributed in the hope that it will be useful,
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
+ * GNU General Public License for more details.
|
|
+ *
|
|
+ * You should have received a copy of the GNU General Public License
|
|
+ * along with this program; if not, write to the Free Software
|
|
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
|
+ *
|
|
+ * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
|
|
+ */
|
|
+
|
|
+#include <linux/init.h>
|
|
+#include <linux/platform_device.h>
|
|
+#include <linux/mutex.h>
|
|
+#include <linux/gpio.h>
|
|
+#include <ifxmips.h>
|
|
+
|
|
+#define IFXMIPS_EBU_START 0x14000000
|
|
+#define IFXMIPS_EBU_MAX 0x00001000
|
|
+#define IFXMIPS_EBU_BUSCON 0x1e7ff
|
|
+#define IFXMIPS_EBU_WP 0x80000000
|
|
+
|
|
+static int shadow = (1 << 10) | (1 << 8);
|
|
+static void __iomem *virt;
|
|
+
|
|
+static int
|
|
+ifxmips_ebu_direction_input(struct gpio_chip *chip, unsigned offset)
|
|
+{
|
|
+ return -EINVAL;
|
|
+}
|
|
+
|
|
+static int
|
|
+ifxmips_ebu_direction_output(struct gpio_chip *chip, unsigned offset, int value)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int
|
|
+ifxmips_ebu_get(struct gpio_chip *chip, unsigned offset)
|
|
+{
|
|
+ return -EINVAL;
|
|
+}
|
|
+
|
|
+static void
|
|
+ifxmips_ebu_set(struct gpio_chip *chip, unsigned offset, int value)
|
|
+{
|
|
+ if(value)
|
|
+ shadow |= (1 << offset);
|
|
+ else
|
|
+ shadow &= ~(1 << offset);
|
|
+ ifxmips_w32(IFXMIPS_EBU_BUSCON, IFXMIPS_EBU_BUSCON1);
|
|
+ *((__u16*)virt) = shadow;
|
|
+ ifxmips_w32(IFXMIPS_EBU_BUSCON | IFXMIPS_EBU_WP, IFXMIPS_EBU_BUSCON1);
|
|
+}
|
|
+
|
|
+static struct gpio_chip
|
|
+ifxmips_ebu_chip =
|
|
+{
|
|
+ .label = "ifxmips_ebu",
|
|
+ .direction_input = ifxmips_ebu_direction_input,
|
|
+ .direction_output = ifxmips_ebu_direction_output,
|
|
+ .set = ifxmips_ebu_set,
|
|
+ .get = ifxmips_ebu_get,
|
|
+ .base = 32,
|
|
+ .ngpio = 16,
|
|
+ .can_sleep = 1,
|
|
+ .owner = THIS_MODULE,
|
|
+};
|
|
+
|
|
+static int __devinit
|
|
+ifxmips_ebu_probe(struct platform_device *dev)
|
|
+{
|
|
+ ifxmips_w32(IFXMIPS_EBU_START | 0x1, IFXMIPS_EBU_ADDRSEL1);
|
|
+ ifxmips_w32(IFXMIPS_EBU_BUSCON | IFXMIPS_EBU_WP, IFXMIPS_EBU_BUSCON1);
|
|
+ virt = ioremap_nocache(IFXMIPS_EBU_START, IFXMIPS_EBU_MAX);
|
|
+ if(gpiochip_add(&ifxmips_ebu_chip))
|
|
+ return -EINVAL;
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int
|
|
+ifxmips_ebu_remove(struct platform_device *dev)
|
|
+{
|
|
+ return gpiochip_remove(&ifxmips_ebu_chip);
|
|
+}
|
|
+
|
|
+static struct platform_driver
|
|
+ifxmips_ebu_driver = {
|
|
+ .probe = ifxmips_ebu_probe,
|
|
+ .remove = ifxmips_ebu_remove,
|
|
+ .driver = {
|
|
+ .name = "ifxmips_ebu",
|
|
+ .owner = THIS_MODULE,
|
|
+ },
|
|
+};
|
|
+
|
|
+static int __init
|
|
+ifxmips_ebu_init(void)
|
|
+{
|
|
+ return platform_driver_register(&ifxmips_ebu_driver);
|
|
+}
|
|
+
|
|
+static void __exit
|
|
+ifxmips_ebu_exit(void)
|
|
+{
|
|
+ platform_driver_unregister(&ifxmips_ebu_driver);
|
|
+}
|
|
+
|
|
+module_init(ifxmips_ebu_init);
|
|
+module_exit(ifxmips_ebu_exit);
|
|
+
|
|
+MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
|
|
+MODULE_LICENSE("GPL v2");
|
|
+MODULE_DESCRIPTION("ifxmips - EBU Latch GPIO-Expander");
|