From patchwork Thu Apr 9 07:26:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 237491 List-Id: U-Boot discussion From: michal.simek at xilinx.com (Michal Simek) Date: Thu, 9 Apr 2020 09:26:36 +0200 Subject: [PATCH V2] mmc: zynq: parse dt when probing In-Reply-To: References: <1804427281.34936.1586257949059@amu316.rsint.net> <20200407141532.20731-1-Benedikt.Grassl@rohde-schwarz.com> Message-ID: <4cc2f74f-2448-e141-b0dc-a300ba2e45eb@xilinx.com> On 09. 04. 20 0:11, Jaehoon Chung wrote: > On 4/7/20 11:15 PM, Benedikt Grassl wrote: >> Currently, the entry "bus-width = <8>" in the ZynqMP's sdhci nodes >> is not evaluated. This results in the bus width staying at its default >> value (4 bit in HS200 mode). >> Fix this by calling mmc_of_parse. This function also checks for the >> "no-1-8-v" and "max-frequency" entries. Remove the handling of those >> nodes from this driver. >> >> Signed-off-by: Benedikt Grassl >> --- >> drivers/mmc/sdhci.c | 3 +-- >> drivers/mmc/zynq_sdhci.c | 15 ++++++--------- >> include/sdhci.h | 1 - >> 3 files changed, 7 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c >> index 520c9f9feb..372dc0a820 100644 >> --- a/drivers/mmc/sdhci.c >> +++ b/drivers/mmc/sdhci.c >> @@ -839,8 +839,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host, >> cfg->host_caps &= ~MMC_MODE_HS_52MHz; >> } >> >> - if (!(cfg->voltages & MMC_VDD_165_195) || >> - (host->quirks & SDHCI_QUIRK_NO_1_8_V)) >> + if (!(cfg->voltages & MMC_VDD_165_195)) >> caps_1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 | >> SDHCI_SUPPORT_DDR50); >> >> diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c >> index da3ff53da1..cfa61af265 100644 >> --- a/drivers/mmc/zynq_sdhci.c >> +++ b/drivers/mmc/zynq_sdhci.c >> @@ -22,14 +22,12 @@ DECLARE_GLOBAL_DATA_PTR; >> struct arasan_sdhci_plat { >> struct mmc_config cfg; >> struct mmc mmc; >> - unsigned int f_max; >> }; >> >> struct arasan_sdhci_priv { >> struct sdhci_host *host; >> u8 deviceid; >> u8 bank; >> - u8 no_1p8; >> }; >> >> #if defined(CONFIG_ARCH_ZYNQMP) >> @@ -238,8 +236,9 @@ static int arasan_sdhci_probe(struct udevice *dev) >> host->quirks |= SDHCI_QUIRK_BROKEN_HISPD_MODE; >> #endif >> >> - if (priv->no_1p8) >> - host->quirks |= SDHCI_QUIRK_NO_1_8_V; >> + ret = mmc_of_parse(dev, &plat->cfg); >> + if (ret) >> + return ret; >> >> host->max_clk = clock; >> >> @@ -247,10 +246,12 @@ static int arasan_sdhci_probe(struct udevice *dev) >> host->mmc->dev = dev; >> host->mmc->priv = host; >> >> - ret = sdhci_setup_cfg(&plat->cfg, host, plat->f_max, >> + ret = sdhci_setup_cfg(&plat->cfg, host, >> + CONFIG_ZYNQ_SDHCI_MAX_FREQ, >> CONFIG_ZYNQ_SDHCI_MIN_FREQ); > > you have removed the parsing "max-frequency" from below code, because it's parsed from mmc_of_parse(). > But It's passing to CONFIG_ZYNQ_SDHCI_MAX_FREQ again. Is it correct? > Could you check one more? You are right. I have checked it myself. This should be the right flow. Interesting is that I have checked jz_mmc.c where f_max is rewritten after mmc_of_parse. Thanks, Michal diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index f856f46ba6a2..5ce627bee985 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -386,6 +386,8 @@ static int arasan_sdhci_probe(struct udevice *dev) host->quirks |= SDHCI_QUIRK_BROKEN_HISPD_MODE; #endif + plat->cfg.f_max = CONFIG_ZYNQ_SDHCI_MAX_FREQ; + ret = mmc_of_parse(dev, &plat->cfg); if (ret) return ret; @@ -396,8 +398,7 @@ static int arasan_sdhci_probe(struct udevice *dev) host->mmc->dev = dev; host->mmc->priv = host; - ret = sdhci_setup_cfg(&plat->cfg, host, - CONFIG_ZYNQ_SDHCI_MAX_FREQ, + ret = sdhci_setup_cfg(&plat->cfg, host, plat->cfg.f_max, CONFIG_ZYNQ_SDHCI_MIN_FREQ); if (ret) return ret;