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