pdata-quirks.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. /*
  2. * Legacy platform_data quirks
  3. *
  4. * Copyright (C) 2013 Texas Instruments
  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. #include <linux/clk.h>
  11. #include <linux/davinci_emac.h>
  12. #include <linux/gpio.h>
  13. #include <linux/init.h>
  14. #include <linux/kernel.h>
  15. #include <linux/of_platform.h>
  16. #include <linux/ti_wilink_st.h>
  17. #include <linux/wl12xx.h>
  18. #include <linux/mmc/card.h>
  19. #include <linux/mmc/host.h>
  20. #include <linux/power/smartreflex.h>
  21. #include <linux/regulator/machine.h>
  22. #include <linux/regulator/fixed.h>
  23. #include <linux/platform_data/pinctrl-single.h>
  24. #include <linux/platform_data/hsmmc-omap.h>
  25. #include <linux/platform_data/iommu-omap.h>
  26. #include <linux/platform_data/ti-sysc.h>
  27. #include <linux/platform_data/wkup_m3.h>
  28. #include <linux/platform_data/asoc-ti-mcbsp.h>
  29. #include "common.h"
  30. #include "common-board-devices.h"
  31. #include "control.h"
  32. #include "omap_device.h"
  33. #include "omap-secure.h"
  34. #include "soc.h"
  35. #include "hsmmc.h"
  36. static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2];
  37. struct pdata_init {
  38. const char *compatible;
  39. void (*fn)(void);
  40. };
  41. static struct of_dev_auxdata omap_auxdata_lookup[];
  42. static struct twl4030_gpio_platform_data twl_gpio_auxdata;
  43. #if IS_ENABLED(CONFIG_OMAP_IOMMU)
  44. int omap_iommu_set_pwrdm_constraint(struct platform_device *pdev, bool request,
  45. u8 *pwrst);
  46. #else
  47. static inline int omap_iommu_set_pwrdm_constraint(struct platform_device *pdev,
  48. bool request, u8 *pwrst)
  49. {
  50. return 0;
  51. }
  52. #endif
  53. #ifdef CONFIG_MACH_NOKIA_N8X0
  54. static void __init omap2420_n8x0_legacy_init(void)
  55. {
  56. omap_auxdata_lookup[0].platform_data = n8x0_legacy_init();
  57. }
  58. #else
  59. #define omap2420_n8x0_legacy_init NULL
  60. #endif
  61. #ifdef CONFIG_ARCH_OMAP3
  62. /*
  63. * Configures GPIOs 126, 127 and 129 to 1.8V mode instead of 3.0V
  64. * mode for MMC1 in case bootloader did not configure things.
  65. * Note that if the pins are used for MMC1, pbias-regulator
  66. * manages the IO voltage.
  67. */
  68. static void __init omap3_gpio126_127_129(void)
  69. {
  70. u32 reg;
  71. reg = omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);
  72. reg &= ~OMAP343X_PBIASLITEVMODE1;
  73. reg |= OMAP343X_PBIASLITEPWRDNZ1;
  74. omap_ctrl_writel(reg, OMAP343X_CONTROL_PBIAS_LITE);
  75. if (cpu_is_omap3630()) {
  76. reg = omap_ctrl_readl(OMAP34XX_CONTROL_WKUP_CTRL);
  77. reg |= OMAP36XX_GPIO_IO_PWRDNZ;
  78. omap_ctrl_writel(reg, OMAP34XX_CONTROL_WKUP_CTRL);
  79. }
  80. }
  81. static void __init hsmmc2_internal_input_clk(void)
  82. {
  83. u32 reg;
  84. reg = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
  85. reg |= OMAP2_MMCSDIO2ADPCLKISEL;
  86. omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1);
  87. }
  88. static struct iommu_platform_data omap3_iommu_pdata = {
  89. .reset_name = "mmu",
  90. .assert_reset = omap_device_assert_hardreset,
  91. .deassert_reset = omap_device_deassert_hardreset,
  92. };
  93. static int omap3_sbc_t3730_twl_callback(struct device *dev,
  94. unsigned gpio,
  95. unsigned ngpio)
  96. {
  97. int res;
  98. res = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
  99. "wlan pwr");
  100. if (res)
  101. return res;
  102. gpio_export(gpio, 0);
  103. return 0;
  104. }
  105. static void __init omap3_sbc_t3x_usb_hub_init(int gpio, char *hub_name)
  106. {
  107. int err = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, hub_name);
  108. if (err) {
  109. pr_err("SBC-T3x: %s reset gpio request failed: %d\n",
  110. hub_name, err);
  111. return;
  112. }
  113. gpio_export(gpio, 0);
  114. udelay(10);
  115. gpio_set_value(gpio, 1);
  116. msleep(1);
  117. }
  118. static void __init omap3_sbc_t3730_twl_init(void)
  119. {
  120. twl_gpio_auxdata.setup = omap3_sbc_t3730_twl_callback;
  121. }
  122. static void __init omap3_sbc_t3730_legacy_init(void)
  123. {
  124. omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
  125. }
  126. static void __init omap3_sbc_t3530_legacy_init(void)
  127. {
  128. omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
  129. }
  130. static struct ti_st_plat_data wilink_pdata = {
  131. .nshutdown_gpio = 137,
  132. .dev_name = "/dev/ttyO1",
  133. .flow_cntrl = 1,
  134. .baud_rate = 300000,
  135. };
  136. static struct platform_device wl18xx_device = {
  137. .name = "kim",
  138. .id = -1,
  139. .dev = {
  140. .platform_data = &wilink_pdata,
  141. }
  142. };
  143. static struct ti_st_plat_data wilink7_pdata = {
  144. .nshutdown_gpio = 162,
  145. .dev_name = "/dev/ttyO1",
  146. .flow_cntrl = 1,
  147. .baud_rate = 3000000,
  148. };
  149. static struct platform_device wl128x_device = {
  150. .name = "kim",
  151. .id = -1,
  152. .dev = {
  153. .platform_data = &wilink7_pdata,
  154. }
  155. };
  156. static struct platform_device btwilink_device = {
  157. .name = "btwilink",
  158. .id = -1,
  159. };
  160. static void __init omap3_igep0020_rev_f_legacy_init(void)
  161. {
  162. platform_device_register(&wl18xx_device);
  163. platform_device_register(&btwilink_device);
  164. }
  165. static void __init omap3_igep0030_rev_g_legacy_init(void)
  166. {
  167. platform_device_register(&wl18xx_device);
  168. platform_device_register(&btwilink_device);
  169. }
  170. static void __init omap3_evm_legacy_init(void)
  171. {
  172. hsmmc2_internal_input_clk();
  173. }
  174. static void am35xx_enable_emac_int(void)
  175. {
  176. u32 v;
  177. v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
  178. v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR |
  179. AM35XX_CPGMAC_C0_MISC_PULSE_CLR | AM35XX_CPGMAC_C0_RX_THRESH_CLR);
  180. omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
  181. omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
  182. }
  183. static void am35xx_disable_emac_int(void)
  184. {
  185. u32 v;
  186. v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
  187. v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR);
  188. omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
  189. omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
  190. }
  191. static struct emac_platform_data am35xx_emac_pdata = {
  192. .interrupt_enable = am35xx_enable_emac_int,
  193. .interrupt_disable = am35xx_disable_emac_int,
  194. };
  195. static void __init am35xx_emac_reset(void)
  196. {
  197. u32 v;
  198. v = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
  199. v &= ~AM35XX_CPGMACSS_SW_RST;
  200. omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET);
  201. omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
  202. }
  203. static struct gpio cm_t3517_wlan_gpios[] __initdata = {
  204. { 56, GPIOF_OUT_INIT_HIGH, "wlan pwr" },
  205. { 4, GPIOF_OUT_INIT_HIGH, "xcvr noe" },
  206. };
  207. static void __init omap3_sbc_t3517_wifi_init(void)
  208. {
  209. int err = gpio_request_array(cm_t3517_wlan_gpios,
  210. ARRAY_SIZE(cm_t3517_wlan_gpios));
  211. if (err) {
  212. pr_err("SBC-T3517: wl12xx gpios request failed: %d\n", err);
  213. return;
  214. }
  215. gpio_export(cm_t3517_wlan_gpios[0].gpio, 0);
  216. gpio_export(cm_t3517_wlan_gpios[1].gpio, 0);
  217. msleep(100);
  218. gpio_set_value(cm_t3517_wlan_gpios[1].gpio, 0);
  219. }
  220. static void __init omap3_sbc_t3517_legacy_init(void)
  221. {
  222. omap3_sbc_t3x_usb_hub_init(152, "cm-t3517 usb hub");
  223. omap3_sbc_t3x_usb_hub_init(98, "sb-t35 usb hub");
  224. am35xx_emac_reset();
  225. hsmmc2_internal_input_clk();
  226. omap3_sbc_t3517_wifi_init();
  227. }
  228. static void __init am3517_evm_legacy_init(void)
  229. {
  230. am35xx_emac_reset();
  231. }
  232. static struct platform_device omap3_rom_rng_device = {
  233. .name = "omap3-rom-rng",
  234. .id = -1,
  235. .dev = {
  236. .platform_data = rx51_secure_rng_call,
  237. },
  238. };
  239. static void __init nokia_n900_legacy_init(void)
  240. {
  241. hsmmc2_internal_input_clk();
  242. mmc_pdata[0].name = "external";
  243. mmc_pdata[1].name = "internal";
  244. if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
  245. if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) {
  246. pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
  247. /* set IBE to 1 */
  248. rx51_secure_update_aux_cr(BIT(6), 0);
  249. } else {
  250. pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n");
  251. pr_warn("Thumb binaries may crash randomly without this workaround\n");
  252. }
  253. pr_info("RX-51: Registering OMAP3 HWRNG device\n");
  254. platform_device_register(&omap3_rom_rng_device);
  255. }
  256. }
  257. static void __init omap3_tao3530_legacy_init(void)
  258. {
  259. hsmmc2_internal_input_clk();
  260. }
  261. static void __init omap3_logicpd_torpedo_init(void)
  262. {
  263. omap3_gpio126_127_129();
  264. platform_device_register(&wl128x_device);
  265. platform_device_register(&btwilink_device);
  266. }
  267. /* omap3pandora legacy devices */
  268. #define PANDORA_WIFI_IRQ_GPIO 21
  269. #define PANDORA_WIFI_NRESET_GPIO 23
  270. static struct platform_device pandora_backlight = {
  271. .name = "pandora-backlight",
  272. .id = -1,
  273. };
  274. static struct regulator_consumer_supply pandora_vmmc3_supply[] = {
  275. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"),
  276. };
  277. static struct regulator_init_data pandora_vmmc3 = {
  278. .constraints = {
  279. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  280. },
  281. .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc3_supply),
  282. .consumer_supplies = pandora_vmmc3_supply,
  283. };
  284. static struct fixed_voltage_config pandora_vwlan = {
  285. .supply_name = "vwlan",
  286. .microvolts = 1800000, /* 1.8V */
  287. .gpio = PANDORA_WIFI_NRESET_GPIO,
  288. .startup_delay = 50000, /* 50ms */
  289. .enable_high = 1,
  290. .init_data = &pandora_vmmc3,
  291. };
  292. static struct platform_device pandora_vwlan_device = {
  293. .name = "reg-fixed-voltage",
  294. .id = 1,
  295. .dev = {
  296. .platform_data = &pandora_vwlan,
  297. },
  298. };
  299. static void pandora_wl1251_init_card(struct mmc_card *card)
  300. {
  301. /*
  302. * We have TI wl1251 attached to MMC3. Pass this information to
  303. * SDIO core because it can't be probed by normal methods.
  304. */
  305. if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) {
  306. card->quirks |= MMC_QUIRK_NONSTD_SDIO;
  307. card->cccr.wide_bus = 1;
  308. card->cis.vendor = 0x104c;
  309. card->cis.device = 0x9066;
  310. card->cis.blksize = 512;
  311. card->cis.max_dtr = 24000000;
  312. card->ocr = 0x80;
  313. }
  314. }
  315. static struct omap2_hsmmc_info pandora_mmc3[] = {
  316. {
  317. .mmc = 3,
  318. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
  319. .gpio_cd = -EINVAL,
  320. .gpio_wp = -EINVAL,
  321. .init_card = pandora_wl1251_init_card,
  322. },
  323. {} /* Terminator */
  324. };
  325. static void __init pandora_wl1251_init(void)
  326. {
  327. struct wl1251_platform_data pandora_wl1251_pdata;
  328. int ret;
  329. memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
  330. pandora_wl1251_pdata.power_gpio = -1;
  331. ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
  332. if (ret < 0)
  333. goto fail;
  334. pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
  335. if (pandora_wl1251_pdata.irq < 0)
  336. goto fail_irq;
  337. pandora_wl1251_pdata.use_eeprom = true;
  338. ret = wl1251_set_platform_data(&pandora_wl1251_pdata);
  339. if (ret < 0)
  340. goto fail_irq;
  341. return;
  342. fail_irq:
  343. gpio_free(PANDORA_WIFI_IRQ_GPIO);
  344. fail:
  345. pr_err("wl1251 board initialisation failed\n");
  346. }
  347. static void __init omap3_pandora_legacy_init(void)
  348. {
  349. platform_device_register(&pandora_backlight);
  350. platform_device_register(&pandora_vwlan_device);
  351. omap_hsmmc_init(pandora_mmc3);
  352. omap_hsmmc_late_init(pandora_mmc3);
  353. pandora_wl1251_init();
  354. }
  355. #endif /* CONFIG_ARCH_OMAP3 */
  356. #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
  357. defined(CONFIG_SOC_DRA7XX)
  358. static struct iommu_platform_data omap4_iommu_pdata = {
  359. .reset_name = "mmu_cache",
  360. .assert_reset = omap_device_assert_hardreset,
  361. .deassert_reset = omap_device_deassert_hardreset,
  362. };
  363. #endif
  364. #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
  365. static struct wkup_m3_platform_data wkup_m3_data = {
  366. .reset_name = "wkup_m3",
  367. .assert_reset = omap_device_assert_hardreset,
  368. .deassert_reset = omap_device_deassert_hardreset,
  369. };
  370. #endif
  371. #ifdef CONFIG_SOC_OMAP5
  372. static void __init omap5_uevm_legacy_init(void)
  373. {
  374. }
  375. #endif
  376. #ifdef CONFIG_SOC_DRA7XX
  377. static struct iommu_platform_data dra7_ipu1_iommu_pdata = {
  378. .reset_name = "mmu_cache",
  379. .assert_reset = omap_device_assert_hardreset,
  380. .deassert_reset = omap_device_deassert_hardreset,
  381. .set_pwrdm_constraint = omap_iommu_set_pwrdm_constraint,
  382. };
  383. static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc1;
  384. static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc2;
  385. static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc3;
  386. static void __init dra7x_evm_mmc_quirk(void)
  387. {
  388. if (omap_rev() == DRA752_REV_ES1_1 || omap_rev() == DRA752_REV_ES1_0) {
  389. dra7_hsmmc_data_mmc1.version = "rev11";
  390. dra7_hsmmc_data_mmc1.max_freq = 96000000;
  391. dra7_hsmmc_data_mmc2.version = "rev11";
  392. dra7_hsmmc_data_mmc2.max_freq = 48000000;
  393. dra7_hsmmc_data_mmc3.version = "rev11";
  394. dra7_hsmmc_data_mmc3.max_freq = 48000000;
  395. }
  396. }
  397. #endif
  398. static int ti_sysc_enable_module(struct device *dev,
  399. const struct ti_sysc_cookie *cookie)
  400. {
  401. if (!cookie->data)
  402. return -EINVAL;
  403. return omap_hwmod_enable(cookie->data);
  404. }
  405. static int ti_sysc_idle_module(struct device *dev,
  406. const struct ti_sysc_cookie *cookie)
  407. {
  408. if (!cookie->data)
  409. return -EINVAL;
  410. return omap_hwmod_idle(cookie->data);
  411. }
  412. static int ti_sysc_shutdown_module(struct device *dev,
  413. const struct ti_sysc_cookie *cookie)
  414. {
  415. if (!cookie->data)
  416. return -EINVAL;
  417. return omap_hwmod_shutdown(cookie->data);
  418. }
  419. static struct of_dev_auxdata omap_auxdata_lookup[];
  420. static struct ti_sysc_platform_data ti_sysc_pdata = {
  421. .auxdata = omap_auxdata_lookup,
  422. .init_module = omap_hwmod_init_module,
  423. .enable_module = ti_sysc_enable_module,
  424. .idle_module = ti_sysc_idle_module,
  425. .shutdown_module = ti_sysc_shutdown_module,
  426. };
  427. static struct pcs_pdata pcs_pdata;
  428. void omap_pcs_legacy_init(int irq, void (*rearm)(void))
  429. {
  430. pcs_pdata.irq = irq;
  431. pcs_pdata.rearm = rearm;
  432. }
  433. /*
  434. * GPIOs for TWL are initialized by the I2C bus and need custom
  435. * handing until DSS has device tree bindings.
  436. */
  437. void omap_auxdata_legacy_init(struct device *dev)
  438. {
  439. if (dev->platform_data)
  440. return;
  441. if (strcmp("twl4030-gpio", dev_name(dev)))
  442. return;
  443. dev->platform_data = &twl_gpio_auxdata;
  444. }
  445. #if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP)
  446. static struct omap_mcbsp_platform_data mcbsp_pdata;
  447. static void __init omap3_mcbsp_init(void)
  448. {
  449. omap3_mcbsp_init_pdata_callback(&mcbsp_pdata);
  450. }
  451. #else
  452. static void __init omap3_mcbsp_init(void) {}
  453. #endif
  454. /*
  455. * Few boards still need auxdata populated before we populate
  456. * the dev entries in of_platform_populate().
  457. */
  458. static struct pdata_init auxdata_quirks[] __initdata = {
  459. #ifdef CONFIG_SOC_OMAP2420
  460. { "nokia,n800", omap2420_n8x0_legacy_init, },
  461. { "nokia,n810", omap2420_n8x0_legacy_init, },
  462. { "nokia,n810-wimax", omap2420_n8x0_legacy_init, },
  463. #endif
  464. #ifdef CONFIG_ARCH_OMAP3
  465. { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_twl_init, },
  466. #endif
  467. { /* sentinel */ },
  468. };
  469. struct omap_sr_data __maybe_unused omap_sr_pdata[OMAP_SR_NR];
  470. static struct of_dev_auxdata omap_auxdata_lookup[] = {
  471. #ifdef CONFIG_MACH_NOKIA_N8X0
  472. OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
  473. OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data),
  474. OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
  475. #endif
  476. #ifdef CONFIG_ARCH_OMAP3
  477. OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
  478. &omap3_iommu_pdata),
  479. OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000,
  480. "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]),
  481. OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000,
  482. "480c9000.smartreflex", &omap_sr_pdata[OMAP_SR_MPU]),
  483. OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]),
  484. OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x480b4000, "480b4000.mmc", &mmc_pdata[1]),
  485. /* Only on am3517 */
  486. OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL),
  487. OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
  488. &am35xx_emac_pdata),
  489. /* McBSP modules with sidetone core */
  490. #if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP)
  491. OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49022000, "49022000.mcbsp", &mcbsp_pdata),
  492. OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49024000, "49024000.mcbsp", &mcbsp_pdata),
  493. #endif
  494. #endif
  495. #ifdef CONFIG_SOC_AM33XX
  496. OF_DEV_AUXDATA("ti,am3352-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
  497. &wkup_m3_data),
  498. #endif
  499. #ifdef CONFIG_SOC_AM43XX
  500. OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
  501. &wkup_m3_data),
  502. #endif
  503. #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
  504. OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu",
  505. &omap4_iommu_pdata),
  506. OF_DEV_AUXDATA("ti,omap4-iommu", 0x55082000, "55082000.mmu",
  507. &omap4_iommu_pdata),
  508. OF_DEV_AUXDATA("ti,omap4-smartreflex-iva", 0x4a0db000,
  509. "4a0db000.smartreflex", &omap_sr_pdata[OMAP_SR_IVA]),
  510. OF_DEV_AUXDATA("ti,omap4-smartreflex-core", 0x4a0dd000,
  511. "4a0dd000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]),
  512. OF_DEV_AUXDATA("ti,omap4-smartreflex-mpu", 0x4a0d9000,
  513. "4a0d9000.smartreflex", &omap_sr_pdata[OMAP_SR_MPU]),
  514. #endif
  515. #ifdef CONFIG_SOC_DRA7XX
  516. OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x4809c000, "4809c000.mmc",
  517. &dra7_hsmmc_data_mmc1),
  518. OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x480b4000, "480b4000.mmc",
  519. &dra7_hsmmc_data_mmc2),
  520. OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x480ad000, "480ad000.mmc",
  521. &dra7_hsmmc_data_mmc3),
  522. OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x40d01000, "40d01000.mmu",
  523. &omap4_iommu_pdata),
  524. OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x41501000, "41501000.mmu",
  525. &omap4_iommu_pdata),
  526. OF_DEV_AUXDATA("ti,dra7-iommu", 0x55082000, "55082000.mmu",
  527. &omap4_iommu_pdata),
  528. OF_DEV_AUXDATA("ti,dra7-iommu", 0x58882000, "58882000.mmu",
  529. &dra7_ipu1_iommu_pdata),
  530. #endif
  531. /* Common auxdata */
  532. OF_DEV_AUXDATA("ti,sysc", 0, NULL, &ti_sysc_pdata),
  533. OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
  534. { /* sentinel */ },
  535. };
  536. /*
  537. * Few boards still need to initialize some legacy devices with
  538. * platform data until the drivers support device tree.
  539. */
  540. static struct pdata_init pdata_quirks[] __initdata = {
  541. #ifdef CONFIG_ARCH_OMAP3
  542. { "compulab,omap3-sbc-t3517", omap3_sbc_t3517_legacy_init, },
  543. { "compulab,omap3-sbc-t3530", omap3_sbc_t3530_legacy_init, },
  544. { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, },
  545. { "nokia,omap3-n900", nokia_n900_legacy_init, },
  546. { "nokia,omap3-n9", hsmmc2_internal_input_clk, },
  547. { "nokia,omap3-n950", hsmmc2_internal_input_clk, },
  548. { "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, },
  549. { "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, },
  550. { "logicpd,dm3730-torpedo-devkit", omap3_logicpd_torpedo_init, },
  551. { "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
  552. { "ti,am3517-evm", am3517_evm_legacy_init, },
  553. { "technexion,omap3-tao3530", omap3_tao3530_legacy_init, },
  554. { "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, },
  555. { "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, },
  556. #endif
  557. #ifdef CONFIG_SOC_OMAP5
  558. { "ti,omap5-uevm", omap5_uevm_legacy_init, },
  559. #endif
  560. #ifdef CONFIG_SOC_DRA7XX
  561. { "ti,dra7-evm", dra7x_evm_mmc_quirk, },
  562. #endif
  563. { /* sentinel */ },
  564. };
  565. static void pdata_quirks_check(struct pdata_init *quirks)
  566. {
  567. while (quirks->compatible) {
  568. if (of_machine_is_compatible(quirks->compatible)) {
  569. if (quirks->fn)
  570. quirks->fn();
  571. }
  572. quirks++;
  573. }
  574. }
  575. void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table)
  576. {
  577. /*
  578. * We still need this for omap2420 and omap3 PM to work, others are
  579. * using drivers/misc/sram.c already.
  580. */
  581. if (of_machine_is_compatible("ti,omap2420") ||
  582. of_machine_is_compatible("ti,omap3"))
  583. omap_sdrc_init(NULL, NULL);
  584. if (of_machine_is_compatible("ti,omap3"))
  585. omap3_mcbsp_init();
  586. pdata_quirks_check(auxdata_quirks);
  587. of_platform_populate(NULL, omap_dt_match_table,
  588. omap_auxdata_lookup, NULL);
  589. pdata_quirks_check(pdata_quirks);
  590. }