diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2010-05-03 03:24:37 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-04 12:50:04 -0400 |
commit | f9faf23799d0726afb56ee6c6c53fbea00ec7de3 (patch) | |
tree | 02145fb643743488cffd057a687ed3737c96d2ad /arch/arm/mach-ux500 | |
parent | 4b27aa4140c20380a67ecefaa48cf3714cc0b8ea (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.c | 50 | ||||
-rw-r--r-- | arch/arm/mach-ux500/devices-db8500.c | 40 | ||||
-rw-r--r-- | arch/arm/mach-ux500/devices.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-ux500/include/mach/devices.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-ux500/include/mach/irqs.h | 1 |
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) \ | ||
74 | static 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 | |||
87 | U8500_I2C_RESOURCES(0, SZ_4K); | ||
88 | U8500_I2C_RESOURCES(1, SZ_4K); | ||
89 | U8500_I2C_RESOURCES(2, SZ_4K); | ||
90 | U8500_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) \ |
93 | static struct nmk_i2c_controller u8500_i2c_##id = { \ | 74 | static 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); | |||
118 | U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); | 99 | U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); |
119 | U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); | 100 | U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); |
120 | 101 | ||
121 | #define U8500_I2C_PDEVICE(cid) \ | ||
122 | static 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 | |||
132 | U8500_I2C_PDEVICE(0); | ||
133 | U8500_I2C_PDEVICE(1); | ||
134 | U8500_I2C_PDEVICE(2); | ||
135 | U8500_I2C_PDEVICE(3); | ||
136 | |||
137 | static struct amba_device *amba_devs[] __initdata = { | 102 | static 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 */ |
145 | static struct platform_device *platform_devs[] __initdata = { | 110 | static 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 | ||
152 | static void __init u8500_init_machine(void) | 117 | static 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 | |||
32 | static 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 | |||
45 | struct 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 | |||
52 | static 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 | |||
65 | struct 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) \ | ||
51 | static 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 | |||
64 | UX500_I2C_RESOURCES(1, SZ_4K); | ||
65 | UX500_I2C_RESOURCES(2, SZ_4K); | ||
66 | UX500_I2C_RESOURCES(3, SZ_4K); | ||
67 | |||
68 | #define UX500_I2C_PDEVICE(cid) \ | ||
69 | struct 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 | |||
76 | UX500_I2C_PDEVICE(1); | ||
77 | UX500_I2C_PDEVICE(2); | ||
78 | UX500_I2C_PDEVICE(3); | ||
79 | |||
50 | void __init amba_add_devices(struct amba_device *devs[], int num) | 80 | void __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; | |||
16 | extern struct amba_device ux500_uart1_device; | 16 | extern struct amba_device ux500_uart1_device; |
17 | extern struct amba_device ux500_uart2_device; | 17 | extern struct amba_device ux500_uart2_device; |
18 | 18 | ||
19 | extern struct platform_device ux500_i2c1_device; | ||
20 | extern struct platform_device ux500_i2c2_device; | ||
21 | extern struct platform_device ux500_i2c3_device; | ||
22 | |||
23 | extern struct platform_device u8500_i2c0_device; | ||
24 | extern 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) |