diff options
Diffstat (limited to 'arch/arm/mach-ux500/board-mop500.c')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index f33dbb7b497b..803aec1d6728 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
23 | 23 | ||
24 | #include <plat/mtu.h> | 24 | #include <plat/mtu.h> |
25 | #include <plat/i2c.h> | ||
25 | 26 | ||
26 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
27 | #include <mach/setup.h> | 28 | #include <mach/setup.h> |
@@ -120,6 +121,70 @@ static struct amba_device pl031_device = { | |||
120 | .irq = {IRQ_RTC_RTT, NO_IRQ}, | 121 | .irq = {IRQ_RTC_RTT, NO_IRQ}, |
121 | }; | 122 | }; |
122 | 123 | ||
124 | #define U8500_I2C_RESOURCES(id, size) \ | ||
125 | static struct resource u8500_i2c_resources_##id[] = { \ | ||
126 | [0] = { \ | ||
127 | .start = U8500_I2C##id##_BASE, \ | ||
128 | .end = U8500_I2C##id##_BASE + size - 1, \ | ||
129 | .flags = IORESOURCE_MEM, \ | ||
130 | }, \ | ||
131 | [1] = { \ | ||
132 | .start = IRQ_I2C##id, \ | ||
133 | .end = IRQ_I2C##id, \ | ||
134 | .flags = IORESOURCE_IRQ \ | ||
135 | } \ | ||
136 | } | ||
137 | |||
138 | U8500_I2C_RESOURCES(0, SZ_4K); | ||
139 | U8500_I2C_RESOURCES(1, SZ_4K); | ||
140 | U8500_I2C_RESOURCES(2, SZ_4K); | ||
141 | U8500_I2C_RESOURCES(3, SZ_4K); | ||
142 | |||
143 | #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \ | ||
144 | static struct nmk_i2c_controller u8500_i2c_##id = { \ | ||
145 | /* \ | ||
146 | * slave data setup time, which is \ | ||
147 | * 250 ns,100ns,10ns which is 14,6,2 \ | ||
148 | * respectively for a 48 Mhz \ | ||
149 | * i2c clock \ | ||
150 | */ \ | ||
151 | .slsu = _slsu, \ | ||
152 | /* Tx FIFO threshold */ \ | ||
153 | .tft = _tft, \ | ||
154 | /* Rx FIFO threshold */ \ | ||
155 | .rft = _rft, \ | ||
156 | /* std. mode operation */ \ | ||
157 | .clk_freq = clk, \ | ||
158 | .sm = _sm, \ | ||
159 | } | ||
160 | |||
161 | /* | ||
162 | * The board uses 4 i2c controllers, initialize all of | ||
163 | * them with slave data setup time of 250 ns, | ||
164 | * Tx & Rx FIFO threshold values as 1 and standard | ||
165 | * mode of operation | ||
166 | */ | ||
167 | U8500_I2C_CONTROLLER(0, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); | ||
168 | U8500_I2C_CONTROLLER(1, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); | ||
169 | U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); | ||
170 | U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); | ||
171 | |||
172 | #define U8500_I2C_PDEVICE(cid) \ | ||
173 | static struct platform_device i2c_controller##cid = { \ | ||
174 | .name = "nmk-i2c", \ | ||
175 | .id = cid, \ | ||
176 | .num_resources = 2, \ | ||
177 | .resource = u8500_i2c_resources_##cid, \ | ||
178 | .dev = { \ | ||
179 | .platform_data = &u8500_i2c_##cid \ | ||
180 | } \ | ||
181 | } | ||
182 | |||
183 | U8500_I2C_PDEVICE(0); | ||
184 | U8500_I2C_PDEVICE(1); | ||
185 | U8500_I2C_PDEVICE(2); | ||
186 | U8500_I2C_PDEVICE(3); | ||
187 | |||
123 | static struct amba_device *amba_devs[] __initdata = { | 188 | static struct amba_device *amba_devs[] __initdata = { |
124 | &uart0_device, | 189 | &uart0_device, |
125 | &uart1_device, | 190 | &uart1_device, |
@@ -128,6 +193,14 @@ static struct amba_device *amba_devs[] __initdata = { | |||
128 | &pl031_device, | 193 | &pl031_device, |
129 | }; | 194 | }; |
130 | 195 | ||
196 | /* add any platform devices here - TODO */ | ||
197 | static struct platform_device *platform_devs[] __initdata = { | ||
198 | &i2c_controller0, | ||
199 | &i2c_controller1, | ||
200 | &i2c_controller2, | ||
201 | &i2c_controller3, | ||
202 | }; | ||
203 | |||
131 | static void __init u8500_timer_init(void) | 204 | static void __init u8500_timer_init(void) |
132 | { | 205 | { |
133 | #ifdef CONFIG_LOCAL_TIMERS | 206 | #ifdef CONFIG_LOCAL_TIMERS |
@@ -152,6 +225,8 @@ static void __init u8500_init_machine(void) | |||
152 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) | 225 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) |
153 | amba_device_register(amba_devs[i], &iomem_resource); | 226 | amba_device_register(amba_devs[i], &iomem_resource); |
154 | 227 | ||
228 | platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); | ||
229 | |||
155 | spi_register_board_info(u8500_spi_devices, | 230 | spi_register_board_info(u8500_spi_devices, |
156 | ARRAY_SIZE(u8500_spi_devices)); | 231 | ARRAY_SIZE(u8500_spi_devices)); |
157 | 232 | ||