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

mmc: sdhci-of-arasan: Use clock-frequency property to update clk_xin

If clock-frequency property is set and it is not the same as the current
clock rate of clk_xin(base clock frequency), set clk_xin to use the
provided clock rate.

Signed-off-by: Rashmi A <rashmi.a@intel.com>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
Link: https://lore.kernel.org/r/20210603182242.25733-2-rashmi.a@intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Rashmi A and committed by
Ulf Hansson
b2af3227 77347eda

+12 -2
+12 -2
drivers/mmc/host/sdhci-of-arasan.c
··· 1542 1542 } 1543 1543 } 1544 1544 1545 + sdhci_get_of_property(pdev); 1546 + 1545 1547 sdhci_arasan->clk_ahb = devm_clk_get(dev, "clk_ahb"); 1546 1548 if (IS_ERR(sdhci_arasan->clk_ahb)) { 1547 1549 ret = dev_err_probe(dev, PTR_ERR(sdhci_arasan->clk_ahb), ··· 1563 1561 goto err_pltfm_free; 1564 1562 } 1565 1563 1564 + /* If clock-frequency property is set, use the provided value */ 1565 + if (pltfm_host->clock && 1566 + pltfm_host->clock != clk_get_rate(clk_xin)) { 1567 + ret = clk_set_rate(clk_xin, pltfm_host->clock); 1568 + if (ret) { 1569 + dev_err(&pdev->dev, "Failed to set SD clock rate\n"); 1570 + goto clk_dis_ahb; 1571 + } 1572 + } 1573 + 1566 1574 ret = clk_prepare_enable(clk_xin); 1567 1575 if (ret) { 1568 1576 dev_err(dev, "Unable to enable SD clock.\n"); 1569 1577 goto clk_dis_ahb; 1570 1578 } 1571 - 1572 - sdhci_get_of_property(pdev); 1573 1579 1574 1580 if (of_property_read_bool(np, "xlnx,fails-without-test-cd")) 1575 1581 sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_FORCE_CDTEST;