board-mop500.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. /*
  2. * Copyright (C) 2008-2012 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/clk.h>
  16. #include <linux/io.h>
  17. #include <linux/i2c.h>
  18. #include <linux/platform_data/i2c-nomadik.h>
  19. #include <linux/platform_data/db8500_thermal.h>
  20. #include <linux/gpio.h>
  21. #include <linux/amba/bus.h>
  22. #include <linux/amba/pl022.h>
  23. #include <linux/amba/serial.h>
  24. #include <linux/spi/spi.h>
  25. #include <linux/mfd/abx500/ab8500.h>
  26. #include <linux/regulator/ab8500.h>
  27. #include <linux/regulator/fixed.h>
  28. #include <linux/regulator/driver.h>
  29. #include <linux/regulator/gpio-regulator.h>
  30. #include <linux/mfd/tc3589x.h>
  31. #include <linux/mfd/tps6105x.h>
  32. #include <linux/mfd/abx500/ab8500-gpio.h>
  33. #include <linux/mfd/abx500/ab8500-codec.h>
  34. #include <linux/platform_data/leds-lp55xx.h>
  35. #include <linux/input.h>
  36. #include <linux/smsc911x.h>
  37. #include <linux/gpio_keys.h>
  38. #include <linux/delay.h>
  39. #include <linux/leds.h>
  40. #include <linux/pinctrl/consumer.h>
  41. #include <linux/platform_data/pinctrl-nomadik.h>
  42. #include <linux/platform_data/dma-ste-dma40.h>
  43. #include <asm/mach-types.h>
  44. #include <asm/mach/arch.h>
  45. #include <mach/hardware.h>
  46. #include <mach/setup.h>
  47. #include <mach/devices.h>
  48. #include <mach/irqs.h>
  49. #include <linux/platform_data/crypto-ux500.h>
  50. #include "ste-dma40-db8500.h"
  51. #include "devices-db8500.h"
  52. #include "board-mop500.h"
  53. #include "board-mop500-regulators.h"
  54. static struct gpio_led snowball_led_array[] = {
  55. {
  56. .name = "user_led",
  57. .default_trigger = "heartbeat",
  58. .gpio = 142,
  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. static struct platform_device snowball_led_dev = {
  66. .name = "leds-gpio",
  67. .dev = {
  68. .platform_data = &snowball_led_data,
  69. },
  70. };
  71. static struct fixed_voltage_config snowball_gpio_en_3v3_data = {
  72. .supply_name = "EN-3V3",
  73. .gpio = SNOWBALL_EN_3V3_ETH_GPIO,
  74. .microvolts = 3300000,
  75. .enable_high = 1,
  76. .init_data = &gpio_en_3v3_regulator,
  77. .startup_delay = 5000, /* 1200us */
  78. };
  79. static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
  80. .name = "reg-fixed-voltage",
  81. .id = 1,
  82. .dev = {
  83. .platform_data = &snowball_gpio_en_3v3_data,
  84. },
  85. };
  86. /* Dynamically populated. */
  87. static struct gpio sdi0_reg_gpios[] = {
  88. { 0, GPIOF_OUT_INIT_LOW, "mmci_vsel" },
  89. };
  90. static struct gpio_regulator_state sdi0_reg_states[] = {
  91. { .value = 2900000, .gpios = (0 << 0) },
  92. { .value = 1800000, .gpios = (1 << 0) },
  93. };
  94. static struct gpio_regulator_config sdi0_reg_info = {
  95. .supply_name = "ext-mmc-level-shifter",
  96. .gpios = sdi0_reg_gpios,
  97. .nr_gpios = ARRAY_SIZE(sdi0_reg_gpios),
  98. .states = sdi0_reg_states,
  99. .nr_states = ARRAY_SIZE(sdi0_reg_states),
  100. .type = REGULATOR_VOLTAGE,
  101. .enable_high = 1,
  102. .enabled_at_boot = 0,
  103. .init_data = &sdi0_reg_init_data,
  104. .startup_delay = 100,
  105. };
  106. static struct platform_device sdi0_regulator = {
  107. .name = "gpio-regulator",
  108. .id = -1,
  109. .dev = {
  110. .platform_data = &sdi0_reg_info,
  111. },
  112. };
  113. static struct abx500_gpio_platform_data ab8500_gpio_pdata = {
  114. .gpio_base = MOP500_AB8500_PIN_GPIO(1),
  115. };
  116. /* ab8500-codec */
  117. static struct ab8500_codec_platform_data ab8500_codec_pdata = {
  118. .amics = {
  119. .mic1_type = AMIC_TYPE_DIFFERENTIAL,
  120. .mic2_type = AMIC_TYPE_DIFFERENTIAL,
  121. .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
  122. .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
  123. .mic2_micbias = AMIC_MICBIAS_VAMIC2
  124. },
  125. .ear_cmv = EAR_CMV_0_95V
  126. };
  127. static struct gpio_keys_button snowball_key_array[] = {
  128. {
  129. .gpio = 32,
  130. .type = EV_KEY,
  131. .code = KEY_1,
  132. .desc = "userpb",
  133. .active_low = 1,
  134. .debounce_interval = 50,
  135. .wakeup = 1,
  136. },
  137. {
  138. .gpio = 151,
  139. .type = EV_KEY,
  140. .code = KEY_2,
  141. .desc = "extkb1",
  142. .active_low = 1,
  143. .debounce_interval = 50,
  144. .wakeup = 1,
  145. },
  146. {
  147. .gpio = 152,
  148. .type = EV_KEY,
  149. .code = KEY_3,
  150. .desc = "extkb2",
  151. .active_low = 1,
  152. .debounce_interval = 50,
  153. .wakeup = 1,
  154. },
  155. {
  156. .gpio = 161,
  157. .type = EV_KEY,
  158. .code = KEY_4,
  159. .desc = "extkb3",
  160. .active_low = 1,
  161. .debounce_interval = 50,
  162. .wakeup = 1,
  163. },
  164. {
  165. .gpio = 162,
  166. .type = EV_KEY,
  167. .code = KEY_5,
  168. .desc = "extkb4",
  169. .active_low = 1,
  170. .debounce_interval = 50,
  171. .wakeup = 1,
  172. },
  173. };
  174. static struct gpio_keys_platform_data snowball_key_data = {
  175. .buttons = snowball_key_array,
  176. .nbuttons = ARRAY_SIZE(snowball_key_array),
  177. };
  178. static struct platform_device snowball_key_dev = {
  179. .name = "gpio-keys",
  180. .id = -1,
  181. .dev = {
  182. .platform_data = &snowball_key_data,
  183. }
  184. };
  185. static struct smsc911x_platform_config snowball_sbnet_cfg = {
  186. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
  187. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  188. .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
  189. .shift = 1,
  190. };
  191. static struct resource sbnet_res[] = {
  192. {
  193. .name = "smsc911x-memory",
  194. .start = (0x5000 << 16),
  195. .end = (0x5000 << 16) + 0xffff,
  196. .flags = IORESOURCE_MEM,
  197. },
  198. {
  199. .start = NOMADIK_GPIO_TO_IRQ(140),
  200. .end = NOMADIK_GPIO_TO_IRQ(140),
  201. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  202. },
  203. };
  204. static struct platform_device snowball_sbnet_dev = {
  205. .name = "smsc911x",
  206. .num_resources = ARRAY_SIZE(sbnet_res),
  207. .resource = sbnet_res,
  208. .dev = {
  209. .platform_data = &snowball_sbnet_cfg,
  210. },
  211. };
  212. struct ab8500_platform_data ab8500_platdata = {
  213. .irq_base = MOP500_AB8500_IRQ_BASE,
  214. .regulator = &ab8500_regulator_plat_data,
  215. .gpio = &ab8500_gpio_pdata,
  216. .codec = &ab8500_codec_pdata,
  217. };
  218. /*
  219. * Thermal Sensor
  220. */
  221. static struct resource db8500_thsens_resources[] = {
  222. {
  223. .name = "IRQ_HOTMON_LOW",
  224. .start = IRQ_PRCMU_HOTMON_LOW,
  225. .end = IRQ_PRCMU_HOTMON_LOW,
  226. .flags = IORESOURCE_IRQ,
  227. },
  228. {
  229. .name = "IRQ_HOTMON_HIGH",
  230. .start = IRQ_PRCMU_HOTMON_HIGH,
  231. .end = IRQ_PRCMU_HOTMON_HIGH,
  232. .flags = IORESOURCE_IRQ,
  233. },
  234. };
  235. static struct db8500_thsens_platform_data db8500_thsens_data = {
  236. .trip_points[0] = {
  237. .temp = 70000,
  238. .type = THERMAL_TRIP_ACTIVE,
  239. .cdev_name = {
  240. [0] = "thermal-cpufreq-0",
  241. },
  242. },
  243. .trip_points[1] = {
  244. .temp = 75000,
  245. .type = THERMAL_TRIP_ACTIVE,
  246. .cdev_name = {
  247. [0] = "thermal-cpufreq-0",
  248. },
  249. },
  250. .trip_points[2] = {
  251. .temp = 80000,
  252. .type = THERMAL_TRIP_ACTIVE,
  253. .cdev_name = {
  254. [0] = "thermal-cpufreq-0",
  255. },
  256. },
  257. .trip_points[3] = {
  258. .temp = 85000,
  259. .type = THERMAL_TRIP_CRITICAL,
  260. },
  261. .num_trips = 4,
  262. };
  263. static struct platform_device u8500_thsens_device = {
  264. .name = "db8500-thermal",
  265. .resource = db8500_thsens_resources,
  266. .num_resources = ARRAY_SIZE(db8500_thsens_resources),
  267. .dev = {
  268. .platform_data = &db8500_thsens_data,
  269. },
  270. };
  271. static struct platform_device u8500_cpufreq_cooling_device = {
  272. .name = "db8500-cpufreq-cooling",
  273. };
  274. /*
  275. * TPS61052
  276. */
  277. static struct tps6105x_platform_data mop500_tps61052_data = {
  278. .mode = TPS6105X_MODE_VOLTAGE,
  279. .regulator_data = &tps61052_regulator,
  280. };
  281. /*
  282. * TC35892
  283. */
  284. static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
  285. {
  286. struct device *parent = NULL;
  287. #if 0
  288. /* FIXME: Is the sdi actually part of tc3589x? */
  289. parent = tc3589x->dev;
  290. #endif
  291. mop500_sdi_tc35892_init(parent);
  292. }
  293. static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
  294. .gpio_base = MOP500_EGPIO(0),
  295. .setup = mop500_tc35892_init,
  296. };
  297. static struct tc3589x_platform_data mop500_tc35892_data = {
  298. .block = TC3589x_BLOCK_GPIO,
  299. .gpio = &mop500_tc35892_gpio_data,
  300. .irq_base = MOP500_EGPIO_IRQ_BASE,
  301. };
  302. static struct lp55xx_led_config lp5521_pri_led[] = {
  303. [0] = {
  304. .chan_nr = 0,
  305. .led_current = 0x2f,
  306. .max_current = 0x5f,
  307. },
  308. [1] = {
  309. .chan_nr = 1,
  310. .led_current = 0x2f,
  311. .max_current = 0x5f,
  312. },
  313. [2] = {
  314. .chan_nr = 2,
  315. .led_current = 0x2f,
  316. .max_current = 0x5f,
  317. },
  318. };
  319. static struct lp55xx_platform_data __initdata lp5521_pri_data = {
  320. .label = "lp5521_pri",
  321. .led_config = &lp5521_pri_led[0],
  322. .num_channels = 3,
  323. .clock_mode = LP55XX_CLOCK_EXT,
  324. };
  325. static struct lp55xx_led_config lp5521_sec_led[] = {
  326. [0] = {
  327. .chan_nr = 0,
  328. .led_current = 0x2f,
  329. .max_current = 0x5f,
  330. },
  331. [1] = {
  332. .chan_nr = 1,
  333. .led_current = 0x2f,
  334. .max_current = 0x5f,
  335. },
  336. [2] = {
  337. .chan_nr = 2,
  338. .led_current = 0x2f,
  339. .max_current = 0x5f,
  340. },
  341. };
  342. static struct lp55xx_platform_data __initdata lp5521_sec_data = {
  343. .label = "lp5521_sec",
  344. .led_config = &lp5521_sec_led[0],
  345. .num_channels = 3,
  346. .clock_mode = LP55XX_CLOCK_EXT,
  347. };
  348. static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
  349. {
  350. I2C_BOARD_INFO("tc3589x", 0x42),
  351. .irq = NOMADIK_GPIO_TO_IRQ(217),
  352. .platform_data = &mop500_tc35892_data,
  353. },
  354. /* I2C0 devices only available prior to HREFv60 */
  355. {
  356. I2C_BOARD_INFO("tps61052", 0x33),
  357. .platform_data = &mop500_tps61052_data,
  358. },
  359. };
  360. #define NUM_PRE_V60_I2C0_DEVICES 1
  361. static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
  362. {
  363. /* lp5521 LED driver, 1st device */
  364. I2C_BOARD_INFO("lp5521", 0x33),
  365. .platform_data = &lp5521_pri_data,
  366. },
  367. {
  368. /* lp5521 LED driver, 2st device */
  369. I2C_BOARD_INFO("lp5521", 0x34),
  370. .platform_data = &lp5521_sec_data,
  371. },
  372. {
  373. /* Light sensor Rohm BH1780GLI */
  374. I2C_BOARD_INFO("bh1780", 0x29),
  375. },
  376. };
  377. static void __init mop500_i2c_init(struct device *parent)
  378. {
  379. db8500_add_i2c0(parent, NULL);
  380. db8500_add_i2c1(parent, NULL);
  381. db8500_add_i2c2(parent, NULL);
  382. db8500_add_i2c3(parent, NULL);
  383. }
  384. static struct gpio_keys_button mop500_gpio_keys[] = {
  385. {
  386. .desc = "SFH7741 Proximity Sensor",
  387. .type = EV_SW,
  388. .code = SW_FRONT_PROXIMITY,
  389. .active_low = 0,
  390. .can_disable = 1,
  391. }
  392. };
  393. static struct regulator *prox_regulator;
  394. static int mop500_prox_activate(struct device *dev);
  395. static void mop500_prox_deactivate(struct device *dev);
  396. static struct gpio_keys_platform_data mop500_gpio_keys_data = {
  397. .buttons = mop500_gpio_keys,
  398. .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
  399. .enable = mop500_prox_activate,
  400. .disable = mop500_prox_deactivate,
  401. };
  402. static struct platform_device mop500_gpio_keys_device = {
  403. .name = "gpio-keys",
  404. .id = 0,
  405. .dev = {
  406. .platform_data = &mop500_gpio_keys_data,
  407. },
  408. };
  409. static int mop500_prox_activate(struct device *dev)
  410. {
  411. prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
  412. "vcc");
  413. if (IS_ERR(prox_regulator)) {
  414. dev_err(&mop500_gpio_keys_device.dev,
  415. "no regulator\n");
  416. return PTR_ERR(prox_regulator);
  417. }
  418. regulator_enable(prox_regulator);
  419. return 0;
  420. }
  421. static void mop500_prox_deactivate(struct device *dev)
  422. {
  423. regulator_disable(prox_regulator);
  424. regulator_put(prox_regulator);
  425. }
  426. void mop500_snowball_ethernet_clock_enable(void)
  427. {
  428. struct clk *clk;
  429. clk = clk_get_sys("fsmc", NULL);
  430. if (!IS_ERR(clk))
  431. clk_prepare_enable(clk);
  432. }
  433. static struct cryp_platform_data u8500_cryp1_platform_data = {
  434. .mem_to_engine = {
  435. .dir = STEDMA40_MEM_TO_PERIPH,
  436. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  437. .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
  438. .src_info.data_width = STEDMA40_WORD_WIDTH,
  439. .dst_info.data_width = STEDMA40_WORD_WIDTH,
  440. .mode = STEDMA40_MODE_LOGICAL,
  441. .src_info.psize = STEDMA40_PSIZE_LOG_4,
  442. .dst_info.psize = STEDMA40_PSIZE_LOG_4,
  443. },
  444. .engine_to_mem = {
  445. .dir = STEDMA40_PERIPH_TO_MEM,
  446. .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
  447. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  448. .src_info.data_width = STEDMA40_WORD_WIDTH,
  449. .dst_info.data_width = STEDMA40_WORD_WIDTH,
  450. .mode = STEDMA40_MODE_LOGICAL,
  451. .src_info.psize = STEDMA40_PSIZE_LOG_4,
  452. .dst_info.psize = STEDMA40_PSIZE_LOG_4,
  453. }
  454. };
  455. static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
  456. .dir = STEDMA40_MEM_TO_PERIPH,
  457. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  458. .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
  459. .src_info.data_width = STEDMA40_WORD_WIDTH,
  460. .dst_info.data_width = STEDMA40_WORD_WIDTH,
  461. .mode = STEDMA40_MODE_LOGICAL,
  462. .src_info.psize = STEDMA40_PSIZE_LOG_16,
  463. .dst_info.psize = STEDMA40_PSIZE_LOG_16,
  464. };
  465. static struct hash_platform_data u8500_hash1_platform_data = {
  466. .mem_to_engine = &u8500_hash_dma_cfg_tx,
  467. .dma_filter = stedma40_filter,
  468. };
  469. /* add any platform devices here - TODO */
  470. static struct platform_device *mop500_platform_devs[] __initdata = {
  471. &mop500_gpio_keys_device,
  472. &sdi0_regulator,
  473. };
  474. #ifdef CONFIG_STE_DMA40
  475. static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
  476. .mode = STEDMA40_MODE_LOGICAL,
  477. .dir = STEDMA40_PERIPH_TO_MEM,
  478. .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
  479. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  480. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  481. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  482. };
  483. static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
  484. .mode = STEDMA40_MODE_LOGICAL,
  485. .dir = STEDMA40_MEM_TO_PERIPH,
  486. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  487. .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
  488. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  489. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  490. };
  491. #endif
  492. struct pl022_ssp_controller ssp0_plat = {
  493. .bus_id = 0,
  494. #ifdef CONFIG_STE_DMA40
  495. .enable_dma = 1,
  496. .dma_filter = stedma40_filter,
  497. .dma_rx_param = &ssp0_dma_cfg_rx,
  498. .dma_tx_param = &ssp0_dma_cfg_tx,
  499. #else
  500. .enable_dma = 0,
  501. #endif
  502. /* on this platform, gpio 31,142,144,214 &
  503. * 224 are connected as chip selects
  504. */
  505. .num_chipselect = 5,
  506. };
  507. static void __init mop500_spi_init(struct device *parent)
  508. {
  509. db8500_add_ssp0(parent, &ssp0_plat);
  510. }
  511. #ifdef CONFIG_STE_DMA40
  512. static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
  513. .mode = STEDMA40_MODE_LOGICAL,
  514. .dir = STEDMA40_PERIPH_TO_MEM,
  515. .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
  516. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  517. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  518. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  519. };
  520. static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
  521. .mode = STEDMA40_MODE_LOGICAL,
  522. .dir = STEDMA40_MEM_TO_PERIPH,
  523. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  524. .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
  525. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  526. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  527. };
  528. static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
  529. .mode = STEDMA40_MODE_LOGICAL,
  530. .dir = STEDMA40_PERIPH_TO_MEM,
  531. .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
  532. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  533. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  534. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  535. };
  536. static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
  537. .mode = STEDMA40_MODE_LOGICAL,
  538. .dir = STEDMA40_MEM_TO_PERIPH,
  539. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  540. .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
  541. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  542. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  543. };
  544. static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
  545. .mode = STEDMA40_MODE_LOGICAL,
  546. .dir = STEDMA40_PERIPH_TO_MEM,
  547. .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
  548. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  549. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  550. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  551. };
  552. static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
  553. .mode = STEDMA40_MODE_LOGICAL,
  554. .dir = STEDMA40_MEM_TO_PERIPH,
  555. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  556. .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
  557. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  558. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  559. };
  560. #endif
  561. struct amba_pl011_data uart0_plat = {
  562. #ifdef CONFIG_STE_DMA40
  563. .dma_filter = stedma40_filter,
  564. .dma_rx_param = &uart0_dma_cfg_rx,
  565. .dma_tx_param = &uart0_dma_cfg_tx,
  566. #endif
  567. };
  568. struct amba_pl011_data uart1_plat = {
  569. #ifdef CONFIG_STE_DMA40
  570. .dma_filter = stedma40_filter,
  571. .dma_rx_param = &uart1_dma_cfg_rx,
  572. .dma_tx_param = &uart1_dma_cfg_tx,
  573. #endif
  574. };
  575. struct amba_pl011_data uart2_plat = {
  576. #ifdef CONFIG_STE_DMA40
  577. .dma_filter = stedma40_filter,
  578. .dma_rx_param = &uart2_dma_cfg_rx,
  579. .dma_tx_param = &uart2_dma_cfg_tx,
  580. #endif
  581. };
  582. static void __init mop500_uart_init(struct device *parent)
  583. {
  584. db8500_add_uart0(parent, &uart0_plat);
  585. db8500_add_uart1(parent, &uart1_plat);
  586. db8500_add_uart2(parent, &uart2_plat);
  587. }
  588. static void __init u8500_cryp1_hash1_init(struct device *parent)
  589. {
  590. db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
  591. db8500_add_hash1(parent, &u8500_hash1_platform_data);
  592. }
  593. static struct platform_device *snowball_platform_devs[] __initdata = {
  594. &snowball_led_dev,
  595. &snowball_key_dev,
  596. &snowball_sbnet_dev,
  597. &snowball_gpio_en_3v3_regulator_dev,
  598. &u8500_thsens_device,
  599. &u8500_cpufreq_cooling_device,
  600. &sdi0_regulator,
  601. };
  602. static void __init mop500_init_machine(void)
  603. {
  604. struct device *parent = NULL;
  605. int i2c0_devs;
  606. int i;
  607. platform_device_register(&db8500_prcmu_device);
  608. mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
  609. sdi0_reg_info.enable_gpio = GPIO_SDMMC_EN;
  610. sdi0_reg_info.gpios[0].gpio = GPIO_SDMMC_1V8_3V_SEL;
  611. mop500_pinmaps_init();
  612. parent = u8500_init_devices(&ab8500_platdata);
  613. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  614. mop500_platform_devs[i]->dev.parent = parent;
  615. platform_add_devices(mop500_platform_devs,
  616. ARRAY_SIZE(mop500_platform_devs));
  617. mop500_i2c_init(parent);
  618. mop500_sdi_init(parent);
  619. mop500_spi_init(parent);
  620. mop500_audio_init(parent);
  621. mop500_uart_init(parent);
  622. u8500_cryp1_hash1_init(parent);
  623. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  624. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  625. i2c_register_board_info(2, mop500_i2c2_devices,
  626. ARRAY_SIZE(mop500_i2c2_devices));
  627. /* This board has full regulator constraints */
  628. regulator_has_full_constraints();
  629. }
  630. static void __init snowball_init_machine(void)
  631. {
  632. struct device *parent = NULL;
  633. int i;
  634. platform_device_register(&db8500_prcmu_device);
  635. sdi0_reg_info.enable_gpio = SNOWBALL_SDMMC_EN_GPIO;
  636. sdi0_reg_info.gpios[0].gpio = SNOWBALL_SDMMC_1V8_3V_GPIO;
  637. snowball_pinmaps_init();
  638. parent = u8500_init_devices(&ab8500_platdata);
  639. for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
  640. snowball_platform_devs[i]->dev.parent = parent;
  641. platform_add_devices(snowball_platform_devs,
  642. ARRAY_SIZE(snowball_platform_devs));
  643. mop500_i2c_init(parent);
  644. snowball_sdi_init(parent);
  645. mop500_spi_init(parent);
  646. mop500_audio_init(parent);
  647. mop500_uart_init(parent);
  648. mop500_snowball_ethernet_clock_enable();
  649. /* This board has full regulator constraints */
  650. regulator_has_full_constraints();
  651. }
  652. static void __init hrefv60_init_machine(void)
  653. {
  654. struct device *parent = NULL;
  655. int i2c0_devs;
  656. int i;
  657. platform_device_register(&db8500_prcmu_device);
  658. /*
  659. * The HREFv60 board removed a GPIO expander and routed
  660. * all these GPIO pins to the internal GPIO controller
  661. * instead.
  662. */
  663. mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
  664. sdi0_reg_info.enable_gpio = HREFV60_SDMMC_EN_GPIO;
  665. sdi0_reg_info.gpios[0].gpio = HREFV60_SDMMC_1V8_3V_GPIO;
  666. hrefv60_pinmaps_init();
  667. parent = u8500_init_devices(&ab8500_platdata);
  668. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  669. mop500_platform_devs[i]->dev.parent = parent;
  670. platform_add_devices(mop500_platform_devs,
  671. ARRAY_SIZE(mop500_platform_devs));
  672. mop500_i2c_init(parent);
  673. hrefv60_sdi_init(parent);
  674. mop500_spi_init(parent);
  675. mop500_audio_init(parent);
  676. mop500_uart_init(parent);
  677. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  678. i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
  679. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  680. i2c_register_board_info(2, mop500_i2c2_devices,
  681. ARRAY_SIZE(mop500_i2c2_devices));
  682. /* This board has full regulator constraints */
  683. regulator_has_full_constraints();
  684. }
  685. MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
  686. /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
  687. .atag_offset = 0x100,
  688. .smp = smp_ops(ux500_smp_ops),
  689. .map_io = u8500_map_io,
  690. .init_irq = ux500_init_irq,
  691. /* we re-use nomadik timer here */
  692. .init_time = ux500_timer_init,
  693. .init_machine = mop500_init_machine,
  694. .init_late = ux500_init_late,
  695. MACHINE_END
  696. MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
  697. .atag_offset = 0x100,
  698. .map_io = u8500_map_io,
  699. .init_irq = ux500_init_irq,
  700. .init_time = ux500_timer_init,
  701. .init_machine = mop500_init_machine,
  702. .init_late = ux500_init_late,
  703. MACHINE_END
  704. MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
  705. .atag_offset = 0x100,
  706. .smp = smp_ops(ux500_smp_ops),
  707. .map_io = u8500_map_io,
  708. .init_irq = ux500_init_irq,
  709. .init_time = ux500_timer_init,
  710. .init_machine = hrefv60_init_machine,
  711. .init_late = ux500_init_late,
  712. MACHINE_END
  713. MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
  714. .atag_offset = 0x100,
  715. .smp = smp_ops(ux500_smp_ops),
  716. .map_io = u8500_map_io,
  717. .init_irq = ux500_init_irq,
  718. /* we re-use nomadik timer here */
  719. .init_time = ux500_timer_init,
  720. .init_machine = snowball_init_machine,
  721. .init_late = NULL,
  722. MACHINE_END