aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-iop32x
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2006-09-18 18:15:21 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-09-25 05:25:38 -0400
commite25d64f1242e8586f6e20c26fd876a4d956a6c45 (patch)
tree1a68da7173716896254847708dcd1675102a24ac /arch/arm/mach-iop32x
parent7ae1f7ec525c32db441836ab0ab010b85cb819a2 (diff)
[ARM] 3819/1: iop3xx: factor out shared i2c code
Move the i2c bits shared between iop32x and iop33x to plat-iop/i2c.c and include/asm-arm/hardware/iop3xx.h. Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-iop32x')
-rw-r--r--arch/arm/mach-iop32x/common.c17
-rw-r--r--arch/arm/mach-iop32x/setup.c53
2 files changed, 12 insertions, 58 deletions
diff --git a/arch/arm/mach-iop32x/common.c b/arch/arm/mach-iop32x/common.c
index 8044af6a54e1..17e7d650fecb 100644
--- a/arch/arm/mach-iop32x/common.c
+++ b/arch/arm/mach-iop32x/common.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <asm/hardware.h> 16#include <asm/hardware.h>
17#include <asm/hardware/iop3xx.h>
17 18
18/* 19/*
19 * Shared variables 20 * Shared variables
@@ -39,23 +40,23 @@ void ep80219_power_off(void)
39 */ 40 */
40 41
41 /* Send the Address byte w/ the start condition */ 42 /* Send the Address byte w/ the start condition */
42 *IOP321_IDBR1 = 0x60; 43 *IOP3XX_IDBR1 = 0x60;
43 *IOP321_ICR1 = 0xE9; 44 *IOP3XX_ICR1 = 0xE9;
44 mdelay(1); 45 mdelay(1);
45 46
46 /* Send the START_MSG byte w/ no start or stop condition */ 47 /* Send the START_MSG byte w/ no start or stop condition */
47 *IOP321_IDBR1 = 0x0F; 48 *IOP3XX_IDBR1 = 0x0F;
48 *IOP321_ICR1 = 0xE8; 49 *IOP3XX_ICR1 = 0xE8;
49 mdelay(1); 50 mdelay(1);
50 51
51 /* Send the SHUTDOWN_COMPLETE Message ID byte w/ no start or stop condition */ 52 /* Send the SHUTDOWN_COMPLETE Message ID byte w/ no start or stop condition */
52 *IOP321_IDBR1 = 0x03; 53 *IOP3XX_IDBR1 = 0x03;
53 *IOP321_ICR1 = 0xE8; 54 *IOP3XX_ICR1 = 0xE8;
54 mdelay(1); 55 mdelay(1);
55 56
56 /* Send an ignored byte w/ stop condition */ 57 /* Send an ignored byte w/ stop condition */
57 *IOP321_IDBR1 = 0x00; 58 *IOP3XX_IDBR1 = 0x00;
58 *IOP321_ICR1 = 0xEA; 59 *IOP3XX_ICR1 = 0xEA;
59 60
60 while (1) ; 61 while (1) ;
61} 62}
diff --git a/arch/arm/mach-iop32x/setup.c b/arch/arm/mach-iop32x/setup.c
index 48d806474f40..1a03b0b41baa 100644
--- a/arch/arm/mach-iop32x/setup.c
+++ b/arch/arm/mach-iop32x/setup.c
@@ -29,6 +29,7 @@
29#include <asm/hardware.h> 29#include <asm/hardware.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/hardware/iop3xx.h>
32 33
33#define IOP321_UART_XTAL 1843200 34#define IOP321_UART_XTAL 1843200
34 35
@@ -57,58 +58,10 @@ static struct uart_port iop321_serial_ports[] = {
57 } 58 }
58}; 59};
59 60
60static struct resource iop32x_i2c_0_resources[] = {
61 [0] = {
62 .start = 0xfffff680,
63 .end = 0xfffff698,
64 .flags = IORESOURCE_MEM,
65 },
66 [1] = {
67 .start = IRQ_IOP321_I2C_0,
68 .end = IRQ_IOP321_I2C_0,
69 .flags = IORESOURCE_IRQ
70 }
71};
72
73static struct resource iop32x_i2c_1_resources[] = {
74 [0] = {
75 .start = 0xfffff6a0,
76 .end = 0xfffff6b8,
77 .flags = IORESOURCE_MEM,
78 },
79 [1] = {
80 .start = IRQ_IOP321_I2C_1,
81 .end = IRQ_IOP321_I2C_1,
82 .flags = IORESOURCE_IRQ
83 }
84};
85
86static struct platform_device iop32x_i2c_0_controller = {
87 .name = "IOP3xx-I2C",
88 .id = 0,
89 .num_resources = 2,
90 .resource = iop32x_i2c_0_resources
91};
92
93static struct platform_device iop32x_i2c_1_controller = {
94 .name = "IOP3xx-I2C",
95 .id = 1,
96 .num_resources = 2,
97 .resource = iop32x_i2c_1_resources
98};
99
100static struct platform_device *iop32x_devices[] __initdata = {
101 &iop32x_i2c_0_controller,
102 &iop32x_i2c_1_controller
103};
104
105void __init iop32x_init(void) 61void __init iop32x_init(void)
106{ 62{
107 if(iop_is_321()) 63 platform_device_register(&iop3xx_i2c0_device);
108 { 64 platform_device_register(&iop3xx_i2c1_device);
109 platform_add_devices(iop32x_devices,
110 ARRAY_SIZE(iop32x_devices));
111 }
112 early_serial_setup(&iop321_serial_ports[0]); 65 early_serial_setup(&iop321_serial_ports[0]);
113} 66}
114 67