pdata-quirks.c 21 KB

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