Skip to contentSkip to conversation

mmc: fsl_esdhc: make GPIO support optional

PATCH New Yangbo Lu 3 participants 11 messages Dec 7, 2016 – Jan 19, 2017

Subsystems (2)
lore
Share & tools
lore

Yangbo Lu

author
#0 lore raw

PATCH 1/4 mmc: fsl_esdhc: make GPIO support optional

There would be compiling error as below when enable driver model for esdhc. undefined reference to `dm_gpio_get_value'
undefined reference to `gpio_request_by_name_nodev'
This patch is to make GPIO support optional with CONFIG_DM_GPIO. Because all boards of QorIQ platform don't need it and they just check register for CD/WP status, only some boards of i.MX platform require this.

---
 drivers/mmc/fsl_esdhc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c +8 -2
index 9796d39..da3a151 100644
@@ -104,8 +104,10 @@ struct fsl_esdhc_priv {
 	struct udevice *dev;
 	int non_removable;
 	int wp_enable;
+#ifdef CONFIG_DM_GPIO
 	struct gpio_desc cd_gpio;
 	struct gpio_desc wp_gpio;
+#endif
 };
 
 /* Return the XFERTYP flags for a given command and data packet */
@@ -687,10 +689,11 @@ static int esdhc_getcd(struct mmc *mmc)
 #ifdef CONFIG_DM_MMC
 	if (priv->non_removable)
 		return 1;
-
+#ifdef CONFIG_DM_GPIO
 	if (dm_gpio_is_valid(&priv->cd_gpio))
 		return dm_gpio_get_value(&priv->cd_gpio);
 #endif
+#endif
 
 	while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_CINS) && --timeout)
 		udelay(1000);
@@ -967,17 +970,20 @@ static int fsl_esdhc_probe(struct udevice *dev)
 		priv->non_removable = 1;
 	 } else {
 		priv->non_removable = 0;
+#ifdef CONFIG_DM_GPIO
 		gpio_request_by_name_nodev(fdt, node, "cd-gpios", 0,
 					   &priv->cd_gpio, GPIOD_IS_IN);
+#endif
 	}
 
 	priv->wp_enable = 1;
 
+#ifdef CONFIG_DM_GPIO
 	ret = gpio_request_by_name_nodev(fdt, node, "wp-gpios", 0,
 					 &priv->wp_gpio, GPIOD_IS_IN);
 	if (ret)
 		priv->wp_enable = 0;
-
+#endif
 	/*
 	 * TODO:
 	 * Because lack of clk driver, if SDHC clk is not enabled,
Signature · 1 line
2.1.0.27.g96db324
author
#1 lore raw

PATCH 2/4 mmc: fsl_esdhc: add 'fsl, esdhc' into of_match table

This patch is to add 'fsl,esdhc' into of_match table to support driver model for QorIQ eSDHC.

---
 drivers/mmc/fsl_esdhc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/fsl_esdhc.c +1 -0
index da3a151..0ae1cfd 100644
@@ -1027,6 +1027,7 @@ static const struct udevice_id fsl_esdhc_ids[] = {
 	{ .compatible = "fsl,imx6sl-usdhc", },
 	{ .compatible = "fsl,imx6q-usdhc", },
 	{ .compatible = "fsl,imx7d-usdhc", },
+	{ .compatible = "fsl,esdhc", },
 	{ /* sentinel */ }
 };
 
Signature · 1 line
2.1.0.27.g96db324
author
#2 lore raw

PATCH 3/4 armv8: ls1012a: add eSDHC nodes

In reply to Yangbo Lu

This patch is to add eSDHC nodes for ls1012a.

---
 arch/arm/dts/fsl-ls1012a.dtsi | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm/dts/fsl-ls1012a.dtsi +17 -0
index 024527e..f8b341d 100644
@@ -103,5 +103,22 @@
 			status = "disabled";
 		};
 
+		esdhc0: esdhc at 1560000 {
+			compatible = "fsl,esdhc";
+			reg = <0x0 0x1560000 0x0 0x10000>;
+			interrupts = <0 62 0x4>;
+			big-endian;
+			bus-width = <4>;
+		};
+
+		esdhc1: esdhc at 1580000 {
+			compatible = "fsl,esdhc";
+			reg = <0x0 0x1580000 0x0 0x10000>;
+			interrupts = <0 65 0x4>;
+			big-endian;
+			non-removable;
+			bus-width = <4>;
+		};
+
 	};
 };
Signature · 1 line
2.1.0.27.g96db324
author
#3 lore raw

PATCH 4/4 configs: ls1012a: enable driver model for eSDHC

In reply to Yangbo Lu

Enable driver model for eSDHC on ls1012a rdb and qds boards.

---
 configs/ls1012aqds_qspi_defconfig | 3 +++
 configs/ls1012ardb_qspi_defconfig | 3 +++
 2 files changed, 6 insertions(+)
configs/ls1012aqds_qspi_defconfig +3 -0
index 27bccd1..7b015a0 100644
@@ -33,6 +33,9 @@ CONFIG_E1000=y
 CONFIG_PCI=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
+CONFIG_DM_MMC=y
+CONFIG_DM_MMC_OPS=n
+CONFIG_BLK=n
 CONFIG_FSL_DSPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
configs/ls1012ardb_qspi_defconfig +3 -0
index 459682d..d86cb0f 100644
@@ -33,6 +33,9 @@ CONFIG_E1000=y
 CONFIG_PCI=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
+CONFIG_DM_MMC=y
+CONFIG_DM_MMC_OPS=n
+CONFIG_BLK=n
 CONFIG_FSL_DSPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
Signature · 1 line
2.1.0.27.g96db324
#4 lore raw

PATCH 1/4 mmc: fsl_esdhc: make GPIO support optional

In reply to Yangbo Lu
Quoted 53 lines · Yangbo Lu

There would be compiling error as below when enable driver model for esdhc. undefined reference to `dm_gpio_get_value'
undefined reference to `gpio_request_by_name_nodev'
This patch is to make GPIO support optional with CONFIG_DM_GPIO. Because all boards of QorIQ platform don't need it and they just check register for CD/WP status, only some boards of i.MX platform require this.

---
 drivers/mmc/fsl_esdhc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c +6 -1
index 9796d39..da3a151 100644
@@ -104,8 +104,10 @@ struct fsl_esdhc_priv {
 	struct udevice *dev;
 	int non_removable;
 	int wp_enable;
+#ifdef CONFIG_DM_GPIO
 	struct gpio_desc cd_gpio;
 	struct gpio_desc wp_gpio;
+#endif
 };
 
 /* Return the XFERTYP flags for a given command and data packet */
@@ -687,10 +689,11 @@ static int esdhc_getcd(struct mmc *mmc)
 #ifdef CONFIG_DM_MMC
 	if (priv->non_removable)
 		return 1;
-
+#ifdef CONFIG_DM_GPIO
 	if (dm_gpio_is_valid(&priv->cd_gpio))
 		return dm_gpio_get_value(&priv->cd_gpio);
 #endif
+#endif
 
 	while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_CINS) && --timeout)
 		udelay(1000);
@@ -967,17 +970,20 @@ static int fsl_esdhc_probe(struct udevice *dev)
 		priv->non_removable = 1;
 	 } else {
 		priv->non_removable = 0;
+#ifdef CONFIG_DM_GPIO
 		gpio_request_by_name_nodev(fdt, node, "cd-gpios", 0,
 					   &priv->cd_gpio, GPIOD_IS_IN);
+#endif
 	}
 
 	priv->wp_enable = 1;
 

drivers/mmc/fsl_esdhc.c static int fsl_esdhc_probe(struct udevice *dev) · line 989

Quoted 10 lines
drivers/mmc/fsl_esdhc.c +2 -1
+#ifdef CONFIG_DM_GPIO
 	ret = gpio_request_by_name_nodev(fdt, node, "wp-gpios", 0,
 					 &priv->wp_gpio, GPIOD_IS_IN);
 	if (ret)
 		priv->wp_enable = 0;
-
+#endif
 	/*
 	 * TODO:
 	 * Because lack of clk driver, if SDHC clk is not enabled,

Jaehoon,

This set looks OK to me. Please review and comment. I can merge it with your ack.

Yangbo,

For MMC or SD patches, please CC Jaehoon.

York

#5 lore raw

PATCH 1/4 mmc: fsl_esdhc: make GPIO support optional

Hi,

Quoted 67 lines · york sun
Quoted 53 lines · Yangbo Lu

There would be compiling error as below when enable driver model for esdhc. undefined reference to `dm_gpio_get_value'
undefined reference to `gpio_request_by_name_nodev'
This patch is to make GPIO support optional with CONFIG_DM_GPIO. Because all boards of QorIQ platform don't need it and they just check register for CD/WP status, only some boards of i.MX platform require this.

---
 drivers/mmc/fsl_esdhc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c +6 -1
index 9796d39..da3a151 100644
@@ -104,8 +104,10 @@ struct fsl_esdhc_priv {
 	struct udevice *dev;
 	int non_removable;
 	int wp_enable;
+#ifdef CONFIG_DM_GPIO
 	struct gpio_desc cd_gpio;
 	struct gpio_desc wp_gpio;
+#endif
 };
 
 /* Return the XFERTYP flags for a given command and data packet */
@@ -687,10 +689,11 @@ static int esdhc_getcd(struct mmc *mmc)
 #ifdef CONFIG_DM_MMC
 	if (priv->non_removable)
 		return 1;
-
+#ifdef CONFIG_DM_GPIO
 	if (dm_gpio_is_valid(&priv->cd_gpio))
 		return dm_gpio_get_value(&priv->cd_gpio);
 #endif
+#endif
 
 	while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_CINS) && --timeout)
 		udelay(1000);
@@ -967,17 +970,20 @@ static int fsl_esdhc_probe(struct udevice *dev)
 		priv->non_removable = 1;
 	 } else {
 		priv->non_removable = 0;
+#ifdef CONFIG_DM_GPIO
 		gpio_request_by_name_nodev(fdt, node, "cd-gpios", 0,
 					   &priv->cd_gpio, GPIOD_IS_IN);
+#endif
 	}
 
 	priv->wp_enable = 1;
 

drivers/mmc/fsl_esdhc.c static int fsl_esdhc_probe(struct udevice *dev) · line 989

Quoted 10 lines
drivers/mmc/fsl_esdhc.c +2 -1
+#ifdef CONFIG_DM_GPIO
 	ret = gpio_request_by_name_nodev(fdt, node, "wp-gpios", 0,
 					 &priv->wp_gpio, GPIOD_IS_IN);
 	if (ret)
 		priv->wp_enable = 0;
-
+#endif
 	/*
 	 * TODO:
 	 * Because lack of clk driver, if SDHC clk is not enabled,

Jaehoon,

Quoted 2 lines

This set looks OK to me. Please review and comment. I can merge it with your ack.

Sorry for late. I missed this patch. It looks good to me.

Best Regards,
Jaehoon Chung

Quoted 9 lines

Yangbo,

For MMC or SD patches, please CC Jaehoon.

York

author
#9 lore raw

PATCH 1/4 mmc: fsl_esdhc: make GPIO support optional

In reply to york sun
Quoted 76 lines

-----Original Message-----
From: york sun
Sent: Thursday, January 05, 2017 3:52 AM
To: Y.B. Lu
Cc: u-boot at lists.denx.de; Jaehoon Chung
Subject: Re: [PATCH 1/4] mmc: fsl_esdhc: make GPIO support optional

Quoted 1 line · Yangbo Lu

There would be compiling error as below when enable driver model for

esdhc.

Quoted 5 lines

undefined reference to `dm_gpio_get_value'
undefined reference to `gpio_request_by_name_nodev'
This patch is to make GPIO support optional with CONFIG_DM_GPIO. Because all boards of QorIQ platform don't need it and they just check register for CD/WP status, only some boards of i.MX platform require

this.

Quoted 47 lines
---
 drivers/mmc/fsl_esdhc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0 -0

9796d39..da3a151 100644

drivers/mmc/fsl_esdhc.c +2 -1
@@ -104,8 +104,10 @@ struct fsl_esdhc_priv {
 	struct udevice *dev;
 	int non_removable;
 	int wp_enable;
+#ifdef CONFIG_DM_GPIO
 	struct gpio_desc cd_gpio;
 	struct gpio_desc wp_gpio;
+#endif
 };
 
 /* Return the XFERTYP flags for a given command and data packet */ @@
-687,10 +689,11 @@ static int esdhc_getcd(struct mmc *mmc)  #ifdef

CONFIG_DM_MMC

drivers/mmc/fsl_esdhc.c +4 -1
 	if (priv->non_removable)
 		return 1;
-
+#ifdef CONFIG_DM_GPIO
 	if (dm_gpio_is_valid(&priv->cd_gpio))
 		return dm_gpio_get_value(&priv->cd_gpio);
 #endif
+#endif
 
 	while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_CINS) && --timeout)
 		udelay(1000);
@@ -967,17 +970,20 @@ static int fsl_esdhc_probe(struct udevice *dev)
 		priv->non_removable = 1;
 	 } else {
 		priv->non_removable = 0;
+#ifdef CONFIG_DM_GPIO
 		gpio_request_by_name_nodev(fdt, node, "cd-gpios", 0,
 					   &priv->cd_gpio, GPIOD_IS_IN);
+#endif
 	}
 
 	priv->wp_enable = 1;
 

drivers/mmc/fsl_esdhc.c static int fsl_esdhc_probe(struct udevice *dev) · line 989

Quoted 10 lines
drivers/mmc/fsl_esdhc.c +2 -1
+#ifdef CONFIG_DM_GPIO
 	ret = gpio_request_by_name_nodev(fdt, node, "wp-gpios", 0,
 					 &priv->wp_gpio, GPIOD_IS_IN);
 	if (ret)
 		priv->wp_enable = 0;
-
+#endif
 	/*
 	 * TODO:
 	 * Because lack of clk driver, if SDHC clk is not enabled,

Jaehoon,

Quoted 6 lines

This set looks OK to me. Please review and comment. I can merge it with your ack.

Yangbo,

For MMC or SD patches, please CC Jaehoon.

[Lu Yangbo-B47093] Ok, York. And sorry for that.

Quoted 2 lines

York

author
#6 lore raw

PATCH 1/4 mmc: fsl_esdhc: make GPIO support optional

In reply to Jaehoon Chung
Quoted 79 lines

-----Original Message-----
From: Jaehoon Chung [mailto:jh80.chung at samsung.com]
Sent: Thursday, January 05, 2017 8:33 AM
To: york sun; Y.B. Lu
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH 1/4] mmc: fsl_esdhc: make GPIO support optional

Hi,

Quoted 2 lines · york sun
Quoted 1 line · Yangbo Lu

There would be compiling error as below when enable driver model for

esdhc.

Quoted 5 lines
Quoted 5 lines

undefined reference to `dm_gpio_get_value'
undefined reference to `gpio_request_by_name_nodev' This patch is to make GPIO support optional with CONFIG_DM_GPIO. Because all boards of QorIQ platform don't need it and they just check register for CD/WP status, only some boards of i.MX platform

require this.

Quoted 60 lines
Quoted 47 lines
---
 drivers/mmc/fsl_esdhc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0 -0

9796d39..da3a151 100644

drivers/mmc/fsl_esdhc.c +2 -0
@@ -104,8 +104,10 @@ struct fsl_esdhc_priv {
 	struct udevice *dev;
 	int non_removable;
 	int wp_enable;
+#ifdef CONFIG_DM_GPIO
 	struct gpio_desc cd_gpio;
 	struct gpio_desc wp_gpio;
+#endif
 };
 
 /* Return the XFERTYP flags for a given command and data packet */
@@ -687,10 +689,11 @@ static int esdhc_getcd(struct mmc *mmc)  #ifdef

CONFIG_DM_MMC

drivers/mmc/fsl_esdhc.c +4 -1
 	if (priv->non_removable)
 		return 1;
-
+#ifdef CONFIG_DM_GPIO
 	if (dm_gpio_is_valid(&priv->cd_gpio))
 		return dm_gpio_get_value(&priv->cd_gpio);
 #endif
+#endif
 
 	while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_CINS) && --timeout)
 		udelay(1000);
@@ -967,17 +970,20 @@ static int fsl_esdhc_probe(struct udevice *dev)
 		priv->non_removable = 1;
 	 } else {
 		priv->non_removable = 0;
+#ifdef CONFIG_DM_GPIO
 		gpio_request_by_name_nodev(fdt, node, "cd-gpios", 0,
 					   &priv->cd_gpio, GPIOD_IS_IN);
+#endif
 	}
 
 	priv->wp_enable = 1;
 

drivers/mmc/fsl_esdhc.c static int fsl_esdhc_probe(struct udevice *dev) · line 989

Quoted 10 lines
drivers/mmc/fsl_esdhc.c +2 -1
+#ifdef CONFIG_DM_GPIO
 	ret = gpio_request_by_name_nodev(fdt, node, "wp-gpios", 0,
 					 &priv->wp_gpio, GPIOD_IS_IN);
 	if (ret)
 		priv->wp_enable = 0;
-
+#endif
 	/*
 	 * TODO:
 	 * Because lack of clk driver, if SDHC clk is not enabled,

Jaehoon,

Quoted 6 lines
Quoted 2 lines

This set looks OK to me. Please review and comment. I can merge it with your ack.

Sorry for late. I missed this patch. It looks good to me.

[Lu Yangbo-B47093] Thanks a lot for your reviewing, Jaehoon :)

Quoted 13 lines

Best Regards,
Jaehoon Chung

Quoted 9 lines

Yangbo,

For MMC or SD patches, please CC Jaehoon.

York

author
#7 lore raw

PATCH 1/4 mmc: fsl_esdhc: make GPIO support optional

In reply to Jaehoon Chung

Hi York,

Could you help to merge this patchset if there is no any changes needed? Thanks :)

Best regards,
Yangbo Lu

Quoted 98 lines

-----Original Message-----
From: Jaehoon Chung [mailto:jh80.chung at samsung.com]
Sent: Thursday, January 05, 2017 8:33 AM
To: york sun; Y.B. Lu
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH 1/4] mmc: fsl_esdhc: make GPIO support optional

Hi,

Quoted 2 lines · york sun
Quoted 1 line · Yangbo Lu

There would be compiling error as below when enable driver model for

esdhc.

Quoted 5 lines
Quoted 5 lines

undefined reference to `dm_gpio_get_value'
undefined reference to `gpio_request_by_name_nodev' This patch is to make GPIO support optional with CONFIG_DM_GPIO. Because all boards of QorIQ platform don't need it and they just check register for CD/WP status, only some boards of i.MX platform

require this.

Quoted 60 lines
Quoted 47 lines
---
 drivers/mmc/fsl_esdhc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0 -0

9796d39..da3a151 100644

drivers/mmc/fsl_esdhc.c +2 -0
@@ -104,8 +104,10 @@ struct fsl_esdhc_priv {
 	struct udevice *dev;
 	int non_removable;
 	int wp_enable;
+#ifdef CONFIG_DM_GPIO
 	struct gpio_desc cd_gpio;
 	struct gpio_desc wp_gpio;
+#endif
 };
 
 /* Return the XFERTYP flags for a given command and data packet */
@@ -687,10 +689,11 @@ static int esdhc_getcd(struct mmc *mmc)  #ifdef

CONFIG_DM_MMC

drivers/mmc/fsl_esdhc.c +4 -1
 	if (priv->non_removable)
 		return 1;
-
+#ifdef CONFIG_DM_GPIO
 	if (dm_gpio_is_valid(&priv->cd_gpio))
 		return dm_gpio_get_value(&priv->cd_gpio);
 #endif
+#endif
 
 	while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_CINS) && --timeout)
 		udelay(1000);
@@ -967,17 +970,20 @@ static int fsl_esdhc_probe(struct udevice *dev)
 		priv->non_removable = 1;
 	 } else {
 		priv->non_removable = 0;
+#ifdef CONFIG_DM_GPIO
 		gpio_request_by_name_nodev(fdt, node, "cd-gpios", 0,
 					   &priv->cd_gpio, GPIOD_IS_IN);
+#endif
 	}
 
 	priv->wp_enable = 1;
 

drivers/mmc/fsl_esdhc.c static int fsl_esdhc_probe(struct udevice *dev) · line 989

Quoted 10 lines
drivers/mmc/fsl_esdhc.c +2 -1
+#ifdef CONFIG_DM_GPIO
 	ret = gpio_request_by_name_nodev(fdt, node, "wp-gpios", 0,
 					 &priv->wp_gpio, GPIOD_IS_IN);
 	if (ret)
 		priv->wp_enable = 0;
-
+#endif
 	/*
 	 * TODO:
 	 * Because lack of clk driver, if SDHC clk is not enabled,

Jaehoon,

Quoted 2 lines

This set looks OK to me. Please review and comment. I can merge it with your ack.

Sorry for late. I missed this patch. It looks good to me.

Best Regards,
Jaehoon Chung

Quoted 9 lines

Yangbo,

For MMC or SD patches, please CC Jaehoon.

York

#8 lore raw

PATCH 1/4 mmc: fsl_esdhc: make GPIO support optional

Quoted 5 lines · Y.B. Lu

Hi York,

Could you help to merge this patchset if there is no any changes needed? Thanks :)

It's in my queue.

York

#10 lore raw

PATCH 1/4 mmc: fsl_esdhc: make GPIO support optional

In reply to Yangbo Lu
Quoted 9 lines · Yangbo Lu

There would be compiling error as below when enable driver model for esdhc. undefined reference to `dm_gpio_get_value'
undefined reference to `gpio_request_by_name_nodev'
This patch is to make GPIO support optional with CONFIG_DM_GPIO. Because all boards of QorIQ platform don't need it and they just check register for CD/WP status, only some boards of i.MX platform require this.

---

This set is applied to fsl-qoriq master, awaiting upstream. Thanks.

York