board-mop500.c 23 KB

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