board-mop500.c 20 KB

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