diff mbox

[U-Boot,3/3] mmc: sd_sdhi: Enable clock using clock framework

Message ID 20170721212256.25961-3-marek.vasut+renesas@gmail.com
State Accepted
Commit 8cd46cba5397e134e6217310d5b0529b3fa46274
Delegated to: Jaehoon Chung
Headers show

Commit Message

Marek Vasut July 21, 2017, 9:22 p.m. UTC
Since we now have clock driver for the RCar Gen3 , add support for
enabling the clock into the SH SDHI driver to prevent hacks in the
board files.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/sh_sdhi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Nobuhiro Iwamatsu Aug. 2, 2017, 11:18 p.m. UTC | #1
Hi,

2017-07-22 6:22 GMT+09:00 Marek Vasut <marek.vasut@gmail.com>:
> Since we now have clock driver for the RCar Gen3 , add support for
> enabling the clock into the SH SDHI driver to prevent hacks in the
> board files.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>

Reviewed-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

> ---
>  drivers/mmc/sh_sdhi.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c
> index 3c5616e507..eef061abb2 100644
> --- a/drivers/mmc/sh_sdhi.c
> +++ b/drivers/mmc/sh_sdhi.c
> @@ -20,6 +20,7 @@
>  #include <linux/sizes.h>
>  #include <asm/arch/rmobile.h>
>  #include <asm/arch/sh_sdhi.h>
> +#include <clk.h>
>
>  #define DRIVER_NAME "sh-sdhi"
>
> @@ -824,8 +825,10 @@ static int sh_sdhi_dm_probe(struct udevice *dev)
>         struct sh_sdhi_plat *plat = dev_get_platdata(dev);
>         struct sh_sdhi_host *host = dev_get_priv(dev);
>         struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
> +       struct clk sh_sdhi_clk;
>         const u32 quirks = dev_get_driver_data(dev);
>         fdt_addr_t base;
> +       int ret;
>
>         base = devfdt_get_addr(dev);
>         if (base == FDT_ADDR_T_NONE)
> @@ -835,6 +838,18 @@ static int sh_sdhi_dm_probe(struct udevice *dev)
>         if (!host->addr)
>                 return -ENOMEM;
>
> +       ret = clk_get_by_index(dev, 0, &sh_sdhi_clk);
> +       if (ret) {
> +               debug("failed to get clock, ret=%d\n", ret);
> +               return ret;
> +       }
> +
> +       ret = clk_enable(&sh_sdhi_clk);
> +       if (ret) {
> +               debug("failed to enable clock, ret=%d\n", ret);
> +               return ret;
> +       }
> +
>         host->quirks = quirks;
>
>         if (host->quirks & SH_SDHI_QUIRK_64BIT_BUF)
> --
> 2.11.0
>
Jaehoon Chung Aug. 17, 2017, 5:39 a.m. UTC | #2
On 07/22/2017 06:22 AM, Marek Vasut wrote:
> Since we now have clock driver for the RCar Gen3 , add support for
> enabling the clock into the SH SDHI driver to prevent hacks in the
> board files.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Reviewed-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

Applied to u-boot-mmc. Sorry for late!

Best Regards,
Jaehoon Chung


> ---
>  drivers/mmc/sh_sdhi.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c
> index 3c5616e507..eef061abb2 100644
> --- a/drivers/mmc/sh_sdhi.c
> +++ b/drivers/mmc/sh_sdhi.c
> @@ -20,6 +20,7 @@
>  #include <linux/sizes.h>
>  #include <asm/arch/rmobile.h>
>  #include <asm/arch/sh_sdhi.h>
> +#include <clk.h>
>  
>  #define DRIVER_NAME "sh-sdhi"
>  
> @@ -824,8 +825,10 @@ static int sh_sdhi_dm_probe(struct udevice *dev)
>  	struct sh_sdhi_plat *plat = dev_get_platdata(dev);
>  	struct sh_sdhi_host *host = dev_get_priv(dev);
>  	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
> +	struct clk sh_sdhi_clk;
>  	const u32 quirks = dev_get_driver_data(dev);
>  	fdt_addr_t base;
> +	int ret;
>  
>  	base = devfdt_get_addr(dev);
>  	if (base == FDT_ADDR_T_NONE)
> @@ -835,6 +838,18 @@ static int sh_sdhi_dm_probe(struct udevice *dev)
>  	if (!host->addr)
>  		return -ENOMEM;
>  
> +	ret = clk_get_by_index(dev, 0, &sh_sdhi_clk);
> +	if (ret) {
> +		debug("failed to get clock, ret=%d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = clk_enable(&sh_sdhi_clk);
> +	if (ret) {
> +		debug("failed to enable clock, ret=%d\n", ret);
> +		return ret;
> +	}
> +
>  	host->quirks = quirks;
>  
>  	if (host->quirks & SH_SDHI_QUIRK_64BIT_BUF)
>
diff mbox

Patch

diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c
index 3c5616e507..eef061abb2 100644
--- a/drivers/mmc/sh_sdhi.c
+++ b/drivers/mmc/sh_sdhi.c
@@ -20,6 +20,7 @@ 
 #include <linux/sizes.h>
 #include <asm/arch/rmobile.h>
 #include <asm/arch/sh_sdhi.h>
+#include <clk.h>
 
 #define DRIVER_NAME "sh-sdhi"
 
@@ -824,8 +825,10 @@  static int sh_sdhi_dm_probe(struct udevice *dev)
 	struct sh_sdhi_plat *plat = dev_get_platdata(dev);
 	struct sh_sdhi_host *host = dev_get_priv(dev);
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct clk sh_sdhi_clk;
 	const u32 quirks = dev_get_driver_data(dev);
 	fdt_addr_t base;
+	int ret;
 
 	base = devfdt_get_addr(dev);
 	if (base == FDT_ADDR_T_NONE)
@@ -835,6 +838,18 @@  static int sh_sdhi_dm_probe(struct udevice *dev)
 	if (!host->addr)
 		return -ENOMEM;
 
+	ret = clk_get_by_index(dev, 0, &sh_sdhi_clk);
+	if (ret) {
+		debug("failed to get clock, ret=%d\n", ret);
+		return ret;
+	}
+
+	ret = clk_enable(&sh_sdhi_clk);
+	if (ret) {
+		debug("failed to enable clock, ret=%d\n", ret);
+		return ret;
+	}
+
 	host->quirks = quirks;
 
 	if (host->quirks & SH_SDHI_QUIRK_64BIT_BUF)