[U-Boot,1/4] mmc: fsl_esdhc: get clock directly from global data
diff mbox series

Message ID 20191112112839.10960-2-yangbo.lu@nxp.com
State Accepted
Commit 5e81cbff375c909637323167b1704596f9088c6a
Delegated to: Peng Fan
Headers show
Series
  • Drop redundant code for eSDHC clock getting
Related show

Commit Message

Yangbo Lu Nov. 12, 2019, 11:28 a.m. UTC
This patch is to get clock directly from global data.

- Remove uclass clk api method. This was what i.MX platforms were
  using, while QorIQ platforms weren't.
- Get clock only from global data, dropping mxc_get_clock().
  QorIQ eSDHC controllers on one silicon use same reference clock.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/mmc/fsl_esdhc.c | 34 ++++------------------------------
 1 file changed, 4 insertions(+), 30 deletions(-)

Comments

Priyanka Jain Nov. 19, 2019, 6:05 a.m. UTC | #1
>-----Original Message-----
>From: Yangbo Lu <yangbo.lu@nxp.com>
>Sent: Tuesday, November 12, 2019 4:59 PM
>To: u-boot@lists.denx.de
>Cc: Peng Fan <peng.fan@nxp.com>; Feng Li <feng.li_2@nxp.com>; Alison Wang
><alison.wang@nxp.com>; Sumit Garg <sumit.garg@nxp.com>; Priyanka Jain
><priyanka.jain@nxp.com>; Mario Six <mario.six@gdsys.cc>; Y.b. Lu
><yangbo.lu@nxp.com>
>Subject: [PATCH 1/4] mmc: fsl_esdhc: get clock directly from global data
>
>This patch is to get clock directly from global data.
>
>- Remove uclass clk api method. This was what i.MX platforms were
>  using, while QorIQ platforms weren't.
>- Get clock only from global data, dropping mxc_get_clock().
>  QorIQ eSDHC controllers on one silicon use same reference clock.
>
>Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
>---
> drivers/mmc/fsl_esdhc.c | 34 ++++------------------------------
> 1 file changed, 4 insertions(+), 30 deletions(-)
>
>diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index
>8ff84aa..09cb773 100644
>--- a/drivers/mmc/fsl_esdhc.c
>+++ b/drivers/mmc/fsl_esdhc.c
>@@ -12,7 +12,6 @@
> #include <config.h>
> #include <common.h>
> #include <command.h>
>-#include <clk.h>
> #include <errno.h>
> #include <hwconfig.h>
> #include <mmc.h>
>@@ -81,7 +80,6 @@ struct fsl_esdhc_plat {  struct fsl_esdhc_priv {
> 	struct fsl_esdhc *esdhc_regs;
> 	unsigned int sdhc_clk;
>-	struct clk per_clk;
> 	unsigned int clock;
> #if !CONFIG_IS_ENABLED(DM_MMC)
> 	struct mmc *mmc;
>@@ -831,9 +829,6 @@ int fsl_esdhc_mmc_init(bd_t *bis)
> 	return fsl_esdhc_initialize(bis, cfg);  }  #else /* DM_MMC */ -#ifndef
>CONFIG_PPC -#include <asm/arch/clock.h> -#endif  static int
>fsl_esdhc_probe(struct udevice *dev)  {
> 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); @@ -841,7
>+836,6 @@ static int fsl_esdhc_probe(struct udevice *dev)
> 	struct fsl_esdhc_priv *priv = dev_get_priv(dev);
> 	fdt_addr_t addr;
> 	struct mmc *mmc;
>-	int ret;
>
> 	addr = dev_read_addr(dev);
> 	if (addr == FDT_ADDR_T_NONE)
>@@ -853,30 +847,10 @@ static int fsl_esdhc_probe(struct udevice *dev)  #endif
> 	priv->dev = dev;
>
>-	if (IS_ENABLED(CONFIG_CLK)) {
>-		/* Assigned clock already set clock */
>-		ret = clk_get_by_name(dev, "per", &priv->per_clk);
>-		if (ret) {
>-			printf("Failed to get per_clk\n");
>-			return ret;
>-		}
>-		ret = clk_enable(&priv->per_clk);
>-		if (ret) {
>-			printf("Failed to enable per_clk\n");
>-			return ret;
>-		}
>-
>-		priv->sdhc_clk = clk_get_rate(&priv->per_clk);
>-	} else {
>-#ifndef CONFIG_PPC
>-		priv->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK + dev->seq);
>-#else
>-		priv->sdhc_clk = gd->arch.sdhc_clk;
>-#endif
>-		if (priv->sdhc_clk <= 0) {
>-			dev_err(dev, "Unable to get clk for %s\n", dev->name);
>-			return -EINVAL;
>-		}
>+	priv->sdhc_clk = gd->arch.sdhc_clk;
>+	if (priv->sdhc_clk <= 0) {
>+		dev_err(dev, "Unable to get clk for %s\n", dev->name);
>+		return -EINVAL;
> 	}
>
> 	fsl_esdhc_get_cfg_common(priv, &plat->cfg);
>--
>2.7.4
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

Patch
diff mbox series

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 8ff84aa..09cb773 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -12,7 +12,6 @@ 
 #include <config.h>
 #include <common.h>
 #include <command.h>
-#include <clk.h>
 #include <errno.h>
 #include <hwconfig.h>
 #include <mmc.h>
@@ -81,7 +80,6 @@  struct fsl_esdhc_plat {
 struct fsl_esdhc_priv {
 	struct fsl_esdhc *esdhc_regs;
 	unsigned int sdhc_clk;
-	struct clk per_clk;
 	unsigned int clock;
 #if !CONFIG_IS_ENABLED(DM_MMC)
 	struct mmc *mmc;
@@ -831,9 +829,6 @@  int fsl_esdhc_mmc_init(bd_t *bis)
 	return fsl_esdhc_initialize(bis, cfg);
 }
 #else /* DM_MMC */
-#ifndef CONFIG_PPC
-#include <asm/arch/clock.h>
-#endif
 static int fsl_esdhc_probe(struct udevice *dev)
 {
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
@@ -841,7 +836,6 @@  static int fsl_esdhc_probe(struct udevice *dev)
 	struct fsl_esdhc_priv *priv = dev_get_priv(dev);
 	fdt_addr_t addr;
 	struct mmc *mmc;
-	int ret;
 
 	addr = dev_read_addr(dev);
 	if (addr == FDT_ADDR_T_NONE)
@@ -853,30 +847,10 @@  static int fsl_esdhc_probe(struct udevice *dev)
 #endif
 	priv->dev = dev;
 
-	if (IS_ENABLED(CONFIG_CLK)) {
-		/* Assigned clock already set clock */
-		ret = clk_get_by_name(dev, "per", &priv->per_clk);
-		if (ret) {
-			printf("Failed to get per_clk\n");
-			return ret;
-		}
-		ret = clk_enable(&priv->per_clk);
-		if (ret) {
-			printf("Failed to enable per_clk\n");
-			return ret;
-		}
-
-		priv->sdhc_clk = clk_get_rate(&priv->per_clk);
-	} else {
-#ifndef CONFIG_PPC
-		priv->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK + dev->seq);
-#else
-		priv->sdhc_clk = gd->arch.sdhc_clk;
-#endif
-		if (priv->sdhc_clk <= 0) {
-			dev_err(dev, "Unable to get clk for %s\n", dev->name);
-			return -EINVAL;
-		}
+	priv->sdhc_clk = gd->arch.sdhc_clk;
+	if (priv->sdhc_clk <= 0) {
+		dev_err(dev, "Unable to get clk for %s\n", dev->name);
+		return -EINVAL;
 	}
 
 	fsl_esdhc_get_cfg_common(priv, &plat->cfg);