board-mop500.c 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
  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/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/of.h>
  37. #include <linux/of_platform.h>
  38. #include <linux/leds.h>
  39. #include <linux/pinctrl/consumer.h>
  40. #include <asm/mach-types.h>
  41. #include <asm/mach/arch.h>
  42. #include <asm/hardware/gic.h>
  43. #include <plat/ste_dma40.h>
  44. #include <plat/gpio-nomadik.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. static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
  87. .gpio_base = MOP500_AB8500_PIN_GPIO(1),
  88. .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
  89. /* config_reg is the initial configuration of ab8500 pins.
  90. * The pins can be configured as GPIO or alt functions based
  91. * on value present in GpioSel1 to GpioSel6 and AlternatFunction
  92. * register. This is the array of 7 configuration settings.
  93. * One has to compile time decide these settings. Below is the
  94. * explanation of these setting
  95. * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
  96. * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
  97. * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
  98. * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
  99. * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
  100. * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
  101. * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
  102. * as GPIO then this register selectes the alternate fucntions
  103. */
  104. .config_reg = {0x00, 0x1E, 0x80, 0x01,
  105. 0x7A, 0x00, 0x00},
  106. };
  107. /* ab8500-codec */
  108. static struct ab8500_codec_platform_data ab8500_codec_pdata = {
  109. .amics = {
  110. .mic1_type = AMIC_TYPE_DIFFERENTIAL,
  111. .mic2_type = AMIC_TYPE_DIFFERENTIAL,
  112. .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
  113. .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
  114. .mic2_micbias = AMIC_MICBIAS_VAMIC2
  115. },
  116. .ear_cmv = EAR_CMV_0_95V
  117. };
  118. static struct gpio_keys_button snowball_key_array[] = {
  119. {
  120. .gpio = 32,
  121. .type = EV_KEY,
  122. .code = KEY_1,
  123. .desc = "userpb",
  124. .active_low = 1,
  125. .debounce_interval = 50,
  126. .wakeup = 1,
  127. },
  128. {
  129. .gpio = 151,
  130. .type = EV_KEY,
  131. .code = KEY_2,
  132. .desc = "extkb1",
  133. .active_low = 1,
  134. .debounce_interval = 50,
  135. .wakeup = 1,
  136. },
  137. {
  138. .gpio = 152,
  139. .type = EV_KEY,
  140. .code = KEY_3,
  141. .desc = "extkb2",
  142. .active_low = 1,
  143. .debounce_interval = 50,
  144. .wakeup = 1,
  145. },
  146. {
  147. .gpio = 161,
  148. .type = EV_KEY,
  149. .code = KEY_4,
  150. .desc = "extkb3",
  151. .active_low = 1,
  152. .debounce_interval = 50,
  153. .wakeup = 1,
  154. },
  155. {
  156. .gpio = 162,
  157. .type = EV_KEY,
  158. .code = KEY_5,
  159. .desc = "extkb4",
  160. .active_low = 1,
  161. .debounce_interval = 50,
  162. .wakeup = 1,
  163. },
  164. };
  165. static struct gpio_keys_platform_data snowball_key_data = {
  166. .buttons = snowball_key_array,
  167. .nbuttons = ARRAY_SIZE(snowball_key_array),
  168. };
  169. static struct platform_device snowball_key_dev = {
  170. .name = "gpio-keys",
  171. .id = -1,
  172. .dev = {
  173. .platform_data = &snowball_key_data,
  174. }
  175. };
  176. static struct smsc911x_platform_config snowball_sbnet_cfg = {
  177. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
  178. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  179. .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
  180. .shift = 1,
  181. };
  182. static struct resource sbnet_res[] = {
  183. {
  184. .name = "smsc911x-memory",
  185. .start = (0x5000 << 16),
  186. .end = (0x5000 << 16) + 0xffff,
  187. .flags = IORESOURCE_MEM,
  188. },
  189. {
  190. .start = NOMADIK_GPIO_TO_IRQ(140),
  191. .end = NOMADIK_GPIO_TO_IRQ(140),
  192. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  193. },
  194. };
  195. static struct platform_device snowball_sbnet_dev = {
  196. .name = "smsc911x",
  197. .num_resources = ARRAY_SIZE(sbnet_res),
  198. .resource = sbnet_res,
  199. .dev = {
  200. .platform_data = &snowball_sbnet_cfg,
  201. },
  202. };
  203. static struct ab8500_platform_data ab8500_platdata = {
  204. .irq_base = MOP500_AB8500_IRQ_BASE,
  205. .regulator_reg_init = ab8500_regulator_reg_init,
  206. .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
  207. .regulator = ab8500_regulators,
  208. .num_regulator = ARRAY_SIZE(ab8500_regulators),
  209. .gpio = &ab8500_gpio_pdata,
  210. .codec = &ab8500_codec_pdata,
  211. };
  212. /*
  213. * Thermal Sensor
  214. */
  215. static struct resource db8500_thsens_resources[] = {
  216. {
  217. .name = "IRQ_HOTMON_LOW",
  218. .start = IRQ_PRCMU_HOTMON_LOW,
  219. .end = IRQ_PRCMU_HOTMON_LOW,
  220. .flags = IORESOURCE_IRQ,
  221. },
  222. {
  223. .name = "IRQ_HOTMON_HIGH",
  224. .start = IRQ_PRCMU_HOTMON_HIGH,
  225. .end = IRQ_PRCMU_HOTMON_HIGH,
  226. .flags = IORESOURCE_IRQ,
  227. },
  228. };
  229. static struct db8500_thsens_platform_data db8500_thsens_data = {
  230. .trip_points[0] = {
  231. .temp = 70000,
  232. .type = THERMAL_TRIP_ACTIVE,
  233. .cdev_name = {
  234. [0] = "thermal-cpufreq-0",
  235. },
  236. },
  237. .trip_points[1] = {
  238. .temp = 75000,
  239. .type = THERMAL_TRIP_ACTIVE,
  240. .cdev_name = {
  241. [0] = "thermal-cpufreq-0",
  242. },
  243. },
  244. .trip_points[2] = {
  245. .temp = 80000,
  246. .type = THERMAL_TRIP_ACTIVE,
  247. .cdev_name = {
  248. [0] = "thermal-cpufreq-0",
  249. },
  250. },
  251. .trip_points[3] = {
  252. .temp = 85000,
  253. .type = THERMAL_TRIP_CRITICAL,
  254. },
  255. .num_trips = 4,
  256. };
  257. static struct platform_device u8500_thsens_device = {
  258. .name = "db8500-thermal",
  259. .resource = db8500_thsens_resources,
  260. .num_resources = ARRAY_SIZE(db8500_thsens_resources),
  261. .dev = {
  262. .platform_data = &db8500_thsens_data,
  263. },
  264. };
  265. static struct platform_device u8500_cpufreq_cooling_device = {
  266. .name = "db8500-cpufreq-cooling",
  267. };
  268. /*
  269. * TPS61052
  270. */
  271. static struct tps6105x_platform_data mop500_tps61052_data = {
  272. .mode = TPS6105X_MODE_VOLTAGE,
  273. .regulator_data = &tps61052_regulator,
  274. };
  275. /*
  276. * TC35892
  277. */
  278. static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
  279. {
  280. struct device *parent = NULL;
  281. #if 0
  282. /* FIXME: Is the sdi actually part of tc3589x? */
  283. parent = tc3589x->dev;
  284. #endif
  285. mop500_sdi_tc35892_init(parent);
  286. }
  287. static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
  288. .gpio_base = MOP500_EGPIO(0),
  289. .setup = mop500_tc35892_init,
  290. };
  291. static struct tc3589x_platform_data mop500_tc35892_data = {
  292. .block = TC3589x_BLOCK_GPIO,
  293. .gpio = &mop500_tc35892_gpio_data,
  294. .irq_base = MOP500_EGPIO_IRQ_BASE,
  295. };
  296. static struct lp5521_led_config lp5521_pri_led[] = {
  297. [0] = {
  298. .chan_nr = 0,
  299. .led_current = 0x2f,
  300. .max_current = 0x5f,
  301. },
  302. [1] = {
  303. .chan_nr = 1,
  304. .led_current = 0x2f,
  305. .max_current = 0x5f,
  306. },
  307. [2] = {
  308. .chan_nr = 2,
  309. .led_current = 0x2f,
  310. .max_current = 0x5f,
  311. },
  312. };
  313. static struct lp5521_platform_data __initdata lp5521_pri_data = {
  314. .label = "lp5521_pri",
  315. .led_config = &lp5521_pri_led[0],
  316. .num_channels = 3,
  317. .clock_mode = LP5521_CLOCK_EXT,
  318. };
  319. static struct lp5521_led_config lp5521_sec_led[] = {
  320. [0] = {
  321. .chan_nr = 0,
  322. .led_current = 0x2f,
  323. .max_current = 0x5f,
  324. },
  325. [1] = {
  326. .chan_nr = 1,
  327. .led_current = 0x2f,
  328. .max_current = 0x5f,
  329. },
  330. [2] = {
  331. .chan_nr = 2,
  332. .led_current = 0x2f,
  333. .max_current = 0x5f,
  334. },
  335. };
  336. static struct lp5521_platform_data __initdata lp5521_sec_data = {
  337. .label = "lp5521_sec",
  338. .led_config = &lp5521_sec_led[0],
  339. .num_channels = 3,
  340. .clock_mode = LP5521_CLOCK_EXT,
  341. };
  342. static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
  343. {
  344. I2C_BOARD_INFO("tc3589x", 0x42),
  345. .irq = NOMADIK_GPIO_TO_IRQ(217),
  346. .platform_data = &mop500_tc35892_data,
  347. },
  348. /* I2C0 devices only available prior to HREFv60 */
  349. {
  350. I2C_BOARD_INFO("tps61052", 0x33),
  351. .platform_data = &mop500_tps61052_data,
  352. },
  353. };
  354. #define NUM_PRE_V60_I2C0_DEVICES 1
  355. static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
  356. {
  357. /* lp5521 LED driver, 1st device */
  358. I2C_BOARD_INFO("lp5521", 0x33),
  359. .platform_data = &lp5521_pri_data,
  360. },
  361. {
  362. /* lp5521 LED driver, 2st device */
  363. I2C_BOARD_INFO("lp5521", 0x34),
  364. .platform_data = &lp5521_sec_data,
  365. },
  366. {
  367. /* Light sensor Rohm BH1780GLI */
  368. I2C_BOARD_INFO("bh1780", 0x29),
  369. },
  370. };
  371. static void __init mop500_i2c_init(struct device *parent)
  372. {
  373. db8500_add_i2c0(parent, NULL);
  374. db8500_add_i2c1(parent, NULL);
  375. db8500_add_i2c2(parent, NULL);
  376. db8500_add_i2c3(parent, NULL);
  377. }
  378. static struct gpio_keys_button mop500_gpio_keys[] = {
  379. {
  380. .desc = "SFH7741 Proximity Sensor",
  381. .type = EV_SW,
  382. .code = SW_FRONT_PROXIMITY,
  383. .active_low = 0,
  384. .can_disable = 1,
  385. }
  386. };
  387. static struct regulator *prox_regulator;
  388. static int mop500_prox_activate(struct device *dev);
  389. static void mop500_prox_deactivate(struct device *dev);
  390. static struct gpio_keys_platform_data mop500_gpio_keys_data = {
  391. .buttons = mop500_gpio_keys,
  392. .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
  393. .enable = mop500_prox_activate,
  394. .disable = mop500_prox_deactivate,
  395. };
  396. static struct platform_device mop500_gpio_keys_device = {
  397. .name = "gpio-keys",
  398. .id = 0,
  399. .dev = {
  400. .platform_data = &mop500_gpio_keys_data,
  401. },
  402. };
  403. static int mop500_prox_activate(struct device *dev)
  404. {
  405. prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
  406. "vcc");
  407. if (IS_ERR(prox_regulator)) {
  408. dev_err(&mop500_gpio_keys_device.dev,
  409. "no regulator\n");
  410. return PTR_ERR(prox_regulator);
  411. }
  412. regulator_enable(prox_regulator);
  413. return 0;
  414. }
  415. static void mop500_prox_deactivate(struct device *dev)
  416. {
  417. regulator_disable(prox_regulator);
  418. regulator_put(prox_regulator);
  419. }
  420. static struct cryp_platform_data u8500_cryp1_platform_data = {
  421. .mem_to_engine = {
  422. .dir = STEDMA40_MEM_TO_PERIPH,
  423. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  424. .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
  425. .src_info.data_width = STEDMA40_WORD_WIDTH,
  426. .dst_info.data_width = STEDMA40_WORD_WIDTH,
  427. .mode = STEDMA40_MODE_LOGICAL,
  428. .src_info.psize = STEDMA40_PSIZE_LOG_4,
  429. .dst_info.psize = STEDMA40_PSIZE_LOG_4,
  430. },
  431. .engine_to_mem = {
  432. .dir = STEDMA40_PERIPH_TO_MEM,
  433. .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
  434. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  435. .src_info.data_width = STEDMA40_WORD_WIDTH,
  436. .dst_info.data_width = STEDMA40_WORD_WIDTH,
  437. .mode = STEDMA40_MODE_LOGICAL,
  438. .src_info.psize = STEDMA40_PSIZE_LOG_4,
  439. .dst_info.psize = STEDMA40_PSIZE_LOG_4,
  440. }
  441. };
  442. static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
  443. .dir = STEDMA40_MEM_TO_PERIPH,
  444. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  445. .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
  446. .src_info.data_width = STEDMA40_WORD_WIDTH,
  447. .dst_info.data_width = STEDMA40_WORD_WIDTH,
  448. .mode = STEDMA40_MODE_LOGICAL,
  449. .src_info.psize = STEDMA40_PSIZE_LOG_16,
  450. .dst_info.psize = STEDMA40_PSIZE_LOG_16,
  451. };
  452. static struct hash_platform_data u8500_hash1_platform_data = {
  453. .mem_to_engine = &u8500_hash_dma_cfg_tx,
  454. .dma_filter = stedma40_filter,
  455. };
  456. /* add any platform devices here - TODO */
  457. static struct platform_device *mop500_platform_devs[] __initdata = {
  458. &mop500_gpio_keys_device,
  459. };
  460. #ifdef CONFIG_STE_DMA40
  461. static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
  462. .mode = STEDMA40_MODE_LOGICAL,
  463. .dir = STEDMA40_PERIPH_TO_MEM,
  464. .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
  465. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  466. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  467. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  468. };
  469. static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
  470. .mode = STEDMA40_MODE_LOGICAL,
  471. .dir = STEDMA40_MEM_TO_PERIPH,
  472. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  473. .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
  474. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  475. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  476. };
  477. #endif
  478. static struct pl022_ssp_controller ssp0_plat = {
  479. .bus_id = 0,
  480. #ifdef CONFIG_STE_DMA40
  481. .enable_dma = 1,
  482. .dma_filter = stedma40_filter,
  483. .dma_rx_param = &ssp0_dma_cfg_rx,
  484. .dma_tx_param = &ssp0_dma_cfg_tx,
  485. #else
  486. .enable_dma = 0,
  487. #endif
  488. /* on this platform, gpio 31,142,144,214 &
  489. * 224 are connected as chip selects
  490. */
  491. .num_chipselect = 5,
  492. };
  493. static void __init mop500_spi_init(struct device *parent)
  494. {
  495. db8500_add_ssp0(parent, &ssp0_plat);
  496. }
  497. #ifdef CONFIG_STE_DMA40
  498. static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
  499. .mode = STEDMA40_MODE_LOGICAL,
  500. .dir = STEDMA40_PERIPH_TO_MEM,
  501. .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
  502. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  503. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  504. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  505. };
  506. static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
  507. .mode = STEDMA40_MODE_LOGICAL,
  508. .dir = STEDMA40_MEM_TO_PERIPH,
  509. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  510. .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
  511. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  512. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  513. };
  514. static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
  515. .mode = STEDMA40_MODE_LOGICAL,
  516. .dir = STEDMA40_PERIPH_TO_MEM,
  517. .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
  518. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  519. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  520. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  521. };
  522. static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
  523. .mode = STEDMA40_MODE_LOGICAL,
  524. .dir = STEDMA40_MEM_TO_PERIPH,
  525. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  526. .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
  527. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  528. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  529. };
  530. static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
  531. .mode = STEDMA40_MODE_LOGICAL,
  532. .dir = STEDMA40_PERIPH_TO_MEM,
  533. .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
  534. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  535. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  536. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  537. };
  538. static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
  539. .mode = STEDMA40_MODE_LOGICAL,
  540. .dir = STEDMA40_MEM_TO_PERIPH,
  541. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  542. .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
  543. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  544. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  545. };
  546. #endif
  547. static struct amba_pl011_data uart0_plat = {
  548. #ifdef CONFIG_STE_DMA40
  549. .dma_filter = stedma40_filter,
  550. .dma_rx_param = &uart0_dma_cfg_rx,
  551. .dma_tx_param = &uart0_dma_cfg_tx,
  552. #endif
  553. };
  554. static struct amba_pl011_data uart1_plat = {
  555. #ifdef CONFIG_STE_DMA40
  556. .dma_filter = stedma40_filter,
  557. .dma_rx_param = &uart1_dma_cfg_rx,
  558. .dma_tx_param = &uart1_dma_cfg_tx,
  559. #endif
  560. };
  561. static struct amba_pl011_data uart2_plat = {
  562. #ifdef CONFIG_STE_DMA40
  563. .dma_filter = stedma40_filter,
  564. .dma_rx_param = &uart2_dma_cfg_rx,
  565. .dma_tx_param = &uart2_dma_cfg_tx,
  566. #endif
  567. };
  568. static void __init mop500_uart_init(struct device *parent)
  569. {
  570. db8500_add_uart0(parent, &uart0_plat);
  571. db8500_add_uart1(parent, &uart1_plat);
  572. db8500_add_uart2(parent, &uart2_plat);
  573. }
  574. static void __init u8500_cryp1_hash1_init(struct device *parent)
  575. {
  576. db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
  577. db8500_add_hash1(parent, &u8500_hash1_platform_data);
  578. }
  579. static struct platform_device *snowball_platform_devs[] __initdata = {
  580. &snowball_led_dev,
  581. &snowball_key_dev,
  582. &snowball_sbnet_dev,
  583. &snowball_gpio_en_3v3_regulator_dev,
  584. &u8500_thsens_device,
  585. &u8500_cpufreq_cooling_device,
  586. };
  587. static void __init mop500_init_machine(void)
  588. {
  589. struct device *parent = NULL;
  590. int i2c0_devs;
  591. int i;
  592. mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
  593. mop500_pinmaps_init();
  594. parent = u8500_init_devices(&ab8500_platdata);
  595. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  596. mop500_platform_devs[i]->dev.parent = parent;
  597. platform_add_devices(mop500_platform_devs,
  598. ARRAY_SIZE(mop500_platform_devs));
  599. mop500_i2c_init(parent);
  600. mop500_sdi_init(parent);
  601. mop500_spi_init(parent);
  602. mop500_audio_init(parent);
  603. mop500_uart_init(parent);
  604. u8500_cryp1_hash1_init(parent);
  605. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  606. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  607. i2c_register_board_info(2, mop500_i2c2_devices,
  608. ARRAY_SIZE(mop500_i2c2_devices));
  609. /* This board has full regulator constraints */
  610. regulator_has_full_constraints();
  611. mop500_uib_init();
  612. }
  613. static void __init snowball_init_machine(void)
  614. {
  615. struct device *parent = NULL;
  616. int i;
  617. snowball_pinmaps_init();
  618. parent = u8500_init_devices(&ab8500_platdata);
  619. for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
  620. snowball_platform_devs[i]->dev.parent = parent;
  621. platform_add_devices(snowball_platform_devs,
  622. ARRAY_SIZE(snowball_platform_devs));
  623. mop500_i2c_init(parent);
  624. snowball_sdi_init(parent);
  625. mop500_spi_init(parent);
  626. mop500_audio_init(parent);
  627. mop500_uart_init(parent);
  628. /* This board has full regulator constraints */
  629. regulator_has_full_constraints();
  630. }
  631. static void __init hrefv60_init_machine(void)
  632. {
  633. struct device *parent = NULL;
  634. int i2c0_devs;
  635. int i;
  636. /*
  637. * The HREFv60 board removed a GPIO expander and routed
  638. * all these GPIO pins to the internal GPIO controller
  639. * instead.
  640. */
  641. mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
  642. hrefv60_pinmaps_init();
  643. parent = u8500_init_devices(&ab8500_platdata);
  644. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  645. mop500_platform_devs[i]->dev.parent = parent;
  646. platform_add_devices(mop500_platform_devs,
  647. ARRAY_SIZE(mop500_platform_devs));
  648. mop500_i2c_init(parent);
  649. hrefv60_sdi_init(parent);
  650. mop500_spi_init(parent);
  651. mop500_audio_init(parent);
  652. mop500_uart_init(parent);
  653. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  654. i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
  655. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  656. i2c_register_board_info(2, mop500_i2c2_devices,
  657. ARRAY_SIZE(mop500_i2c2_devices));
  658. /* This board has full regulator constraints */
  659. regulator_has_full_constraints();
  660. mop500_uib_init();
  661. }
  662. MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
  663. /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
  664. .atag_offset = 0x100,
  665. .smp = smp_ops(ux500_smp_ops),
  666. .map_io = u8500_map_io,
  667. .init_irq = ux500_init_irq,
  668. /* we re-use nomadik timer here */
  669. .timer = &ux500_timer,
  670. .handle_irq = gic_handle_irq,
  671. .init_machine = mop500_init_machine,
  672. .init_late = ux500_init_late,
  673. MACHINE_END
  674. MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
  675. .atag_offset = 0x100,
  676. .smp = smp_ops(ux500_smp_ops),
  677. .map_io = u8500_map_io,
  678. .init_irq = ux500_init_irq,
  679. .timer = &ux500_timer,
  680. .handle_irq = gic_handle_irq,
  681. .init_machine = hrefv60_init_machine,
  682. .init_late = ux500_init_late,
  683. MACHINE_END
  684. MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
  685. .atag_offset = 0x100,
  686. .smp = smp_ops(ux500_smp_ops),
  687. .map_io = u8500_map_io,
  688. .init_irq = ux500_init_irq,
  689. /* we re-use nomadik timer here */
  690. .timer = &ux500_timer,
  691. .handle_irq = gic_handle_irq,
  692. .init_machine = snowball_init_machine,
  693. .init_late = ux500_init_late,
  694. MACHINE_END
  695. #ifdef CONFIG_MACH_UX500_DT
  696. struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
  697. /* Requires call-back bindings. */
  698. OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
  699. /* Requires DMA and call-back bindings. */
  700. OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
  701. OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
  702. OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
  703. /* Requires DMA bindings. */
  704. OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
  705. OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data),
  706. OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data),
  707. OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data),
  708. OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data),
  709. /* Requires clock name bindings. */
  710. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
  711. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
  712. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
  713. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
  714. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
  715. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
  716. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
  717. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
  718. OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
  719. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
  720. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
  721. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
  722. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
  723. OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
  724. /* Requires device name bindings. */
  725. OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
  726. /* Requires clock name and DMA bindings. */
  727. OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
  728. "ux500-msp-i2s.0", &msp0_platform_data),
  729. OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
  730. "ux500-msp-i2s.1", &msp1_platform_data),
  731. OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000,
  732. "ux500-msp-i2s.2", &msp2_platform_data),
  733. OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000,
  734. "ux500-msp-i2s.3", &msp3_platform_data),
  735. {},
  736. };
  737. static const struct of_device_id u8500_local_bus_nodes[] = {
  738. /* only create devices below soc node */
  739. { .compatible = "stericsson,db8500", },
  740. { .compatible = "stericsson,db8500-prcmu", },
  741. { .compatible = "simple-bus"},
  742. { },
  743. };
  744. static void __init u8500_init_machine(void)
  745. {
  746. struct device *parent = NULL;
  747. int i2c0_devs;
  748. int i;
  749. /* Pinmaps must be in place before devices register */
  750. if (of_machine_is_compatible("st-ericsson,mop500"))
  751. mop500_pinmaps_init();
  752. else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
  753. snowball_pinmaps_init();
  754. else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
  755. hrefv60_pinmaps_init();
  756. parent = u8500_of_init_devices();
  757. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  758. mop500_platform_devs[i]->dev.parent = parent;
  759. /* automatically probe child nodes of db8500 device */
  760. of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
  761. if (of_machine_is_compatible("st-ericsson,mop500")) {
  762. mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
  763. platform_add_devices(mop500_platform_devs,
  764. ARRAY_SIZE(mop500_platform_devs));
  765. mop500_sdi_init(parent);
  766. mop500_audio_init(parent);
  767. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  768. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  769. i2c_register_board_info(2, mop500_i2c2_devices,
  770. ARRAY_SIZE(mop500_i2c2_devices));
  771. mop500_uib_init();
  772. } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
  773. mop500_of_audio_init(parent);
  774. } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
  775. /*
  776. * The HREFv60 board removed a GPIO expander and routed
  777. * all these GPIO pins to the internal GPIO controller
  778. * instead.
  779. */
  780. mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
  781. platform_add_devices(mop500_platform_devs,
  782. ARRAY_SIZE(mop500_platform_devs));
  783. mop500_uib_init();
  784. }
  785. /* This board has full regulator constraints */
  786. regulator_has_full_constraints();
  787. }
  788. static const char * u8500_dt_board_compat[] = {
  789. "calaosystems,snowball-a9500",
  790. "st-ericsson,hrefv60+",
  791. "st-ericsson,u8500",
  792. "st-ericsson,mop500",
  793. NULL,
  794. };
  795. DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
  796. .smp = smp_ops(ux500_smp_ops),
  797. .map_io = u8500_map_io,
  798. .init_irq = ux500_init_irq,
  799. /* we re-use nomadik timer here */
  800. .timer = &ux500_timer,
  801. .handle_irq = gic_handle_irq,
  802. .init_machine = u8500_init_machine,
  803. .init_late = ux500_init_late,
  804. .dt_compat = u8500_dt_board_compat,
  805. MACHINE_END
  806. #endif