aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-07-09 06:57:44 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-07-09 06:57:44 +0000
commit38b922b128896ab1d4ee57ce9baf4f7ee2d5419b (patch)
treec28c9604fbcf787b5d421f09f147b6bdcd69cd2c /target
parente111b2d68b147d2e67b9d8da055d0b7f8fd53c37 (diff)
downloadupstream-38b922b128896ab1d4ee57ce9baf4f7ee2d5419b.tar.gz
upstream-38b922b128896ab1d4ee57ce9baf4f7ee2d5419b.tar.bz2
upstream-38b922b128896ab1d4ee57ce9baf4f7ee2d5419b.zip
[ar71xx] register a I2C GPIO expander on the PB44 board
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16747 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c
index 5d98ea5d14..df5b954ca6 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c
@@ -14,6 +14,9 @@
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
+#include <linux/i2c.h>
+#include <linux/i2c-gpio.h>
+#include <linux/i2c/pcf857x.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
@@ -21,6 +24,11 @@
#include "devices.h"
+#define PB44_GPIO_I2C_SCL 0
+#define PB44_GPIO_I2C_SDA 1
+
+#define PB44_GPIO_EXP_BASE 16
+
static struct spi_board_info pb44_spi_info[] = {
{
.bus_num = 0,
@@ -46,6 +54,30 @@ static struct ar71xx_pci_irq pb44_pci_irqs[] __initdata = {
}
};
+static struct i2c_gpio_platform_data pb44_i2c_gpio_data = {
+ .sda_pin = PB44_GPIO_I2C_SDA,
+ .scl_pin = PB44_GPIO_I2C_SCL,
+};
+
+static struct platform_device pb44_i2c_gpio_device = {
+ .name = "i2c-gpio",
+ .id = 0,
+ .dev = {
+ .platform_data = &pb44_i2c_gpio_data,
+ }
+};
+
+static struct pcf857x_platform_data pb44_pcf857x_data = {
+ .gpio_base = PB44_GPIO_EXP_BASE,
+};
+
+static struct i2c_board_info pb44_i2c_board_info[] __initdata = {
+ {
+ I2C_BOARD_INFO("pcf8575", 0x20),
+ .platform_data = &pb44_pcf857x_data,
+ },
+};
+
#define PB44_WAN_PHYMASK BIT(0)
#define PB44_LAN_PHYMASK 0
#define PB44_MDIO_PHYMASK (PB44_LAN_PHYMASK | PB44_WAN_PHYMASK)
@@ -73,6 +105,11 @@ static void __init pb44_init(void)
ar71xx_pci_init(ARRAY_SIZE(pb44_pci_irqs), pb44_pci_irqs);
+ i2c_register_board_info(0, pb44_i2c_board_info,
+ ARRAY_SIZE(pb44_i2c_board_info));
+
+ platform_device_register(&pb44_i2c_gpio_device);
+
/* TODO: GPIO LEDs & buttons */
}