board-mop500.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876
  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/gpio.h>
  18. #include <linux/amba/bus.h>
  19. #include <linux/amba/pl022.h>
  20. #include <linux/amba/serial.h>
  21. #include <linux/spi/spi.h>
  22. #include <linux/mfd/abx500/ab8500.h>
  23. #include <linux/regulator/ab8500.h>
  24. #include <linux/mfd/tc3589x.h>
  25. #include <linux/mfd/tps6105x.h>
  26. #include <linux/mfd/abx500/ab8500-gpio.h>
  27. #include <linux/mfd/abx500/ab8500-codec.h>
  28. #include <linux/leds-lp5521.h>
  29. #include <linux/input.h>
  30. #include <linux/smsc911x.h>
  31. #include <linux/gpio_keys.h>
  32. #include <linux/delay.h>
  33. #include <linux/of.h>
  34. #include <linux/of_platform.h>
  35. #include <linux/leds.h>
  36. #include <linux/pinctrl/consumer.h>
  37. #include <asm/mach-types.h>
  38. #include <asm/mach/arch.h>
  39. #include <asm/hardware/gic.h>
  40. #include <plat/i2c.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. static struct resource ab8500_resources[] = {
  197. [0] = {
  198. .start = IRQ_DB8500_AB8500,
  199. .end = IRQ_DB8500_AB8500,
  200. .flags = IORESOURCE_IRQ
  201. }
  202. };
  203. struct platform_device ab8500_device = {
  204. .name = "ab8500-core",
  205. .id = 0,
  206. .dev = {
  207. .platform_data = &ab8500_platdata,
  208. },
  209. .num_resources = 1,
  210. .resource = ab8500_resources,
  211. };
  212. /*
  213. * TPS61052
  214. */
  215. static struct tps6105x_platform_data mop500_tps61052_data = {
  216. .mode = TPS6105X_MODE_VOLTAGE,
  217. .regulator_data = &tps61052_regulator,
  218. };
  219. /*
  220. * TC35892
  221. */
  222. static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
  223. {
  224. struct device *parent = NULL;
  225. #if 0
  226. /* FIXME: Is the sdi actually part of tc3589x? */
  227. parent = tc3589x->dev;
  228. #endif
  229. mop500_sdi_tc35892_init(parent);
  230. }
  231. static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
  232. .gpio_base = MOP500_EGPIO(0),
  233. .setup = mop500_tc35892_init,
  234. };
  235. static struct tc3589x_platform_data mop500_tc35892_data = {
  236. .block = TC3589x_BLOCK_GPIO,
  237. .gpio = &mop500_tc35892_gpio_data,
  238. .irq_base = MOP500_EGPIO_IRQ_BASE,
  239. };
  240. static struct lp5521_led_config lp5521_pri_led[] = {
  241. [0] = {
  242. .chan_nr = 0,
  243. .led_current = 0x2f,
  244. .max_current = 0x5f,
  245. },
  246. [1] = {
  247. .chan_nr = 1,
  248. .led_current = 0x2f,
  249. .max_current = 0x5f,
  250. },
  251. [2] = {
  252. .chan_nr = 2,
  253. .led_current = 0x2f,
  254. .max_current = 0x5f,
  255. },
  256. };
  257. static struct lp5521_platform_data __initdata lp5521_pri_data = {
  258. .label = "lp5521_pri",
  259. .led_config = &lp5521_pri_led[0],
  260. .num_channels = 3,
  261. .clock_mode = LP5521_CLOCK_EXT,
  262. };
  263. static struct lp5521_led_config lp5521_sec_led[] = {
  264. [0] = {
  265. .chan_nr = 0,
  266. .led_current = 0x2f,
  267. .max_current = 0x5f,
  268. },
  269. [1] = {
  270. .chan_nr = 1,
  271. .led_current = 0x2f,
  272. .max_current = 0x5f,
  273. },
  274. [2] = {
  275. .chan_nr = 2,
  276. .led_current = 0x2f,
  277. .max_current = 0x5f,
  278. },
  279. };
  280. static struct lp5521_platform_data __initdata lp5521_sec_data = {
  281. .label = "lp5521_sec",
  282. .led_config = &lp5521_sec_led[0],
  283. .num_channels = 3,
  284. .clock_mode = LP5521_CLOCK_EXT,
  285. };
  286. static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
  287. {
  288. I2C_BOARD_INFO("tc3589x", 0x42),
  289. .irq = NOMADIK_GPIO_TO_IRQ(217),
  290. .platform_data = &mop500_tc35892_data,
  291. },
  292. /* I2C0 devices only available prior to HREFv60 */
  293. {
  294. I2C_BOARD_INFO("tps61052", 0x33),
  295. .platform_data = &mop500_tps61052_data,
  296. },
  297. };
  298. #define NUM_PRE_V60_I2C0_DEVICES 1
  299. static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
  300. {
  301. /* lp5521 LED driver, 1st device */
  302. I2C_BOARD_INFO("lp5521", 0x33),
  303. .platform_data = &lp5521_pri_data,
  304. },
  305. {
  306. /* lp5521 LED driver, 2st device */
  307. I2C_BOARD_INFO("lp5521", 0x34),
  308. .platform_data = &lp5521_sec_data,
  309. },
  310. {
  311. /* Light sensor Rohm BH1780GLI */
  312. I2C_BOARD_INFO("bh1780", 0x29),
  313. },
  314. };
  315. static void __init mop500_i2c_init(struct device *parent)
  316. {
  317. db8500_add_i2c0(parent, NULL);
  318. db8500_add_i2c1(parent, NULL);
  319. db8500_add_i2c2(parent, NULL);
  320. db8500_add_i2c3(parent, NULL);
  321. }
  322. static struct gpio_keys_button mop500_gpio_keys[] = {
  323. {
  324. .desc = "SFH7741 Proximity Sensor",
  325. .type = EV_SW,
  326. .code = SW_FRONT_PROXIMITY,
  327. .active_low = 0,
  328. .can_disable = 1,
  329. }
  330. };
  331. static struct regulator *prox_regulator;
  332. static int mop500_prox_activate(struct device *dev);
  333. static void mop500_prox_deactivate(struct device *dev);
  334. static struct gpio_keys_platform_data mop500_gpio_keys_data = {
  335. .buttons = mop500_gpio_keys,
  336. .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
  337. .enable = mop500_prox_activate,
  338. .disable = mop500_prox_deactivate,
  339. };
  340. static struct platform_device mop500_gpio_keys_device = {
  341. .name = "gpio-keys",
  342. .id = 0,
  343. .dev = {
  344. .platform_data = &mop500_gpio_keys_data,
  345. },
  346. };
  347. static int mop500_prox_activate(struct device *dev)
  348. {
  349. prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
  350. "vcc");
  351. if (IS_ERR(prox_regulator)) {
  352. dev_err(&mop500_gpio_keys_device.dev,
  353. "no regulator\n");
  354. return PTR_ERR(prox_regulator);
  355. }
  356. regulator_enable(prox_regulator);
  357. return 0;
  358. }
  359. static void mop500_prox_deactivate(struct device *dev)
  360. {
  361. regulator_disable(prox_regulator);
  362. regulator_put(prox_regulator);
  363. }
  364. static struct cryp_platform_data u8500_cryp1_platform_data = {
  365. .mem_to_engine = {
  366. .dir = STEDMA40_MEM_TO_PERIPH,
  367. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  368. .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
  369. .src_info.data_width = STEDMA40_WORD_WIDTH,
  370. .dst_info.data_width = STEDMA40_WORD_WIDTH,
  371. .mode = STEDMA40_MODE_LOGICAL,
  372. .src_info.psize = STEDMA40_PSIZE_LOG_4,
  373. .dst_info.psize = STEDMA40_PSIZE_LOG_4,
  374. },
  375. .engine_to_mem = {
  376. .dir = STEDMA40_PERIPH_TO_MEM,
  377. .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
  378. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  379. .src_info.data_width = STEDMA40_WORD_WIDTH,
  380. .dst_info.data_width = STEDMA40_WORD_WIDTH,
  381. .mode = STEDMA40_MODE_LOGICAL,
  382. .src_info.psize = STEDMA40_PSIZE_LOG_4,
  383. .dst_info.psize = STEDMA40_PSIZE_LOG_4,
  384. }
  385. };
  386. static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
  387. .dir = STEDMA40_MEM_TO_PERIPH,
  388. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  389. .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
  390. .src_info.data_width = STEDMA40_WORD_WIDTH,
  391. .dst_info.data_width = STEDMA40_WORD_WIDTH,
  392. .mode = STEDMA40_MODE_LOGICAL,
  393. .src_info.psize = STEDMA40_PSIZE_LOG_16,
  394. .dst_info.psize = STEDMA40_PSIZE_LOG_16,
  395. };
  396. static struct hash_platform_data u8500_hash1_platform_data = {
  397. .mem_to_engine = &u8500_hash_dma_cfg_tx,
  398. .dma_filter = stedma40_filter,
  399. };
  400. /* add any platform devices here - TODO */
  401. static struct platform_device *mop500_platform_devs[] __initdata = {
  402. &mop500_gpio_keys_device,
  403. &ab8500_device,
  404. };
  405. #ifdef CONFIG_STE_DMA40
  406. static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
  407. .mode = STEDMA40_MODE_LOGICAL,
  408. .dir = STEDMA40_PERIPH_TO_MEM,
  409. .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
  410. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  411. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  412. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  413. };
  414. static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
  415. .mode = STEDMA40_MODE_LOGICAL,
  416. .dir = STEDMA40_MEM_TO_PERIPH,
  417. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  418. .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
  419. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  420. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  421. };
  422. #endif
  423. static struct pl022_ssp_controller ssp0_plat = {
  424. .bus_id = 0,
  425. #ifdef CONFIG_STE_DMA40
  426. .enable_dma = 1,
  427. .dma_filter = stedma40_filter,
  428. .dma_rx_param = &ssp0_dma_cfg_rx,
  429. .dma_tx_param = &ssp0_dma_cfg_tx,
  430. #else
  431. .enable_dma = 0,
  432. #endif
  433. /* on this platform, gpio 31,142,144,214 &
  434. * 224 are connected as chip selects
  435. */
  436. .num_chipselect = 5,
  437. };
  438. static void __init mop500_spi_init(struct device *parent)
  439. {
  440. db8500_add_ssp0(parent, &ssp0_plat);
  441. }
  442. #ifdef CONFIG_STE_DMA40
  443. static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
  444. .mode = STEDMA40_MODE_LOGICAL,
  445. .dir = STEDMA40_PERIPH_TO_MEM,
  446. .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
  447. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  448. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  449. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  450. };
  451. static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
  452. .mode = STEDMA40_MODE_LOGICAL,
  453. .dir = STEDMA40_MEM_TO_PERIPH,
  454. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  455. .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
  456. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  457. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  458. };
  459. static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
  460. .mode = STEDMA40_MODE_LOGICAL,
  461. .dir = STEDMA40_PERIPH_TO_MEM,
  462. .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
  463. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  464. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  465. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  466. };
  467. static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
  468. .mode = STEDMA40_MODE_LOGICAL,
  469. .dir = STEDMA40_MEM_TO_PERIPH,
  470. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  471. .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
  472. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  473. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  474. };
  475. static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
  476. .mode = STEDMA40_MODE_LOGICAL,
  477. .dir = STEDMA40_PERIPH_TO_MEM,
  478. .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
  479. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  480. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  481. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  482. };
  483. static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
  484. .mode = STEDMA40_MODE_LOGICAL,
  485. .dir = STEDMA40_MEM_TO_PERIPH,
  486. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  487. .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
  488. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  489. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  490. };
  491. #endif
  492. #define PRCC_K_SOFTRST_SET 0x18
  493. #define PRCC_K_SOFTRST_CLEAR 0x1C
  494. static void ux500_uart0_reset(void)
  495. {
  496. void __iomem *prcc_rst_set, *prcc_rst_clr;
  497. prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
  498. PRCC_K_SOFTRST_SET);
  499. prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
  500. PRCC_K_SOFTRST_CLEAR);
  501. /* Activate soft reset PRCC_K_SOFTRST_CLEAR */
  502. writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr);
  503. udelay(1);
  504. /* Release soft reset PRCC_K_SOFTRST_SET */
  505. writel((readl(prcc_rst_set) | 0x1), prcc_rst_set);
  506. udelay(1);
  507. }
  508. static struct amba_pl011_data uart0_plat = {
  509. #ifdef CONFIG_STE_DMA40
  510. .dma_filter = stedma40_filter,
  511. .dma_rx_param = &uart0_dma_cfg_rx,
  512. .dma_tx_param = &uart0_dma_cfg_tx,
  513. #endif
  514. .reset = ux500_uart0_reset,
  515. };
  516. static struct amba_pl011_data uart1_plat = {
  517. #ifdef CONFIG_STE_DMA40
  518. .dma_filter = stedma40_filter,
  519. .dma_rx_param = &uart1_dma_cfg_rx,
  520. .dma_tx_param = &uart1_dma_cfg_tx,
  521. #endif
  522. };
  523. static struct amba_pl011_data uart2_plat = {
  524. #ifdef CONFIG_STE_DMA40
  525. .dma_filter = stedma40_filter,
  526. .dma_rx_param = &uart2_dma_cfg_rx,
  527. .dma_tx_param = &uart2_dma_cfg_tx,
  528. #endif
  529. };
  530. static void __init mop500_uart_init(struct device *parent)
  531. {
  532. db8500_add_uart0(parent, &uart0_plat);
  533. db8500_add_uart1(parent, &uart1_plat);
  534. db8500_add_uart2(parent, &uart2_plat);
  535. }
  536. static void __init u8500_cryp1_hash1_init(struct device *parent)
  537. {
  538. db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
  539. db8500_add_hash1(parent, &u8500_hash1_platform_data);
  540. }
  541. static struct platform_device *snowball_platform_devs[] __initdata = {
  542. &snowball_led_dev,
  543. &snowball_key_dev,
  544. &snowball_sbnet_dev,
  545. &ab8500_device,
  546. };
  547. static void __init mop500_init_machine(void)
  548. {
  549. struct device *parent = NULL;
  550. int i2c0_devs;
  551. int i;
  552. mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
  553. mop500_pinmaps_init();
  554. parent = u8500_init_devices();
  555. /* FIXME: parent of ab8500 should be prcmu */
  556. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  557. mop500_platform_devs[i]->dev.parent = parent;
  558. platform_add_devices(mop500_platform_devs,
  559. ARRAY_SIZE(mop500_platform_devs));
  560. mop500_i2c_init(parent);
  561. mop500_sdi_init(parent);
  562. mop500_spi_init(parent);
  563. mop500_msp_init(parent);
  564. mop500_uart_init(parent);
  565. u8500_cryp1_hash1_init(parent);
  566. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  567. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  568. i2c_register_board_info(2, mop500_i2c2_devices,
  569. ARRAY_SIZE(mop500_i2c2_devices));
  570. /* This board has full regulator constraints */
  571. regulator_has_full_constraints();
  572. mop500_uib_init();
  573. }
  574. static void __init snowball_init_machine(void)
  575. {
  576. struct device *parent = NULL;
  577. int i;
  578. snowball_pinmaps_init();
  579. parent = u8500_init_devices();
  580. for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
  581. snowball_platform_devs[i]->dev.parent = parent;
  582. platform_add_devices(snowball_platform_devs,
  583. ARRAY_SIZE(snowball_platform_devs));
  584. mop500_i2c_init(parent);
  585. snowball_sdi_init(parent);
  586. mop500_spi_init(parent);
  587. mop500_msp_init(parent);
  588. mop500_uart_init(parent);
  589. /* This board has full regulator constraints */
  590. regulator_has_full_constraints();
  591. }
  592. static void __init hrefv60_init_machine(void)
  593. {
  594. struct device *parent = NULL;
  595. int i2c0_devs;
  596. int i;
  597. /*
  598. * The HREFv60 board removed a GPIO expander and routed
  599. * all these GPIO pins to the internal GPIO controller
  600. * instead.
  601. */
  602. mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
  603. hrefv60_pinmaps_init();
  604. parent = u8500_init_devices();
  605. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  606. mop500_platform_devs[i]->dev.parent = parent;
  607. platform_add_devices(mop500_platform_devs,
  608. ARRAY_SIZE(mop500_platform_devs));
  609. mop500_i2c_init(parent);
  610. hrefv60_sdi_init(parent);
  611. mop500_spi_init(parent);
  612. mop500_msp_init(parent);
  613. mop500_uart_init(parent);
  614. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  615. i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
  616. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  617. i2c_register_board_info(2, mop500_i2c2_devices,
  618. ARRAY_SIZE(mop500_i2c2_devices));
  619. /* This board has full regulator constraints */
  620. regulator_has_full_constraints();
  621. mop500_uib_init();
  622. }
  623. MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
  624. /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
  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 = mop500_init_machine,
  632. .init_late = ux500_init_late,
  633. MACHINE_END
  634. MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
  635. .atag_offset = 0x100,
  636. .map_io = u8500_map_io,
  637. .init_irq = ux500_init_irq,
  638. .timer = &ux500_timer,
  639. .handle_irq = gic_handle_irq,
  640. .init_machine = hrefv60_init_machine,
  641. .init_late = ux500_init_late,
  642. MACHINE_END
  643. MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
  644. .atag_offset = 0x100,
  645. .map_io = u8500_map_io,
  646. .init_irq = ux500_init_irq,
  647. /* we re-use nomadik timer here */
  648. .timer = &ux500_timer,
  649. .handle_irq = gic_handle_irq,
  650. .init_machine = snowball_init_machine,
  651. .init_late = ux500_init_late,
  652. MACHINE_END
  653. #ifdef CONFIG_MACH_UX500_DT
  654. static struct platform_device *snowball_of_platform_devs[] __initdata = {
  655. &snowball_led_dev,
  656. &snowball_key_dev,
  657. };
  658. struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
  659. /* Requires DMA and call-back bindings. */
  660. OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
  661. OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
  662. OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
  663. /* Requires DMA bindings. */
  664. OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
  665. OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data),
  666. OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data),
  667. /* Requires clock name bindings. */
  668. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
  669. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
  670. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
  671. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
  672. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
  673. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
  674. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
  675. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
  676. OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
  677. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
  678. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
  679. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
  680. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
  681. OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
  682. /* Requires device name bindings. */
  683. OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
  684. {},
  685. };
  686. static const struct of_device_id u8500_local_bus_nodes[] = {
  687. /* only create devices below soc node */
  688. { .compatible = "stericsson,db8500", },
  689. { .compatible = "stericsson,db8500-prcmu", },
  690. { .compatible = "stericsson,db8500-prcmu-regulator", },
  691. { .compatible = "stericsson,ab8500", },
  692. { .compatible = "stericsson,ab8500-regulator", },
  693. { .compatible = "simple-bus"},
  694. { },
  695. };
  696. static void __init u8500_init_machine(void)
  697. {
  698. struct device *parent = NULL;
  699. int i2c0_devs;
  700. int i;
  701. /* Pinmaps must be in place before devices register */
  702. if (of_machine_is_compatible("st-ericsson,mop500"))
  703. mop500_pinmaps_init();
  704. else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
  705. snowball_pinmaps_init();
  706. else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
  707. hrefv60_pinmaps_init();
  708. parent = u8500_of_init_devices();
  709. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  710. mop500_platform_devs[i]->dev.parent = parent;
  711. /* automatically probe child nodes of db8500 device */
  712. of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
  713. if (of_machine_is_compatible("st-ericsson,mop500")) {
  714. mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
  715. platform_add_devices(mop500_platform_devs,
  716. ARRAY_SIZE(mop500_platform_devs));
  717. mop500_sdi_init(parent);
  718. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  719. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  720. i2c_register_board_info(2, mop500_i2c2_devices,
  721. ARRAY_SIZE(mop500_i2c2_devices));
  722. mop500_uib_init();
  723. } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
  724. /*
  725. * The HREFv60 board removed a GPIO expander and routed
  726. * all these GPIO pins to the internal GPIO controller
  727. * instead.
  728. */
  729. mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
  730. platform_add_devices(mop500_platform_devs,
  731. ARRAY_SIZE(mop500_platform_devs));
  732. hrefv60_sdi_init(parent);
  733. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  734. i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
  735. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  736. i2c_register_board_info(2, mop500_i2c2_devices,
  737. ARRAY_SIZE(mop500_i2c2_devices));
  738. mop500_uib_init();
  739. }
  740. /* This board has full regulator constraints */
  741. regulator_has_full_constraints();
  742. }
  743. static const char * u8500_dt_board_compat[] = {
  744. "calaosystems,snowball-a9500",
  745. "st-ericsson,hrefv60+",
  746. "st-ericsson,u8500",
  747. "st-ericsson,mop500",
  748. NULL,
  749. };
  750. DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
  751. .map_io = u8500_map_io,
  752. .init_irq = ux500_init_irq,
  753. /* we re-use nomadik timer here */
  754. .timer = &ux500_timer,
  755. .handle_irq = gic_handle_irq,
  756. .init_machine = u8500_init_machine,
  757. .init_late = ux500_init_late,
  758. .dt_compat = u8500_dt_board_compat,
  759. MACHINE_END
  760. #endif