summaryrefslogtreecommitdiff
path: root/target/linux/ifxmips
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-03-25 11:50:46 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-03-25 11:50:46 +0000
commitdd98c76b9a5cc9b278bee9251bd0a57d39a58031 (patch)
tree95d054fed6abcf46425c58fa55b81dba5c769fd4 /target/linux/ifxmips
parentc4a3b1979a2f519cb80154b7c83cf92241a03adc (diff)
[ifxmips] implement gpiolib drivers for core gpio and ebu attached latches
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20418 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ifxmips')
-rw-r--r--target/linux/ifxmips/config-2.6.3022
-rw-r--r--target/linux/ifxmips/config-2.6.32161
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/gpio.c231
-rw-r--r--target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/gpio.h105
-rw-r--r--target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/ifxmips_irq.h7
-rw-r--r--target/linux/ifxmips/patches-2.6.30/100-board.patch25
-rw-r--r--target/linux/ifxmips/patches-2.6.30/600-ebu-gpio.patch196
7 files changed, 495 insertions, 252 deletions
diff --git a/target/linux/ifxmips/config-2.6.30 b/target/linux/ifxmips/config-2.6.30
index e41b2881b0..27e4b8096a 100644
--- a/target/linux/ifxmips/config-2.6.30
+++ b/target/linux/ifxmips/config-2.6.30
@@ -4,17 +4,17 @@ CONFIG_ADM6996_PHY=y
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
CONFIG_ARCH_POPULATES_NODE_MAP=y
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
# CONFIG_ARCH_SUPPORTS_MSI is not set
CONFIG_ARCH_SUPPORTS_OPROFILE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
# CONFIG_BCM47XX is not set
# CONFIG_BINARY_PRINTF is not set
CONFIG_BITREVERSE=y
# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
-CONFIG_CEVT_R4K_LIB=y
CONFIG_CEVT_R4K=y
+CONFIG_CEVT_R4K_LIB=y
CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2"
CONFIG_CPU_BIG_ENDIAN=y
# CONFIG_CPU_CAVIUM_OCTEON is not set
@@ -23,9 +23,9 @@ CONFIG_CPU_HAS_PREFETCH=y
CONFIG_CPU_HAS_SYNC=y
# CONFIG_CPU_LITTLE_ENDIAN is not set
# CONFIG_CPU_LOONGSON2 is not set
+CONFIG_CPU_MIPS32=y
# CONFIG_CPU_MIPS32_R1 is not set
CONFIG_CPU_MIPS32_R2=y
-CONFIG_CPU_MIPS32=y
# CONFIG_CPU_MIPS64_R1 is not set
# CONFIG_CPU_MIPS64_R2 is not set
CONFIG_CPU_MIPSR2=y
@@ -47,21 +47,24 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y
# CONFIG_CPU_TX39XX is not set
# CONFIG_CPU_TX49XX is not set
# CONFIG_CPU_VR41XX is not set
-CONFIG_CSRC_R4K_LIB=y
CONFIG_CSRC_R4K=y
+CONFIG_CSRC_R4K_LIB=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DEVPORT=y
# CONFIG_DM9000 is not set
CONFIG_DMA_NEED_PCI_MAP_STATE=y
CONFIG_DMA_NONCOHERENT=y
CONFIG_EARLY_PRINTK=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_GENERIC_FIND_LAST_BIT=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_GENERIC_GPIO=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_IFXMIPS_EBU=y
+CONFIG_GPIO_SYSFS=y
CONFIG_HARDWARE_WATCHPOINTS=y
CONFIG_HAS_DMA=y
CONFIG_HAS_IOMEM=y
@@ -75,15 +78,15 @@ CONFIG_HAVE_STD_PC_SERIAL_PORT=y
# CONFIG_HIGH_RES_TIMERS is not set
CONFIG_HW_HAS_PCI=y
CONFIG_HW_RANDOM=y
-# CONFIG_HZ_100 is not set
CONFIG_HZ=250
+# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
+CONFIG_IFXMIPS=y
CONFIG_IFXMIPS_GPIO_RST_BTN=y
CONFIG_IFXMIPS_MII0=y
# CONFIG_IFXMIPS_PROM_ASC0 is not set
CONFIG_IFXMIPS_PROM_ASC1=y
CONFIG_IFXMIPS_WDT=y
-CONFIG_IFXMIPS=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_IRQ_CPU=y
CONFIG_KALLSYMS=y
@@ -97,6 +100,7 @@ CONFIG_LEDS_IFXMIPS=y
# CONFIG_MACH_TX49XX is not set
# CONFIG_MACH_VR41XX is not set
# CONFIG_MIKROTIK_RB532 is not set
+CONFIG_MIPS=y
# CONFIG_MIPS_COBALT is not set
CONFIG_MIPS_L1_CACHE_SHIFT=5
# CONFIG_MIPS_MACHINE is not set
@@ -106,10 +110,8 @@ CONFIG_MIPS_MT_DISABLED=y
# CONFIG_MIPS_MT_SMTC is not set
# CONFIG_MIPS_SIM is not set
# CONFIG_MIPS_VPE_LOADER is not set
-CONFIG_MIPS=y
CONFIG_MTD_CFI_ADV_OPTIONS=y
CONFIG_MTD_CFI_GEOMETRY=y
-# CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_IFXMIPS=y
# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
@@ -126,6 +128,7 @@ CONFIG_PHYLIB=y
# CONFIG_PNX8550_JBS is not set
# CONFIG_PNX8550_STB810 is not set
# CONFIG_PROBE_INITRD_HEADER is not set
+CONFIG_RTL8306_PHY=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
# CONFIG_SCSI_DMA is not set
# CONFIG_SERIAL_8250 is not set
@@ -143,7 +146,6 @@ CONFIG_SERIAL_IFXMIPS=y
# CONFIG_SIBYTE_SENTOSA is not set
# CONFIG_SIBYTE_SWARM is not set
# CONFIG_SLOW_WORK is not set
-CONFIG_SQUASHFS_SUPPORT_LZMA=y
CONFIG_SWAP_IO_SPACE=y
CONFIG_SWCONFIG=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
diff --git a/target/linux/ifxmips/config-2.6.32 b/target/linux/ifxmips/config-2.6.32
new file mode 100644
index 0000000000..da094c0a07
--- /dev/null
+++ b/target/linux/ifxmips/config-2.6.32
@@ -0,0 +1,161 @@
+CONFIG_32BIT=y
+# CONFIG_64BIT is not set
+CONFIG_ADM6996_PHY=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+# CONFIG_AR7 is not set
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
+CONFIG_BITREVERSE=y
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+CONFIG_CEVT_R4K=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CFG80211_DEFAULT_PS_VALUE=0
+CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2"
+CONFIG_CPU_BIG_ENDIAN=y
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_CPU_HAS_PREFETCH=y
+CONFIG_CPU_HAS_SYNC=y
+# CONFIG_CPU_LITTLE_ENDIAN is not set
+# CONFIG_CPU_LOONGSON2E is not set
+CONFIG_CPU_MIPS32=y
+# CONFIG_CPU_MIPS32_R1 is not set
+CONFIG_CPU_MIPS32_R2=y
+# CONFIG_CPU_MIPS64_R1 is not set
+# CONFIG_CPU_MIPS64_R2 is not set
+CONFIG_CPU_MIPSR2=y
+# CONFIG_CPU_NEVADA is not set
+# CONFIG_CPU_R10000 is not set
+# CONFIG_CPU_R3000 is not set
+# CONFIG_CPU_R4300 is not set
+# CONFIG_CPU_R4X00 is not set
+# CONFIG_CPU_R5000 is not set
+# CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
+# CONFIG_CPU_R6000 is not set
+# CONFIG_CPU_R8000 is not set
+# CONFIG_CPU_RM7000 is not set
+# CONFIG_CPU_RM9000 is not set
+# CONFIG_CPU_SB1 is not set
+CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_CPU_SUPPORTS_HIGHMEM=y
+# CONFIG_CPU_TX39XX is not set
+# CONFIG_CPU_TX49XX is not set
+# CONFIG_CPU_VR41XX is not set
+CONFIG_CSRC_R4K=y
+CONFIG_CSRC_R4K_LIB=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_DEVPORT=y
+# CONFIG_DM9000 is not set
+CONFIG_DMA_NEED_PCI_MAP_STATE=y
+CONFIG_DMA_NONCOHERENT=y
+CONFIG_EARLY_PRINTK=y
+# CONFIG_FSNOTIFY is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_HARDWARE_WATCHPOINTS=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_STD_PC_SERIAL_PORT=y
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_HW_HAS_PCI=y
+CONFIG_HW_RANDOM=y
+CONFIG_HZ=250
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+CONFIG_IFXMIPS=y
+CONFIG_IFXMIPS_GPIO_RST_BTN=y
+CONFIG_IFXMIPS_MII0=y
+# CONFIG_IFXMIPS_PROM_ASC0 is not set
+CONFIG_IFXMIPS_PROM_ASC1=y
+CONFIG_IFXMIPS_WDT=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_IRQ_CPU=y
+CONFIG_KALLSYMS=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_IFXMIPS=y
+# CONFIG_MACH_ALCHEMY is not set
+# CONFIG_MACH_DECSTATION is not set
+# CONFIG_MACH_JAZZ is not set
+# CONFIG_MACH_LOONGSON is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+CONFIG_MIPS=y
+# CONFIG_MIPS_COBALT is not set
+CONFIG_MIPS_L1_CACHE_SHIFT=5
+# CONFIG_MIPS_MACHINE is not set
+# CONFIG_MIPS_MALTA is not set
+CONFIG_MIPS_MT_DISABLED=y
+# CONFIG_MIPS_MT_SMP is not set
+# CONFIG_MIPS_MT_SMTC is not set
+# CONFIG_MIPS_SIM is not set
+# CONFIG_MIPS_VPE_LOADER is not set
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_GEOMETRY=y
+# CONFIG_MTD_CFI_INTELEXT is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+CONFIG_MTD_IFXMIPS=y
+# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
+# CONFIG_NO_IOPORT is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PHYLIB=y
+# CONFIG_PMC_MSP is not set
+# CONFIG_PMC_YOSEMITE is not set
+# CONFIG_PNX8550_JBS is not set
+# CONFIG_PNX8550_STB810 is not set
+# CONFIG_PROBE_INITRD_HEADER is not set
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SERIAL_8250 is not set
+CONFIG_SERIAL_IFXMIPS=y
+# CONFIG_SGI_IP22 is not set
+# CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
+# CONFIG_SGI_IP32 is not set
+# CONFIG_SIBYTE_BIGSUR is not set
+# CONFIG_SIBYTE_CARMEL is not set
+# CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_SWARM is not set
+CONFIG_SWAP_IO_SPACE=y
+CONFIG_SWCONFIG=y
+CONFIG_SYS_HAS_CPU_MIPS32_R1=y
+CONFIG_SYS_HAS_CPU_MIPS32_R2=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
+CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_SYS_SUPPORTS_MULTITHREADING=y
+# CONFIG_TC35815 is not set
+CONFIG_TRAD_SIGNALS=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+CONFIG_TREE_RCU=y
+CONFIG_USB_SUPPORT=y
+CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/gpio.c b/target/linux/ifxmips/files/arch/mips/ifxmips/gpio.c
index 3ef5100ab2..1ac00ded5b 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/gpio.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/gpio.c
@@ -36,6 +36,7 @@
#include <linux/platform_device.h>
#include <linux/uaccess.h>
#include <linux/semaphore.h>
+#include <linux/gpio.h>
#include <net/sock.h>
@@ -44,27 +45,13 @@
#define MAX_PORTS 2
#define PINS_PER_PORT 16
-#ifdef CONFIG_IFXMIPS_GPIO_RST_BTN
-
-unsigned int rst_port = 1;
-unsigned int rst_pin = 15;
-static struct timer_list rst_button_timer;
-
-extern struct sock *uevent_sock;
-extern u64 uevent_next_seqnum(void);
-static unsigned long seen;
-static int pressed;
-
-struct event_t {
- struct work_struct wq;
- int set;
- unsigned long jiffies;
-};
-#endif
-
#define IFXMIPS_GPIO_SANITY {if (port > MAX_PORTS || pin > PINS_PER_PORT) return -EINVAL; }
-int ifxmips_port_reserve_pin(unsigned int port, unsigned int pin)
+#define GPIO_TO_PORT(x) ((x > 15) ? (1) : (0))
+#define GPIO_TO_GPIO(x) ((x > 15) ? (x - 16) : (x))
+
+int
+ifxmips_port_reserve_pin(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
printk(KERN_INFO "%s : call to obseleted function\n", __func__);
@@ -72,7 +59,8 @@ int ifxmips_port_reserve_pin(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_reserve_pin);
-int ifxmips_port_free_pin(unsigned int port, unsigned int pin)
+int
+ifxmips_port_free_pin(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
printk(KERN_INFO "%s : call to obseleted function\n", __func__);
@@ -80,7 +68,8 @@ int ifxmips_port_free_pin(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_free_pin);
-int ifxmips_port_set_open_drain(unsigned int port, unsigned int pin)
+int
+ifxmips_port_set_open_drain(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_OD + (port * 0xC)) | (1 << pin),
@@ -89,7 +78,8 @@ int ifxmips_port_set_open_drain(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_set_open_drain);
-int ifxmips_port_clear_open_drain(unsigned int port, unsigned int pin)
+int
+ifxmips_port_clear_open_drain(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_OD + (port * 0xC)) & ~(1 << pin),
@@ -98,7 +88,8 @@ int ifxmips_port_clear_open_drain(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_clear_open_drain);
-int ifxmips_port_set_pudsel(unsigned int port, unsigned int pin)
+int
+ifxmips_port_set_pudsel(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_PUDSEL + (port * 0xC)) | (1 << pin),
@@ -107,7 +98,8 @@ int ifxmips_port_set_pudsel(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_set_pudsel);
-int ifxmips_port_clear_pudsel(unsigned int port, unsigned int pin)
+int
+ifxmips_port_clear_pudsel(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_PUDSEL + (port * 0xC)) & ~(1 << pin),
@@ -116,7 +108,8 @@ int ifxmips_port_clear_pudsel(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_clear_pudsel);
-int ifxmips_port_set_puden(unsigned int port, unsigned int pin)
+int
+ifxmips_port_set_puden(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_PUDEN + (port * 0xC)) | (1 << pin),
@@ -125,7 +118,8 @@ int ifxmips_port_set_puden(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_set_puden);
-int ifxmips_port_clear_puden(unsigned int port, unsigned int pin)
+int
+ifxmips_port_clear_puden(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_PUDEN + (port * 0xC)) & ~(1 << pin),
@@ -134,7 +128,8 @@ int ifxmips_port_clear_puden(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_clear_puden);
-int ifxmips_port_set_stoff(unsigned int port, unsigned int pin)
+int
+ifxmips_port_set_stoff(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_STOFF + (port * 0xC)) | (1 << pin),
@@ -143,7 +138,8 @@ int ifxmips_port_set_stoff(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_set_stoff);
-int ifxmips_port_clear_stoff(unsigned int port, unsigned int pin)
+int
+ifxmips_port_clear_stoff(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_STOFF + (port * 0xC)) & ~(1 << pin),
@@ -152,7 +148,8 @@ int ifxmips_port_clear_stoff(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_clear_stoff);
-int ifxmips_port_set_dir_out(unsigned int port, unsigned int pin)
+int
+ifxmips_port_set_dir_out(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_DIR + (port * 0xC)) | (1 << pin),
@@ -161,7 +158,8 @@ int ifxmips_port_set_dir_out(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_set_dir_out);
-int ifxmips_port_set_dir_in(unsigned int port, unsigned int pin)
+int
+ifxmips_port_set_dir_in(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_DIR + (port * 0xC)) & ~(1 << pin),
@@ -170,7 +168,8 @@ int ifxmips_port_set_dir_in(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_set_dir_in);
-int ifxmips_port_set_output(unsigned int port, unsigned int pin)
+int
+ifxmips_port_set_output(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_OUT + (port * 0xC)) | (1 << pin),
@@ -179,7 +178,8 @@ int ifxmips_port_set_output(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_set_output);
-int ifxmips_port_clear_output(unsigned int port, unsigned int pin)
+int
+ifxmips_port_clear_output(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_OUT + (port * 0xC)) & ~(1 << pin),
@@ -188,7 +188,8 @@ int ifxmips_port_clear_output(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_clear_output);
-int ifxmips_port_get_input(unsigned int port, unsigned int pin)
+int
+ifxmips_port_get_input(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
if (ifxmips_r32(IFXMIPS_GPIO_P0_IN + (port * 0xC)) & (1 << pin))
@@ -198,7 +199,8 @@ int ifxmips_port_get_input(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_get_input);
-int ifxmips_port_set_altsel0(unsigned int port, unsigned int pin)
+int
+ifxmips_port_set_altsel0(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_ALTSEL0 + (port * 0xC)) | (1 << pin),
@@ -207,7 +209,8 @@ int ifxmips_port_set_altsel0(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_set_altsel0);
-int ifxmips_port_clear_altsel0(unsigned int port, unsigned int pin)
+int
+ifxmips_port_clear_altsel0(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_ALTSEL0 + (port * 0xC)) & ~(1 << pin),
@@ -216,7 +219,8 @@ int ifxmips_port_clear_altsel0(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_clear_altsel0);
-int ifxmips_port_set_altsel1(unsigned int port, unsigned int pin)
+int
+ifxmips_port_set_altsel1(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_ALTSEL1 + (port * 0xC)) | (1 << pin),
@@ -225,7 +229,8 @@ int ifxmips_port_set_altsel1(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_set_altsel1);
-int ifxmips_port_clear_altsel1(unsigned int port, unsigned int pin)
+int
+ifxmips_port_clear_altsel1(unsigned int port, unsigned int pin)
{
IFXMIPS_GPIO_SANITY;
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P0_ALTSEL1 + (port * 0xC)) & ~(1 << pin),
@@ -234,105 +239,85 @@ int ifxmips_port_clear_altsel1(unsigned int port, unsigned int pin)
}
EXPORT_SYMBOL(ifxmips_port_clear_altsel1);
-#ifdef CONFIG_IFXMIPS_GPIO_RST_BTN
-static inline void add_msg(struct sk_buff *skb, char *msg)
+static void
+ifxmips_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
{
- char *scratch;
- scratch = skb_put(skb, strlen(msg) + 1);
- sprintf(scratch, msg);
+ int port = GPIO_TO_PORT(offset);
+ int gpio = GPIO_TO_GPIO(offset);
+ if(value)
+ ifxmips_port_set_output(port, gpio);
+ else
+ ifxmips_port_clear_output(port, gpio);
}
-static void hotplug_button(struct work_struct *wq)
+static int
+ifxmips_gpio_get(struct gpio_chip *chip, unsigned int offset)
{
- struct sk_buff *skb;
- struct event_t *event;
- size_t len;
- char *scratch, *s;
- char buf[128];
-
- event = container_of(wq, struct event_t, wq);
- if (!uevent_sock)
- goto done;
-
- s = event->set ? "pressed" : "released";
- len = strlen(s) + 2;
- skb = alloc_skb(len + 2048, GFP_KERNEL);
- if (!skb)
- goto done;
-
- scratch = skb_put(skb, len);
- sprintf(scratch, "%s@", s);
- add_msg(skb, "HOME=/");
- add_msg(skb, "PATH=/sbin:/bin:/usr/sbin:/usr/bin");
- add_msg(skb, "SUBSYSTEM=button");
- add_msg(skb, "BUTTON=reset");
- add_msg(skb, (event->set ? "ACTION=pressed" : "ACTION=released"));
- sprintf(buf, "SEEN=%ld", (event->jiffies - seen)/HZ);
- add_msg(skb, buf);
- snprintf(buf, 128, "SEQNUM=%llu", uevent_next_seqnum());
- add_msg(skb, buf);
-
- NETLINK_CB(skb).dst_group = 1;
- netlink_broadcast(uevent_sock, skb, 0, 1, GFP_KERNEL);
-done:
- kfree(event);
+ int port = GPIO_TO_PORT(offset);
+ int gpio = GPIO_TO_GPIO(offset);
+ return ifxmips_port_get_input(port, gpio);
}
-static void reset_button_poll(unsigned long unused)
+static int
+ifxmips_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
{
- struct event_t *event;
-
- rst_button_timer.expires = jiffies + (HZ / 4);
- add_timer(&rst_button_timer);
-
- if (pressed != ifxmips_port_get_input(rst_port, rst_pin)) {
- if (pressed)
- pressed = 0;
- else
- pressed = 1;
- event = kzalloc(sizeof(struct event_t), GFP_ATOMIC);
- if (!event) {
- printk(KERN_INFO "Could not alloc hotplug event\n");
- return;
- }
- event->set = pressed;
- event->jiffies = jiffies;
- INIT_WORK(&event->wq, (void *)(void *)hotplug_button);
- schedule_work(&event->wq);
- seen = jiffies;
- }
+ int port = GPIO_TO_PORT(offset);
+ int gpio = GPIO_TO_GPIO(offset);
+ ifxmips_port_set_open_drain(port, gpio);
+ ifxmips_port_clear_altsel0(port, gpio);
+ ifxmips_port_clear_altsel1(port, gpio);
+ ifxmips_port_set_dir_in(port, gpio);
+ return 0;
}
-#endif
-static int ifxmips_gpio_probe(struct platform_device *dev)
+static int
+ifxmips_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, int value)
{
- int retval = 0;
-
-#ifdef CONFIG_IFXMIPS_GPIO_RST_BTN
- rst_port = dev->resource[0].start;
- rst_pin = dev->resource[0].end;
- ifxmips_port_set_open_drain(rst_port, rst_pin);
- ifxmips_port_clear_altsel0(rst_port, rst_pin);
- ifxmips_port_clear_altsel1(rst_port, rst_pin);
- ifxmips_port_set_dir_in(rst_port, rst_pin);
- seen = jiffies;
- init_timer(&rst_button_timer);
- rst_button_timer.function = reset_button_poll;
- rst_button_timer.expires = jiffies + HZ;
- add_timer(&rst_button_timer);
-#endif
- return retval;
+ int port = GPIO_TO_PORT(offset);
+ int gpio = GPIO_TO_GPIO(offset);
+ ifxmips_port_clear_open_drain(port, gpio);
+ ifxmips_port_clear_altsel0(port, gpio);
+ ifxmips_port_clear_altsel1(port, gpio);
+ ifxmips_port_set_dir_out(port, gpio);
+ ifxmips_gpio_set(chip, offset, value);
+ return 0;
+}
+
+int
+gpio_to_irq(unsigned int gpio)
+{
+ return -EINVAL;
+}
+EXPORT_SYMBOL(gpio_to_irq);
+
+struct gpio_chip
+ifxmips_gpio_chip =
+{
+ .label = "ifxmips-gpio",
+ .direction_input = ifxmips_gpio_direction_input,
+ .direction_output = ifxmips_gpio_direction_output,
+ .get = ifxmips_gpio_get,
+ .set = ifxmips_gpio_set,
+ .base = 0,
+ .ngpio = 32,
+};
+
+static int
+ifxmips_gpio_probe(struct platform_device *dev)
+{
+ gpiochip_add(&ifxmips_gpio_chip);
+ return 0;
}
-static int ifxmips_gpio_remove(struct platform_device *pdev)
+static int
+ifxmips_gpio_remove(struct platform_device *pdev)
{
-#ifdef CONFIG_IFXMIPS_GPIO_RST_BTN
- del_timer_sync(&rst_button_timer);
-#endif
+ gpiochip_remove(&ifxmips_gpio_chip);
return 0;
}
-static struct platform_driver ifxmips_gpio_driver = {
+static struct platform_driver
+ifxmips_gpio_driver = {
.probe = ifxmips_gpio_probe,
.remove = ifxmips_gpio_remove,
.driver = {
@@ -341,7 +326,8 @@ static struct platform_driver ifxmips_gpio_driver = {
},
};
-int __init ifxmips_gpio_init(void)
+int __init
+ifxmips_gpio_init(void)
{
int ret = platform_driver_register(&ifxmips_gpio_driver);
if (ret)
@@ -349,7 +335,8 @@ int __init ifxmips_gpio_init(void)
return ret;
}
-void __exit ifxmips_gpio_exit(void)
+void __exit
+ifxmips_gpio_exit(void)
{
platform_driver_unregister(&ifxmips_gpio_driver);
}
diff --git a/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/gpio.h b/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/gpio.h
deleted file mode 100644
index 4176bfd809..0000000000
--- a/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/gpio.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * include/asm-mips/mach-ifxmips/gpio.h
- *
- * 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) 2007 John Crispin <blogic@openwrt.org>
- *
- */
-
-#ifndef _IFXMIPS_GPIO_H_
-#define _IFXMIPS_GPIO_H_
-
-#include <ifxmips.h>
-#include <ifxmips_gpio.h>
-
-#define GPIO_TO_PORT(x) ((x > 15) ? (1) : (0))
-#define GPIO_TO_GPIO(x) ((x > 15) ? (x-16) : (x))
-
-static inline int gpio_direction_input(unsigned gpio)
-{
- ifxmips_port_set_open_drain(GPIO_TO_PORT(gpio), GPIO_TO_GPIO(gpio));
- ifxmips_port_clear_altsel0(GPIO_TO_PORT(gpio), GPIO_TO_GPIO(gpio));
- ifxmips_port_clear_altsel1(GPIO_TO_PORT(gpio), GPIO_TO_GPIO(gpio));
- ifxmips_port_set_dir_in(GPIO_TO_PORT(gpio), GPIO_TO_GPIO(gpio));
- return 0;
-}
-
-static inline int gpio_direction_output(unsigned gpio, int value)
-{
- ifxmips_port_clear_open_drain(GPIO_TO_PORT(gpio), GPIO_TO_GPIO(gpio));
- ifxmips_port_clear_altsel0(GPIO_TO_PORT(gpio), GPIO_TO_GPIO(gpio));
- ifxmips_port_clear_altsel1(GPIO_TO_PORT(gpio), GPIO_TO_GPIO(gpio));
- ifxmips_port_set_dir_out(GPIO_TO_PORT(gpio), GPIO_TO_GPIO(gpio));
- return 0;
-}
-
-static inline int gpio_get_value(unsigned gpio)
-{
- ifxmips_port_get_input(GPIO_TO_PORT(gpio), GPIO_TO_GPIO(gpio));
- return 0;
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
- if (value)
- ifxmips_port_set_output(GPIO_TO_PORT(gpio), GPIO_TO_GPIO(gpio));
- else
- ifxmips_port_clear_output(GPIO_TO_PORT(gpio),
- GPIO_TO_GPIO(gpio));
-}
-
-static inline int gpio_request(unsigned gpio, const char *label)
-{
- return 0;
-}
-
-static inline void gpio_free(unsigned gpio)
-{
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
- return 0;
-}
-
-static inline int irq_to_gpio(unsigned irq)
-{
- return 0;
-}
-
-static inline int gpio_cansleep(unsigned gpio)
-{
- return 0;
-}
-
-static inline int gpio_get_value_cansleep(unsigned gpio)
-{
- might_sleep();
- return gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value_cansleep(unsigned gpio, int value)
-{
- might_sleep();
- gpio_set_value(gpio, value);
-}
-
-static inline int gpio_is_valid(int number)
-{
- return ((unsigned)number) < 32;
-}
-
-#endif
diff --git a/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/ifxmips_irq.h b/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/ifxmips_irq.h
index f3cb99c2bb..e6ca59baf9 100644
--- a/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/ifxmips_irq.h
+++ b/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/ifxmips_irq.h
@@ -66,8 +66,11 @@
#define IFXMIPS_PPE_MBOX_INT (INT_NUM_IM2_IRL0 + 24)
-#define IFXMIPS_USB_INT (INT_NUM_IM4_IRL0 + 22)
-#define IFXMIPS_USB_OC_INT (INT_NUM_IM4_IRL0 + 23)
+#define INT_NUM_IM4_IRL14 (INT_NUM_IM4_IRL0 + 14)
+#define INT_NUM_IM4_IRL18 (INT_NUM_IM4_IRL0 + 18)
+#define INT_NUM_IM4_IRL19 (INT_NUM_IM4_IRL0 + 19)
+#define IFXMIPS_USB_INT (INT_NUM_IM4_IRL0 + 22)
+#define IFXMIPS_USB_OC_INT (INT_NUM_IM4_IRL0 + 23)
extern void ifxmips_mask_and_ack_irq(unsigned int irq_nr);
diff --git a/target/linux/ifxmips/patches-2.6.30/100-board.patch b/target/linux/ifxmips/patches-2.6.30/100-board.patch
index 16272698ec..5e7530ecde 100644
--- a/target/linux/ifxmips/patches-2.6.30/100-board.patch
+++ b/target/linux/ifxmips/patches-2.6.30/100-board.patch
@@ -1,8 +1,8 @@
-Index: linux-2.6.30.5/arch/mips/Kconfig
+Index: linux-2.6.30.10/arch/mips/Kconfig
===================================================================
---- linux-2.6.30.5.orig/arch/mips/Kconfig 2009-09-02 22:12:48.000000000 +0200
-+++ linux-2.6.30.5/arch/mips/Kconfig 2009-09-03 01:18:31.000000000 +0200
-@@ -79,6 +79,24 @@
+--- linux-2.6.30.10.orig/arch/mips/Kconfig 2010-03-24 15:32:02.000000000 +0100
++++ linux-2.6.30.10/arch/mips/Kconfig 2010-03-24 21:56:29.000000000 +0100
+@@ -79,6 +79,23 @@
select SYS_SUPPORTS_64BIT_KERNEL
select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -20,14 +20,13 @@ Index: linux-2.6.30.5/arch/mips/Kconfig
+ select SYS_SUPPORTS_MULTITHREADING
+ select SYS_HAS_EARLY_PRINTK
+ select HW_HAS_PCI
-+ select GENERIC_GPIO
-+ select ARCH_WANT_OPTIONAL_GPIOLIB
++ select ARCH_REQUIRE_GPIOLIB
+ select SWAP_IO_SPACE
+
config MACH_DECSTATION
bool "DECstations"
select BOOT_ELF32
-@@ -643,6 +661,7 @@
+@@ -643,6 +660,7 @@
source "arch/mips/txx9/Kconfig"
source "arch/mips/vr41xx/Kconfig"
source "arch/mips/cavium-octeon/Kconfig"
@@ -35,10 +34,10 @@ Index: linux-2.6.30.5/arch/mips/Kconfig
endmenu
-Index: linux-2.6.30.5/arch/mips/Makefile
+Index: linux-2.6.30.10/arch/mips/Makefile
===================================================================
---- linux-2.6.30.5.orig/arch/mips/Makefile 2009-09-02 22:12:48.000000000 +0200
-+++ linux-2.6.30.5/arch/mips/Makefile 2009-09-02 22:12:53.000000000 +0200
+--- linux-2.6.30.10.orig/arch/mips/Makefile 2010-03-24 15:32:02.000000000 +0100
++++ linux-2.6.30.10/arch/mips/Makefile 2010-03-24 15:32:04.000000000 +0100
@@ -290,6 +290,13 @@
load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000
@@ -53,10 +52,10 @@ Index: linux-2.6.30.5/arch/mips/Makefile
# DECstation family
#
core-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/
-Index: linux-2.6.30.5/arch/mips/include/asm/bootinfo.h
+Index: linux-2.6.30.10/arch/mips/include/asm/bootinfo.h
===================================================================
---- linux-2.6.30.5.orig/arch/mips/include/asm/bootinfo.h 2009-09-02 22:12:48.000000000 +0200
-+++ linux-2.6.30.5/arch/mips/include/asm/bootinfo.h 2009-09-02 22:13:05.000000000 +0200
+--- linux-2.6.30.10.orig/arch/mips/include/asm/bootinfo.h 2009-12-04 07:00:07.000000000 +0100
++++ linux-2.6.30.10/arch/mips/include/asm/bootinfo.h 2010-03-24 15:32:04.000000000 +0100
@@ -57,6 +57,8 @@
#define MACH_MIKROTIK_RB532 0 /* Mikrotik RouterBoard 532 */
#define MACH_MIKROTIK_RB532A 1 /* Mikrotik RouterBoard 532A */
diff --git a/target/linux/ifxmips/patches-2.6.30/600-ebu-gpio.patch b/target/linux/ifxmips/patches-2.6.30/600-ebu-gpio.patch
new file mode 100644
index 0000000000..01e428a183
--- /dev/null
+++ b/target/linux/ifxmips/patches-2.6.30/600-ebu-gpio.patch
@@ -0,0 +1,196 @@
+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");