Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mmc-v6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC host fixes from Ulf Hansson:

- sdhci_am654: Fix MMC init failures on am62x boards

- sdhci-of-dwcmshc: Add PD workaround on RK3576 to avoid hang

* tag 'mmc-v6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
mmc: sdhci_am654: Add SDHCI_QUIRK2_SUPPRESS_V1P8_ENA quirk to am62 compatible
mmc: sdhci-of-dwcmshc: add PD workaround on RK3576

+74 -1
+40
drivers/mmc/host/sdhci-of-dwcmshc.c
··· 17 17 #include <linux/module.h> 18 18 #include <linux/of.h> 19 19 #include <linux/platform_device.h> 20 + #include <linux/pm_domain.h> 20 21 #include <linux/pm_runtime.h> 21 22 #include <linux/reset.h> 22 23 #include <linux/sizes.h> ··· 746 745 } 747 746 } 748 747 748 + static void dwcmshc_rk3576_postinit(struct sdhci_host *host, struct dwcmshc_priv *dwc_priv) 749 + { 750 + struct device *dev = mmc_dev(host->mmc); 751 + int ret; 752 + 753 + /* 754 + * This works around the design of the RK3576's power domains, which 755 + * makes the PD_NVM power domain, which the sdhci controller on the 756 + * RK3576 is in, never come back the same way once it's run-time 757 + * suspended once. This can happen during early kernel boot if no driver 758 + * is using either PD_NVM or its child power domain PD_SDGMAC for a 759 + * short moment, leading to it being turned off to save power. By 760 + * keeping it on, sdhci suspending won't lead to PD_NVM becoming a 761 + * candidate for getting turned off. 762 + */ 763 + ret = dev_pm_genpd_rpm_always_on(dev, true); 764 + if (ret && ret != -EOPNOTSUPP) 765 + dev_warn(dev, "failed to set PD rpm always on, SoC may hang later: %pe\n", 766 + ERR_PTR(ret)); 767 + 768 + dwcmshc_rk35xx_postinit(host, dwc_priv); 769 + } 770 + 749 771 static int th1520_execute_tuning(struct sdhci_host *host, u32 opcode) 750 772 { 751 773 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); ··· 1200 1176 .postinit = dwcmshc_rk35xx_postinit, 1201 1177 }; 1202 1178 1179 + static const struct dwcmshc_pltfm_data sdhci_dwcmshc_rk3576_pdata = { 1180 + .pdata = { 1181 + .ops = &sdhci_dwcmshc_rk35xx_ops, 1182 + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN | 1183 + SDHCI_QUIRK_BROKEN_TIMEOUT_VAL, 1184 + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | 1185 + SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN, 1186 + }, 1187 + .init = dwcmshc_rk35xx_init, 1188 + .postinit = dwcmshc_rk3576_postinit, 1189 + }; 1190 + 1203 1191 static const struct dwcmshc_pltfm_data sdhci_dwcmshc_th1520_pdata = { 1204 1192 .pdata = { 1205 1193 .ops = &sdhci_dwcmshc_th1520_ops, ··· 1309 1273 { 1310 1274 .compatible = "rockchip,rk3588-dwcmshc", 1311 1275 .data = &sdhci_dwcmshc_rk35xx_pdata, 1276 + }, 1277 + { 1278 + .compatible = "rockchip,rk3576-dwcmshc", 1279 + .data = &sdhci_dwcmshc_rk3576_pdata, 1312 1280 }, 1313 1281 { 1314 1282 .compatible = "rockchip,rk3568-dwcmshc",
+34 -1
drivers/mmc/host/sdhci_am654.c
··· 155 155 u32 tuning_loop; 156 156 157 157 #define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0) 158 + #define SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA BIT(1) 158 159 }; 159 160 160 161 struct window { ··· 167 166 struct sdhci_am654_driver_data { 168 167 const struct sdhci_pltfm_data *pdata; 169 168 u32 flags; 169 + u32 quirks; 170 170 #define IOMUX_PRESENT (1 << 0) 171 171 #define FREQSEL_2_BIT (1 << 1) 172 172 #define STRBSEL_4_BIT (1 << 2) ··· 356 354 sdhci_am654->clkbuf_sel); 357 355 358 356 sdhci_set_clock(host, clock); 357 + } 358 + 359 + static int sdhci_am654_start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios) 360 + { 361 + struct sdhci_host *host = mmc_priv(mmc); 362 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 363 + struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host); 364 + int ret; 365 + 366 + if ((sdhci_am654->quirks & SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA) && 367 + ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) { 368 + if (!IS_ERR(mmc->supply.vqmmc)) { 369 + ret = mmc_regulator_set_vqmmc(mmc, ios); 370 + if (ret < 0) { 371 + pr_err("%s: Switching to 1.8V signalling voltage failed,\n", 372 + mmc_hostname(mmc)); 373 + return -EIO; 374 + } 375 + } 376 + return 0; 377 + } 378 + 379 + return sdhci_start_signal_voltage_switch(mmc, ios); 359 380 } 360 381 361 382 static u8 sdhci_am654_write_power_on(struct sdhci_host *host, u8 val, int reg) ··· 675 650 .flags = IOMUX_PRESENT, 676 651 }; 677 652 653 + static const struct sdhci_am654_driver_data sdhci_am62_4bit_drvdata = { 654 + .pdata = &sdhci_j721e_4bit_pdata, 655 + .flags = IOMUX_PRESENT, 656 + .quirks = SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA, 657 + }; 658 + 678 659 static const struct soc_device_attribute sdhci_am654_devices[] = { 679 660 { .family = "AM65X", 680 661 .revision = "SR1.0", ··· 903 872 }, 904 873 { 905 874 .compatible = "ti,am62-sdhci", 906 - .data = &sdhci_j721e_4bit_drvdata, 875 + .data = &sdhci_am62_4bit_drvdata, 907 876 }, 908 877 { /* sentinel */ } 909 878 }; ··· 937 906 pltfm_host = sdhci_priv(host); 938 907 sdhci_am654 = sdhci_pltfm_priv(pltfm_host); 939 908 sdhci_am654->flags = drvdata->flags; 909 + sdhci_am654->quirks = drvdata->quirks; 940 910 941 911 clk_xin = devm_clk_get(dev, "clk_xin"); 942 912 if (IS_ERR(clk_xin)) { ··· 972 940 goto err_pltfm_free; 973 941 } 974 942 943 + host->mmc_host_ops.start_signal_voltage_switch = sdhci_am654_start_signal_voltage_switch; 975 944 host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning; 976 945 977 946 pm_runtime_get_noresume(dev);