board-mop500.c 23 KB

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