board-mop500.c 19 KB

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