diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-iop32x/common.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/setup.c | 53 | ||||
-rw-r--r-- | arch/arm/mach-iop33x/setup.c | 44 | ||||
-rw-r--r-- | arch/arm/plat-iop/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/plat-iop/i2c.c | 81 |
5 files changed, 96 insertions, 101 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 | ||
60 | static 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 | |||
73 | static 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 | |||
86 | static 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 | |||
93 | static 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 | |||
100 | static struct platform_device *iop32x_devices[] __initdata = { | ||
101 | &iop32x_i2c_0_controller, | ||
102 | &iop32x_i2c_1_controller | ||
103 | }; | ||
104 | |||
105 | void __init iop32x_init(void) | 61 | void __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 | ||
diff --git a/arch/arm/mach-iop33x/setup.c b/arch/arm/mach-iop33x/setup.c index 67cb21cb0ad9..ad737d6582b5 100644 --- a/arch/arm/mach-iop33x/setup.c +++ b/arch/arm/mach-iop33x/setup.c | |||
@@ -100,51 +100,9 @@ static struct platform_device iop33x_uart1 = { | |||
100 | .resource = iop33x_uart1_resources, | 100 | .resource = iop33x_uart1_resources, |
101 | }; | 101 | }; |
102 | 102 | ||
103 | static struct resource iop33x_i2c_0_resources[] = { | ||
104 | [0] = { | ||
105 | .start = 0xfffff680, | ||
106 | .end = 0xfffff698, | ||
107 | .flags = IORESOURCE_MEM, | ||
108 | }, | ||
109 | [1] = { | ||
110 | .start = IRQ_IOP331_I2C_0, | ||
111 | .end = IRQ_IOP331_I2C_0, | ||
112 | .flags = IORESOURCE_IRQ | ||
113 | } | ||
114 | }; | ||
115 | |||
116 | static struct resource iop33x_i2c_1_resources[] = { | ||
117 | [0] = { | ||
118 | .start = 0xfffff6a0, | ||
119 | .end = 0xfffff6b8, | ||
120 | .flags = IORESOURCE_MEM, | ||
121 | }, | ||
122 | [1] = { | ||
123 | .start = IRQ_IOP331_I2C_1, | ||
124 | .end = IRQ_IOP331_I2C_1, | ||
125 | .flags = IORESOURCE_IRQ | ||
126 | } | ||
127 | }; | ||
128 | |||
129 | static struct platform_device iop33x_i2c_0_controller = { | ||
130 | .name = "IOP3xx-I2C", | ||
131 | .id = 0, | ||
132 | .num_resources = 2, | ||
133 | .resource = iop33x_i2c_0_resources | ||
134 | }; | ||
135 | |||
136 | static struct platform_device iop33x_i2c_1_controller = { | ||
137 | .name = "IOP3xx-I2C", | ||
138 | .id = 1, | ||
139 | .num_resources = 2, | ||
140 | .resource = iop33x_i2c_1_resources | ||
141 | }; | ||
142 | |||
143 | static struct platform_device *iop33x_devices[] __initdata = { | 103 | static struct platform_device *iop33x_devices[] __initdata = { |
144 | &iop33x_uart0, | 104 | &iop33x_uart0, |
145 | &iop33x_uart1, | 105 | &iop33x_uart1, |
146 | &iop33x_i2c_0_controller, | ||
147 | &iop33x_i2c_1_controller | ||
148 | }; | 106 | }; |
149 | 107 | ||
150 | void __init iop33x_init(void) | 108 | void __init iop33x_init(void) |
@@ -154,6 +112,8 @@ void __init iop33x_init(void) | |||
154 | platform_add_devices(iop33x_devices, | 112 | platform_add_devices(iop33x_devices, |
155 | ARRAY_SIZE(iop33x_devices)); | 113 | ARRAY_SIZE(iop33x_devices)); |
156 | } | 114 | } |
115 | platform_device_register(&iop3xx_i2c0_device); | ||
116 | platform_device_register(&iop3xx_i2c1_device); | ||
157 | } | 117 | } |
158 | 118 | ||
159 | #ifdef CONFIG_ARCH_IOP33X | 119 | #ifdef CONFIG_ARCH_IOP33X |
diff --git a/arch/arm/plat-iop/Makefile b/arch/arm/plat-iop/Makefile index b299103537c5..be6ab7c71ca3 100644 --- a/arch/arm/plat-iop/Makefile +++ b/arch/arm/plat-iop/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o | 5 | obj-y := i2c.o setup.o |
6 | obj-m := | 6 | obj-m := |
7 | obj-n := | 7 | obj-n := |
8 | obj- := | 8 | obj- := |
diff --git a/arch/arm/plat-iop/i2c.c b/arch/arm/plat-iop/i2c.c new file mode 100644 index 000000000000..7ae149c2e982 --- /dev/null +++ b/arch/arm/plat-iop/i2c.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-iop/i2c.c | ||
3 | * | ||
4 | * Author: Nicolas Pitre <nico@cam.org> | ||
5 | * Copyright (C) 2001 MontaVista Software, Inc. | ||
6 | * Copyright (C) 2004 Intel Corporation. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/mm.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/major.h> | ||
16 | #include <linux/fs.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/serial.h> | ||
19 | #include <linux/tty.h> | ||
20 | #include <linux/serial_core.h> | ||
21 | #include <asm/io.h> | ||
22 | #include <asm/pgtable.h> | ||
23 | #include <asm/page.h> | ||
24 | #include <asm/mach/map.h> | ||
25 | #include <asm/setup.h> | ||
26 | #include <asm/system.h> | ||
27 | #include <asm/memory.h> | ||
28 | #include <asm/hardware.h> | ||
29 | #include <asm/hardware/iop3xx.h> | ||
30 | #include <asm/mach-types.h> | ||
31 | #include <asm/mach/arch.h> | ||
32 | |||
33 | #ifdef CONFIG_ARCH_IOP32X | ||
34 | #define IRQ_IOP3XX_I2C_0 IRQ_IOP321_I2C_0 | ||
35 | #define IRQ_IOP3XX_I2C_1 IRQ_IOP321_I2C_1 | ||
36 | #endif | ||
37 | #ifdef CONFIG_ARCH_IOP33X | ||
38 | #define IRQ_IOP3XX_I2C_0 IRQ_IOP331_I2C_0 | ||
39 | #define IRQ_IOP3XX_I2C_1 IRQ_IOP331_I2C_1 | ||
40 | #endif | ||
41 | |||
42 | static struct resource iop3xx_i2c0_resources[] = { | ||
43 | [0] = { | ||
44 | .start = 0xfffff680, | ||
45 | .end = 0xfffff697, | ||
46 | .flags = IORESOURCE_MEM, | ||
47 | }, | ||
48 | [1] = { | ||
49 | .start = IRQ_IOP3XX_I2C_0, | ||
50 | .end = IRQ_IOP3XX_I2C_0, | ||
51 | .flags = IORESOURCE_IRQ, | ||
52 | }, | ||
53 | }; | ||
54 | |||
55 | struct platform_device iop3xx_i2c0_device = { | ||
56 | .name = "IOP3xx-I2C", | ||
57 | .id = 0, | ||
58 | .num_resources = 2, | ||
59 | .resource = iop3xx_i2c0_resources, | ||
60 | }; | ||
61 | |||
62 | |||
63 | static struct resource iop3xx_i2c1_resources[] = { | ||
64 | [0] = { | ||
65 | .start = 0xfffff6a0, | ||
66 | .end = 0xfffff6b7, | ||
67 | .flags = IORESOURCE_MEM, | ||
68 | }, | ||
69 | [1] = { | ||
70 | .start = IRQ_IOP3XX_I2C_1, | ||
71 | .end = IRQ_IOP3XX_I2C_1, | ||
72 | .flags = IORESOURCE_IRQ, | ||
73 | } | ||
74 | }; | ||
75 | |||
76 | struct platform_device iop3xx_i2c1_device = { | ||
77 | .name = "IOP3xx-I2C", | ||
78 | .id = 1, | ||
79 | .num_resources = 2, | ||
80 | .resource = iop3xx_i2c1_resources, | ||
81 | }; | ||