diff options
author | Eric Miao <eric.miao@marvell.com> | 2009-04-13 03:34:54 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2009-06-04 22:32:02 -0400 |
commit | 1a77920e4cbe508c8dc40fef1d0beb21aac8cc17 (patch) | |
tree | 19ce0dbcd421e2c48c62438b089c1ada26cc99e7 /arch/arm/mach-mmp | |
parent | f0a83701399123b0e95cc4d949fcccf9941fd190 (diff) |
[ARM] pxa: add I2C (TWSI) devices to pxa168/pxa910
Signed-off-by: Paul Shen <paul.shen@marvell.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'arch/arm/mach-mmp')
-rw-r--r-- | arch/arm/mach-mmp/include/mach/mfp-pxa168.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-mmp/include/mach/pxa168.h | 24 | ||||
-rw-r--r-- | arch/arm/mach-mmp/include/mach/pxa910.h | 24 | ||||
-rw-r--r-- | arch/arm/mach-mmp/pxa168.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-mmp/pxa910.c | 6 |
5 files changed, 64 insertions, 0 deletions
diff --git a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h index 2e914649b9e4..dc4226371d64 100644 --- a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h +++ b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h | |||
@@ -253,6 +253,10 @@ | |||
253 | #define GPIO58_LCD_PCLK_WR MFP_CFG(GPIO58, AF1) | 253 | #define GPIO58_LCD_PCLK_WR MFP_CFG(GPIO58, AF1) |
254 | #define GPIO85_LCD_VSYNC MFP_CFG(GPIO85, AF1) | 254 | #define GPIO85_LCD_VSYNC MFP_CFG(GPIO85, AF1) |
255 | 255 | ||
256 | /* I2C */ | ||
257 | #define GPIO105_CI2C_SDA MFP_CFG(GPIO105, AF1) | ||
258 | #define GPIO106_CI2C_SCL MFP_CFG(GPIO106, AF1) | ||
259 | |||
256 | /* I2S */ | 260 | /* I2S */ |
257 | #define GPIO113_I2S_MCLK MFP_CFG(GPIO113,AF6) | 261 | #define GPIO113_I2S_MCLK MFP_CFG(GPIO113,AF6) |
258 | #define GPIO114_I2S_FRM MFP_CFG(GPIO114,AF1) | 262 | #define GPIO114_I2S_FRM MFP_CFG(GPIO114,AF1) |
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h index ef0a8a2076e9..bfdd6299dff5 100644 --- a/arch/arm/mach-mmp/include/mach/pxa168.h +++ b/arch/arm/mach-mmp/include/mach/pxa168.h | |||
@@ -1,10 +1,14 @@ | |||
1 | #ifndef __ASM_MACH_PXA168_H | 1 | #ifndef __ASM_MACH_PXA168_H |
2 | #define __ASM_MACH_PXA168_H | 2 | #define __ASM_MACH_PXA168_H |
3 | 3 | ||
4 | #include <linux/i2c.h> | ||
4 | #include <mach/devices.h> | 5 | #include <mach/devices.h> |
6 | #include <plat/i2c.h> | ||
5 | 7 | ||
6 | extern struct pxa_device_desc pxa168_device_uart1; | 8 | extern struct pxa_device_desc pxa168_device_uart1; |
7 | extern struct pxa_device_desc pxa168_device_uart2; | 9 | extern struct pxa_device_desc pxa168_device_uart2; |
10 | extern struct pxa_device_desc pxa168_device_twsi0; | ||
11 | extern struct pxa_device_desc pxa168_device_twsi1; | ||
8 | 12 | ||
9 | static inline int pxa168_add_uart(int id) | 13 | static inline int pxa168_add_uart(int id) |
10 | { | 14 | { |
@@ -20,4 +24,24 @@ static inline int pxa168_add_uart(int id) | |||
20 | 24 | ||
21 | return pxa_register_device(d, NULL, 0); | 25 | return pxa_register_device(d, NULL, 0); |
22 | } | 26 | } |
27 | |||
28 | static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data, | ||
29 | struct i2c_board_info *info, unsigned size) | ||
30 | { | ||
31 | struct pxa_device_desc *d = NULL; | ||
32 | int ret; | ||
33 | |||
34 | switch (id) { | ||
35 | case 0: d = &pxa168_device_twsi0; break; | ||
36 | case 1: d = &pxa168_device_twsi1; break; | ||
37 | default: | ||
38 | return -EINVAL; | ||
39 | } | ||
40 | |||
41 | ret = i2c_register_board_info(id, info, size); | ||
42 | if (ret) | ||
43 | return ret; | ||
44 | |||
45 | return pxa_register_device(d, data, sizeof(*data)); | ||
46 | } | ||
23 | #endif /* __ASM_MACH_PXA168_H */ | 47 | #endif /* __ASM_MACH_PXA168_H */ |
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h index b7aeaf574c36..a0f0cbee1c07 100644 --- a/arch/arm/mach-mmp/include/mach/pxa910.h +++ b/arch/arm/mach-mmp/include/mach/pxa910.h | |||
@@ -1,10 +1,14 @@ | |||
1 | #ifndef __ASM_MACH_PXA910_H | 1 | #ifndef __ASM_MACH_PXA910_H |
2 | #define __ASM_MACH_PXA910_H | 2 | #define __ASM_MACH_PXA910_H |
3 | 3 | ||
4 | #include <linux/i2c.h> | ||
4 | #include <mach/devices.h> | 5 | #include <mach/devices.h> |
6 | #include <plat/i2c.h> | ||
5 | 7 | ||
6 | extern struct pxa_device_desc pxa910_device_uart1; | 8 | extern struct pxa_device_desc pxa910_device_uart1; |
7 | extern struct pxa_device_desc pxa910_device_uart2; | 9 | extern struct pxa_device_desc pxa910_device_uart2; |
10 | extern struct pxa_device_desc pxa910_device_twsi0; | ||
11 | extern struct pxa_device_desc pxa910_device_twsi1; | ||
8 | 12 | ||
9 | static inline int pxa910_add_uart(int id) | 13 | static inline int pxa910_add_uart(int id) |
10 | { | 14 | { |
@@ -20,4 +24,24 @@ static inline int pxa910_add_uart(int id) | |||
20 | 24 | ||
21 | return pxa_register_device(d, NULL, 0); | 25 | return pxa_register_device(d, NULL, 0); |
22 | } | 26 | } |
27 | |||
28 | static inline int pxa910_add_twsi(int id, struct i2c_pxa_platform_data *data, | ||
29 | struct i2c_board_info *info, unsigned size) | ||
30 | { | ||
31 | struct pxa_device_desc *d = NULL; | ||
32 | int ret; | ||
33 | |||
34 | switch (id) { | ||
35 | case 0: d = &pxa910_device_twsi0; break; | ||
36 | case 1: d = &pxa910_device_twsi1; break; | ||
37 | default: | ||
38 | return -EINVAL; | ||
39 | } | ||
40 | |||
41 | ret = i2c_register_board_info(id, info, size); | ||
42 | if (ret) | ||
43 | return ret; | ||
44 | |||
45 | return pxa_register_device(d, data, sizeof(*data)); | ||
46 | } | ||
23 | #endif /* __ASM_MACH_PXA910_H */ | 47 | #endif /* __ASM_MACH_PXA910_H */ |
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c index ae924468658c..e0729e34f7ad 100644 --- a/arch/arm/mach-mmp/pxa168.c +++ b/arch/arm/mach-mmp/pxa168.c | |||
@@ -65,11 +65,15 @@ void __init pxa168_init_irq(void) | |||
65 | /* APB peripheral clocks */ | 65 | /* APB peripheral clocks */ |
66 | static APBC_CLK(uart1, PXA168_UART1, 1, 14745600); | 66 | static APBC_CLK(uart1, PXA168_UART1, 1, 14745600); |
67 | static APBC_CLK(uart2, PXA168_UART2, 1, 14745600); | 67 | static APBC_CLK(uart2, PXA168_UART2, 1, 14745600); |
68 | static APBC_CLK(twsi0, PXA168_TWSI0, 1, 33000000); | ||
69 | static APBC_CLK(twsi1, PXA168_TWSI1, 1, 33000000); | ||
68 | 70 | ||
69 | /* device and clock bindings */ | 71 | /* device and clock bindings */ |
70 | static struct clk_lookup pxa168_clkregs[] = { | 72 | static struct clk_lookup pxa168_clkregs[] = { |
71 | INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL), | 73 | INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL), |
72 | INIT_CLKREG(&clk_uart2, "pxa2xx-uart.1", NULL), | 74 | INIT_CLKREG(&clk_uart2, "pxa2xx-uart.1", NULL), |
75 | INIT_CLKREG(&clk_twsi0, "pxa2xx-i2c.0", NULL), | ||
76 | INIT_CLKREG(&clk_twsi1, "pxa2xx-i2c.1", NULL), | ||
73 | }; | 77 | }; |
74 | 78 | ||
75 | static int __init pxa168_init(void) | 79 | static int __init pxa168_init(void) |
@@ -109,3 +113,5 @@ struct sys_timer pxa168_timer = { | |||
109 | /* on-chip devices */ | 113 | /* on-chip devices */ |
110 | PXA168_DEVICE(uart1, "pxa2xx-uart", 0, UART1, 0xd4017000, 0x30, 21, 22); | 114 | PXA168_DEVICE(uart1, "pxa2xx-uart", 0, UART1, 0xd4017000, 0x30, 21, 22); |
111 | PXA168_DEVICE(uart2, "pxa2xx-uart", 1, UART2, 0xd4018000, 0x30, 23, 24); | 115 | PXA168_DEVICE(uart2, "pxa2xx-uart", 1, UART2, 0xd4018000, 0x30, 23, 24); |
116 | PXA168_DEVICE(twsi0, "pxa2xx-i2c", 0, TWSI0, 0xd4011000, 0x28); | ||
117 | PXA168_DEVICE(twsi1, "pxa2xx-i2c", 1, TWSI1, 0xd4025000, 0x28); | ||
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c index 453f8f7758bf..b97328b96ce7 100644 --- a/arch/arm/mach-mmp/pxa910.c +++ b/arch/arm/mach-mmp/pxa910.c | |||
@@ -103,11 +103,15 @@ void __init pxa910_init_irq(void) | |||
103 | /* APB peripheral clocks */ | 103 | /* APB peripheral clocks */ |
104 | static APBC_CLK(uart1, PXA910_UART0, 1, 14745600); | 104 | static APBC_CLK(uart1, PXA910_UART0, 1, 14745600); |
105 | static APBC_CLK(uart2, PXA910_UART1, 1, 14745600); | 105 | static APBC_CLK(uart2, PXA910_UART1, 1, 14745600); |
106 | static APBC_CLK(twsi0, PXA168_TWSI0, 1, 33000000); | ||
107 | static APBC_CLK(twsi1, PXA168_TWSI1, 1, 33000000); | ||
106 | 108 | ||
107 | /* device and clock bindings */ | 109 | /* device and clock bindings */ |
108 | static struct clk_lookup pxa910_clkregs[] = { | 110 | static struct clk_lookup pxa910_clkregs[] = { |
109 | INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL), | 111 | INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL), |
110 | INIT_CLKREG(&clk_uart2, "pxa2xx-uart.1", NULL), | 112 | INIT_CLKREG(&clk_uart2, "pxa2xx-uart.1", NULL), |
113 | INIT_CLKREG(&clk_twsi0, "pxa2xx-i2c.0", NULL), | ||
114 | INIT_CLKREG(&clk_twsi1, "pxa2xx-i2c.1", NULL), | ||
111 | }; | 115 | }; |
112 | 116 | ||
113 | static int __init pxa910_init(void) | 117 | static int __init pxa910_init(void) |
@@ -156,3 +160,5 @@ struct sys_timer pxa910_timer = { | |||
156 | */ | 160 | */ |
157 | PXA910_DEVICE(uart1, "pxa2xx-uart", 0, UART2, 0xd4017000, 0x30, 21, 22); | 161 | PXA910_DEVICE(uart1, "pxa2xx-uart", 0, UART2, 0xd4017000, 0x30, 21, 22); |
158 | PXA910_DEVICE(uart2, "pxa2xx-uart", 1, UART3, 0xd4018000, 0x30, 23, 24); | 162 | PXA910_DEVICE(uart2, "pxa2xx-uart", 1, UART3, 0xd4018000, 0x30, 23, 24); |
163 | PXA910_DEVICE(twsi0, "pxa2xx-i2c", 0, TWSI0, 0xd4011000, 0x28); | ||
164 | PXA910_DEVICE(twsi1, "pxa2xx-i2c", 1, TWSI1, 0xd4025000, 0x28); | ||