All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig
@ 2018-04-20  9:14 Masahiro Yamada
  2018-04-20  9:14 ` [U-Boot] [PATCH 1/4] mmc: tmio: move clk_enable() to each driver's probe function Masahiro Yamada
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Masahiro Yamada @ 2018-04-20  9:14 UTC (permalink / raw)
  To: u-boot


Usually, the image size tends to increase gradually.
Finally, it is hitting the size limit for my board.

One size consuming part is the clock driver, and it is only used
by the SD/eMMC driver in SPL.  By disabling it, I can save lots of space.



Masahiro Yamada (4):
  mmc: tmio: move clk_enable() to each driver's probe function
  mmc: uniphier-sd: skip clock set-up for SPL
  ARM: dts: uniphier: drop u-boot,dm-pre-reloc from SD/eMMC clock node
  clk: uniphier: disable SPL_CLK

 arch/arm/dts/uniphier-v7-u-boot.dtsi | 16 ----------------
 drivers/clk/uniphier/Kconfig         |  1 -
 drivers/mmc/renesas-sdhi.c           | 23 +++++++++++++++++++++++
 drivers/mmc/tmio-common.c            | 22 ----------------------
 drivers/mmc/uniphier-sd.c            | 29 +++++++++++++++++++++++++++++
 5 files changed, 52 insertions(+), 39 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/4] mmc: tmio: move clk_enable() to each driver's probe function
  2018-04-20  9:14 [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig Masahiro Yamada
@ 2018-04-20  9:14 ` Masahiro Yamada
  2018-04-20  9:23   ` Masahiro Yamada
  2018-04-20  9:14 ` [U-Boot] [PATCH 2/4] mmc: uniphier-sd: skip clock set-up for SPL Masahiro Yamada
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2018-04-20  9:14 UTC (permalink / raw)
  To: u-boot

I need to differentiate the clock handling for uniphier-sd.  Move it
to each driver's probe function from the tmio common code so that
renesas-sdhi will not be affected.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/mmc/renesas-sdhi.c | 23 +++++++++++++++++++++++
 drivers/mmc/tmio-common.c  | 22 ----------------------
 drivers/mmc/uniphier-sd.c  | 25 +++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c
index 56a43ca..8e49b2f 100644
--- a/drivers/mmc/renesas-sdhi.c
+++ b/drivers/mmc/renesas-sdhi.c
@@ -330,8 +330,10 @@ static const struct udevice_id renesas_sdhi_match[] = {
 
 static int renesas_sdhi_probe(struct udevice *dev)
 {
+	struct tmio_sd_priv *priv = dev_get_priv(dev);
 	u32 quirks = dev_get_driver_data(dev);
 	struct fdt_resource reg_res;
+	struct clk clk;
 	DECLARE_GLOBAL_DATA_PTR;
 	int ret;
 
@@ -348,6 +350,27 @@ static int renesas_sdhi_probe(struct udevice *dev)
 			quirks |= TMIO_SD_CAP_16BIT;
 	}
 
+	ret = clk_get_by_index(dev, 0, &clk);
+	if (ret < 0) {
+		dev_err(dev, "failed to get host clock\n");
+		return ret;
+	}
+
+	/* set to max rate */
+	priv->mclk = clk_set_rate(&clk, ULONG_MAX);
+	if (IS_ERR_VALUE(priv->mclk)) {
+		dev_err(dev, "failed to set rate for host clock\n");
+		clk_free(&clk);
+		return priv->mclk;
+	}
+
+	ret = clk_enable(&clk);
+	clk_free(&clk);
+	if (ret) {
+		dev_err(dev, "failed to enable host clock\n");
+		return ret;
+	}
+
 	ret = tmio_sd_probe(dev, quirks);
 #if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT)
 	if (!ret)
diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c
index 5f1c9c0..4ea6612 100644
--- a/drivers/mmc/tmio-common.c
+++ b/drivers/mmc/tmio-common.c
@@ -713,7 +713,6 @@ int tmio_sd_probe(struct udevice *dev, u32 quirks)
 	struct tmio_sd_priv *priv = dev_get_priv(dev);
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
 	fdt_addr_t base;
-	struct clk clk;
 	int ret;
 
 	base = devfdt_get_addr(dev);
@@ -728,27 +727,6 @@ int tmio_sd_probe(struct udevice *dev, u32 quirks)
 	device_get_supply_regulator(dev, "vqmmc-supply", &priv->vqmmc_dev);
 #endif
 
-	ret = clk_get_by_index(dev, 0, &clk);
-	if (ret < 0) {
-		dev_err(dev, "failed to get host clock\n");
-		return ret;
-	}
-
-	/* set to max rate */
-	priv->mclk = clk_set_rate(&clk, ULONG_MAX);
-	if (IS_ERR_VALUE(priv->mclk)) {
-		dev_err(dev, "failed to set rate for host clock\n");
-		clk_free(&clk);
-		return priv->mclk;
-	}
-
-	ret = clk_enable(&clk);
-	clk_free(&clk);
-	if (ret) {
-		dev_err(dev, "failed to enable host clock\n");
-		return ret;
-	}
-
 	ret = mmc_of_parse(dev, &plat->cfg);
 	if (ret < 0) {
 		dev_err(dev, "failed to parse host caps\n");
diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c
index 47379b0..bc6e41d 100644
--- a/drivers/mmc/uniphier-sd.c
+++ b/drivers/mmc/uniphier-sd.c
@@ -32,6 +32,31 @@ static const struct udevice_id uniphier_sd_match[] = {
 
 static int uniphier_sd_probe(struct udevice *dev)
 {
+	struct tmio_sd_priv *priv = dev_get_priv(dev);
+	struct clk clk;
+	int ret;
+
+	ret = clk_get_by_index(dev, 0, &clk);
+	if (ret < 0) {
+		dev_err(dev, "failed to get host clock\n");
+		return ret;
+	}
+
+	/* set to max rate */
+	priv->mclk = clk_set_rate(&clk, ULONG_MAX);
+	if (IS_ERR_VALUE(priv->mclk)) {
+		dev_err(dev, "failed to set rate for host clock\n");
+		clk_free(&clk);
+		return priv->mclk;
+	}
+
+	ret = clk_enable(&clk);
+	clk_free(&clk);
+	if (ret) {
+		dev_err(dev, "failed to enable host clock\n");
+		return ret;
+	}
+
 	return tmio_sd_probe(dev, 0);
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/4] mmc: uniphier-sd: skip clock set-up for SPL
  2018-04-20  9:14 [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig Masahiro Yamada
  2018-04-20  9:14 ` [U-Boot] [PATCH 1/4] mmc: tmio: move clk_enable() to each driver's probe function Masahiro Yamada
@ 2018-04-20  9:14 ` Masahiro Yamada
  2018-04-20  9:14 ` [U-Boot] [PATCH 3/4] ARM: dts: uniphier: drop u-boot, dm-pre-reloc from SD/eMMC clock node Masahiro Yamada
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2018-04-20  9:14 UTC (permalink / raw)
  To: u-boot

The size of SPL is hitting the limit (64KB) for uniphier_v7_defconfig.
When booting from SD/eMMC, obviously its clock has been properly set up
by the boot ROM.  Acutually, no need to re-initialize the clock in SPL.

Using a clock driver would generalize the SoC specific code, but
solving the memory footprint problem would win.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/mmc/uniphier-sd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c
index bc6e41d..61f8da4 100644
--- a/drivers/mmc/uniphier-sd.c
+++ b/drivers/mmc/uniphier-sd.c
@@ -33,6 +33,7 @@ static const struct udevice_id uniphier_sd_match[] = {
 static int uniphier_sd_probe(struct udevice *dev)
 {
 	struct tmio_sd_priv *priv = dev_get_priv(dev);
+#ifndef CONFIG_SPL_BUILD
 	struct clk clk;
 	int ret;
 
@@ -56,6 +57,9 @@ static int uniphier_sd_probe(struct udevice *dev)
 		dev_err(dev, "failed to enable host clock\n");
 		return ret;
 	}
+#else
+	priv->mclk = 100000000;
+#endif
 
 	return tmio_sd_probe(dev, 0);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 3/4] ARM: dts: uniphier: drop u-boot, dm-pre-reloc from SD/eMMC clock node
  2018-04-20  9:14 [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig Masahiro Yamada
  2018-04-20  9:14 ` [U-Boot] [PATCH 1/4] mmc: tmio: move clk_enable() to each driver's probe function Masahiro Yamada
  2018-04-20  9:14 ` [U-Boot] [PATCH 2/4] mmc: uniphier-sd: skip clock set-up for SPL Masahiro Yamada
@ 2018-04-20  9:14 ` Masahiro Yamada
  2018-04-20  9:14 ` [U-Boot] [PATCH 4/4] clk: uniphier: disable SPL_CLK Masahiro Yamada
  2018-04-23 16:03 ` [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig Masahiro Yamada
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2018-04-20  9:14 UTC (permalink / raw)
  To: u-boot

Now that the SD/eMMC driver does not use the clock driver in SPL,
remove u-boot,dm-pre-reloc properties to let the fdtgrep tool drop
the unnecessary nodes.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm/dts/uniphier-v7-u-boot.dtsi | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/arch/arm/dts/uniphier-v7-u-boot.dtsi b/arch/arm/dts/uniphier-v7-u-boot.dtsi
index 0094a45..9459bf0 100644
--- a/arch/arm/dts/uniphier-v7-u-boot.dtsi
+++ b/arch/arm/dts/uniphier-v7-u-boot.dtsi
@@ -14,22 +14,6 @@
 			u-boot,dm-pre-reloc;
 		};
 
-		mioctrl at 59810000 {
-			u-boot,dm-pre-reloc;
-
-			clock {
-				u-boot,dm-pre-reloc;
-			};
-		};
-
-		sdctrl at 59810000 {
-			u-boot,dm-pre-reloc;
-
-			clock {
-				u-boot,dm-pre-reloc;
-			};
-		};
-
 		soc-glue at 5f800000 {
 			u-boot,dm-pre-reloc;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 4/4] clk: uniphier: disable SPL_CLK
  2018-04-20  9:14 [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig Masahiro Yamada
                   ` (2 preceding siblings ...)
  2018-04-20  9:14 ` [U-Boot] [PATCH 3/4] ARM: dts: uniphier: drop u-boot, dm-pre-reloc from SD/eMMC clock node Masahiro Yamada
@ 2018-04-20  9:14 ` Masahiro Yamada
  2018-04-23 16:03 ` [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig Masahiro Yamada
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2018-04-20  9:14 UTC (permalink / raw)
  To: u-boot

The last clock consumer in SPL, SD/eMMC driver, gave up using the
clock driver.  The clock driver is only used in U-Boot proper.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/clk/uniphier/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/clk/uniphier/Kconfig b/drivers/clk/uniphier/Kconfig
index 3666d84..a26ca8c 100644
--- a/drivers/clk/uniphier/Kconfig
+++ b/drivers/clk/uniphier/Kconfig
@@ -2,7 +2,6 @@ config CLK_UNIPHIER
 	def_bool y
 	depends on ARCH_UNIPHIER
 	select CLK
-	select SPL_CLK if SPL
 	help
 	  Support for clock controllers on UniPhier SoCs.
 	  Say Y if you want to control clocks provided by System Control
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/4] mmc: tmio: move clk_enable() to each driver's probe function
  2018-04-20  9:14 ` [U-Boot] [PATCH 1/4] mmc: tmio: move clk_enable() to each driver's probe function Masahiro Yamada
@ 2018-04-20  9:23   ` Masahiro Yamada
  0 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2018-04-20  9:23 UTC (permalink / raw)
  To: u-boot

+CC Marek


2018-04-20 18:14 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> I need to differentiate the clock handling for uniphier-sd.  Move it
> to each driver's probe function from the tmio common code so that
> renesas-sdhi will not be affected.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/mmc/renesas-sdhi.c | 23 +++++++++++++++++++++++
>  drivers/mmc/tmio-common.c  | 22 ----------------------
>  drivers/mmc/uniphier-sd.c  | 25 +++++++++++++++++++++++++
>  3 files changed, 48 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c
> index 56a43ca..8e49b2f 100644
> --- a/drivers/mmc/renesas-sdhi.c
> +++ b/drivers/mmc/renesas-sdhi.c
> @@ -330,8 +330,10 @@ static const struct udevice_id renesas_sdhi_match[] = {
>
>  static int renesas_sdhi_probe(struct udevice *dev)
>  {
> +       struct tmio_sd_priv *priv = dev_get_priv(dev);
>         u32 quirks = dev_get_driver_data(dev);
>         struct fdt_resource reg_res;
> +       struct clk clk;
>         DECLARE_GLOBAL_DATA_PTR;
>         int ret;
>
> @@ -348,6 +350,27 @@ static int renesas_sdhi_probe(struct udevice *dev)
>                         quirks |= TMIO_SD_CAP_16BIT;
>         }
>
> +       ret = clk_get_by_index(dev, 0, &clk);
> +       if (ret < 0) {
> +               dev_err(dev, "failed to get host clock\n");
> +               return ret;
> +       }
> +
> +       /* set to max rate */
> +       priv->mclk = clk_set_rate(&clk, ULONG_MAX);
> +       if (IS_ERR_VALUE(priv->mclk)) {
> +               dev_err(dev, "failed to set rate for host clock\n");
> +               clk_free(&clk);
> +               return priv->mclk;
> +       }
> +
> +       ret = clk_enable(&clk);
> +       clk_free(&clk);
> +       if (ret) {
> +               dev_err(dev, "failed to enable host clock\n");
> +               return ret;
> +       }
> +
>         ret = tmio_sd_probe(dev, quirks);
>  #if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT)
>         if (!ret)
> diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c
> index 5f1c9c0..4ea6612 100644
> --- a/drivers/mmc/tmio-common.c
> +++ b/drivers/mmc/tmio-common.c
> @@ -713,7 +713,6 @@ int tmio_sd_probe(struct udevice *dev, u32 quirks)
>         struct tmio_sd_priv *priv = dev_get_priv(dev);
>         struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
>         fdt_addr_t base;
> -       struct clk clk;
>         int ret;
>
>         base = devfdt_get_addr(dev);
> @@ -728,27 +727,6 @@ int tmio_sd_probe(struct udevice *dev, u32 quirks)
>         device_get_supply_regulator(dev, "vqmmc-supply", &priv->vqmmc_dev);
>  #endif
>
> -       ret = clk_get_by_index(dev, 0, &clk);
> -       if (ret < 0) {
> -               dev_err(dev, "failed to get host clock\n");
> -               return ret;
> -       }
> -
> -       /* set to max rate */
> -       priv->mclk = clk_set_rate(&clk, ULONG_MAX);
> -       if (IS_ERR_VALUE(priv->mclk)) {
> -               dev_err(dev, "failed to set rate for host clock\n");
> -               clk_free(&clk);
> -               return priv->mclk;
> -       }
> -
> -       ret = clk_enable(&clk);
> -       clk_free(&clk);
> -       if (ret) {
> -               dev_err(dev, "failed to enable host clock\n");
> -               return ret;
> -       }
> -
>         ret = mmc_of_parse(dev, &plat->cfg);
>         if (ret < 0) {
>                 dev_err(dev, "failed to parse host caps\n");
> diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c
> index 47379b0..bc6e41d 100644
> --- a/drivers/mmc/uniphier-sd.c
> +++ b/drivers/mmc/uniphier-sd.c
> @@ -32,6 +32,31 @@ static const struct udevice_id uniphier_sd_match[] = {
>
>  static int uniphier_sd_probe(struct udevice *dev)
>  {
> +       struct tmio_sd_priv *priv = dev_get_priv(dev);
> +       struct clk clk;
> +       int ret;
> +
> +       ret = clk_get_by_index(dev, 0, &clk);
> +       if (ret < 0) {
> +               dev_err(dev, "failed to get host clock\n");
> +               return ret;
> +       }
> +
> +       /* set to max rate */
> +       priv->mclk = clk_set_rate(&clk, ULONG_MAX);
> +       if (IS_ERR_VALUE(priv->mclk)) {
> +               dev_err(dev, "failed to set rate for host clock\n");
> +               clk_free(&clk);
> +               return priv->mclk;
> +       }
> +
> +       ret = clk_enable(&clk);
> +       clk_free(&clk);
> +       if (ret) {
> +               dev_err(dev, "failed to enable host clock\n");
> +               return ret;
> +       }
> +
>         return tmio_sd_probe(dev, 0);
>  }
>
> --
> 2.7.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig
  2018-04-20  9:14 [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig Masahiro Yamada
                   ` (3 preceding siblings ...)
  2018-04-20  9:14 ` [U-Boot] [PATCH 4/4] clk: uniphier: disable SPL_CLK Masahiro Yamada
@ 2018-04-23 16:03 ` Masahiro Yamada
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2018-04-23 16:03 UTC (permalink / raw)
  To: u-boot

2018-04-20 18:14 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
>
> Usually, the image size tends to increase gradually.
> Finally, it is hitting the size limit for my board.
>
> One size consuming part is the clock driver, and it is only used
> by the SD/eMMC driver in SPL.  By disabling it, I can save lots of space.
>
>
>
> Masahiro Yamada (4):
>   mmc: tmio: move clk_enable() to each driver's probe function
>   mmc: uniphier-sd: skip clock set-up for SPL
>   ARM: dts: uniphier: drop u-boot,dm-pre-reloc from SD/eMMC clock node
>   clk: uniphier: disable SPL_CLK

Applied to u-boot-uniphier.





-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-04-23 16:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20  9:14 [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig Masahiro Yamada
2018-04-20  9:14 ` [U-Boot] [PATCH 1/4] mmc: tmio: move clk_enable() to each driver's probe function Masahiro Yamada
2018-04-20  9:23   ` Masahiro Yamada
2018-04-20  9:14 ` [U-Boot] [PATCH 2/4] mmc: uniphier-sd: skip clock set-up for SPL Masahiro Yamada
2018-04-20  9:14 ` [U-Boot] [PATCH 3/4] ARM: dts: uniphier: drop u-boot, dm-pre-reloc from SD/eMMC clock node Masahiro Yamada
2018-04-20  9:14 ` [U-Boot] [PATCH 4/4] clk: uniphier: disable SPL_CLK Masahiro Yamada
2018-04-23 16:03 ` [U-Boot] [PATCH 0/4] ARM: uniphier: decrease the SPL image size to fix uniphier_v7_defconfig Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.