diff mbox series

[05/12] mmc: nds32: ftsdc010: Convert to livetree

Message ID 20210807132413.3513724-6-sjg@chromium.org
State Accepted
Commit 62470afed14a598d36d055c60ccc3ffab6967dcc
Delegated to: Simon Glass
Headers show
Series dm: Expand of-platdata support to GPIOs and clean up | expand

Commit Message

Simon Glass Aug. 7, 2021, 1:24 p.m. UTC
Use the livetree API for this driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/mmc/ftsdc010_mci.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

Comments

Rick Chen Aug. 9, 2021, 2:42 a.m. UTC | #1
> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Simon Glass
> Sent: Saturday, August 07, 2021 9:24 PM
> To: U-Boot Mailing List <u-boot@lists.denx.de>
> Cc: Tom Rini <trini@konsulko.com>; Simon Glass <sjg@chromium.org>; Jaehoon Chung <jh80.chung@samsung.com>; Macpaul Lin <macpaul@andestech.com>; Peng Fan <peng.fan@nxp.com>
> Subject: [PATCH 05/12] mmc: nds32: ftsdc010: Convert to livetree
>
> Use the livetree API for this driver.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/mmc/ftsdc010_mci.c | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)

Reviewed-by: Rick Chen <rick@andestech.com>
Jaehoon Chung Aug. 12, 2021, 10:22 p.m. UTC | #2
On 8/7/21 10:24 PM, Simon Glass wrote:
> Use the livetree API for this driver.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regars,
Jaehoon Chung

> ---
> 
>  drivers/mmc/ftsdc010_mci.c | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c
> index 221fba313d3..b30da5b72a4 100644
> --- a/drivers/mmc/ftsdc010_mci.c
> +++ b/drivers/mmc/ftsdc010_mci.c
> @@ -30,8 +30,6 @@
>  #include <syscon.h>
>  #include <linux/err.h>
>  
> -DECLARE_GLOBAL_DATA_PTR;
> -
>  #define CFG_CMD_TIMEOUT (CONFIG_SYS_HZ >> 4) /* 250 ms */
>  #define CFG_RST_TIMEOUT CONFIG_SYS_HZ /* 1 sec reset timeout */
>  
> @@ -395,24 +393,18 @@ static int ftsdc010_mmc_of_to_plat(struct udevice *dev)
>  #if CONFIG_IS_ENABLED(OF_REAL)
>  	struct ftsdc_priv *priv = dev_get_priv(dev);
>  	struct ftsdc010_chip *chip = &priv->chip;
> +
>  	chip->name = dev->name;
>  	chip->ioaddr = dev_read_addr_ptr(dev);
> -	chip->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
> -					"bus-width", 4);
> +	chip->buswidth = dev_read_u32_default(dev, "bus-width", 4);
>  	chip->priv = dev;
> -	priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
> -				    "fifo-depth", 0);
> -	priv->fifo_mode = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
> -					  "fifo-mode");
> -	if (fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
> -			 "clock-freq-min-max", priv->minmax, 2)) {
> -		int val = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
> -				  "max-frequency", -EINVAL);
> -		if (val < 0)
> -			return val;
> +	priv->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0);
> +	priv->fifo_mode = dev_read_bool(dev, "fifo-mode");
> +	if (dev_read_u32_array(dev, "clock-freq-min-max", priv->minmax, 2)) {
> +		if (dev_read_u32(dev, "max-frequency", &priv->minmax[1]))
> +			return -EINVAL;
>  
>  		priv->minmax[0] = 400000;  /* 400 kHz */
> -		priv->minmax[1] = val;
>  	} else {
>  		debug("%s: 'clock-freq-min-max' property was deprecated.\n",
>  		__func__);
>
Simon Glass Sept. 26, 2021, 6:40 p.m. UTC | #3
On 8/7/21 10:24 PM, Simon Glass wrote:
> Use the livetree API for this driver.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regars,
Jaehoon Chung

> ---
>
>  drivers/mmc/ftsdc010_mci.c | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)
>
Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c
index 221fba313d3..b30da5b72a4 100644
--- a/drivers/mmc/ftsdc010_mci.c
+++ b/drivers/mmc/ftsdc010_mci.c
@@ -30,8 +30,6 @@ 
 #include <syscon.h>
 #include <linux/err.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define CFG_CMD_TIMEOUT (CONFIG_SYS_HZ >> 4) /* 250 ms */
 #define CFG_RST_TIMEOUT CONFIG_SYS_HZ /* 1 sec reset timeout */
 
@@ -395,24 +393,18 @@  static int ftsdc010_mmc_of_to_plat(struct udevice *dev)
 #if CONFIG_IS_ENABLED(OF_REAL)
 	struct ftsdc_priv *priv = dev_get_priv(dev);
 	struct ftsdc010_chip *chip = &priv->chip;
+
 	chip->name = dev->name;
 	chip->ioaddr = dev_read_addr_ptr(dev);
-	chip->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-					"bus-width", 4);
+	chip->buswidth = dev_read_u32_default(dev, "bus-width", 4);
 	chip->priv = dev;
-	priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-				    "fifo-depth", 0);
-	priv->fifo_mode = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-					  "fifo-mode");
-	if (fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
-			 "clock-freq-min-max", priv->minmax, 2)) {
-		int val = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-				  "max-frequency", -EINVAL);
-		if (val < 0)
-			return val;
+	priv->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0);
+	priv->fifo_mode = dev_read_bool(dev, "fifo-mode");
+	if (dev_read_u32_array(dev, "clock-freq-min-max", priv->minmax, 2)) {
+		if (dev_read_u32(dev, "max-frequency", &priv->minmax[1]))
+			return -EINVAL;
 
 		priv->minmax[0] = 400000;  /* 400 kHz */
-		priv->minmax[1] = val;
 	} else {
 		debug("%s: 'clock-freq-min-max' property was deprecated.\n",
 		__func__);