aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ux500
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2010-05-03 03:24:37 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-05-04 12:50:04 -0400
commitf9faf23799d0726afb56ee6c6c53fbea00ec7de3 (patch)
tree02145fb643743488cffd057a687ed3737c96d2ad /arch/arm/mach-ux500
parent4b27aa4140c20380a67ecefaa48cf3714cc0b8ea (diff)
ARM: 6085/1: ux500: reorganize i2c devices
Move common i2c devices to devices.c and DB8500-specific I2C devices to devices-db8500.c. Acked-by: Linus Walleij <linus.walleij@stericsson.com> Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-ux500')
-rw-r--r--arch/arm/mach-ux500/board-mop500.c50
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c40
-rw-r--r--arch/arm/mach-ux500/devices.c30
-rw-r--r--arch/arm/mach-ux500/include/mach/devices.h7
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs.h1
5 files changed, 88 insertions, 40 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 0e595bf3366e..cd0bd36221b9 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -70,27 +70,8 @@ static struct pl022_ssp_controller ssp0_platform_data = {
70 .num_chipselect = 5, 70 .num_chipselect = 5,
71}; 71};
72 72
73#define U8500_I2C_RESOURCES(id, size) \
74static struct resource u8500_i2c_resources_##id[] = { \
75 [0] = { \
76 .start = U8500_I2C##id##_BASE, \
77 .end = U8500_I2C##id##_BASE + size - 1, \
78 .flags = IORESOURCE_MEM, \
79 }, \
80 [1] = { \
81 .start = IRQ_I2C##id, \
82 .end = IRQ_I2C##id, \
83 .flags = IORESOURCE_IRQ \
84 } \
85}
86
87U8500_I2C_RESOURCES(0, SZ_4K);
88U8500_I2C_RESOURCES(1, SZ_4K);
89U8500_I2C_RESOURCES(2, SZ_4K);
90U8500_I2C_RESOURCES(3, SZ_4K);
91
92#define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \ 73#define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
93static struct nmk_i2c_controller u8500_i2c_##id = { \ 74static struct nmk_i2c_controller u8500_i2c##id##_data = { \
94 /* \ 75 /* \
95 * slave data setup time, which is \ 76 * slave data setup time, which is \
96 * 250 ns,100ns,10ns which is 14,6,2 \ 77 * 250 ns,100ns,10ns which is 14,6,2 \
@@ -118,22 +99,6 @@ U8500_I2C_CONTROLLER(1, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
118U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); 99U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
119U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); 100U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
120 101
121#define U8500_I2C_PDEVICE(cid) \
122static struct platform_device i2c_controller##cid = { \
123 .name = "nmk-i2c", \
124 .id = cid, \
125 .num_resources = 2, \
126 .resource = u8500_i2c_resources_##cid, \
127 .dev = { \
128 .platform_data = &u8500_i2c_##cid \
129 } \
130}
131
132U8500_I2C_PDEVICE(0);
133U8500_I2C_PDEVICE(1);
134U8500_I2C_PDEVICE(2);
135U8500_I2C_PDEVICE(3);
136
137static struct amba_device *amba_devs[] __initdata = { 102static struct amba_device *amba_devs[] __initdata = {
138 &ux500_uart0_device, 103 &ux500_uart0_device,
139 &ux500_uart1_device, 104 &ux500_uart1_device,
@@ -143,16 +108,21 @@ static struct amba_device *amba_devs[] __initdata = {
143 108
144/* add any platform devices here - TODO */ 109/* add any platform devices here - TODO */
145static struct platform_device *platform_devs[] __initdata = { 110static struct platform_device *platform_devs[] __initdata = {
146 &i2c_controller0, 111 &u8500_i2c0_device,
147 &i2c_controller1, 112 &ux500_i2c1_device,
148 &i2c_controller2, 113 &ux500_i2c2_device,
149 &i2c_controller3, 114 &ux500_i2c3_device,
150}; 115};
151 116
152static void __init u8500_init_machine(void) 117static void __init u8500_init_machine(void)
153{ 118{
154 int i; 119 int i;
155 120
121 u8500_i2c0_device.dev.platform_data = &u8500_i2c0_data;
122 ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data;
123 ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data;
124 ux500_i2c3_device.dev.platform_data = &u8500_i2c3_data;
125
156 u8500_ssp0_device.dev.platform_data = &ssp0_platform_data; 126 u8500_ssp0_device.dev.platform_data = &ssp0_platform_data;
157 127
158 /* Register the active AMBA devices on this board */ 128 /* Register the active AMBA devices on this board */
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index f4a2dda4d0ac..397f862c9ef4 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -28,3 +28,43 @@ struct amba_device u8500_ssp0_device = {
28 /* ST-Ericsson modified id */ 28 /* ST-Ericsson modified id */
29 .periphid = SSP_PER_ID, 29 .periphid = SSP_PER_ID,
30}; 30};
31
32static struct resource u8500_i2c0_resources[] = {
33 [0] = {
34 .start = U8500_I2C0_BASE,
35 .end = U8500_I2C0_BASE + SZ_4K - 1,
36 .flags = IORESOURCE_MEM,
37 },
38 [1] = {
39 .start = IRQ_I2C0,
40 .end = IRQ_I2C0,
41 .flags = IORESOURCE_IRQ,
42 }
43};
44
45struct platform_device u8500_i2c0_device = {
46 .name = "nmk-i2c",
47 .id = 0,
48 .resource = u8500_i2c0_resources,
49 .num_resources = ARRAY_SIZE(u8500_i2c0_resources),
50};
51
52static struct resource u8500_i2c4_resources[] = {
53 [0] = {
54 .start = U8500_I2C4_BASE,
55 .end = U8500_I2C4_BASE + SZ_4K - 1,
56 .flags = IORESOURCE_MEM,
57 },
58 [1] = {
59 .start = IRQ_I2C4,
60 .end = IRQ_I2C4,
61 .flags = IORESOURCE_IRQ,
62 }
63};
64
65struct platform_device u8500_i2c4_device = {
66 .name = "nmk-i2c",
67 .id = 4,
68 .resource = u8500_i2c4_resources,
69 .num_resources = ARRAY_SIZE(u8500_i2c4_resources),
70};
diff --git a/arch/arm/mach-ux500/devices.c b/arch/arm/mach-ux500/devices.c
index 374fcceb10a9..8a268893cb7f 100644
--- a/arch/arm/mach-ux500/devices.c
+++ b/arch/arm/mach-ux500/devices.c
@@ -47,6 +47,36 @@ struct amba_device ux500_uart2_device = {
47 .irq = {IRQ_UART2, NO_IRQ}, 47 .irq = {IRQ_UART2, NO_IRQ},
48}; 48};
49 49
50#define UX500_I2C_RESOURCES(id, size) \
51static struct resource ux500_i2c##id##_resources[] = { \
52 [0] = { \
53 .start = UX500_I2C##id##_BASE, \
54 .end = UX500_I2C##id##_BASE + size - 1, \
55 .flags = IORESOURCE_MEM, \
56 }, \
57 [1] = { \
58 .start = IRQ_I2C##id, \
59 .end = IRQ_I2C##id, \
60 .flags = IORESOURCE_IRQ \
61 } \
62}
63
64UX500_I2C_RESOURCES(1, SZ_4K);
65UX500_I2C_RESOURCES(2, SZ_4K);
66UX500_I2C_RESOURCES(3, SZ_4K);
67
68#define UX500_I2C_PDEVICE(cid) \
69struct platform_device ux500_i2c##cid##_device = { \
70 .name = "nmk-i2c", \
71 .id = cid, \
72 .num_resources = 2, \
73 .resource = ux500_i2c##cid##_resources, \
74}
75
76UX500_I2C_PDEVICE(1);
77UX500_I2C_PDEVICE(2);
78UX500_I2C_PDEVICE(3);
79
50void __init amba_add_devices(struct amba_device *devs[], int num) 80void __init amba_add_devices(struct amba_device *devs[], int num)
51{ 81{
52 int i; 82 int i;
diff --git a/arch/arm/mach-ux500/include/mach/devices.h b/arch/arm/mach-ux500/include/mach/devices.h
index 7cc4983c0f48..251b4eb8694a 100644
--- a/arch/arm/mach-ux500/include/mach/devices.h
+++ b/arch/arm/mach-ux500/include/mach/devices.h
@@ -16,4 +16,11 @@ extern struct amba_device ux500_uart0_device;
16extern struct amba_device ux500_uart1_device; 16extern struct amba_device ux500_uart1_device;
17extern struct amba_device ux500_uart2_device; 17extern struct amba_device ux500_uart2_device;
18 18
19extern struct platform_device ux500_i2c1_device;
20extern struct platform_device ux500_i2c2_device;
21extern struct platform_device ux500_i2c3_device;
22
23extern struct platform_device u8500_i2c0_device;
24extern struct platform_device u8500_i2c4_device;
25
19#endif 26#endif
diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/include/mach/irqs.h
index 8a1f6976c245..7970684b1d09 100644
--- a/arch/arm/mach-ux500/include/mach/irqs.h
+++ b/arch/arm/mach-ux500/include/mach/irqs.h
@@ -42,6 +42,7 @@
42#define IRQ_AB4500 (IRQ_SHPI_START + 40) 42#define IRQ_AB4500 (IRQ_SHPI_START + 40)
43#define IRQ_DISP (IRQ_SHPI_START + 48) 43#define IRQ_DISP (IRQ_SHPI_START + 48)
44#define IRQ_SiPI3 (IRQ_SHPI_START + 49) 44#define IRQ_SiPI3 (IRQ_SHPI_START + 49)
45#define IRQ_I2C4 (IRQ_SHPI_START + 51)
45#define IRQ_SSP1 (IRQ_SHPI_START + 52) 46#define IRQ_SSP1 (IRQ_SHPI_START + 52)
46#define IRQ_I2C2 (IRQ_SHPI_START + 55) 47#define IRQ_I2C2 (IRQ_SHPI_START + 55)
47#define IRQ_SDMMC0 (IRQ_SHPI_START + 60) 48#define IRQ_SDMMC0 (IRQ_SHPI_START + 60)