1 Index: linux-2.6.30.10/drivers/gpio/Kconfig
2 ===================================================================
3 --- linux-2.6.30.10.orig/drivers/gpio/Kconfig 2010-03-24 21:55:56.000000000 +0100
4 +++ linux-2.6.30.10/drivers/gpio/Kconfig 2010-03-24 21:56:36.000000000 +0100
6 SPI driver for Microchip MCP23S08 I/O expander. This provides
7 a GPIO interface supporting inputs and outputs.
9 +comment "EBU GPIO expanders:"
11 +config GPIO_IFXMIPS_EBU
12 + boolean "IFXMIPS EBU attached I/O expander"
15 + This driver allows you to drive latches attached to the SoCc External Bus Unit
18 Index: linux-2.6.30.10/drivers/gpio/Makefile
19 ===================================================================
20 --- linux-2.6.30.10.orig/drivers/gpio/Makefile 2010-03-24 21:55:56.000000000 +0100
21 +++ linux-2.6.30.10/drivers/gpio/Makefile 2010-03-24 21:56:36.000000000 +0100
23 obj-$(CONFIG_GPIO_TWL4030) += twl4030-gpio.o
24 obj-$(CONFIG_GPIO_XILINX) += xilinx_gpio.o
25 obj-$(CONFIG_GPIO_BT8XX) += bt8xxgpio.o
26 +obj-$(CONFIG_GPIO_IFXMIPS_EBU) += ifxmips_ebu_gpio.o
27 Index: linux-2.6.30.10/arch/mips/ifxmips/board.c
28 ===================================================================
29 --- linux-2.6.30.10.orig/arch/mips/ifxmips/board.c 2010-03-25 10:43:06.000000000 +0100
30 +++ linux-2.6.30.10/arch/mips/ifxmips/board.c 2010-03-25 12:40:54.000000000 +0100
32 .name = "ifxmips_wdt",
35 +static struct platform_device ifxmips_ebu = {
37 + .name = "ifxmips_ebu",
40 static struct resource ifxmips_mtd_resource = {
41 .start = IFXMIPS_FLASH_START,
42 .end = IFXMIPS_FLASH_START + IFXMIPS_FLASH_MAX - 1,
44 static struct gpio_led arv452_gpio_leds[] = {
45 { .name = "ifx:blue:power", .gpio = 3, .active_low = 1, },
46 { .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, },
47 - { .name = "ifx:pink:internet", .gpio = 5, .active_low = 1, },
48 + { .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, },
49 { .name = "ifx:red:power", .gpio = 6, .active_low = 1, },
50 { .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, },
51 { .name = "ifx:red:wps", .gpio = 9, .active_low = 1, },
52 + { .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, },
53 + { .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, },
54 + { .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, },
55 + { .name = "ifx:blue:fxo", .gpio = 35, .active_low = 1, },
56 + { .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, },
57 + { .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, },
58 + { .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, },
59 + { .name = "ifx:red:internet", .gpio = 41, .active_low = 1, },
62 static struct gpio_led_platform_data ifxmips_gpio_led_data;
64 struct platform_device *arv452_devs[] = {
65 &ifxmips_gpio, &ifxmips_mii, &ifxmips_mtd,
66 &ifxmips_gpio_dev, &ifxmips_wdt, &dwc_usb,
68 #ifdef CONFIG_LEDS_GPIO
71 Index: linux-2.6.30.10/drivers/gpio/ifxmips_ebu_gpio.c
72 ===================================================================
73 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
74 +++ linux-2.6.30.10/drivers/gpio/ifxmips_ebu_gpio.c 2010-03-25 12:47:07.000000000 +0100
77 + * This program is free software; you can redistribute it and/or modify
78 + * it under the terms of the GNU General Public License as published by
79 + * the Free Software Foundation; either version 2 of the License, or
80 + * (at your option) any later version.
82 + * This program is distributed in the hope that it will be useful,
83 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
84 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
85 + * GNU General Public License for more details.
87 + * You should have received a copy of the GNU General Public License
88 + * along with this program; if not, write to the Free Software
89 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
91 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
94 +#include <linux/init.h>
95 +#include <linux/platform_device.h>
96 +#include <linux/mutex.h>
97 +#include <linux/gpio.h>
100 +#define IFXMIPS_EBU_START 0x14000000
101 +#define IFXMIPS_EBU_MAX 0x00001000
102 +#define IFXMIPS_EBU_BUSCON 0x1e7ff
103 +#define IFXMIPS_EBU_WP 0x80000000
105 +static int shadow = (1 << 10) | (1 << 8);
106 +static void __iomem *virt;
109 +ifxmips_ebu_direction_input(struct gpio_chip *chip, unsigned offset)
115 +ifxmips_ebu_direction_output(struct gpio_chip *chip, unsigned offset, int value)
121 +ifxmips_ebu_get(struct gpio_chip *chip, unsigned offset)
127 +ifxmips_ebu_set(struct gpio_chip *chip, unsigned offset, int value)
130 + shadow |= (1 << offset);
132 + shadow &= ~(1 << offset);
133 + ifxmips_w32(IFXMIPS_EBU_BUSCON, IFXMIPS_EBU_BUSCON1);
134 + *((__u16*)virt) = shadow;
135 + ifxmips_w32(IFXMIPS_EBU_BUSCON | IFXMIPS_EBU_WP, IFXMIPS_EBU_BUSCON1);
138 +static struct gpio_chip
141 + .label = "ifxmips_ebu",
142 + .direction_input = ifxmips_ebu_direction_input,
143 + .direction_output = ifxmips_ebu_direction_output,
144 + .set = ifxmips_ebu_set,
145 + .get = ifxmips_ebu_get,
149 + .owner = THIS_MODULE,
152 +static int __devinit
153 +ifxmips_ebu_probe(struct platform_device *dev)
155 + ifxmips_w32(IFXMIPS_EBU_START | 0x1, IFXMIPS_EBU_ADDRSEL1);
156 + ifxmips_w32(IFXMIPS_EBU_BUSCON | IFXMIPS_EBU_WP, IFXMIPS_EBU_BUSCON1);
157 + virt = ioremap_nocache(IFXMIPS_EBU_START, IFXMIPS_EBU_MAX);
158 + if(gpiochip_add(&ifxmips_ebu_chip))
164 +ifxmips_ebu_remove(struct platform_device *dev)
166 + return gpiochip_remove(&ifxmips_ebu_chip);
169 +static struct platform_driver
170 +ifxmips_ebu_driver = {
171 + .probe = ifxmips_ebu_probe,
172 + .remove = ifxmips_ebu_remove,
174 + .name = "ifxmips_ebu",
175 + .owner = THIS_MODULE,
180 +ifxmips_ebu_init(void)
182 + return platform_driver_register(&ifxmips_ebu_driver);
186 +ifxmips_ebu_exit(void)
188 + platform_driver_unregister(&ifxmips_ebu_driver);
191 +module_init(ifxmips_ebu_init);
192 +module_exit(ifxmips_ebu_exit);
194 +MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
195 +MODULE_LICENSE("GPL v2");
196 +MODULE_DESCRIPTION("ifxmips - EBU Latch GPIO-Expander");