Commit 15424880 authored by Marcin Wojtas's avatar Marcin Wojtas Committed by Ulf Hansson
Browse files

mmc: sdhci-xenon: use clk only with DT



As a preparation for supporting ACPI, modify the driver
to use the clk framework only when booting with DT -
otherwise rely on the configuration done by firmware.
For that purpose introduce also a custom SDHCI get_max_clock
callback.

Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
Link: https://lore.kernel.org/r/20201204171626.10935-4-mw@semihalf.com


Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent f29bf660
Loading
Loading
Loading
Loading
+32 −19
Original line number Diff line number Diff line
@@ -247,6 +247,16 @@ static void xenon_voltage_switch(struct sdhci_host *host)
	sdhci_readw(host, SDHCI_HOST_CONTROL2);
}

static unsigned int xenon_get_max_clock(struct sdhci_host *host)
{
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);

	if (pltfm_host->clk)
		return sdhci_pltfm_clk_get_max_clock(host);
	else
		return pltfm_host->clock;
}

static const struct sdhci_ops sdhci_xenon_ops = {
	.voltage_switch		= xenon_voltage_switch,
	.set_clock		= sdhci_set_clock,
@@ -254,7 +264,7 @@ static const struct sdhci_ops sdhci_xenon_ops = {
	.set_bus_width		= sdhci_set_bus_width,
	.reset			= xenon_reset,
	.set_uhs_signaling	= xenon_set_uhs_signaling,
	.get_max_clock		= sdhci_pltfm_clk_get_max_clock,
	.get_max_clock		= xenon_get_max_clock,
};

static const struct sdhci_pltfm_data sdhci_xenon_pdata = {
@@ -483,6 +493,7 @@ static void xenon_sdhc_unprepare(struct sdhci_host *host)
static int xenon_probe(struct platform_device *pdev)
{
	struct sdhci_pltfm_host *pltfm_host;
	struct device *dev = &pdev->dev;
	struct sdhci_host *host;
	struct xenon_priv *priv;
	int err;
@@ -503,6 +514,7 @@ static int xenon_probe(struct platform_device *pdev)
	 */
	xenon_replace_mmc_host_ops(host);

	if (dev->of_node) {
		pltfm_host->clk = devm_clk_get(&pdev->dev, "core");
		if (IS_ERR(pltfm_host->clk)) {
			err = PTR_ERR(pltfm_host->clk);
@@ -523,6 +535,7 @@ static int xenon_probe(struct platform_device *pdev)
			if (err)
				goto err_clk;
		}
	}

	err = mmc_of_parse(host->mmc);
	if (err)