| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Legacy platform_data quirks |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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 | 6 | */ |
|---|
| 10 | 7 | #include <linux/clk.h> |
|---|
| 11 | 8 | #include <linux/davinci_emac.h> |
|---|
| .. | .. |
|---|
| 13 | 10 | #include <linux/init.h> |
|---|
| 14 | 11 | #include <linux/kernel.h> |
|---|
| 15 | 12 | #include <linux/of_platform.h> |
|---|
| 16 | | -#include <linux/ti_wilink_st.h> |
|---|
| 17 | 13 | #include <linux/wl12xx.h> |
|---|
| 18 | 14 | #include <linux/mmc/card.h> |
|---|
| 19 | 15 | #include <linux/mmc/host.h> |
|---|
| .. | .. |
|---|
| 27 | 23 | #include <linux/platform_data/ti-sysc.h> |
|---|
| 28 | 24 | #include <linux/platform_data/wkup_m3.h> |
|---|
| 29 | 25 | #include <linux/platform_data/asoc-ti-mcbsp.h> |
|---|
| 26 | +#include <linux/platform_data/ti-prm.h> |
|---|
| 30 | 27 | |
|---|
| 28 | +#include "clockdomain.h" |
|---|
| 31 | 29 | #include "common.h" |
|---|
| 32 | 30 | #include "common-board-devices.h" |
|---|
| 33 | 31 | #include "control.h" |
|---|
| 34 | 32 | #include "omap_device.h" |
|---|
| 35 | 33 | #include "omap-secure.h" |
|---|
| 36 | 34 | #include "soc.h" |
|---|
| 37 | | -#include "hsmmc.h" |
|---|
| 38 | 35 | |
|---|
| 39 | 36 | static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2]; |
|---|
| 40 | 37 | |
|---|
| .. | .. |
|---|
| 45 | 42 | |
|---|
| 46 | 43 | static struct of_dev_auxdata omap_auxdata_lookup[]; |
|---|
| 47 | 44 | static struct twl4030_gpio_platform_data twl_gpio_auxdata; |
|---|
| 45 | + |
|---|
| 46 | +#if IS_ENABLED(CONFIG_OMAP_IOMMU) |
|---|
| 47 | +int omap_iommu_set_pwrdm_constraint(struct platform_device *pdev, bool request, |
|---|
| 48 | + u8 *pwrst); |
|---|
| 49 | +#else |
|---|
| 50 | +static inline int omap_iommu_set_pwrdm_constraint(struct platform_device *pdev, |
|---|
| 51 | + bool request, u8 *pwrst) |
|---|
| 52 | +{ |
|---|
| 53 | + return 0; |
|---|
| 54 | +} |
|---|
| 55 | +#endif |
|---|
| 48 | 56 | |
|---|
| 49 | 57 | #ifdef CONFIG_MACH_NOKIA_N8X0 |
|---|
| 50 | 58 | static void __init omap2420_n8x0_legacy_init(void) |
|---|
| .. | .. |
|---|
| 90 | 98 | .reset_name = "mmu", |
|---|
| 91 | 99 | .assert_reset = omap_device_assert_hardreset, |
|---|
| 92 | 100 | .deassert_reset = omap_device_deassert_hardreset, |
|---|
| 101 | + .device_enable = omap_device_enable, |
|---|
| 102 | + .device_idle = omap_device_idle, |
|---|
| 103 | +}; |
|---|
| 104 | + |
|---|
| 105 | +static struct iommu_platform_data omap3_iommu_isp_pdata = { |
|---|
| 106 | + .device_enable = omap_device_enable, |
|---|
| 107 | + .device_idle = omap_device_idle, |
|---|
| 93 | 108 | }; |
|---|
| 94 | 109 | |
|---|
| 95 | 110 | static int omap3_sbc_t3730_twl_callback(struct device *dev, |
|---|
| .. | .. |
|---|
| 138 | 153 | static void __init omap3_sbc_t3530_legacy_init(void) |
|---|
| 139 | 154 | { |
|---|
| 140 | 155 | omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub"); |
|---|
| 141 | | -} |
|---|
| 142 | | - |
|---|
| 143 | | -static struct ti_st_plat_data wilink_pdata = { |
|---|
| 144 | | - .nshutdown_gpio = 137, |
|---|
| 145 | | - .dev_name = "/dev/ttyO1", |
|---|
| 146 | | - .flow_cntrl = 1, |
|---|
| 147 | | - .baud_rate = 300000, |
|---|
| 148 | | -}; |
|---|
| 149 | | - |
|---|
| 150 | | -static struct platform_device wl18xx_device = { |
|---|
| 151 | | - .name = "kim", |
|---|
| 152 | | - .id = -1, |
|---|
| 153 | | - .dev = { |
|---|
| 154 | | - .platform_data = &wilink_pdata, |
|---|
| 155 | | - } |
|---|
| 156 | | -}; |
|---|
| 157 | | - |
|---|
| 158 | | -static struct ti_st_plat_data wilink7_pdata = { |
|---|
| 159 | | - .nshutdown_gpio = 162, |
|---|
| 160 | | - .dev_name = "/dev/ttyO1", |
|---|
| 161 | | - .flow_cntrl = 1, |
|---|
| 162 | | - .baud_rate = 3000000, |
|---|
| 163 | | -}; |
|---|
| 164 | | - |
|---|
| 165 | | -static struct platform_device wl128x_device = { |
|---|
| 166 | | - .name = "kim", |
|---|
| 167 | | - .id = -1, |
|---|
| 168 | | - .dev = { |
|---|
| 169 | | - .platform_data = &wilink7_pdata, |
|---|
| 170 | | - } |
|---|
| 171 | | -}; |
|---|
| 172 | | - |
|---|
| 173 | | -static struct platform_device btwilink_device = { |
|---|
| 174 | | - .name = "btwilink", |
|---|
| 175 | | - .id = -1, |
|---|
| 176 | | -}; |
|---|
| 177 | | - |
|---|
| 178 | | -static void __init omap3_igep0020_rev_f_legacy_init(void) |
|---|
| 179 | | -{ |
|---|
| 180 | | - platform_device_register(&wl18xx_device); |
|---|
| 181 | | - platform_device_register(&btwilink_device); |
|---|
| 182 | | -} |
|---|
| 183 | | - |
|---|
| 184 | | -static void __init omap3_igep0030_rev_g_legacy_init(void) |
|---|
| 185 | | -{ |
|---|
| 186 | | - platform_device_register(&wl18xx_device); |
|---|
| 187 | | - platform_device_register(&btwilink_device); |
|---|
| 188 | 156 | } |
|---|
| 189 | 157 | |
|---|
| 190 | 158 | static void __init omap3_evm_legacy_init(void) |
|---|
| .. | .. |
|---|
| 269 | 237 | mmc_pdata[0].name = "external"; |
|---|
| 270 | 238 | mmc_pdata[1].name = "internal"; |
|---|
| 271 | 239 | |
|---|
| 272 | | - if (omap_type() == OMAP2_DEVICE_TYPE_SEC) { |
|---|
| 240 | + if (omap_type() != OMAP2_DEVICE_TYPE_GP) { |
|---|
| 273 | 241 | if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) { |
|---|
| 274 | 242 | pr_info("RX-51: Enabling ARM errata 430973 workaround\n"); |
|---|
| 275 | 243 | /* set IBE to 1 */ |
|---|
| .. | .. |
|---|
| 289 | 257 | static void __init omap3_logicpd_torpedo_init(void) |
|---|
| 290 | 258 | { |
|---|
| 291 | 259 | omap3_gpio126_127_129(); |
|---|
| 292 | | - platform_device_register(&wl128x_device); |
|---|
| 293 | | - platform_device_register(&btwilink_device); |
|---|
| 294 | 260 | } |
|---|
| 295 | 261 | |
|---|
| 296 | 262 | /* omap3pandora legacy devices */ |
|---|
| .. | .. |
|---|
| 305 | 271 | platform_device_register(&pandora_backlight); |
|---|
| 306 | 272 | } |
|---|
| 307 | 273 | #endif /* CONFIG_ARCH_OMAP3 */ |
|---|
| 308 | | - |
|---|
| 309 | | -#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) |
|---|
| 310 | | -static struct iommu_platform_data omap4_iommu_pdata = { |
|---|
| 311 | | - .reset_name = "mmu_cache", |
|---|
| 312 | | - .assert_reset = omap_device_assert_hardreset, |
|---|
| 313 | | - .deassert_reset = omap_device_deassert_hardreset, |
|---|
| 314 | | -}; |
|---|
| 315 | | -#endif |
|---|
| 316 | 274 | |
|---|
| 317 | 275 | #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) |
|---|
| 318 | 276 | static struct wkup_m3_platform_data wkup_m3_data = { |
|---|
| .. | .. |
|---|
| 329 | 287 | #endif |
|---|
| 330 | 288 | |
|---|
| 331 | 289 | #ifdef CONFIG_SOC_DRA7XX |
|---|
| 290 | +static struct iommu_platform_data dra7_ipu1_dsp_iommu_pdata = { |
|---|
| 291 | + .set_pwrdm_constraint = omap_iommu_set_pwrdm_constraint, |
|---|
| 292 | +}; |
|---|
| 293 | + |
|---|
| 332 | 294 | static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc1; |
|---|
| 333 | 295 | static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc2; |
|---|
| 334 | 296 | static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc3; |
|---|
| .. | .. |
|---|
| 347 | 309 | } |
|---|
| 348 | 310 | } |
|---|
| 349 | 311 | #endif |
|---|
| 312 | + |
|---|
| 313 | +static struct clockdomain *ti_sysc_find_one_clockdomain(struct clk *clk) |
|---|
| 314 | +{ |
|---|
| 315 | + struct clk_hw *hw = __clk_get_hw(clk); |
|---|
| 316 | + struct clockdomain *clkdm = NULL; |
|---|
| 317 | + struct clk_hw_omap *hwclk; |
|---|
| 318 | + |
|---|
| 319 | + hwclk = to_clk_hw_omap(hw); |
|---|
| 320 | + if (!omap2_clk_is_hw_omap(hw)) |
|---|
| 321 | + return NULL; |
|---|
| 322 | + |
|---|
| 323 | + if (hwclk && hwclk->clkdm_name) |
|---|
| 324 | + clkdm = clkdm_lookup(hwclk->clkdm_name); |
|---|
| 325 | + |
|---|
| 326 | + return clkdm; |
|---|
| 327 | +} |
|---|
| 328 | + |
|---|
| 329 | +/** |
|---|
| 330 | + * ti_sysc_clkdm_init - find clockdomain based on clock |
|---|
| 331 | + * @fck: device functional clock |
|---|
| 332 | + * @ick: device interface clock |
|---|
| 333 | + * @dev: struct device |
|---|
| 334 | + * |
|---|
| 335 | + * Populate clockdomain based on clock. It is needed for |
|---|
| 336 | + * clkdm_deny_idle() and clkdm_allow_idle() for blocking clockdomain |
|---|
| 337 | + * clockdomain idle during reset, enable and idle. |
|---|
| 338 | + * |
|---|
| 339 | + * Note that we assume interconnect driver manages the clocks |
|---|
| 340 | + * and do not need to populate oh->_clk for dynamically |
|---|
| 341 | + * allocated modules. |
|---|
| 342 | + */ |
|---|
| 343 | +static int ti_sysc_clkdm_init(struct device *dev, |
|---|
| 344 | + struct clk *fck, struct clk *ick, |
|---|
| 345 | + struct ti_sysc_cookie *cookie) |
|---|
| 346 | +{ |
|---|
| 347 | + if (!IS_ERR(fck)) |
|---|
| 348 | + cookie->clkdm = ti_sysc_find_one_clockdomain(fck); |
|---|
| 349 | + if (cookie->clkdm) |
|---|
| 350 | + return 0; |
|---|
| 351 | + if (!IS_ERR(ick)) |
|---|
| 352 | + cookie->clkdm = ti_sysc_find_one_clockdomain(ick); |
|---|
| 353 | + if (cookie->clkdm) |
|---|
| 354 | + return 0; |
|---|
| 355 | + |
|---|
| 356 | + return -ENODEV; |
|---|
| 357 | +} |
|---|
| 358 | + |
|---|
| 359 | +static void ti_sysc_clkdm_deny_idle(struct device *dev, |
|---|
| 360 | + const struct ti_sysc_cookie *cookie) |
|---|
| 361 | +{ |
|---|
| 362 | + if (cookie->clkdm) |
|---|
| 363 | + clkdm_deny_idle(cookie->clkdm); |
|---|
| 364 | +} |
|---|
| 365 | + |
|---|
| 366 | +static void ti_sysc_clkdm_allow_idle(struct device *dev, |
|---|
| 367 | + const struct ti_sysc_cookie *cookie) |
|---|
| 368 | +{ |
|---|
| 369 | + if (cookie->clkdm) |
|---|
| 370 | + clkdm_allow_idle(cookie->clkdm); |
|---|
| 371 | +} |
|---|
| 350 | 372 | |
|---|
| 351 | 373 | static int ti_sysc_enable_module(struct device *dev, |
|---|
| 352 | 374 | const struct ti_sysc_cookie *cookie) |
|---|
| .. | .. |
|---|
| 375 | 397 | return omap_hwmod_shutdown(cookie->data); |
|---|
| 376 | 398 | } |
|---|
| 377 | 399 | |
|---|
| 400 | +static bool ti_sysc_soc_type_gp(void) |
|---|
| 401 | +{ |
|---|
| 402 | + return omap_type() == OMAP2_DEVICE_TYPE_GP; |
|---|
| 403 | +} |
|---|
| 404 | + |
|---|
| 378 | 405 | static struct of_dev_auxdata omap_auxdata_lookup[]; |
|---|
| 379 | 406 | |
|---|
| 380 | 407 | static struct ti_sysc_platform_data ti_sysc_pdata = { |
|---|
| 381 | 408 | .auxdata = omap_auxdata_lookup, |
|---|
| 409 | + .soc_type_gp = ti_sysc_soc_type_gp, |
|---|
| 410 | + .init_clockdomain = ti_sysc_clkdm_init, |
|---|
| 411 | + .clkdm_deny_idle = ti_sysc_clkdm_deny_idle, |
|---|
| 412 | + .clkdm_allow_idle = ti_sysc_clkdm_allow_idle, |
|---|
| 382 | 413 | .init_module = omap_hwmod_init_module, |
|---|
| 383 | 414 | .enable_module = ti_sysc_enable_module, |
|---|
| 384 | 415 | .idle_module = ti_sysc_idle_module, |
|---|
| .. | .. |
|---|
| 392 | 423 | pcs_pdata.irq = irq; |
|---|
| 393 | 424 | pcs_pdata.rearm = rearm; |
|---|
| 394 | 425 | } |
|---|
| 426 | + |
|---|
| 427 | +static struct ti_prm_platform_data ti_prm_pdata = { |
|---|
| 428 | + .clkdm_deny_idle = clkdm_deny_idle, |
|---|
| 429 | + .clkdm_allow_idle = clkdm_allow_idle, |
|---|
| 430 | + .clkdm_lookup = clkdm_lookup, |
|---|
| 431 | +}; |
|---|
| 395 | 432 | |
|---|
| 396 | 433 | /* |
|---|
| 397 | 434 | * GPIOs for TWL are initialized by the I2C bus and need custom |
|---|
| .. | .. |
|---|
| 408 | 445 | dev->platform_data = &twl_gpio_auxdata; |
|---|
| 409 | 446 | } |
|---|
| 410 | 447 | |
|---|
| 411 | | -#if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP) |
|---|
| 448 | +#if IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP) |
|---|
| 412 | 449 | static struct omap_mcbsp_platform_data mcbsp_pdata; |
|---|
| 413 | 450 | static void __init omap3_mcbsp_init(void) |
|---|
| 414 | 451 | { |
|---|
| .. | .. |
|---|
| 445 | 482 | #ifdef CONFIG_ARCH_OMAP3 |
|---|
| 446 | 483 | OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu", |
|---|
| 447 | 484 | &omap3_iommu_pdata), |
|---|
| 485 | + OF_DEV_AUXDATA("ti,omap2-iommu", 0x480bd400, "480bd400.mmu", |
|---|
| 486 | + &omap3_iommu_isp_pdata), |
|---|
| 448 | 487 | OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000, |
|---|
| 449 | 488 | "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]), |
|---|
| 450 | 489 | OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000, |
|---|
| .. | .. |
|---|
| 457 | 496 | &am35xx_emac_pdata), |
|---|
| 458 | 497 | OF_DEV_AUXDATA("nokia,n900-rom-rng", 0, NULL, rx51_secure_rng_call), |
|---|
| 459 | 498 | /* McBSP modules with sidetone core */ |
|---|
| 460 | | -#if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP) |
|---|
| 499 | +#if IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP) |
|---|
| 461 | 500 | OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49022000, "49022000.mcbsp", &mcbsp_pdata), |
|---|
| 462 | 501 | OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49024000, "49024000.mcbsp", &mcbsp_pdata), |
|---|
| 463 | 502 | #endif |
|---|
| .. | .. |
|---|
| 471 | 510 | &wkup_m3_data), |
|---|
| 472 | 511 | #endif |
|---|
| 473 | 512 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) |
|---|
| 474 | | - OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu", |
|---|
| 475 | | - &omap4_iommu_pdata), |
|---|
| 476 | | - OF_DEV_AUXDATA("ti,omap4-iommu", 0x55082000, "55082000.mmu", |
|---|
| 477 | | - &omap4_iommu_pdata), |
|---|
| 478 | 513 | OF_DEV_AUXDATA("ti,omap4-smartreflex-iva", 0x4a0db000, |
|---|
| 479 | 514 | "4a0db000.smartreflex", &omap_sr_pdata[OMAP_SR_IVA]), |
|---|
| 480 | 515 | OF_DEV_AUXDATA("ti,omap4-smartreflex-core", 0x4a0dd000, |
|---|
| .. | .. |
|---|
| 489 | 524 | &dra7_hsmmc_data_mmc2), |
|---|
| 490 | 525 | OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x480ad000, "480ad000.mmc", |
|---|
| 491 | 526 | &dra7_hsmmc_data_mmc3), |
|---|
| 527 | + OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x40d01000, "40d01000.mmu", |
|---|
| 528 | + &dra7_ipu1_dsp_iommu_pdata), |
|---|
| 529 | + OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x41501000, "41501000.mmu", |
|---|
| 530 | + &dra7_ipu1_dsp_iommu_pdata), |
|---|
| 531 | + OF_DEV_AUXDATA("ti,dra7-iommu", 0x58882000, "58882000.mmu", |
|---|
| 532 | + &dra7_ipu1_dsp_iommu_pdata), |
|---|
| 492 | 533 | #endif |
|---|
| 493 | 534 | /* Common auxdata */ |
|---|
| 494 | 535 | OF_DEV_AUXDATA("ti,sysc", 0, NULL, &ti_sysc_pdata), |
|---|
| 495 | 536 | OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata), |
|---|
| 537 | + OF_DEV_AUXDATA("ti,omap-prm-inst", 0, NULL, &ti_prm_pdata), |
|---|
| 538 | + OF_DEV_AUXDATA("ti,omap-sdma", 0, NULL, &dma_plat_info), |
|---|
| 496 | 539 | { /* sentinel */ }, |
|---|
| 497 | 540 | }; |
|---|
| 498 | 541 | |
|---|
| .. | .. |
|---|
| 508 | 551 | { "nokia,omap3-n900", nokia_n900_legacy_init, }, |
|---|
| 509 | 552 | { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, |
|---|
| 510 | 553 | { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, |
|---|
| 511 | | - { "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, }, |
|---|
| 512 | | - { "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, }, |
|---|
| 513 | 554 | { "logicpd,dm3730-torpedo-devkit", omap3_logicpd_torpedo_init, }, |
|---|
| 514 | 555 | { "ti,omap3-evm-37xx", omap3_evm_legacy_init, }, |
|---|
| 515 | 556 | { "ti,am3517-evm", am3517_evm_legacy_init, }, |
|---|