summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeepak Saxena <dsaxena@net.rmk.(none)>2005-01-07 22:07:15 +0000
committerRussell King <rmk@flint.arm.linux.org.uk>2005-01-07 22:07:15 +0000
commitcaef95d464c895b1ae81cf7c03632d14afe6ce84 (patch)
tree03b591049dba07f6d0e769b1a532e29c4b5fd189
parenteb25b5b24b977f108c5a08b98d57357af0612cbb (diff)
[ARM PATCH] 2358/1: Add IXP46x I2C platform device
Patch from Deepak Saxena The IXP46x chips from Intel include the same I2C controller as found on the IOP3xx. This patch adds a hook to the platform-level init code to add that device to the device tree if running on a 46x CPU. A separate patch has been sent upstream via Greg KH for the changes to the I2C driver to support both IOP and IXP systems. While at it, we fix a minor issue with the code where we were sending the wrong ptr to platform_add_devices(). I am not sure how it ever worked... Signed-off-by: Deepak Saxena Signed-off-by: Russell King
-rw-r--r--arch/arm/mach-ixp4xx/common.c37
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c3
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c4
-rw-r--r--arch/arm/mach-ixp4xx/prpmc1100-setup.c4
-rw-r--r--include/asm-arm/arch-ixp4xx/irqs.h14
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h1
6 files changed, 52 insertions, 11 deletions
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index b63d4f609bc8..9c7614b9125c 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -279,3 +279,40 @@ struct sys_timer ixp4xx_timer = {
.init = ixp4xx_timer_init,
.offset = ixp4xx_gettimeoffset,
};
+
+static struct resource ixp46x_i2c_resources[] = {
+ [0] = {
+ .start = 0xc8011000,
+ .end = 0xc801101c,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_IXP4XX_I2C,
+ .end = IRQ_IXP4XX_I2C,
+ .flags = IORESOURCE_IRQ
+ }
+};
+
+/*
+ * I2C controller. The IXP46x uses the same block as the IOP3xx, so
+ * we just use the same device name.
+ */
+static struct platform_device ixp46x_i2c_controller = {
+ .name = "IOP3xx-I2C",
+ .id = 0,
+ .num_resources = 2,
+ .resource = &ixp46x_i2c_resources
+};
+
+static struct platform_device *ixp46x_devices[] __initdata = {
+ &ixp46x_i2c_controller
+};
+
+void __init ixp4xx_sys_init(void)
+{
+ if (cpu_is_ixp46x()) {
+ platform_add_devices(ixp46x_devices,
+ ARRAY_SIZE(ixp46x_devices));
+ }
+}
+
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index a4b54430f121..651ff67a5754 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -89,7 +89,8 @@ static void __init coyote_init(void)
*IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
*IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
- platform_add_devices(&coyote_devices, ARRAY_SIZE(coyote_devices));
+ ixp4xx_sys_init();
+ platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
}
#ifdef CONFIG_ARCH_ADI_COYOTE
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index e6a4e60ef17b..4aafd8e6e98a 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -108,6 +108,8 @@ static struct platform_device *ixdp425_devices[] __initdata = {
static void __init ixdp425_init(void)
{
+ ixp4xx_sys_init();
+
/*
* IXP465 has 32MB window
*/
@@ -115,7 +117,7 @@ static void __init ixdp425_init(void)
ixdp425_flash_resource.end += IXDP425_FLASH_SIZE;
}
- platform_add_devices(&ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
+ platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
}
MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
diff --git a/arch/arm/mach-ixp4xx/prpmc1100-setup.c b/arch/arm/mach-ixp4xx/prpmc1100-setup.c
index 199e454d1d3f..68f679a41528 100644
--- a/arch/arm/mach-ixp4xx/prpmc1100-setup.c
+++ b/arch/arm/mach-ixp4xx/prpmc1100-setup.c
@@ -79,7 +79,9 @@ static struct platform_device *prpmc1100_devices[] __initdata = {
static void __init prpmc1100_init(void)
{
- platform_add_devices(&prpmc1100_devices, ARRAY_SIZE(prpmc1100_devices));
+ ixp4xx_sys_init();
+
+ platform_add_devices(prpmc1100_devices, ARRAY_SIZE(prpmc1100_devices));
}
MACHINE_START(PRPMC1100, "Motorola PrPMC1100")
diff --git a/include/asm-arm/arch-ixp4xx/irqs.h b/include/asm-arm/arch-ixp4xx/irqs.h
index ca6de70b7ba3..ca808281c7f9 100644
--- a/include/asm-arm/arch-ixp4xx/irqs.h
+++ b/include/asm-arm/arch-ixp4xx/irqs.h
@@ -48,14 +48,6 @@
#define IRQ_IXP4XX_GPIO12 29
#define IRQ_IXP4XX_SW_INT1 30
#define IRQ_IXP4XX_SW_INT2 31
-
-#ifndef CONFIG_CPU_IXP46X
-#define NR_IRQS 32
-#else
-
-/*
- * IXP465 adds new sources
- */
#define IRQ_IXP4XX_USB_HOST 32
#define IRQ_IXP4XX_I2C 33
#define IRQ_IXP4XX_SSP 34
@@ -67,6 +59,12 @@
#define IRQ_IXP4XX_MCU_ECC 61
#define IRQ_IXP4XX_EXP_PE 62
+/*
+ * Only first 32 sources are valid if running on IXP42x systems
+ */
+#ifndef CONFIG_CPU_IXP46X
+#define NR_IRQS 32
+#else
#define NR_IRQS 64
#endif
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index fc9d710184f3..d0e195b32953 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -60,6 +60,7 @@ struct sys_timer;
*/
extern void ixp4xx_map_io(void);
extern void ixp4xx_init_irq(void);
+extern void ixp4xx_sys_init(void);
extern struct sys_timer ixp4xx_timer;
extern void ixp4xx_pci_preinit(void);
struct pci_sys_data;