1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 26a08e1e6STony Lindgren /* 36a08e1e6STony Lindgren * Legacy platform_data quirks 46a08e1e6STony Lindgren * 56a08e1e6STony Lindgren * Copyright (C) 2013 Texas Instruments 66a08e1e6STony Lindgren */ 76a08e1e6STony Lindgren #include <linux/clk.h> 871900314STony Lindgren #include <linux/davinci_emac.h> 9*d5f4fa60SLinus Walleij #include <linux/gpio/machine.h> 10d74e3166SArnd Bergmann #include <linux/gpio/consumer.h> 115f0a2c69STony Lindgren #include <linux/gpio.h> 126a08e1e6STony Lindgren #include <linux/init.h> 136a08e1e6STony Lindgren #include <linux/kernel.h> 148651bd8cSTony Lindgren #include <linux/of_platform.h> 15f9d50fefSGrazvydas Ignotas #include <linux/mmc/card.h> 16f9d50fefSGrazvydas Ignotas #include <linux/mmc/host.h> 17d060b405STony Lindgren #include <linux/power/smartreflex.h> 18f9d50fefSGrazvydas Ignotas #include <linux/regulator/machine.h> 19f9d50fefSGrazvydas Ignotas #include <linux/regulator/fixed.h> 206a08e1e6STony Lindgren 2130a69ef7STony Lindgren #include <linux/platform_data/pinctrl-single.h> 2210c1f7d3STony Lindgren #include <linux/platform_data/hsmmc-omap.h> 23910f1678SSuman Anna #include <linux/platform_data/iommu-omap.h> 24ef70b0bdSTony Lindgren #include <linux/platform_data/ti-sysc.h> 256da74c54SDave Gerlach #include <linux/platform_data/wkup_m3.h> 26c26c84c9SPeter Ujfalusi #include <linux/platform_data/asoc-ti-mcbsp.h> 278de44fb7STero Kristo #include <linux/platform_data/ti-prm.h> 2830a69ef7STony Lindgren 292b2f7defSTony Lindgren #include "clockdomain.h" 306a08e1e6STony Lindgren #include "common.h" 316a08e1e6STony Lindgren #include "common-board-devices.h" 32faf4bd47SAaro Koskinen #include "control.h" 33910f1678SSuman Anna #include "omap_device.h" 34deff82e6SSebastian Reichel #include "omap-secure.h" 35deff82e6SSebastian Reichel #include "soc.h" 366a08e1e6STony Lindgren 3710c1f7d3STony Lindgren static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2]; 3810c1f7d3STony Lindgren 396a08e1e6STony Lindgren struct pdata_init { 406a08e1e6STony Lindgren const char *compatible; 416a08e1e6STony Lindgren void (*fn)(void); 426a08e1e6STony Lindgren }; 436a08e1e6STony Lindgren 44f734a9b3SSekhar Nori static struct of_dev_auxdata omap_auxdata_lookup[]; 45fa590c92STony Lindgren 46fa590c92STony Lindgren #ifdef CONFIG_MACH_NOKIA_N8X0 47fa590c92STony Lindgren static void __init omap2420_n8x0_legacy_init(void) 48fa590c92STony Lindgren { 49fa590c92STony Lindgren omap_auxdata_lookup[0].platform_data = n8x0_legacy_init(); 50fa590c92STony Lindgren } 51fa590c92STony Lindgren #else 52fa590c92STony Lindgren #define omap2420_n8x0_legacy_init NULL 53fa590c92STony Lindgren #endif 54fa590c92STony Lindgren 55faf4bd47SAaro Koskinen #ifdef CONFIG_ARCH_OMAP3 56b96b332fSTony Lindgren /* 57b96b332fSTony Lindgren * Configures GPIOs 126, 127 and 129 to 1.8V mode instead of 3.0V 58b96b332fSTony Lindgren * mode for MMC1 in case bootloader did not configure things. 59b96b332fSTony Lindgren * Note that if the pins are used for MMC1, pbias-regulator 60b96b332fSTony Lindgren * manages the IO voltage. 61b96b332fSTony Lindgren */ 62b96b332fSTony Lindgren static void __init omap3_gpio126_127_129(void) 63b96b332fSTony Lindgren { 64b96b332fSTony Lindgren u32 reg; 65b96b332fSTony Lindgren 66b96b332fSTony Lindgren reg = omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE); 67b96b332fSTony Lindgren reg &= ~OMAP343X_PBIASLITEVMODE1; 68b96b332fSTony Lindgren reg |= OMAP343X_PBIASLITEPWRDNZ1; 69b96b332fSTony Lindgren omap_ctrl_writel(reg, OMAP343X_CONTROL_PBIAS_LITE); 70b96b332fSTony Lindgren if (cpu_is_omap3630()) { 71b96b332fSTony Lindgren reg = omap_ctrl_readl(OMAP34XX_CONTROL_WKUP_CTRL); 72b96b332fSTony Lindgren reg |= OMAP36XX_GPIO_IO_PWRDNZ; 73b96b332fSTony Lindgren omap_ctrl_writel(reg, OMAP34XX_CONTROL_WKUP_CTRL); 74b96b332fSTony Lindgren } 75b96b332fSTony Lindgren } 76b96b332fSTony Lindgren 77faf4bd47SAaro Koskinen static void __init hsmmc2_internal_input_clk(void) 78faf4bd47SAaro Koskinen { 79faf4bd47SAaro Koskinen u32 reg; 80faf4bd47SAaro Koskinen 81faf4bd47SAaro Koskinen reg = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1); 82faf4bd47SAaro Koskinen reg |= OMAP2_MMCSDIO2ADPCLKISEL; 83faf4bd47SAaro Koskinen omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1); 84faf4bd47SAaro Koskinen } 8515c9887eSJavier Martinez Canillas 86133ad7abSTony Lindgren #ifdef CONFIG_OMAP_HWMOD 87910f1678SSuman Anna static struct iommu_platform_data omap3_iommu_pdata = { 88910f1678SSuman Anna .reset_name = "mmu", 89910f1678SSuman Anna .assert_reset = omap_device_assert_hardreset, 90910f1678SSuman Anna .deassert_reset = omap_device_deassert_hardreset, 9119feeee5SSuman Anna .device_enable = omap_device_enable, 9219feeee5SSuman Anna .device_idle = omap_device_idle, 93910f1678SSuman Anna }; 94910f1678SSuman Anna 950af3e1a4SSuman Anna static struct iommu_platform_data omap3_iommu_isp_pdata = { 960af3e1a4SSuman Anna .device_enable = omap_device_enable, 970af3e1a4SSuman Anna .device_idle = omap_device_idle, 980af3e1a4SSuman Anna }; 99133ad7abSTony Lindgren #endif 1000af3e1a4SSuman Anna 101b62d91e5SDmitry Lifshitz static void __init omap3_sbc_t3x_usb_hub_init(int gpio, char *hub_name) 102b62d91e5SDmitry Lifshitz { 103b62d91e5SDmitry Lifshitz int err = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, hub_name); 104b62d91e5SDmitry Lifshitz 105b62d91e5SDmitry Lifshitz if (err) { 106b62d91e5SDmitry Lifshitz pr_err("SBC-T3x: %s reset gpio request failed: %d\n", 107b62d91e5SDmitry Lifshitz hub_name, err); 108b62d91e5SDmitry Lifshitz return; 109b62d91e5SDmitry Lifshitz } 110b62d91e5SDmitry Lifshitz 111d74e3166SArnd Bergmann gpiod_export(gpio_to_desc(gpio), 0); 112b62d91e5SDmitry Lifshitz 113b62d91e5SDmitry Lifshitz udelay(10); 114b62d91e5SDmitry Lifshitz gpio_set_value(gpio, 1); 115b62d91e5SDmitry Lifshitz msleep(1); 116b62d91e5SDmitry Lifshitz } 117b62d91e5SDmitry Lifshitz 1180f0cfc69STony Lindgren static void __init omap3_sbc_t3730_legacy_init(void) 1190f0cfc69STony Lindgren { 120b62d91e5SDmitry Lifshitz omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub"); 1210f0cfc69STony Lindgren } 1220f0cfc69STony Lindgren 12340ecc02eSDmitry Lifshitz static void __init omap3_sbc_t3530_legacy_init(void) 12440ecc02eSDmitry Lifshitz { 125b62d91e5SDmitry Lifshitz omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub"); 12640ecc02eSDmitry Lifshitz } 12740ecc02eSDmitry Lifshitz 12879b39f79STony Lindgren static void __init omap3_evm_legacy_init(void) 12979b39f79STony Lindgren { 1305b7610f2STony Lindgren hsmmc2_internal_input_clk(); 13179b39f79STony Lindgren } 13271900314STony Lindgren 13371900314STony Lindgren static void am35xx_enable_emac_int(void) 13471900314STony Lindgren { 13571900314STony Lindgren u32 v; 13671900314STony Lindgren 13771900314STony Lindgren v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); 13871900314STony Lindgren v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR | 13971900314STony Lindgren AM35XX_CPGMAC_C0_MISC_PULSE_CLR | AM35XX_CPGMAC_C0_RX_THRESH_CLR); 14071900314STony Lindgren omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR); 14171900314STony Lindgren omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */ 14271900314STony Lindgren } 14371900314STony Lindgren 14471900314STony Lindgren static void am35xx_disable_emac_int(void) 14571900314STony Lindgren { 14671900314STony Lindgren u32 v; 14771900314STony Lindgren 14871900314STony Lindgren v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); 14971900314STony Lindgren v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR); 15071900314STony Lindgren omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR); 15171900314STony Lindgren omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */ 15271900314STony Lindgren } 15371900314STony Lindgren 15471900314STony Lindgren static struct emac_platform_data am35xx_emac_pdata = { 15571900314STony Lindgren .interrupt_enable = am35xx_enable_emac_int, 15671900314STony Lindgren .interrupt_disable = am35xx_disable_emac_int, 15771900314STony Lindgren }; 15871900314STony Lindgren 159fb45105aSDmitry Lifshitz static void __init am35xx_emac_reset(void) 16071900314STony Lindgren { 16171900314STony Lindgren u32 v; 16271900314STony Lindgren 16371900314STony Lindgren v = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); 16471900314STony Lindgren v &= ~AM35XX_CPGMACSS_SW_RST; 16571900314STony Lindgren omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET); 16671900314STony Lindgren omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */ 16771900314STony Lindgren } 168deff82e6SSebastian Reichel 169fb45105aSDmitry Lifshitz static struct gpio cm_t3517_wlan_gpios[] __initdata = { 170fb45105aSDmitry Lifshitz { 56, GPIOF_OUT_INIT_HIGH, "wlan pwr" }, 171fb45105aSDmitry Lifshitz { 4, GPIOF_OUT_INIT_HIGH, "xcvr noe" }, 172fb45105aSDmitry Lifshitz }; 173fb45105aSDmitry Lifshitz 174fb45105aSDmitry Lifshitz static void __init omap3_sbc_t3517_wifi_init(void) 175fb45105aSDmitry Lifshitz { 176fb45105aSDmitry Lifshitz int err = gpio_request_array(cm_t3517_wlan_gpios, 177fb45105aSDmitry Lifshitz ARRAY_SIZE(cm_t3517_wlan_gpios)); 178fb45105aSDmitry Lifshitz if (err) { 179fb45105aSDmitry Lifshitz pr_err("SBC-T3517: wl12xx gpios request failed: %d\n", err); 180fb45105aSDmitry Lifshitz return; 181fb45105aSDmitry Lifshitz } 182fb45105aSDmitry Lifshitz 183d74e3166SArnd Bergmann gpiod_export(gpio_to_desc(cm_t3517_wlan_gpios[0].gpio), 0); 184d74e3166SArnd Bergmann gpiod_export(gpio_to_desc(cm_t3517_wlan_gpios[1].gpio), 0); 185fb45105aSDmitry Lifshitz 186fb45105aSDmitry Lifshitz msleep(100); 187fb45105aSDmitry Lifshitz gpio_set_value(cm_t3517_wlan_gpios[1].gpio, 0); 188fb45105aSDmitry Lifshitz } 189fb45105aSDmitry Lifshitz 190fb45105aSDmitry Lifshitz static void __init omap3_sbc_t3517_legacy_init(void) 191fb45105aSDmitry Lifshitz { 192b62d91e5SDmitry Lifshitz omap3_sbc_t3x_usb_hub_init(152, "cm-t3517 usb hub"); 193b62d91e5SDmitry Lifshitz omap3_sbc_t3x_usb_hub_init(98, "sb-t35 usb hub"); 194fb45105aSDmitry Lifshitz am35xx_emac_reset(); 195fb45105aSDmitry Lifshitz hsmmc2_internal_input_clk(); 196fb45105aSDmitry Lifshitz omap3_sbc_t3517_wifi_init(); 197fb45105aSDmitry Lifshitz } 198fb45105aSDmitry Lifshitz 199fb45105aSDmitry Lifshitz static void __init am3517_evm_legacy_init(void) 200fb45105aSDmitry Lifshitz { 201fb45105aSDmitry Lifshitz am35xx_emac_reset(); 202fb45105aSDmitry Lifshitz } 203f83ccb93SLinus Torvalds 204deff82e6SSebastian Reichel static void __init nokia_n900_legacy_init(void) 205deff82e6SSebastian Reichel { 206deff82e6SSebastian Reichel hsmmc2_internal_input_clk(); 20710c1f7d3STony Lindgren mmc_pdata[0].name = "external"; 20810c1f7d3STony Lindgren mmc_pdata[1].name = "internal"; 209deff82e6SSebastian Reichel 2107fb61afbSTony Lindgren if (omap_type() != OMAP2_DEVICE_TYPE_GP) { 211deff82e6SSebastian Reichel if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) { 212deff82e6SSebastian Reichel pr_info("RX-51: Enabling ARM errata 430973 workaround\n"); 213deff82e6SSebastian Reichel /* set IBE to 1 */ 214deff82e6SSebastian Reichel rx51_secure_update_aux_cr(BIT(6), 0); 215deff82e6SSebastian Reichel } else { 2163d0cb73eSJoe Perches pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n"); 2173d0cb73eSJoe Perches pr_warn("Thumb binaries may crash randomly without this workaround\n"); 218deff82e6SSebastian Reichel } 219deff82e6SSebastian Reichel } 220deff82e6SSebastian Reichel } 22163dd5bc0SStefan Roese 22263dd5bc0SStefan Roese static void __init omap3_tao3530_legacy_init(void) 22363dd5bc0SStefan Roese { 22463dd5bc0SStefan Roese hsmmc2_internal_input_clk(); 22515c9887eSJavier Martinez Canillas } 226fc53e2ccSGrazvydas Ignotas 227485fa126SAdam Ford static void __init omap3_logicpd_torpedo_init(void) 228485fa126SAdam Ford { 229485fa126SAdam Ford omap3_gpio126_127_129(); 230485fa126SAdam Ford } 231485fa126SAdam Ford 232f9d50fefSGrazvydas Ignotas /* omap3pandora legacy devices */ 233f9d50fefSGrazvydas Ignotas 234fc53e2ccSGrazvydas Ignotas static struct platform_device pandora_backlight = { 235fc53e2ccSGrazvydas Ignotas .name = "pandora-backlight", 236fc53e2ccSGrazvydas Ignotas .id = -1, 237fc53e2ccSGrazvydas Ignotas }; 238fc53e2ccSGrazvydas Ignotas 239fc53e2ccSGrazvydas Ignotas static void __init omap3_pandora_legacy_init(void) 240fc53e2ccSGrazvydas Ignotas { 241fc53e2ccSGrazvydas Ignotas platform_device_register(&pandora_backlight); 242fc53e2ccSGrazvydas Ignotas } 243faf4bd47SAaro Koskinen #endif /* CONFIG_ARCH_OMAP3 */ 244faf4bd47SAaro Koskinen 245fc66ce0bSSekhar Nori #ifdef CONFIG_SOC_DRA7XX 2464601832fSSuman Anna static struct iommu_platform_data dra7_ipu1_dsp_iommu_pdata = { 2474601832fSSuman Anna .set_pwrdm_constraint = omap_iommu_set_pwrdm_constraint, 2484601832fSSuman Anna }; 249fc66ce0bSSekhar Nori #endif 250fc66ce0bSSekhar Nori 2512b2f7defSTony Lindgren static struct clockdomain *ti_sysc_find_one_clockdomain(struct clk *clk) 2522b2f7defSTony Lindgren { 25390bdfa0bSTony Lindgren struct clk_hw *hw = __clk_get_hw(clk); 2542b2f7defSTony Lindgren struct clockdomain *clkdm = NULL; 2552b2f7defSTony Lindgren struct clk_hw_omap *hwclk; 2562b2f7defSTony Lindgren 25790bdfa0bSTony Lindgren hwclk = to_clk_hw_omap(hw); 25890bdfa0bSTony Lindgren if (!omap2_clk_is_hw_omap(hw)) 25990bdfa0bSTony Lindgren return NULL; 26090bdfa0bSTony Lindgren 2612b2f7defSTony Lindgren if (hwclk && hwclk->clkdm_name) 2622b2f7defSTony Lindgren clkdm = clkdm_lookup(hwclk->clkdm_name); 2632b2f7defSTony Lindgren 2642b2f7defSTony Lindgren return clkdm; 2652b2f7defSTony Lindgren } 2662b2f7defSTony Lindgren 2672b2f7defSTony Lindgren /** 2682b2f7defSTony Lindgren * ti_sysc_clkdm_init - find clockdomain based on clock 2692b2f7defSTony Lindgren * @fck: device functional clock 2702b2f7defSTony Lindgren * @ick: device interface clock 2712b2f7defSTony Lindgren * @dev: struct device 2722b2f7defSTony Lindgren * 2732b2f7defSTony Lindgren * Populate clockdomain based on clock. It is needed for 2742b2f7defSTony Lindgren * clkdm_deny_idle() and clkdm_allow_idle() for blocking clockdomain 2752b2f7defSTony Lindgren * clockdomain idle during reset, enable and idle. 2762b2f7defSTony Lindgren * 2772b2f7defSTony Lindgren * Note that we assume interconnect driver manages the clocks 2782b2f7defSTony Lindgren * and do not need to populate oh->_clk for dynamically 2792b2f7defSTony Lindgren * allocated modules. 2802b2f7defSTony Lindgren */ 2812b2f7defSTony Lindgren static int ti_sysc_clkdm_init(struct device *dev, 2822b2f7defSTony Lindgren struct clk *fck, struct clk *ick, 2832b2f7defSTony Lindgren struct ti_sysc_cookie *cookie) 2842b2f7defSTony Lindgren { 2852783d063STony Lindgren if (!IS_ERR(fck)) 2862b2f7defSTony Lindgren cookie->clkdm = ti_sysc_find_one_clockdomain(fck); 2872b2f7defSTony Lindgren if (cookie->clkdm) 2882b2f7defSTony Lindgren return 0; 2892783d063STony Lindgren if (!IS_ERR(ick)) 2902b2f7defSTony Lindgren cookie->clkdm = ti_sysc_find_one_clockdomain(ick); 2912b2f7defSTony Lindgren if (cookie->clkdm) 2922b2f7defSTony Lindgren return 0; 2932b2f7defSTony Lindgren 2942b2f7defSTony Lindgren return -ENODEV; 2952b2f7defSTony Lindgren } 2962b2f7defSTony Lindgren 2972b2f7defSTony Lindgren static void ti_sysc_clkdm_deny_idle(struct device *dev, 2982b2f7defSTony Lindgren const struct ti_sysc_cookie *cookie) 2992b2f7defSTony Lindgren { 3002b2f7defSTony Lindgren if (cookie->clkdm) 3012b2f7defSTony Lindgren clkdm_deny_idle(cookie->clkdm); 3022b2f7defSTony Lindgren } 3032b2f7defSTony Lindgren 3042b2f7defSTony Lindgren static void ti_sysc_clkdm_allow_idle(struct device *dev, 3052b2f7defSTony Lindgren const struct ti_sysc_cookie *cookie) 3062b2f7defSTony Lindgren { 3072b2f7defSTony Lindgren if (cookie->clkdm) 3082b2f7defSTony Lindgren clkdm_allow_idle(cookie->clkdm); 3092b2f7defSTony Lindgren } 3102b2f7defSTony Lindgren 311133ad7abSTony Lindgren #ifdef CONFIG_OMAP_HWMOD 312ef70b0bdSTony Lindgren static int ti_sysc_enable_module(struct device *dev, 313ef70b0bdSTony Lindgren const struct ti_sysc_cookie *cookie) 314ef70b0bdSTony Lindgren { 315ef70b0bdSTony Lindgren if (!cookie->data) 316ef70b0bdSTony Lindgren return -EINVAL; 317ef70b0bdSTony Lindgren 318ef70b0bdSTony Lindgren return omap_hwmod_enable(cookie->data); 319ef70b0bdSTony Lindgren } 320ef70b0bdSTony Lindgren 321ef70b0bdSTony Lindgren static int ti_sysc_idle_module(struct device *dev, 322ef70b0bdSTony Lindgren const struct ti_sysc_cookie *cookie) 323ef70b0bdSTony Lindgren { 324ef70b0bdSTony Lindgren if (!cookie->data) 325ef70b0bdSTony Lindgren return -EINVAL; 326ef70b0bdSTony Lindgren 327ef70b0bdSTony Lindgren return omap_hwmod_idle(cookie->data); 328ef70b0bdSTony Lindgren } 329ef70b0bdSTony Lindgren 330ef70b0bdSTony Lindgren static int ti_sysc_shutdown_module(struct device *dev, 331ef70b0bdSTony Lindgren const struct ti_sysc_cookie *cookie) 332ef70b0bdSTony Lindgren { 333ef70b0bdSTony Lindgren if (!cookie->data) 334ef70b0bdSTony Lindgren return -EINVAL; 335ef70b0bdSTony Lindgren 336ef70b0bdSTony Lindgren return omap_hwmod_shutdown(cookie->data); 337ef70b0bdSTony Lindgren } 338133ad7abSTony Lindgren #endif /* CONFIG_OMAP_HWMOD */ 339ef70b0bdSTony Lindgren 340feaa8baeSTony Lindgren static bool ti_sysc_soc_type_gp(void) 341feaa8baeSTony Lindgren { 342feaa8baeSTony Lindgren return omap_type() == OMAP2_DEVICE_TYPE_GP; 343feaa8baeSTony Lindgren } 344feaa8baeSTony Lindgren 345ef70b0bdSTony Lindgren static struct of_dev_auxdata omap_auxdata_lookup[]; 346ef70b0bdSTony Lindgren 347ef70b0bdSTony Lindgren static struct ti_sysc_platform_data ti_sysc_pdata = { 348ef70b0bdSTony Lindgren .auxdata = omap_auxdata_lookup, 349feaa8baeSTony Lindgren .soc_type_gp = ti_sysc_soc_type_gp, 3502b2f7defSTony Lindgren .init_clockdomain = ti_sysc_clkdm_init, 3512b2f7defSTony Lindgren .clkdm_deny_idle = ti_sysc_clkdm_deny_idle, 3522b2f7defSTony Lindgren .clkdm_allow_idle = ti_sysc_clkdm_allow_idle, 353133ad7abSTony Lindgren #ifdef CONFIG_OMAP_HWMOD 354695eea3dSTony Lindgren .init_module = omap_hwmod_init_module, 355ef70b0bdSTony Lindgren .enable_module = ti_sysc_enable_module, 356ef70b0bdSTony Lindgren .idle_module = ti_sysc_idle_module, 357ef70b0bdSTony Lindgren .shutdown_module = ti_sysc_shutdown_module, 358133ad7abSTony Lindgren #endif 359ef70b0bdSTony Lindgren }; 360ef70b0bdSTony Lindgren 36130a69ef7STony Lindgren static struct pcs_pdata pcs_pdata; 36230a69ef7STony Lindgren 36330a69ef7STony Lindgren void omap_pcs_legacy_init(int irq, void (*rearm)(void)) 36430a69ef7STony Lindgren { 36530a69ef7STony Lindgren pcs_pdata.irq = irq; 36630a69ef7STony Lindgren pcs_pdata.rearm = rearm; 36730a69ef7STony Lindgren } 36830a69ef7STony Lindgren 3698de44fb7STero Kristo static struct ti_prm_platform_data ti_prm_pdata = { 3708de44fb7STero Kristo .clkdm_deny_idle = clkdm_deny_idle, 3718de44fb7STero Kristo .clkdm_allow_idle = clkdm_allow_idle, 3728de44fb7STero Kristo .clkdm_lookup = clkdm_lookup, 3738de44fb7STero Kristo }; 3748de44fb7STero Kristo 375f21af425STony Lindgren #if defined(CONFIG_ARCH_OMAP3) && IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP) 376c26c84c9SPeter Ujfalusi static struct omap_mcbsp_platform_data mcbsp_pdata; 377c26c84c9SPeter Ujfalusi static void __init omap3_mcbsp_init(void) 378c26c84c9SPeter Ujfalusi { 379c26c84c9SPeter Ujfalusi omap3_mcbsp_init_pdata_callback(&mcbsp_pdata); 380c26c84c9SPeter Ujfalusi } 381c26c84c9SPeter Ujfalusi #else 382c26c84c9SPeter Ujfalusi static void __init omap3_mcbsp_init(void) {} 383c26c84c9SPeter Ujfalusi #endif 384c26c84c9SPeter Ujfalusi 385dad12d11STony Lindgren /* 386036582f7STony Lindgren * Few boards still need auxdata populated before we populate 387036582f7STony Lindgren * the dev entries in of_platform_populate(). 388036582f7STony Lindgren */ 389036582f7STony Lindgren static struct pdata_init auxdata_quirks[] __initdata = { 390fa590c92STony Lindgren #ifdef CONFIG_SOC_OMAP2420 391fa590c92STony Lindgren { "nokia,n800", omap2420_n8x0_legacy_init, }, 392fa590c92STony Lindgren { "nokia,n810", omap2420_n8x0_legacy_init, }, 393fa590c92STony Lindgren { "nokia,n810-wimax", omap2420_n8x0_legacy_init, }, 394fa590c92STony Lindgren #endif 395036582f7STony Lindgren { /* sentinel */ }, 396036582f7STony Lindgren }; 397036582f7STony Lindgren 398d060b405STony Lindgren struct omap_sr_data __maybe_unused omap_sr_pdata[OMAP_SR_NR]; 399d060b405STony Lindgren 400ef70b0bdSTony Lindgren static struct of_dev_auxdata omap_auxdata_lookup[] = { 401036582f7STony Lindgren #ifdef CONFIG_MACH_NOKIA_N8X0 402036582f7STony Lindgren OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL), 403e92ce89cSFelipe Balbi OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data), 404036582f7STony Lindgren #endif 40530a69ef7STony Lindgren #ifdef CONFIG_ARCH_OMAP3 406910f1678SSuman Anna OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu", 407910f1678SSuman Anna &omap3_iommu_pdata), 4080af3e1a4SSuman Anna OF_DEV_AUXDATA("ti,omap2-iommu", 0x480bd400, "480bd400.mmu", 4090af3e1a4SSuman Anna &omap3_iommu_isp_pdata), 410d060b405STony Lindgren OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000, 411d060b405STony Lindgren "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]), 412d060b405STony Lindgren OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000, 413d060b405STony Lindgren "480c9000.smartreflex", &omap_sr_pdata[OMAP_SR_MPU]), 41410c1f7d3STony Lindgren OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]), 41510c1f7d3STony Lindgren OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x480b4000, "480b4000.mmc", &mmc_pdata[1]), 41671900314STony Lindgren /* Only on am3517 */ 41771900314STony Lindgren OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL), 41871900314STony Lindgren OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0", 41971900314STony Lindgren &am35xx_emac_pdata), 4200c0ef9eaSTony Lindgren OF_DEV_AUXDATA("nokia,n900-rom-rng", 0, NULL, rx51_secure_rng_call), 421c26c84c9SPeter Ujfalusi /* McBSP modules with sidetone core */ 422558eb0bfSPeter Ujfalusi #if IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP) 423c26c84c9SPeter Ujfalusi OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49022000, "49022000.mcbsp", &mcbsp_pdata), 424c26c84c9SPeter Ujfalusi OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49024000, "49024000.mcbsp", &mcbsp_pdata), 425c26c84c9SPeter Ujfalusi #endif 42630a69ef7STony Lindgren #endif 42767eb1e6eSSuman Anna #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) 428d060b405STony Lindgren OF_DEV_AUXDATA("ti,omap4-smartreflex-iva", 0x4a0db000, 429d060b405STony Lindgren "4a0db000.smartreflex", &omap_sr_pdata[OMAP_SR_IVA]), 430d060b405STony Lindgren OF_DEV_AUXDATA("ti,omap4-smartreflex-core", 0x4a0dd000, 431d060b405STony Lindgren "4a0dd000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]), 432d060b405STony Lindgren OF_DEV_AUXDATA("ti,omap4-smartreflex-mpu", 0x4a0d9000, 433d060b405STony Lindgren "4a0d9000.smartreflex", &omap_sr_pdata[OMAP_SR_MPU]), 43430a69ef7STony Lindgren #endif 435fc66ce0bSSekhar Nori #ifdef CONFIG_SOC_DRA7XX 4364601832fSSuman Anna OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x40d01000, "40d01000.mmu", 4374601832fSSuman Anna &dra7_ipu1_dsp_iommu_pdata), 4384601832fSSuman Anna OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x41501000, "41501000.mmu", 4394601832fSSuman Anna &dra7_ipu1_dsp_iommu_pdata), 4404601832fSSuman Anna OF_DEV_AUXDATA("ti,dra7-iommu", 0x58882000, "58882000.mmu", 4414601832fSSuman Anna &dra7_ipu1_dsp_iommu_pdata), 442fc66ce0bSSekhar Nori #endif 443d4f414e5STony Lindgren /* Common auxdata */ 444eda080eaSTony Lindgren OF_DEV_AUXDATA("simple-pm-bus", 0, NULL, omap_auxdata_lookup), 445ef70b0bdSTony Lindgren OF_DEV_AUXDATA("ti,sysc", 0, NULL, &ti_sysc_pdata), 446d4f414e5STony Lindgren OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata), 4478de44fb7STero Kristo OF_DEV_AUXDATA("ti,omap-prm-inst", 0, NULL, &ti_prm_pdata), 448211010aeSTony Lindgren OF_DEV_AUXDATA("ti,omap-sdma", 0, NULL, &dma_plat_info), 4498651bd8cSTony Lindgren { /* sentinel */ }, 4508651bd8cSTony Lindgren }; 4518651bd8cSTony Lindgren 452036582f7STony Lindgren /* 453036582f7STony Lindgren * Few boards still need to initialize some legacy devices with 454036582f7STony Lindgren * platform data until the drivers support device tree. 455036582f7STony Lindgren */ 4566a08e1e6STony Lindgren static struct pdata_init pdata_quirks[] __initdata = { 457faf4bd47SAaro Koskinen #ifdef CONFIG_ARCH_OMAP3 458fb45105aSDmitry Lifshitz { "compulab,omap3-sbc-t3517", omap3_sbc_t3517_legacy_init, }, 45940ecc02eSDmitry Lifshitz { "compulab,omap3-sbc-t3530", omap3_sbc_t3530_legacy_init, }, 4600f0cfc69STony Lindgren { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, }, 461deff82e6SSebastian Reichel { "nokia,omap3-n900", nokia_n900_legacy_init, }, 462faf4bd47SAaro Koskinen { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, 463faf4bd47SAaro Koskinen { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, 464485fa126SAdam Ford { "logicpd,dm3730-torpedo-devkit", omap3_logicpd_torpedo_init, }, 46579b39f79STony Lindgren { "ti,omap3-evm-37xx", omap3_evm_legacy_init, }, 46671900314STony Lindgren { "ti,am3517-evm", am3517_evm_legacy_init, }, 46763dd5bc0SStefan Roese { "technexion,omap3-tao3530", omap3_tao3530_legacy_init, }, 468fc53e2ccSGrazvydas Ignotas { "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, }, 469fc53e2ccSGrazvydas Ignotas { "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, }, 470faf4bd47SAaro Koskinen #endif 4716a08e1e6STony Lindgren { /* sentinel */ }, 4726a08e1e6STony Lindgren }; 4736a08e1e6STony Lindgren 474036582f7STony Lindgren static void pdata_quirks_check(struct pdata_init *quirks) 4756a08e1e6STony Lindgren { 4766a08e1e6STony Lindgren while (quirks->compatible) { 4776a08e1e6STony Lindgren if (of_machine_is_compatible(quirks->compatible)) { 4786a08e1e6STony Lindgren if (quirks->fn) 4796a08e1e6STony Lindgren quirks->fn(); 4806a08e1e6STony Lindgren } 4816a08e1e6STony Lindgren quirks++; 4826a08e1e6STony Lindgren } 4836a08e1e6STony Lindgren } 484036582f7STony Lindgren 485a15de032STony Lindgren static const char * const pdata_quirks_init_nodes[] = { 486a15de032STony Lindgren "prcm", 487a15de032STony Lindgren "prm", 488a15de032STony Lindgren }; 489a15de032STony Lindgren 490aa4e1331SWei Yongjun static void __init 491a15de032STony Lindgren pdata_quirks_init_clocks(const struct of_device_id *omap_dt_match_table) 492036582f7STony Lindgren { 493ae5f70f7STony Lindgren struct device_node *np; 494a15de032STony Lindgren int i; 495ae5f70f7STony Lindgren 496a15de032STony Lindgren for (i = 0; i < ARRAY_SIZE(pdata_quirks_init_nodes); i++) { 497a15de032STony Lindgren np = of_find_node_by_name(NULL, pdata_quirks_init_nodes[i]); 498a15de032STony Lindgren if (!np) 499a15de032STony Lindgren continue; 500a15de032STony Lindgren 501a15de032STony Lindgren of_platform_populate(np, omap_dt_match_table, 502a15de032STony Lindgren omap_auxdata_lookup, NULL); 5035cdbab96SLiang He 5045cdbab96SLiang He of_node_put(np); 505a15de032STony Lindgren } 506a15de032STony Lindgren } 507a15de032STony Lindgren 508a15de032STony Lindgren void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table) 509a15de032STony Lindgren { 51057df5380STony Lindgren /* 51157df5380STony Lindgren * We still need this for omap2420 and omap3 PM to work, others are 51257df5380STony Lindgren * using drivers/misc/sram.c already. 51357df5380STony Lindgren */ 51457df5380STony Lindgren if (of_machine_is_compatible("ti,omap2420") || 51557df5380STony Lindgren of_machine_is_compatible("ti,omap3")) 516036582f7STony Lindgren omap_sdrc_init(NULL, NULL); 51757df5380STony Lindgren 518c26c84c9SPeter Ujfalusi if (of_machine_is_compatible("ti,omap3")) 519c26c84c9SPeter Ujfalusi omap3_mcbsp_init(); 520036582f7STony Lindgren pdata_quirks_check(auxdata_quirks); 521ae5f70f7STony Lindgren 522a15de032STony Lindgren pdata_quirks_init_clocks(omap_dt_match_table); 523ae5f70f7STony Lindgren 524036582f7STony Lindgren of_platform_populate(NULL, omap_dt_match_table, 525036582f7STony Lindgren omap_auxdata_lookup, NULL); 526036582f7STony Lindgren pdata_quirks_check(pdata_quirks); 527036582f7STony Lindgren } 528