]>
Commit | Line | Data |
---|---|---|
aa44ef4d SK |
1 | /* |
2 | * Copyright (C) 2008-2009 ST-Ericsson | |
3 | * | |
4 | * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License version 2, as | |
8 | * published by the Free Software Foundation. | |
9 | * | |
10 | */ | |
11 | #include <linux/kernel.h> | |
12 | #include <linux/init.h> | |
13 | #include <linux/interrupt.h> | |
14 | #include <linux/platform_device.h> | |
15 | #include <linux/io.h> | |
b8410a15 | 16 | #include <linux/i2c.h> |
ea05a57f | 17 | #include <linux/gpio.h> |
aa44ef4d SK |
18 | #include <linux/amba/bus.h> |
19 | #include <linux/amba/pl022.h> | |
5d7b8467 | 20 | #include <linux/amba/serial.h> |
aa44ef4d | 21 | #include <linux/spi/spi.h> |
39ae702c | 22 | #include <linux/mfd/ab8500.h> |
79568b94 | 23 | #include <linux/regulator/ab8500.h> |
20406ebf | 24 | #include <linux/mfd/tc3589x.h> |
fe67dfc8 | 25 | #include <linux/mfd/tps6105x.h> |
3ef374a2 | 26 | #include <linux/mfd/ab8500/gpio.h> |
dd7b2a05 | 27 | #include <linux/leds-lp5521.h> |
a71b819b | 28 | #include <linux/input.h> |
350abe03 | 29 | #include <linux/smsc911x.h> |
a71b819b | 30 | #include <linux/gpio_keys.h> |
1a7d4369 | 31 | #include <linux/delay.h> |
aa44ef4d | 32 | |
350abe03 | 33 | #include <linux/leds.h> |
aa44ef4d SK |
34 | #include <asm/mach-types.h> |
35 | #include <asm/mach/arch.h> | |
36 | ||
d48a41c1 | 37 | #include <plat/i2c.h> |
5d7b8467 | 38 | #include <plat/ste_dma40.h> |
1a7d4369 | 39 | #include <plat/pincfg.h> |
0f332861 | 40 | #include <plat/gpio-nomadik.h> |
aa44ef4d SK |
41 | |
42 | #include <mach/hardware.h> | |
43 | #include <mach/setup.h> | |
9e4e7fe1 | 44 | #include <mach/devices.h> |
29aeb3cf | 45 | #include <mach/irqs.h> |
aa44ef4d | 46 | |
1a7d4369 | 47 | #include "pins-db8500.h" |
5d7b8467 | 48 | #include "ste-dma40-db8500.h" |
fbf1eadf | 49 | #include "devices-db8500.h" |
008f8a2f | 50 | #include "board-mop500.h" |
a1e516e3 | 51 | #include "board-mop500-regulators.h" |
ea05a57f | 52 | |
350abe03 RM |
53 | static struct gpio_led snowball_led_array[] = { |
54 | { | |
55 | .name = "user_led", | |
56 | .default_trigger = "none", | |
57 | .gpio = 142, | |
58 | }, | |
59 | }; | |
60 | ||
61 | static struct gpio_led_platform_data snowball_led_data = { | |
62 | .leds = snowball_led_array, | |
63 | .num_leds = ARRAY_SIZE(snowball_led_array), | |
64 | }; | |
65 | ||
66 | static struct platform_device snowball_led_dev = { | |
67 | .name = "leds-gpio", | |
68 | .dev = { | |
69 | .platform_data = &snowball_led_data, | |
70 | }, | |
71 | }; | |
72 | ||
3ef374a2 BB |
73 | static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { |
74 | .gpio_base = MOP500_AB8500_GPIO(0), | |
75 | .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, | |
76 | /* config_reg is the initial configuration of ab8500 pins. | |
77 | * The pins can be configured as GPIO or alt functions based | |
78 | * on value present in GpioSel1 to GpioSel6 and AlternatFunction | |
79 | * register. This is the array of 7 configuration settings. | |
80 | * One has to compile time decide these settings. Below is the | |
25985edc | 81 | * explanation of these setting |
3ef374a2 BB |
82 | * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO |
83 | * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO | |
84 | * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO | |
85 | * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO | |
86 | * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO | |
87 | * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO | |
88 | * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured | |
89 | * as GPIO then this register selectes the alternate fucntions | |
90 | */ | |
91 | .config_reg = {0x00, 0x1E, 0x80, 0x01, | |
92 | 0x7A, 0x00, 0x00}, | |
93 | }; | |
94 | ||
350abe03 RM |
95 | static struct gpio_keys_button snowball_key_array[] = { |
96 | { | |
97 | .gpio = 32, | |
98 | .type = EV_KEY, | |
99 | .code = KEY_1, | |
100 | .desc = "userpb", | |
101 | .active_low = 1, | |
102 | .debounce_interval = 50, | |
103 | .wakeup = 1, | |
104 | }, | |
105 | { | |
106 | .gpio = 151, | |
107 | .type = EV_KEY, | |
108 | .code = KEY_2, | |
109 | .desc = "extkb1", | |
110 | .active_low = 1, | |
111 | .debounce_interval = 50, | |
112 | .wakeup = 1, | |
113 | }, | |
114 | { | |
115 | .gpio = 152, | |
116 | .type = EV_KEY, | |
117 | .code = KEY_3, | |
118 | .desc = "extkb2", | |
119 | .active_low = 1, | |
120 | .debounce_interval = 50, | |
121 | .wakeup = 1, | |
122 | }, | |
123 | { | |
124 | .gpio = 161, | |
125 | .type = EV_KEY, | |
126 | .code = KEY_4, | |
127 | .desc = "extkb3", | |
128 | .active_low = 1, | |
129 | .debounce_interval = 50, | |
130 | .wakeup = 1, | |
131 | }, | |
132 | { | |
133 | .gpio = 162, | |
134 | .type = EV_KEY, | |
135 | .code = KEY_5, | |
136 | .desc = "extkb4", | |
137 | .active_low = 1, | |
138 | .debounce_interval = 50, | |
139 | .wakeup = 1, | |
140 | }, | |
141 | }; | |
142 | ||
143 | static struct gpio_keys_platform_data snowball_key_data = { | |
144 | .buttons = snowball_key_array, | |
145 | .nbuttons = ARRAY_SIZE(snowball_key_array), | |
146 | }; | |
147 | ||
148 | static struct platform_device snowball_key_dev = { | |
149 | .name = "gpio-keys", | |
150 | .id = -1, | |
151 | .dev = { | |
152 | .platform_data = &snowball_key_data, | |
153 | } | |
154 | }; | |
155 | ||
156 | static struct smsc911x_platform_config snowball_sbnet_cfg = { | |
157 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, | |
158 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | |
159 | .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY, | |
160 | .shift = 1, | |
161 | }; | |
162 | ||
163 | static struct resource sbnet_res[] = { | |
164 | { | |
165 | .name = "smsc911x-memory", | |
166 | .start = (0x5000 << 16), | |
167 | .end = (0x5000 << 16) + 0xffff, | |
168 | .flags = IORESOURCE_MEM, | |
169 | }, | |
170 | { | |
171 | .start = NOMADIK_GPIO_TO_IRQ(140), | |
172 | .end = NOMADIK_GPIO_TO_IRQ(140), | |
173 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | |
174 | }, | |
175 | }; | |
176 | ||
177 | static struct platform_device snowball_sbnet_dev = { | |
178 | .name = "smsc911x", | |
179 | .num_resources = ARRAY_SIZE(sbnet_res), | |
180 | .resource = sbnet_res, | |
181 | .dev = { | |
182 | .platform_data = &snowball_sbnet_cfg, | |
183 | }, | |
184 | }; | |
185 | ||
39ae702c RV |
186 | static struct ab8500_platform_data ab8500_platdata = { |
187 | .irq_base = MOP500_AB8500_IRQ_BASE, | |
dfa3a824 BJ |
188 | .regulator_reg_init = ab8500_regulator_reg_init, |
189 | .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init), | |
a1e516e3 BJ |
190 | .regulator = ab8500_regulators, |
191 | .num_regulator = ARRAY_SIZE(ab8500_regulators), | |
3ef374a2 | 192 | .gpio = &ab8500_gpio_pdata, |
39ae702c RV |
193 | }; |
194 | ||
29aeb3cf LW |
195 | static struct resource ab8500_resources[] = { |
196 | [0] = { | |
22039b7c RV |
197 | .start = IRQ_DB8500_AB8500, |
198 | .end = IRQ_DB8500_AB8500, | |
199 | .flags = IORESOURCE_IRQ | |
29aeb3cf LW |
200 | } |
201 | }; | |
202 | ||
203 | struct platform_device ab8500_device = { | |
204 | .name = "ab8500-i2c", | |
205 | .id = 0, | |
206 | .dev = { | |
207 | .platform_data = &ab8500_platdata, | |
208 | }, | |
209 | .num_resources = 1, | |
210 | .resource = ab8500_resources, | |
211 | }; | |
212 | ||
fe67dfc8 LW |
213 | /* |
214 | * TPS61052 | |
215 | */ | |
216 | ||
217 | static struct tps6105x_platform_data mop500_tps61052_data = { | |
218 | .mode = TPS6105X_MODE_VOLTAGE, | |
219 | .regulator_data = &tps61052_regulator, | |
220 | }; | |
221 | ||
b8410a15 RV |
222 | /* |
223 | * TC35892 | |
224 | */ | |
225 | ||
20406ebf | 226 | static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base) |
b8410a15 RV |
227 | { |
228 | mop500_sdi_tc35892_init(); | |
229 | } | |
230 | ||
20406ebf | 231 | static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = { |
b8410a15 RV |
232 | .gpio_base = MOP500_EGPIO(0), |
233 | .setup = mop500_tc35892_init, | |
234 | }; | |
235 | ||
20406ebf | 236 | static struct tc3589x_platform_data mop500_tc35892_data = { |
611b7590 | 237 | .block = TC3589x_BLOCK_GPIO, |
b8410a15 RV |
238 | .gpio = &mop500_tc35892_gpio_data, |
239 | .irq_base = MOP500_EGPIO_IRQ_BASE, | |
240 | }; | |
241 | ||
dd7b2a05 PL |
242 | static struct lp5521_led_config lp5521_pri_led[] = { |
243 | [0] = { | |
244 | .chan_nr = 0, | |
245 | .led_current = 0x2f, | |
246 | .max_current = 0x5f, | |
247 | }, | |
248 | [1] = { | |
249 | .chan_nr = 1, | |
250 | .led_current = 0x2f, | |
251 | .max_current = 0x5f, | |
252 | }, | |
253 | [2] = { | |
254 | .chan_nr = 2, | |
255 | .led_current = 0x2f, | |
256 | .max_current = 0x5f, | |
257 | }, | |
258 | }; | |
259 | ||
260 | static struct lp5521_platform_data __initdata lp5521_pri_data = { | |
261 | .label = "lp5521_pri", | |
262 | .led_config = &lp5521_pri_led[0], | |
263 | .num_channels = 3, | |
264 | .clock_mode = LP5521_CLOCK_EXT, | |
265 | }; | |
266 | ||
267 | static struct lp5521_led_config lp5521_sec_led[] = { | |
268 | [0] = { | |
269 | .chan_nr = 0, | |
270 | .led_current = 0x2f, | |
271 | .max_current = 0x5f, | |
272 | }, | |
273 | [1] = { | |
274 | .chan_nr = 1, | |
275 | .led_current = 0x2f, | |
276 | .max_current = 0x5f, | |
277 | }, | |
278 | [2] = { | |
279 | .chan_nr = 2, | |
280 | .led_current = 0x2f, | |
281 | .max_current = 0x5f, | |
282 | }, | |
283 | }; | |
284 | ||
285 | static struct lp5521_platform_data __initdata lp5521_sec_data = { | |
286 | .label = "lp5521_sec", | |
287 | .led_config = &lp5521_sec_led[0], | |
288 | .num_channels = 3, | |
289 | .clock_mode = LP5521_CLOCK_EXT, | |
290 | }; | |
291 | ||
fe67dfc8 | 292 | static struct i2c_board_info __initdata mop500_i2c0_devices[] = { |
b8410a15 | 293 | { |
20406ebf | 294 | I2C_BOARD_INFO("tc3589x", 0x42), |
dd7b2a05 | 295 | .irq = NOMADIK_GPIO_TO_IRQ(217), |
b8410a15 RV |
296 | .platform_data = &mop500_tc35892_data, |
297 | }, | |
cf568c58 | 298 | /* I2C0 devices only available prior to HREFv60 */ |
fe67dfc8 LW |
299 | { |
300 | I2C_BOARD_INFO("tps61052", 0x33), | |
301 | .platform_data = &mop500_tps61052_data, | |
302 | }, | |
303 | }; | |
304 | ||
cf568c58 LW |
305 | #define NUM_PRE_V60_I2C0_DEVICES 1 |
306 | ||
dd7b2a05 PL |
307 | static struct i2c_board_info __initdata mop500_i2c2_devices[] = { |
308 | { | |
309 | /* lp5521 LED driver, 1st device */ | |
310 | I2C_BOARD_INFO("lp5521", 0x33), | |
311 | .platform_data = &lp5521_pri_data, | |
312 | }, | |
313 | { | |
314 | /* lp5521 LED driver, 2st device */ | |
315 | I2C_BOARD_INFO("lp5521", 0x34), | |
316 | .platform_data = &lp5521_sec_data, | |
317 | }, | |
bb3b2187 LJ |
318 | { |
319 | /* Light sensor Rohm BH1780GLI */ | |
320 | I2C_BOARD_INFO("bh1780", 0x29), | |
321 | }, | |
dd7b2a05 PL |
322 | }; |
323 | ||
2b030bda | 324 | #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm) \ |
f9faf237 | 325 | static struct nmk_i2c_controller u8500_i2c##id##_data = { \ |
d48a41c1 SK |
326 | /* \ |
327 | * slave data setup time, which is \ | |
328 | * 250 ns,100ns,10ns which is 14,6,2 \ | |
329 | * respectively for a 48 Mhz \ | |
330 | * i2c clock \ | |
331 | */ \ | |
332 | .slsu = _slsu, \ | |
333 | /* Tx FIFO threshold */ \ | |
334 | .tft = _tft, \ | |
335 | /* Rx FIFO threshold */ \ | |
336 | .rft = _rft, \ | |
337 | /* std. mode operation */ \ | |
338 | .clk_freq = clk, \ | |
2b030bda LW |
339 | /* Slave response timeout(ms) */\ |
340 | .timeout = t_out, \ | |
d48a41c1 SK |
341 | .sm = _sm, \ |
342 | } | |
343 | ||
344 | /* | |
345 | * The board uses 4 i2c controllers, initialize all of | |
346 | * them with slave data setup time of 250 ns, | |
2b030bda | 347 | * Tx & Rx FIFO threshold values as 8 and standard |
d48a41c1 SK |
348 | * mode of operation |
349 | */ | |
2b030bda LW |
350 | U8500_I2C_CONTROLLER(0, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); |
351 | U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); | |
352 | U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); | |
353 | U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); | |
d48a41c1 | 354 | |
fbf1eadf RV |
355 | static void __init mop500_i2c_init(void) |
356 | { | |
357 | db8500_add_i2c0(&u8500_i2c0_data); | |
358 | db8500_add_i2c1(&u8500_i2c1_data); | |
359 | db8500_add_i2c2(&u8500_i2c2_data); | |
360 | db8500_add_i2c3(&u8500_i2c3_data); | |
361 | } | |
aa44ef4d | 362 | |
a71b819b PL |
363 | static struct gpio_keys_button mop500_gpio_keys[] = { |
364 | { | |
365 | .desc = "SFH7741 Proximity Sensor", | |
366 | .type = EV_SW, | |
367 | .code = SW_FRONT_PROXIMITY, | |
a71b819b PL |
368 | .active_low = 0, |
369 | .can_disable = 1, | |
370 | } | |
371 | }; | |
372 | ||
373 | static struct regulator *prox_regulator; | |
374 | static int mop500_prox_activate(struct device *dev); | |
375 | static void mop500_prox_deactivate(struct device *dev); | |
376 | ||
377 | static struct gpio_keys_platform_data mop500_gpio_keys_data = { | |
378 | .buttons = mop500_gpio_keys, | |
379 | .nbuttons = ARRAY_SIZE(mop500_gpio_keys), | |
380 | .enable = mop500_prox_activate, | |
381 | .disable = mop500_prox_deactivate, | |
382 | }; | |
383 | ||
384 | static struct platform_device mop500_gpio_keys_device = { | |
385 | .name = "gpio-keys", | |
386 | .id = 0, | |
387 | .dev = { | |
388 | .platform_data = &mop500_gpio_keys_data, | |
389 | }, | |
390 | }; | |
391 | ||
392 | static int mop500_prox_activate(struct device *dev) | |
393 | { | |
394 | prox_regulator = regulator_get(&mop500_gpio_keys_device.dev, | |
395 | "vcc"); | |
396 | if (IS_ERR(prox_regulator)) { | |
397 | dev_err(&mop500_gpio_keys_device.dev, | |
398 | "no regulator\n"); | |
399 | return PTR_ERR(prox_regulator); | |
400 | } | |
401 | regulator_enable(prox_regulator); | |
402 | return 0; | |
403 | } | |
404 | ||
405 | static void mop500_prox_deactivate(struct device *dev) | |
406 | { | |
407 | regulator_disable(prox_regulator); | |
408 | regulator_put(prox_regulator); | |
409 | } | |
410 | ||
d48a41c1 | 411 | /* add any platform devices here - TODO */ |
350abe03 | 412 | static struct platform_device *mop500_platform_devs[] __initdata = { |
a71b819b | 413 | &mop500_gpio_keys_device, |
350abe03 | 414 | &ab8500_device, |
d48a41c1 SK |
415 | }; |
416 | ||
5d7b8467 LW |
417 | #ifdef CONFIG_STE_DMA40 |
418 | static struct stedma40_chan_cfg ssp0_dma_cfg_rx = { | |
419 | .mode = STEDMA40_MODE_LOGICAL, | |
420 | .dir = STEDMA40_PERIPH_TO_MEM, | |
421 | .src_dev_type = DB8500_DMA_DEV8_SSP0_RX, | |
422 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | |
423 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
424 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
425 | }; | |
426 | ||
427 | static struct stedma40_chan_cfg ssp0_dma_cfg_tx = { | |
428 | .mode = STEDMA40_MODE_LOGICAL, | |
429 | .dir = STEDMA40_MEM_TO_PERIPH, | |
430 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | |
431 | .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX, | |
432 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
433 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
434 | }; | |
435 | #endif | |
436 | ||
437 | static struct pl022_ssp_controller ssp0_platform_data = { | |
438 | .bus_id = 0, | |
439 | #ifdef CONFIG_STE_DMA40 | |
440 | .enable_dma = 1, | |
441 | .dma_filter = stedma40_filter, | |
442 | .dma_rx_param = &ssp0_dma_cfg_rx, | |
443 | .dma_tx_param = &ssp0_dma_cfg_tx, | |
444 | #else | |
445 | .enable_dma = 0, | |
446 | #endif | |
447 | /* on this platform, gpio 31,142,144,214 & | |
448 | * 224 are connected as chip selects | |
449 | */ | |
450 | .num_chipselect = 5, | |
451 | }; | |
452 | ||
fbf1eadf | 453 | static void __init mop500_spi_init(void) |
aa44ef4d | 454 | { |
fbf1eadf RV |
455 | db8500_add_ssp0(&ssp0_platform_data); |
456 | } | |
aa44ef4d | 457 | |
5d7b8467 LW |
458 | #ifdef CONFIG_STE_DMA40 |
459 | static struct stedma40_chan_cfg uart0_dma_cfg_rx = { | |
460 | .mode = STEDMA40_MODE_LOGICAL, | |
461 | .dir = STEDMA40_PERIPH_TO_MEM, | |
462 | .src_dev_type = DB8500_DMA_DEV13_UART0_RX, | |
463 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | |
464 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
465 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
466 | }; | |
467 | ||
468 | static struct stedma40_chan_cfg uart0_dma_cfg_tx = { | |
469 | .mode = STEDMA40_MODE_LOGICAL, | |
470 | .dir = STEDMA40_MEM_TO_PERIPH, | |
471 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | |
472 | .dst_dev_type = DB8500_DMA_DEV13_UART0_TX, | |
473 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
474 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
475 | }; | |
476 | ||
477 | static struct stedma40_chan_cfg uart1_dma_cfg_rx = { | |
478 | .mode = STEDMA40_MODE_LOGICAL, | |
479 | .dir = STEDMA40_PERIPH_TO_MEM, | |
480 | .src_dev_type = DB8500_DMA_DEV12_UART1_RX, | |
481 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | |
482 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
483 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
484 | }; | |
485 | ||
486 | static struct stedma40_chan_cfg uart1_dma_cfg_tx = { | |
487 | .mode = STEDMA40_MODE_LOGICAL, | |
488 | .dir = STEDMA40_MEM_TO_PERIPH, | |
489 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | |
490 | .dst_dev_type = DB8500_DMA_DEV12_UART1_TX, | |
491 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
492 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
493 | }; | |
494 | ||
495 | static struct stedma40_chan_cfg uart2_dma_cfg_rx = { | |
496 | .mode = STEDMA40_MODE_LOGICAL, | |
497 | .dir = STEDMA40_PERIPH_TO_MEM, | |
498 | .src_dev_type = DB8500_DMA_DEV11_UART2_RX, | |
499 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | |
500 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
501 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
502 | }; | |
503 | ||
504 | static struct stedma40_chan_cfg uart2_dma_cfg_tx = { | |
505 | .mode = STEDMA40_MODE_LOGICAL, | |
506 | .dir = STEDMA40_MEM_TO_PERIPH, | |
507 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | |
508 | .dst_dev_type = DB8500_DMA_DEV11_UART2_TX, | |
509 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
510 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
511 | }; | |
512 | #endif | |
513 | ||
1a7d4369 SKS |
514 | |
515 | static pin_cfg_t mop500_pins_uart0[] = { | |
516 | GPIO0_U0_CTSn | PIN_INPUT_PULLUP, | |
517 | GPIO1_U0_RTSn | PIN_OUTPUT_HIGH, | |
518 | GPIO2_U0_RXD | PIN_INPUT_PULLUP, | |
519 | GPIO3_U0_TXD | PIN_OUTPUT_HIGH, | |
520 | }; | |
521 | ||
522 | #define PRCC_K_SOFTRST_SET 0x18 | |
523 | #define PRCC_K_SOFTRST_CLEAR 0x1C | |
524 | static void ux500_uart0_reset(void) | |
525 | { | |
526 | void __iomem *prcc_rst_set, *prcc_rst_clr; | |
527 | ||
528 | prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE + | |
529 | PRCC_K_SOFTRST_SET); | |
530 | prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE + | |
531 | PRCC_K_SOFTRST_CLEAR); | |
532 | ||
533 | /* Activate soft reset PRCC_K_SOFTRST_CLEAR */ | |
534 | writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr); | |
535 | udelay(1); | |
536 | ||
537 | /* Release soft reset PRCC_K_SOFTRST_SET */ | |
538 | writel((readl(prcc_rst_set) | 0x1), prcc_rst_set); | |
539 | udelay(1); | |
540 | } | |
541 | ||
542 | static void ux500_uart0_init(void) | |
543 | { | |
544 | int ret; | |
545 | ||
546 | ret = nmk_config_pins(mop500_pins_uart0, | |
547 | ARRAY_SIZE(mop500_pins_uart0)); | |
548 | if (ret < 0) | |
549 | pr_err("pl011: uart pins_enable failed\n"); | |
550 | } | |
551 | ||
552 | static void ux500_uart0_exit(void) | |
553 | { | |
554 | int ret; | |
555 | ||
556 | ret = nmk_config_pins_sleep(mop500_pins_uart0, | |
557 | ARRAY_SIZE(mop500_pins_uart0)); | |
558 | if (ret < 0) | |
559 | pr_err("pl011: uart pins_disable failed\n"); | |
560 | } | |
561 | ||
5d7b8467 LW |
562 | static struct amba_pl011_data uart0_plat = { |
563 | #ifdef CONFIG_STE_DMA40 | |
564 | .dma_filter = stedma40_filter, | |
565 | .dma_rx_param = &uart0_dma_cfg_rx, | |
566 | .dma_tx_param = &uart0_dma_cfg_tx, | |
567 | #endif | |
1a7d4369 SKS |
568 | .init = ux500_uart0_init, |
569 | .exit = ux500_uart0_exit, | |
570 | .reset = ux500_uart0_reset, | |
5d7b8467 LW |
571 | }; |
572 | ||
573 | static struct amba_pl011_data uart1_plat = { | |
574 | #ifdef CONFIG_STE_DMA40 | |
575 | .dma_filter = stedma40_filter, | |
576 | .dma_rx_param = &uart1_dma_cfg_rx, | |
577 | .dma_tx_param = &uart1_dma_cfg_tx, | |
578 | #endif | |
579 | }; | |
580 | ||
581 | static struct amba_pl011_data uart2_plat = { | |
582 | #ifdef CONFIG_STE_DMA40 | |
583 | .dma_filter = stedma40_filter, | |
584 | .dma_rx_param = &uart2_dma_cfg_rx, | |
585 | .dma_tx_param = &uart2_dma_cfg_tx, | |
586 | #endif | |
587 | }; | |
588 | ||
fbf1eadf RV |
589 | static void __init mop500_uart_init(void) |
590 | { | |
5d7b8467 LW |
591 | db8500_add_uart0(&uart0_plat); |
592 | db8500_add_uart1(&uart1_plat); | |
593 | db8500_add_uart2(&uart2_plat); | |
fbf1eadf RV |
594 | } |
595 | ||
350abe03 RM |
596 | static struct platform_device *snowball_platform_devs[] __initdata = { |
597 | &snowball_led_dev, | |
598 | &snowball_key_dev, | |
599 | &snowball_sbnet_dev, | |
600 | &ab8500_device, | |
601 | }; | |
602 | ||
4b4f757c | 603 | static void __init mop500_init_machine(void) |
fbf1eadf | 604 | { |
cf568c58 LW |
605 | int i2c0_devs; |
606 | ||
110c2c2f LJ |
607 | mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; |
608 | ||
609 | u8500_init_devices(); | |
610 | ||
611 | mop500_pins_init(); | |
612 | ||
613 | platform_add_devices(mop500_platform_devs, | |
614 | ARRAY_SIZE(mop500_platform_devs)); | |
615 | ||
616 | mop500_i2c_init(); | |
617 | mop500_sdi_init(); | |
618 | mop500_spi_init(); | |
619 | mop500_uart_init(); | |
620 | ||
621 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); | |
622 | ||
623 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); | |
624 | i2c_register_board_info(2, mop500_i2c2_devices, | |
625 | ARRAY_SIZE(mop500_i2c2_devices)); | |
626 | ||
627 | /* This board has full regulator constraints */ | |
628 | regulator_has_full_constraints(); | |
629 | } | |
630 | ||
631 | static void __init snowball_init_machine(void) | |
632 | { | |
633 | int i2c0_devs; | |
634 | ||
635 | u8500_init_devices(); | |
636 | ||
637 | snowball_pins_init(); | |
638 | ||
639 | platform_add_devices(snowball_platform_devs, | |
640 | ARRAY_SIZE(snowball_platform_devs)); | |
641 | ||
642 | mop500_i2c_init(); | |
643 | snowball_sdi_init(); | |
644 | mop500_spi_init(); | |
645 | mop500_uart_init(); | |
646 | ||
647 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); | |
648 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); | |
649 | i2c_register_board_info(2, mop500_i2c2_devices, | |
650 | ARRAY_SIZE(mop500_i2c2_devices)); | |
651 | ||
652 | /* This board has full regulator constraints */ | |
653 | regulator_has_full_constraints(); | |
654 | } | |
655 | ||
656 | static void __init hrefv60_init_machine(void) | |
657 | { | |
658 | int i2c0_devs; | |
659 | ||
4b4f757c LW |
660 | /* |
661 | * The HREFv60 board removed a GPIO expander and routed | |
662 | * all these GPIO pins to the internal GPIO controller | |
663 | * instead. | |
664 | */ | |
110c2c2f | 665 | mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; |
4b4f757c | 666 | |
ea05a57f RV |
667 | u8500_init_devices(); |
668 | ||
110c2c2f | 669 | hrefv60_pins_init(); |
ea05a57f | 670 | |
110c2c2f LJ |
671 | platform_add_devices(mop500_platform_devs, |
672 | ARRAY_SIZE(mop500_platform_devs)); | |
d48a41c1 | 673 | |
fbf1eadf | 674 | mop500_i2c_init(); |
008f8a2f | 675 | mop500_sdi_init(); |
fbf1eadf RV |
676 | mop500_spi_init(); |
677 | mop500_uart_init(); | |
008f8a2f | 678 | |
cf568c58 | 679 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
110c2c2f LJ |
680 | |
681 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; | |
cf568c58 LW |
682 | |
683 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); | |
dd7b2a05 PL |
684 | i2c_register_board_info(2, mop500_i2c2_devices, |
685 | ARRAY_SIZE(mop500_i2c2_devices)); | |
db24520f LW |
686 | |
687 | /* This board has full regulator constraints */ | |
688 | regulator_has_full_constraints(); | |
aa44ef4d SK |
689 | } |
690 | ||
691 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") | |
692 | /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */ | |
bc77b1aa | 693 | .atag_offset = 0x100, |
aa44ef4d | 694 | .map_io = u8500_map_io, |
178980f9 | 695 | .init_irq = ux500_init_irq, |
aa44ef4d | 696 | /* we re-use nomadik timer here */ |
41ac329f | 697 | .timer = &ux500_timer, |
4b4f757c LW |
698 | .init_machine = mop500_init_machine, |
699 | MACHINE_END | |
700 | ||
701 | MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") | |
bc77b1aa | 702 | .atag_offset = 0x100, |
4b4f757c LW |
703 | .map_io = u8500_map_io, |
704 | .init_irq = ux500_init_irq, | |
705 | .timer = &ux500_timer, | |
110c2c2f | 706 | .init_machine = hrefv60_init_machine, |
aa44ef4d | 707 | MACHINE_END |
350abe03 RM |
708 | |
709 | MACHINE_START(SNOWBALL, "Calao Systems Snowball platform") | |
bc77b1aa | 710 | .atag_offset = 0x100, |
350abe03 RM |
711 | .map_io = u8500_map_io, |
712 | .init_irq = ux500_init_irq, | |
713 | /* we re-use nomadik timer here */ | |
714 | .timer = &ux500_timer, | |
110c2c2f | 715 | .init_machine = snowball_init_machine, |
350abe03 | 716 | MACHINE_END |