All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support
@ 2020-07-22 13:14 Walter Lozano
  2020-07-22 13:14 ` [PATCH v2 1/6] mmc: fsl_esdhc_imx: rename driver name to match ll_entry Walter Lozano
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Walter Lozano @ 2020-07-22 13:14 UTC (permalink / raw)
  To: u-boot

The SPL in iMX6 boards is restricted to 68 KB as this is the free available
space in OCRAM for most revisions. In this context, adding OF_CONTROL and DM
increases the SPL size which could make it difficult to add specific features
required for custom scenarios.

These patches aim to take advantage of OF_PLATADATA in order to reduce the SPL
size in this scenario, by parsing DT data to generate platdata structures,
and thus removing the overhead caused by DT and related libraries.

This series is focused in MMC driver, which is used for boot in boards such as
Cubox-i. Also, in order to support CD, the OF_PLATDATA support is also
implemented on GPIO driver.

Changes in v2:
- Improve commit message with footprint reduction

Walter Lozano (6):
  mmc: fsl_esdhc_imx: rename driver name to match ll_entry
  mmc: fsl_esdhc_imx: add OF_PLATDATA support
  gpio: mxc_gpio: add OF_PLATDATA support
  mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled
  drivers: rename more drivers to match compatible string
  mx6cuboxi: enable OF_PLATDATA

 configs/mx6cuboxi_defconfig        |  1 +
 drivers/gpio/mxc_gpio.c            | 18 +++++-
 drivers/mmc/fsl_esdhc_imx.c        | 94 +++++++++++++++++++++++++-----
 drivers/pinctrl/nxp/pinctrl-imx6.c |  6 +-
 drivers/video/imx/mxc_ipuv3_fb.c   |  4 +-
 5 files changed, 103 insertions(+), 20 deletions(-)

-- 
2.20.1

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

* [PATCH v2 1/6] mmc: fsl_esdhc_imx: rename driver name to match ll_entry
  2020-07-22 13:14 [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
@ 2020-07-22 13:14 ` Walter Lozano
  2020-07-26 14:54   ` Simon Glass
  2020-07-22 13:14 ` [PATCH v2 2/6] mmc: fsl_esdhc_imx: add OF_PLATDATA support Walter Lozano
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Walter Lozano @ 2020-07-22 13:14 UTC (permalink / raw)
  To: u-boot

As discussed in commit <addf358bac1d2bd0> rename fsl_esdhc_imx
driver to allow the OF_PLATDATA support.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---

(no changes since v1)

 drivers/mmc/fsl_esdhc_imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 5b61eeb214..7d76b144a7 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -1644,7 +1644,7 @@ static int fsl_esdhc_bind(struct udevice *dev)
 #endif
 
 U_BOOT_DRIVER(fsl_esdhc) = {
-	.name	= "fsl-esdhc-mmc",
+	.name	= "fsl_esdhc",
 	.id	= UCLASS_MMC,
 	.of_match = fsl_esdhc_ids,
 	.ops	= &fsl_esdhc_ops,
-- 
2.20.1

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

* [PATCH v2 2/6] mmc: fsl_esdhc_imx: add OF_PLATDATA support
  2020-07-22 13:14 [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
  2020-07-22 13:14 ` [PATCH v2 1/6] mmc: fsl_esdhc_imx: rename driver name to match ll_entry Walter Lozano
@ 2020-07-22 13:14 ` Walter Lozano
  2020-07-26 14:54   ` Simon Glass
  2020-07-22 13:14 ` [PATCH v2 3/6] gpio: mxc_gpio: " Walter Lozano
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Walter Lozano @ 2020-07-22 13:14 UTC (permalink / raw)
  To: u-boot

In order to reduce the footprint of SPL by removing dtb and library
overhead add OF_PLATDATA support to fsl_esdhc_imx. This initial
approach does not support card detection, which will be enabled after
adding OF_PLATDATA support to GPIO.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---

(no changes since v1)

 drivers/mmc/fsl_esdhc_imx.c | 67 +++++++++++++++++++++++++++++--------
 1 file changed, 53 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 7d76b144a7..f2509b5cc9 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -33,6 +33,9 @@
 #include <dm.h>
 #include <asm-generic/gpio.h>
 #include <dm/pinctrl.h>
+#include <dt-structs.h>
+#include <mapmem.h>
+#include <dm/ofnode.h>
 
 #if !CONFIG_IS_ENABLED(BLK)
 #include "mmc_private.h"
@@ -102,6 +105,11 @@ struct fsl_esdhc {
 };
 
 struct fsl_esdhc_plat {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+	/* Put this first since driver model will copy the data here */
+	struct dtd_fsl_esdhc dtplat;
+#endif
+
 	struct mmc_config cfg;
 	struct mmc mmc;
 };
@@ -1378,25 +1386,19 @@ __weak void init_clk_usdhc(u32 index)
 {
 }
 
-static int fsl_esdhc_probe(struct udevice *dev)
+static int fsl_esdhc_ofdata_to_platdata(struct udevice *dev)
 {
-	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
-	struct fsl_esdhc_plat *plat = dev_get_platdata(dev);
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct fsl_esdhc_priv *priv = dev_get_priv(dev);
-	const void *fdt = gd->fdt_blob;
-	int node = dev_of_offset(dev);
-	struct esdhc_soc_data *data =
-		(struct esdhc_soc_data *)dev_get_driver_data(dev);
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
 	struct udevice *vqmmc_dev;
+	int ret;
 #endif
+	const void *fdt = gd->fdt_blob;
+	int node = dev_of_offset(dev);
+
 	fdt_addr_t addr;
 	unsigned int val;
-	struct mmc *mmc;
-#if !CONFIG_IS_ENABLED(BLK)
-	struct blk_desc *bdesc;
-#endif
-	int ret;
 
 	addr = dev_read_addr(dev);
 	if (addr == FDT_ADDR_T_NONE)
@@ -1404,8 +1406,6 @@ static int fsl_esdhc_probe(struct udevice *dev)
 	priv->esdhc_regs = (struct fsl_esdhc *)addr;
 	priv->dev = dev;
 	priv->mode = -1;
-	if (data)
-		priv->flags = data->flags;
 
 	val = dev_read_u32_default(dev, "bus-width", -1);
 	if (val == 8)
@@ -1469,6 +1469,40 @@ static int fsl_esdhc_probe(struct udevice *dev)
 			priv->vs18_enable = 1;
 	}
 #endif
+#endif
+	return 0;
+}
+
+static int fsl_esdhc_probe(struct udevice *dev)
+{
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct fsl_esdhc_plat *plat = dev_get_platdata(dev);
+	struct fsl_esdhc_priv *priv = dev_get_priv(dev);
+	struct esdhc_soc_data *data =
+		(struct esdhc_soc_data *)dev_get_driver_data(dev);
+	struct mmc *mmc;
+#if !CONFIG_IS_ENABLED(BLK)
+	struct blk_desc *bdesc;
+#endif
+	int ret;
+
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+	struct dtd_fsl_esdhc *dtplat = &plat->dtplat;
+	unsigned int val;
+
+	priv->esdhc_regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
+	val = plat->dtplat.bus_width;
+	if (val == 8)
+		priv->bus_width = 8;
+	else if (val == 4)
+		priv->bus_width = 4;
+	else
+		priv->bus_width = 1;
+	priv->non_removable = 1;
+#endif
+
+	if (data)
+		priv->flags = data->flags;
 
 	/*
 	 * TODO:
@@ -1520,9 +1554,11 @@ static int fsl_esdhc_probe(struct udevice *dev)
 		return ret;
 	}
 
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	ret = mmc_of_parse(dev, &plat->cfg);
 	if (ret)
 		return ret;
+#endif
 
 	mmc = &plat->mmc;
 	mmc->cfg = &plat->cfg;
@@ -1647,6 +1683,7 @@ U_BOOT_DRIVER(fsl_esdhc) = {
 	.name	= "fsl_esdhc",
 	.id	= UCLASS_MMC,
 	.of_match = fsl_esdhc_ids,
+	.ofdata_to_platdata = fsl_esdhc_ofdata_to_platdata,
 	.ops	= &fsl_esdhc_ops,
 #if CONFIG_IS_ENABLED(BLK)
 	.bind	= fsl_esdhc_bind,
@@ -1655,4 +1692,6 @@ U_BOOT_DRIVER(fsl_esdhc) = {
 	.platdata_auto_alloc_size = sizeof(struct fsl_esdhc_plat),
 	.priv_auto_alloc_size = sizeof(struct fsl_esdhc_priv),
 };
+
+U_BOOT_DRIVER_ALIAS(fsl_esdhc, fsl_imx6q_usdhc)
 #endif
-- 
2.20.1

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

* [PATCH v2 3/6] gpio: mxc_gpio: add OF_PLATDATA support
  2020-07-22 13:14 [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
  2020-07-22 13:14 ` [PATCH v2 1/6] mmc: fsl_esdhc_imx: rename driver name to match ll_entry Walter Lozano
  2020-07-22 13:14 ` [PATCH v2 2/6] mmc: fsl_esdhc_imx: add OF_PLATDATA support Walter Lozano
@ 2020-07-22 13:14 ` Walter Lozano
  2020-07-26 14:54   ` Simon Glass
  2020-07-27 12:10   ` Stefano Babic
  2020-07-22 13:14 ` [PATCH v2 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled Walter Lozano
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 17+ messages in thread
From: Walter Lozano @ 2020-07-22 13:14 UTC (permalink / raw)
  To: u-boot

Continuing with the OF_PLATADATA support for iMX6 to reduce SPL
footprint, add it to mxc_gpio. Thanks to this, it will be possible to
enable card detection on MMC driver.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---

(no changes since v1)

 drivers/gpio/mxc_gpio.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index 316dcc757b..fc49b5b577 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -13,6 +13,8 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <dt-structs.h>
+#include <mapmem.h>
 
 enum mxc_gpio_direction {
 	MXC_GPIO_DIRECTION_IN,
@@ -22,6 +24,10 @@ enum mxc_gpio_direction {
 #define GPIO_PER_BANK			32
 
 struct mxc_gpio_plat {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+	/* Put this first since driver model will copy the data here */
+	struct dtd_gpio_mxc dtplat;
+#endif
 	int bank_index;
 	struct gpio_regs *regs;
 };
@@ -306,8 +312,16 @@ static int mxc_gpio_bind(struct udevice *dev)
 	 * is statically initialized in U_BOOT_DEVICES.Here
 	 * will return.
 	 */
-	if (plat)
+
+	if (plat) {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+		struct dtd_gpio_mxc *dtplat = &plat->dtplat;
+
+		plat->regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
+		plat->bank_index = dev->req_seq;
+#endif
 		return 0;
+	}
 
 	addr = devfdt_get_addr(dev);
 	if (addr == FDT_ADDR_T_NONE)
@@ -350,6 +364,8 @@ U_BOOT_DRIVER(gpio_mxc) = {
 	.bind	= mxc_gpio_bind,
 };
 
+U_BOOT_DRIVER_ALIAS(gpio_mxc, fsl_imx6q_gpio)
+
 #if !CONFIG_IS_ENABLED(OF_CONTROL)
 static const struct mxc_gpio_plat mxc_plat[] = {
 	{ 0, (struct gpio_regs *)GPIO1_BASE_ADDR },
-- 
2.20.1

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

* [PATCH v2 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled
  2020-07-22 13:14 [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
                   ` (2 preceding siblings ...)
  2020-07-22 13:14 ` [PATCH v2 3/6] gpio: mxc_gpio: " Walter Lozano
@ 2020-07-22 13:14 ` Walter Lozano
  2020-07-26 14:54   ` Simon Glass
  2020-07-22 13:14 ` [PATCH v2 5/6] drivers: rename more drivers to match compatible string Walter Lozano
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Walter Lozano @ 2020-07-22 13:14 UTC (permalink / raw)
  To: u-boot

After enabling OF_PLATDATA support to both MMC and GPIO drivers add the
support for card detection.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---

(no changes since v1)

 drivers/mmc/fsl_esdhc_imx.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index f2509b5cc9..4448565b5a 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -1498,7 +1498,32 @@ static int fsl_esdhc_probe(struct udevice *dev)
 		priv->bus_width = 4;
 	else
 		priv->bus_width = 1;
-	priv->non_removable = 1;
+
+	if (dtplat->non_removable)
+		priv->non_removable = 1;
+	else
+		priv->non_removable = 0;
+
+#if CONFIG_IS_ENABLED(DM_GPIO)
+	if (!priv->non_removable) {
+		struct udevice *gpiodev;
+		struct driver_info *info;
+
+		info = (struct driver_info *)dtplat->cd_gpios->node;
+
+		ret = device_get_by_driver_info(info, &gpiodev);
+
+		if (ret)
+			return ret;
+
+		ret = gpio_dev_request_index(gpiodev, gpiodev->name, "cd-gpios",
+					     dtplat->cd_gpios->arg[0], GPIOD_IS_IN,
+					     dtplat->cd_gpios->arg[1], &priv->cd_gpio);
+
+		if (ret)
+			return ret;
+	}
+#endif
 #endif
 
 	if (data)
-- 
2.20.1

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

* [PATCH v2 5/6] drivers: rename more drivers to match compatible string
  2020-07-22 13:14 [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
                   ` (3 preceding siblings ...)
  2020-07-22 13:14 ` [PATCH v2 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled Walter Lozano
@ 2020-07-22 13:14 ` Walter Lozano
  2020-07-26 14:54   ` Simon Glass
  2020-07-22 13:14 ` [PATCH v2 6/6] mx6cuboxi: enable OF_PLATDATA Walter Lozano
  2020-07-23  1:34 ` [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Peng Fan
  6 siblings, 1 reply; 17+ messages in thread
From: Walter Lozano @ 2020-07-22 13:14 UTC (permalink / raw)
  To: u-boot

Continuing with the approach in commit <addf358bac1d2bd0> rename
additional drivers to allow the OF_PLATDATA support.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---

(no changes since v1)

 drivers/pinctrl/nxp/pinctrl-imx6.c | 6 ++++--
 drivers/video/imx/mxc_ipuv3_fb.c   | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/nxp/pinctrl-imx6.c b/drivers/pinctrl/nxp/pinctrl-imx6.c
index aafa3057ad..84004e5921 100644
--- a/drivers/pinctrl/nxp/pinctrl-imx6.c
+++ b/drivers/pinctrl/nxp/pinctrl-imx6.c
@@ -41,8 +41,8 @@ static const struct udevice_id imx6_pinctrl_match[] = {
 	{ /* sentinel */ }
 };
 
-U_BOOT_DRIVER(imx6_pinctrl) = {
-	.name = "imx6-pinctrl",
+U_BOOT_DRIVER(fsl_imx6q_iomuxc) = {
+	.name = "fsl_imx6q_iomuxc",
 	.id = UCLASS_PINCTRL,
 	.of_match = of_match_ptr(imx6_pinctrl_match),
 	.probe = imx6_pinctrl_probe,
@@ -51,3 +51,5 @@ U_BOOT_DRIVER(imx6_pinctrl) = {
 	.ops = &imx_pinctrl_ops,
 	.flags = DM_FLAG_PRE_RELOC,
 };
+
+U_BOOT_DRIVER_ALIAS(fsl_imx6q_iomuxc, fsl_imx6dl_iomuxc)
diff --git a/drivers/video/imx/mxc_ipuv3_fb.c b/drivers/video/imx/mxc_ipuv3_fb.c
index 587d62f2d8..492bc3e829 100644
--- a/drivers/video/imx/mxc_ipuv3_fb.c
+++ b/drivers/video/imx/mxc_ipuv3_fb.c
@@ -660,8 +660,8 @@ static const struct udevice_id ipuv3_video_ids[] = {
 	{ }
 };
 
-U_BOOT_DRIVER(ipuv3_video) = {
-	.name	= "ipuv3_video",
+U_BOOT_DRIVER(fsl_imx6q_ipu) = {
+	.name	= "fsl_imx6q_ipu",
 	.id	= UCLASS_VIDEO,
 	.of_match = ipuv3_video_ids,
 	.bind	= ipuv3_video_bind,
-- 
2.20.1

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

* [PATCH v2 6/6] mx6cuboxi: enable OF_PLATDATA
  2020-07-22 13:14 [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
                   ` (4 preceding siblings ...)
  2020-07-22 13:14 ` [PATCH v2 5/6] drivers: rename more drivers to match compatible string Walter Lozano
@ 2020-07-22 13:14 ` Walter Lozano
  2020-07-26 14:54   ` Simon Glass
  2020-07-23  1:34 ` [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Peng Fan
  6 siblings, 1 reply; 17+ messages in thread
From: Walter Lozano @ 2020-07-22 13:14 UTC (permalink / raw)
  To: u-boot

As both MMC and GPIO driver now supports OF_PLATDATA, enable it in
defconfig in order to reduce the SPL footprint. After applying this
setting the SPL reduction is 5 KB, which partially compensates the
increment due to DM.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---

Changes in v2:
- Improve commit message with footprint reduction

 configs/mx6cuboxi_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/mx6cuboxi_defconfig b/configs/mx6cuboxi_defconfig
index cd4d4da43e..54e5b76f3c 100644
--- a/configs/mx6cuboxi_defconfig
+++ b/configs/mx6cuboxi_defconfig
@@ -42,6 +42,7 @@ CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6dl-hummingboard2-emmc-som-v15"
 CONFIG_OF_LIST="imx6dl-hummingboard2-emmc-som-v15 imx6q-hummingboard2-emmc-som-v15"
 CONFIG_MULTI_DTB_FIT=y
+CONFIG_SPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
-- 
2.20.1

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

* [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support
  2020-07-22 13:14 [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
                   ` (5 preceding siblings ...)
  2020-07-22 13:14 ` [PATCH v2 6/6] mx6cuboxi: enable OF_PLATDATA Walter Lozano
@ 2020-07-23  1:34 ` Peng Fan
  2020-07-23  2:01   ` Walter Lozano
  6 siblings, 1 reply; 17+ messages in thread
From: Peng Fan @ 2020-07-23  1:34 UTC (permalink / raw)
  To: u-boot

Hi Walter,

> Subject: [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support
> 
> The SPL in iMX6 boards is restricted to 68 KB as this is the free available space
> in OCRAM for most revisions. In this context, adding OF_CONTROL and DM
> increases the SPL size which could make it difficult to add specific features
> required for custom scenarios.
> 
> These patches aim to take advantage of OF_PLATADATA in order to reduce the
> SPL size in this scenario, by parsing DT data to generate platdata structures,
> and thus removing the overhead caused by DT and related libraries.
> 
> This series is focused in MMC driver, which is used for boot in boards such as
> Cubox-i. Also, in order to support CD, the OF_PLATDATA support is also
> implemented on GPIO driver.

Do you have some data that how much is decreased using OF_PLATDATA?

Thanks,
Peng.

> 
> Changes in v2:
> - Improve commit message with footprint reduction
> 
> Walter Lozano (6):
>   mmc: fsl_esdhc_imx: rename driver name to match ll_entry
>   mmc: fsl_esdhc_imx: add OF_PLATDATA support
>   gpio: mxc_gpio: add OF_PLATDATA support
>   mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled
>   drivers: rename more drivers to match compatible string
>   mx6cuboxi: enable OF_PLATDATA
> 
>  configs/mx6cuboxi_defconfig        |  1 +
>  drivers/gpio/mxc_gpio.c            | 18 +++++-
>  drivers/mmc/fsl_esdhc_imx.c        | 94
> +++++++++++++++++++++++++-----
>  drivers/pinctrl/nxp/pinctrl-imx6.c |  6 +-
>  drivers/video/imx/mxc_ipuv3_fb.c   |  4 +-
>  5 files changed, 103 insertions(+), 20 deletions(-)
> 
> --
> 2.20.1

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

* [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support
  2020-07-23  1:34 ` [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Peng Fan
@ 2020-07-23  2:01   ` Walter Lozano
  0 siblings, 0 replies; 17+ messages in thread
From: Walter Lozano @ 2020-07-23  2:01 UTC (permalink / raw)
  To: u-boot

Hi Peng

On 22/7/20 22:34, Peng Fan wrote:
> Hi Walter,
>
>> Subject: [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support
>>
>> The SPL in iMX6 boards is restricted to 68 KB as this is the free available space
>> in OCRAM for most revisions. In this context, adding OF_CONTROL and DM
>> increases the SPL size which could make it difficult to add specific features
>> required for custom scenarios.
>>
>> These patches aim to take advantage of OF_PLATADATA in order to reduce the
>> SPL size in this scenario, by parsing DT data to generate platdata structures,
>> and thus removing the overhead caused by DT and related libraries.
>>
>> This series is focused in MMC driver, which is used for boot in boards such as
>> Cubox-i. Also, in order to support CD, the OF_PLATDATA support is also
>> implemented on GPIO driver.
> Do you have some data that how much is decreased using OF_PLATDATA?
>
Yes, I updated the commit message on Patch 6/6, but should have updated 
the cover letter. With OF_PLATDATA enabled the reduction on 
mx6cuboxi_defconfig is 5 KB, which is half of the overhead introduced by 
DM on this config. Additionally, I've in my backlog some additional 
patches for further improvements.

Regards,

Walter

>> Changes in v2:
>> - Improve commit message with footprint reduction
>>
>> Walter Lozano (6):
>>    mmc: fsl_esdhc_imx: rename driver name to match ll_entry
>>    mmc: fsl_esdhc_imx: add OF_PLATDATA support
>>    gpio: mxc_gpio: add OF_PLATDATA support
>>    mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled
>>    drivers: rename more drivers to match compatible string
>>    mx6cuboxi: enable OF_PLATDATA
>>
>>   configs/mx6cuboxi_defconfig        |  1 +
>>   drivers/gpio/mxc_gpio.c            | 18 +++++-
>>   drivers/mmc/fsl_esdhc_imx.c        | 94
>> +++++++++++++++++++++++++-----
>>   drivers/pinctrl/nxp/pinctrl-imx6.c |  6 +-
>>   drivers/video/imx/mxc_ipuv3_fb.c   |  4 +-
>>   5 files changed, 103 insertions(+), 20 deletions(-)
>>
>> --
>> 2.20.1

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

* [PATCH v2 1/6] mmc: fsl_esdhc_imx: rename driver name to match ll_entry
  2020-07-22 13:14 ` [PATCH v2 1/6] mmc: fsl_esdhc_imx: rename driver name to match ll_entry Walter Lozano
@ 2020-07-26 14:54   ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2020-07-26 14:54 UTC (permalink / raw)
  To: u-boot

On Wed, 22 Jul 2020 at 07:14, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> As discussed in commit <addf358bac1d2bd0> rename fsl_esdhc_imx
> driver to allow the OF_PLATDATA support.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>
> (no changes since v1)
>
>  drivers/mmc/fsl_esdhc_imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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

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

* [PATCH v2 2/6] mmc: fsl_esdhc_imx: add OF_PLATDATA support
  2020-07-22 13:14 ` [PATCH v2 2/6] mmc: fsl_esdhc_imx: add OF_PLATDATA support Walter Lozano
@ 2020-07-26 14:54   ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2020-07-26 14:54 UTC (permalink / raw)
  To: u-boot

On Wed, 22 Jul 2020 at 07:14, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> In order to reduce the footprint of SPL by removing dtb and library
> overhead add OF_PLATDATA support to fsl_esdhc_imx. This initial

overhead, add

> approach does not support card detection, which will be enabled after
> adding OF_PLATDATA support to GPIO.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>
> (no changes since v1)
>
>  drivers/mmc/fsl_esdhc_imx.c | 67 +++++++++++++++++++++++++++++--------
>  1 file changed, 53 insertions(+), 14 deletions(-)

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

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

* [PATCH v2 3/6] gpio: mxc_gpio: add OF_PLATDATA support
  2020-07-22 13:14 ` [PATCH v2 3/6] gpio: mxc_gpio: " Walter Lozano
@ 2020-07-26 14:54   ` Simon Glass
  2020-07-27 12:10   ` Stefano Babic
  1 sibling, 0 replies; 17+ messages in thread
From: Simon Glass @ 2020-07-26 14:54 UTC (permalink / raw)
  To: u-boot

On Wed, 22 Jul 2020 at 07:14, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> Continuing with the OF_PLATADATA support for iMX6 to reduce SPL
> footprint, add it to mxc_gpio. Thanks to this, it will be possible to
> enable card detection on MMC driver.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>
> (no changes since v1)
>
>  drivers/gpio/mxc_gpio.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)

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

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

* [PATCH v2 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled
  2020-07-22 13:14 ` [PATCH v2 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled Walter Lozano
@ 2020-07-26 14:54   ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2020-07-26 14:54 UTC (permalink / raw)
  To: u-boot

On Wed, 22 Jul 2020 at 07:15, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> After enabling OF_PLATDATA support to both MMC and GPIO drivers add the
> support for card detection.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>
> (no changes since v1)
>
>  drivers/mmc/fsl_esdhc_imx.c | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)

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

See below

>
> diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
> index f2509b5cc9..4448565b5a 100644
> --- a/drivers/mmc/fsl_esdhc_imx.c
> +++ b/drivers/mmc/fsl_esdhc_imx.c
> @@ -1498,7 +1498,32 @@ static int fsl_esdhc_probe(struct udevice *dev)
>                 priv->bus_width = 4;
>         else
>                 priv->bus_width = 1;
> -       priv->non_removable = 1;
> +
> +       if (dtplat->non_removable)
> +               priv->non_removable = 1;
> +       else
> +               priv->non_removable = 0;
> +
> +#if CONFIG_IS_ENABLED(DM_GPIO)

Can this use if() ?


> +       if (!priv->non_removable) {
> +               struct udevice *gpiodev;
> +               struct driver_info *info;
> +
> +               info = (struct driver_info *)dtplat->cd_gpios->node;
> +
> +               ret = device_get_by_driver_info(info, &gpiodev);
> +
> +               if (ret)
> +                       return ret;
> +
> +               ret = gpio_dev_request_index(gpiodev, gpiodev->name, "cd-gpios",
> +                                            dtplat->cd_gpios->arg[0], GPIOD_IS_IN,
> +                                            dtplat->cd_gpios->arg[1], &priv->cd_gpio);
> +
> +               if (ret)
> +                       return ret;
> +       }
> +#endif
>  #endif
>
>         if (data)
> --
> 2.20.1
>

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

* [PATCH v2 5/6] drivers: rename more drivers to match compatible string
  2020-07-22 13:14 ` [PATCH v2 5/6] drivers: rename more drivers to match compatible string Walter Lozano
@ 2020-07-26 14:54   ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2020-07-26 14:54 UTC (permalink / raw)
  To: u-boot

On Wed, 22 Jul 2020 at 07:15, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> Continuing with the approach in commit <addf358bac1d2bd0> rename
> additional drivers to allow the OF_PLATDATA support.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>
> (no changes since v1)
>
>  drivers/pinctrl/nxp/pinctrl-imx6.c | 6 ++++--
>  drivers/video/imx/mxc_ipuv3_fb.c   | 4 ++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
>

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

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

* [PATCH v2 6/6] mx6cuboxi: enable OF_PLATDATA
  2020-07-22 13:14 ` [PATCH v2 6/6] mx6cuboxi: enable OF_PLATDATA Walter Lozano
@ 2020-07-26 14:54   ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2020-07-26 14:54 UTC (permalink / raw)
  To: u-boot

On Wed, 22 Jul 2020 at 07:15, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> As both MMC and GPIO driver now supports OF_PLATDATA, enable it in
> defconfig in order to reduce the SPL footprint. After applying this
> setting the SPL reduction is 5 KB, which partially compensates the
> increment due to DM.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>
> Changes in v2:
> - Improve commit message with footprint reduction
>
>  configs/mx6cuboxi_defconfig | 1 +
>  1 file changed, 1 insertion(+)

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

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

* [PATCH v2 3/6] gpio: mxc_gpio: add OF_PLATDATA support
  2020-07-22 13:14 ` [PATCH v2 3/6] gpio: mxc_gpio: " Walter Lozano
  2020-07-26 14:54   ` Simon Glass
@ 2020-07-27 12:10   ` Stefano Babic
  2020-07-29 15:32     ` Walter Lozano
  1 sibling, 1 reply; 17+ messages in thread
From: Stefano Babic @ 2020-07-27 12:10 UTC (permalink / raw)
  To: u-boot

Hi Walter,

On 22.07.20 15:14, Walter Lozano wrote:
> Continuing with the OF_PLATADATA support for iMX6 to reduce SPL
> footprint, add it to mxc_gpio. Thanks to this, it will be possible to
> enable card detection on MMC driver.
> 
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
> 

This conflicts with commit 6103e570cdd0d0e854b071ee17b14589356a82bd
Author: Ye Li <ye.li@nxp.com>
Date:   Tue Jun 9 20:29:51 2020 -0700

    gpio: mxc_gpio: Improve to use ofdata_to_platdata

already mainlined. Can you take a look ? Thanks !

Best regards,
Stefano

> (no changes since v1)
> 
>  drivers/gpio/mxc_gpio.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
> index 316dcc757b..fc49b5b577 100644
> --- a/drivers/gpio/mxc_gpio.c
> +++ b/drivers/gpio/mxc_gpio.c
> @@ -13,6 +13,8 @@
>  #include <asm/arch/imx-regs.h>
>  #include <asm/gpio.h>
>  #include <asm/io.h>
> +#include <dt-structs.h>
> +#include <mapmem.h>
>  
>  enum mxc_gpio_direction {
>  	MXC_GPIO_DIRECTION_IN,
> @@ -22,6 +24,10 @@ enum mxc_gpio_direction {
>  #define GPIO_PER_BANK			32
>  
>  struct mxc_gpio_plat {
> +#if CONFIG_IS_ENABLED(OF_PLATDATA)
> +	/* Put this first since driver model will copy the data here */
> +	struct dtd_gpio_mxc dtplat;
> +#endif
>  	int bank_index;
>  	struct gpio_regs *regs;
>  };
> @@ -306,8 +312,16 @@ static int mxc_gpio_bind(struct udevice *dev)
>  	 * is statically initialized in U_BOOT_DEVICES.Here
>  	 * will return.
>  	 */
> -	if (plat)
> +
> +	if (plat) {
> +#if CONFIG_IS_ENABLED(OF_PLATDATA)
> +		struct dtd_gpio_mxc *dtplat = &plat->dtplat;
> +
> +		plat->regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
> +		plat->bank_index = dev->req_seq;
> +#endif
>  		return 0;
> +	}
>  
>  	addr = devfdt_get_addr(dev);
>  	if (addr == FDT_ADDR_T_NONE)
> @@ -350,6 +364,8 @@ U_BOOT_DRIVER(gpio_mxc) = {
>  	.bind	= mxc_gpio_bind,
>  };
>  
> +U_BOOT_DRIVER_ALIAS(gpio_mxc, fsl_imx6q_gpio)
> +
>  #if !CONFIG_IS_ENABLED(OF_CONTROL)
>  static const struct mxc_gpio_plat mxc_plat[] = {
>  	{ 0, (struct gpio_regs *)GPIO1_BASE_ADDR },
> 


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

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

* [PATCH v2 3/6] gpio: mxc_gpio: add OF_PLATDATA support
  2020-07-27 12:10   ` Stefano Babic
@ 2020-07-29 15:32     ` Walter Lozano
  0 siblings, 0 replies; 17+ messages in thread
From: Walter Lozano @ 2020-07-29 15:32 UTC (permalink / raw)
  To: u-boot

Hi Stefano,

On 27/7/20 09:10, Stefano Babic wrote:
> Hi Walter,
>
> On 22.07.20 15:14, Walter Lozano wrote:
>> Continuing with the OF_PLATADATA support for iMX6 to reduce SPL
>> footprint, add it to mxc_gpio. Thanks to this, it will be possible to
>> enable card detection on MMC driver.
>>
>> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
>> ---
>>
> This conflicts with commit 6103e570cdd0d0e854b071ee17b14589356a82bd
> Author: Ye Li <ye.li@nxp.com>
> Date:   Tue Jun 9 20:29:51 2020 -0700
>
>      gpio: mxc_gpio: Improve to use ofdata_to_platdata
>
> already mainlined. Can you take a look ? Thanks !
>
Sure, thanks for pointing at the issue. I've already sent a new version.

Regards,

Walter

>> (no changes since v1)
>>
>>   drivers/gpio/mxc_gpio.c | 18 +++++++++++++++++-
>>   1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
>> index 316dcc757b..fc49b5b577 100644
>> --- a/drivers/gpio/mxc_gpio.c
>> +++ b/drivers/gpio/mxc_gpio.c
>> @@ -13,6 +13,8 @@
>>   #include <asm/arch/imx-regs.h>
>>   #include <asm/gpio.h>
>>   #include <asm/io.h>
>> +#include <dt-structs.h>
>> +#include <mapmem.h>
>>   
>>   enum mxc_gpio_direction {
>>   	MXC_GPIO_DIRECTION_IN,
>> @@ -22,6 +24,10 @@ enum mxc_gpio_direction {
>>   #define GPIO_PER_BANK			32
>>   
>>   struct mxc_gpio_plat {
>> +#if CONFIG_IS_ENABLED(OF_PLATDATA)
>> +	/* Put this first since driver model will copy the data here */
>> +	struct dtd_gpio_mxc dtplat;
>> +#endif
>>   	int bank_index;
>>   	struct gpio_regs *regs;
>>   };
>> @@ -306,8 +312,16 @@ static int mxc_gpio_bind(struct udevice *dev)
>>   	 * is statically initialized in U_BOOT_DEVICES.Here
>>   	 * will return.
>>   	 */
>> -	if (plat)
>> +
>> +	if (plat) {
>> +#if CONFIG_IS_ENABLED(OF_PLATDATA)
>> +		struct dtd_gpio_mxc *dtplat = &plat->dtplat;
>> +
>> +		plat->regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
>> +		plat->bank_index = dev->req_seq;
>> +#endif
>>   		return 0;
>> +	}
>>   
>>   	addr = devfdt_get_addr(dev);
>>   	if (addr == FDT_ADDR_T_NONE)
>> @@ -350,6 +364,8 @@ U_BOOT_DRIVER(gpio_mxc) = {
>>   	.bind	= mxc_gpio_bind,
>>   };
>>   
>> +U_BOOT_DRIVER_ALIAS(gpio_mxc, fsl_imx6q_gpio)
>> +
>>   #if !CONFIG_IS_ENABLED(OF_CONTROL)
>>   static const struct mxc_gpio_plat mxc_plat[] = {
>>   	{ 0, (struct gpio_regs *)GPIO1_BASE_ADDR },
>>
>

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

end of thread, other threads:[~2020-07-29 15:32 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 13:14 [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
2020-07-22 13:14 ` [PATCH v2 1/6] mmc: fsl_esdhc_imx: rename driver name to match ll_entry Walter Lozano
2020-07-26 14:54   ` Simon Glass
2020-07-22 13:14 ` [PATCH v2 2/6] mmc: fsl_esdhc_imx: add OF_PLATDATA support Walter Lozano
2020-07-26 14:54   ` Simon Glass
2020-07-22 13:14 ` [PATCH v2 3/6] gpio: mxc_gpio: " Walter Lozano
2020-07-26 14:54   ` Simon Glass
2020-07-27 12:10   ` Stefano Babic
2020-07-29 15:32     ` Walter Lozano
2020-07-22 13:14 ` [PATCH v2 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled Walter Lozano
2020-07-26 14:54   ` Simon Glass
2020-07-22 13:14 ` [PATCH v2 5/6] drivers: rename more drivers to match compatible string Walter Lozano
2020-07-26 14:54   ` Simon Glass
2020-07-22 13:14 ` [PATCH v2 6/6] mx6cuboxi: enable OF_PLATDATA Walter Lozano
2020-07-26 14:54   ` Simon Glass
2020-07-23  1:34 ` [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Peng Fan
2020-07-23  2:01   ` Walter Lozano

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.