board-mop500.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875
  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/regulator/fixed.h>
  26. #include <linux/mfd/tc3589x.h>
  27. #include <linux/mfd/tps6105x.h>
  28. #include <linux/mfd/abx500/ab8500-gpio.h>
  29. #include <linux/mfd/abx500/ab8500-codec.h>
  30. #include <linux/leds-lp5521.h>
  31. #include <linux/input.h>
  32. #include <linux/smsc911x.h>
  33. #include <linux/gpio_keys.h>
  34. #include <linux/delay.h>
  35. #include <linux/of.h>
  36. #include <linux/of_platform.h>
  37. #include <linux/leds.h>
  38. #include <linux/pinctrl/consumer.h>
  39. #include <asm/mach-types.h>
  40. #include <asm/mach/arch.h>
  41. #include <asm/hardware/gic.h>
  42. #include <plat/ste_dma40.h>
  43. #include <plat/gpio-nomadik.h>
  44. #include <mach/hardware.h>
  45. #include <mach/setup.h>
  46. #include <mach/devices.h>
  47. #include <mach/irqs.h>
  48. #include <mach/crypto-ux500.h>
  49. #include "ste-dma40-db8500.h"
  50. #include "devices-db8500.h"
  51. #include "board-mop500.h"
  52. #include "board-mop500-regulators.h"
  53. #include "board-mop500-msp.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. * 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. };
  404. #ifdef CONFIG_STE_DMA40
  405. static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
  406. .mode = STEDMA40_MODE_LOGICAL,
  407. .dir = STEDMA40_PERIPH_TO_MEM,
  408. .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
  409. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  410. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  411. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  412. };
  413. static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
  414. .mode = STEDMA40_MODE_LOGICAL,
  415. .dir = STEDMA40_MEM_TO_PERIPH,
  416. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  417. .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
  418. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  419. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  420. };
  421. #endif
  422. static struct pl022_ssp_controller ssp0_plat = {
  423. .bus_id = 0,
  424. #ifdef CONFIG_STE_DMA40
  425. .enable_dma = 1,
  426. .dma_filter = stedma40_filter,
  427. .dma_rx_param = &ssp0_dma_cfg_rx,
  428. .dma_tx_param = &ssp0_dma_cfg_tx,
  429. #else
  430. .enable_dma = 0,
  431. #endif
  432. /* on this platform, gpio 31,142,144,214 &
  433. * 224 are connected as chip selects
  434. */
  435. .num_chipselect = 5,
  436. };
  437. static void __init mop500_spi_init(struct device *parent)
  438. {
  439. db8500_add_ssp0(parent, &ssp0_plat);
  440. }
  441. #ifdef CONFIG_STE_DMA40
  442. static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
  443. .mode = STEDMA40_MODE_LOGICAL,
  444. .dir = STEDMA40_PERIPH_TO_MEM,
  445. .src_dev_type = DB8500_DMA_DEV13_UART0_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 uart0_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_DEV13_UART0_TX,
  455. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  456. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  457. };
  458. static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
  459. .mode = STEDMA40_MODE_LOGICAL,
  460. .dir = STEDMA40_PERIPH_TO_MEM,
  461. .src_dev_type = DB8500_DMA_DEV12_UART1_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 uart1_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_DEV12_UART1_TX,
  471. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  472. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  473. };
  474. static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
  475. .mode = STEDMA40_MODE_LOGICAL,
  476. .dir = STEDMA40_PERIPH_TO_MEM,
  477. .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
  478. .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
  479. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  480. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  481. };
  482. static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
  483. .mode = STEDMA40_MODE_LOGICAL,
  484. .dir = STEDMA40_MEM_TO_PERIPH,
  485. .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
  486. .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
  487. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  488. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  489. };
  490. #endif
  491. #define PRCC_K_SOFTRST_SET 0x18
  492. #define PRCC_K_SOFTRST_CLEAR 0x1C
  493. static void ux500_uart0_reset(void)
  494. {
  495. void __iomem *prcc_rst_set, *prcc_rst_clr;
  496. prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
  497. PRCC_K_SOFTRST_SET);
  498. prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
  499. PRCC_K_SOFTRST_CLEAR);
  500. /* Activate soft reset PRCC_K_SOFTRST_CLEAR */
  501. writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr);
  502. udelay(1);
  503. /* Release soft reset PRCC_K_SOFTRST_SET */
  504. writel((readl(prcc_rst_set) | 0x1), prcc_rst_set);
  505. udelay(1);
  506. }
  507. static struct amba_pl011_data uart0_plat = {
  508. #ifdef CONFIG_STE_DMA40
  509. .dma_filter = stedma40_filter,
  510. .dma_rx_param = &uart0_dma_cfg_rx,
  511. .dma_tx_param = &uart0_dma_cfg_tx,
  512. #endif
  513. .reset = ux500_uart0_reset,
  514. };
  515. static struct amba_pl011_data uart1_plat = {
  516. #ifdef CONFIG_STE_DMA40
  517. .dma_filter = stedma40_filter,
  518. .dma_rx_param = &uart1_dma_cfg_rx,
  519. .dma_tx_param = &uart1_dma_cfg_tx,
  520. #endif
  521. };
  522. static struct amba_pl011_data uart2_plat = {
  523. #ifdef CONFIG_STE_DMA40
  524. .dma_filter = stedma40_filter,
  525. .dma_rx_param = &uart2_dma_cfg_rx,
  526. .dma_tx_param = &uart2_dma_cfg_tx,
  527. #endif
  528. };
  529. static void __init mop500_uart_init(struct device *parent)
  530. {
  531. db8500_add_uart0(parent, &uart0_plat);
  532. db8500_add_uart1(parent, &uart1_plat);
  533. db8500_add_uart2(parent, &uart2_plat);
  534. }
  535. static void __init u8500_cryp1_hash1_init(struct device *parent)
  536. {
  537. db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
  538. db8500_add_hash1(parent, &u8500_hash1_platform_data);
  539. }
  540. static struct platform_device *snowball_platform_devs[] __initdata = {
  541. &snowball_led_dev,
  542. &snowball_key_dev,
  543. &snowball_sbnet_dev,
  544. &snowball_gpio_en_3v3_regulator_dev,
  545. };
  546. static void __init mop500_init_machine(void)
  547. {
  548. struct device *parent = NULL;
  549. int i2c0_devs;
  550. int i;
  551. mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
  552. mop500_pinmaps_init();
  553. parent = u8500_init_devices(&ab8500_platdata);
  554. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  555. mop500_platform_devs[i]->dev.parent = parent;
  556. platform_add_devices(mop500_platform_devs,
  557. ARRAY_SIZE(mop500_platform_devs));
  558. mop500_i2c_init(parent);
  559. mop500_sdi_init(parent);
  560. mop500_spi_init(parent);
  561. mop500_msp_init(parent);
  562. mop500_uart_init(parent);
  563. u8500_cryp1_hash1_init(parent);
  564. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  565. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  566. i2c_register_board_info(2, mop500_i2c2_devices,
  567. ARRAY_SIZE(mop500_i2c2_devices));
  568. /* This board has full regulator constraints */
  569. regulator_has_full_constraints();
  570. mop500_uib_init();
  571. }
  572. static void __init snowball_init_machine(void)
  573. {
  574. struct device *parent = NULL;
  575. int i;
  576. snowball_pinmaps_init();
  577. parent = u8500_init_devices(&ab8500_platdata);
  578. for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
  579. snowball_platform_devs[i]->dev.parent = parent;
  580. platform_add_devices(snowball_platform_devs,
  581. ARRAY_SIZE(snowball_platform_devs));
  582. mop500_i2c_init(parent);
  583. snowball_sdi_init(parent);
  584. mop500_spi_init(parent);
  585. mop500_msp_init(parent);
  586. mop500_uart_init(parent);
  587. /* This board has full regulator constraints */
  588. regulator_has_full_constraints();
  589. }
  590. static void __init hrefv60_init_machine(void)
  591. {
  592. struct device *parent = NULL;
  593. int i2c0_devs;
  594. int i;
  595. /*
  596. * The HREFv60 board removed a GPIO expander and routed
  597. * all these GPIO pins to the internal GPIO controller
  598. * instead.
  599. */
  600. mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
  601. hrefv60_pinmaps_init();
  602. parent = u8500_init_devices(&ab8500_platdata);
  603. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  604. mop500_platform_devs[i]->dev.parent = parent;
  605. platform_add_devices(mop500_platform_devs,
  606. ARRAY_SIZE(mop500_platform_devs));
  607. mop500_i2c_init(parent);
  608. hrefv60_sdi_init(parent);
  609. mop500_spi_init(parent);
  610. mop500_msp_init(parent);
  611. mop500_uart_init(parent);
  612. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  613. i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
  614. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  615. i2c_register_board_info(2, mop500_i2c2_devices,
  616. ARRAY_SIZE(mop500_i2c2_devices));
  617. /* This board has full regulator constraints */
  618. regulator_has_full_constraints();
  619. mop500_uib_init();
  620. }
  621. MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
  622. /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
  623. .atag_offset = 0x100,
  624. .map_io = u8500_map_io,
  625. .init_irq = ux500_init_irq,
  626. /* we re-use nomadik timer here */
  627. .timer = &ux500_timer,
  628. .handle_irq = gic_handle_irq,
  629. .init_machine = mop500_init_machine,
  630. .init_late = ux500_init_late,
  631. MACHINE_END
  632. MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
  633. .atag_offset = 0x100,
  634. .map_io = u8500_map_io,
  635. .init_irq = ux500_init_irq,
  636. .timer = &ux500_timer,
  637. .handle_irq = gic_handle_irq,
  638. .init_machine = hrefv60_init_machine,
  639. .init_late = ux500_init_late,
  640. MACHINE_END
  641. MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
  642. .atag_offset = 0x100,
  643. .map_io = u8500_map_io,
  644. .init_irq = ux500_init_irq,
  645. /* we re-use nomadik timer here */
  646. .timer = &ux500_timer,
  647. .handle_irq = gic_handle_irq,
  648. .init_machine = snowball_init_machine,
  649. .init_late = ux500_init_late,
  650. MACHINE_END
  651. #ifdef CONFIG_MACH_UX500_DT
  652. static struct platform_device *snowball_of_platform_devs[] __initdata = {
  653. &snowball_led_dev,
  654. &snowball_key_dev,
  655. };
  656. struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
  657. /* Requires DMA and call-back bindings. */
  658. OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
  659. OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
  660. OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
  661. /* Requires DMA bindings. */
  662. OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
  663. OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data),
  664. OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data),
  665. /* Requires clock name bindings. */
  666. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
  667. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
  668. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
  669. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
  670. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
  671. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
  672. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
  673. OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
  674. OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
  675. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
  676. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
  677. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
  678. OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
  679. OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
  680. /* Requires device name bindings. */
  681. OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
  682. {},
  683. };
  684. static const struct of_device_id u8500_local_bus_nodes[] = {
  685. /* only create devices below soc node */
  686. { .compatible = "stericsson,db8500", },
  687. { .compatible = "stericsson,db8500-prcmu", },
  688. { .compatible = "simple-bus"},
  689. { },
  690. };
  691. static void __init u8500_init_machine(void)
  692. {
  693. struct device *parent = NULL;
  694. int i2c0_devs;
  695. int i;
  696. /* Pinmaps must be in place before devices register */
  697. if (of_machine_is_compatible("st-ericsson,mop500"))
  698. mop500_pinmaps_init();
  699. else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
  700. snowball_pinmaps_init();
  701. else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
  702. hrefv60_pinmaps_init();
  703. parent = u8500_of_init_devices();
  704. for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
  705. mop500_platform_devs[i]->dev.parent = parent;
  706. /* automatically probe child nodes of db8500 device */
  707. of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
  708. if (of_machine_is_compatible("st-ericsson,mop500")) {
  709. mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
  710. platform_add_devices(mop500_platform_devs,
  711. ARRAY_SIZE(mop500_platform_devs));
  712. mop500_sdi_init(parent);
  713. mop500_msp_init(parent);
  714. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  715. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  716. i2c_register_board_info(2, mop500_i2c2_devices,
  717. ARRAY_SIZE(mop500_i2c2_devices));
  718. mop500_uib_init();
  719. } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
  720. mop500_msp_init(parent);
  721. } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
  722. /*
  723. * The HREFv60 board removed a GPIO expander and routed
  724. * all these GPIO pins to the internal GPIO controller
  725. * instead.
  726. */
  727. mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
  728. platform_add_devices(mop500_platform_devs,
  729. ARRAY_SIZE(mop500_platform_devs));
  730. hrefv60_sdi_init(parent);
  731. mop500_msp_init(parent);
  732. i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
  733. i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
  734. i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
  735. i2c_register_board_info(2, mop500_i2c2_devices,
  736. ARRAY_SIZE(mop500_i2c2_devices));
  737. mop500_uib_init();
  738. }
  739. /* This board has full regulator constraints */
  740. regulator_has_full_constraints();
  741. }
  742. static const char * u8500_dt_board_compat[] = {
  743. "calaosystems,snowball-a9500",
  744. "st-ericsson,hrefv60+",
  745. "st-ericsson,u8500",
  746. "st-ericsson,mop500",
  747. NULL,
  748. };
  749. DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
  750. .map_io = u8500_map_io,
  751. .init_irq = ux500_init_irq,
  752. /* we re-use nomadik timer here */
  753. .timer = &ux500_timer,
  754. .handle_irq = gic_handle_irq,
  755. .init_machine = u8500_init_machine,
  756. .init_late = ux500_init_late,
  757. .dt_compat = u8500_dt_board_compat,
  758. MACHINE_END
  759. #endif