board-mop500.c 17 KB

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