All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mmc: fsl_esdhc_imx: Handle the "broken-cd" property
@ 2020-01-06 23:11 Fabio Estevam
  2020-01-06 23:11 ` [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass " Fabio Estevam
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Fabio Estevam @ 2020-01-06 23:11 UTC (permalink / raw)
  To: u-boot

When no GPIO is used to read the card detect status the following
error is seen:

MMC:   FSL_SDHC: 0, FSL_SDHC: 1                                                 
Loading Environment from MMC... MMC: no card present                           
*** Warning - No block device, using default environment 

Fix it by handling the "broken-cd" property in the same way
that drivers/mmc/sdhci.c does, which considers that the SD card
is present when the "broken-cd" property is passed.

Tested on a imx6ul-evk board.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/mmc/fsl_esdhc_imx.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index f1afab742d..7d465ef76b 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -115,6 +115,7 @@ struct esdhc_soc_data {
  * Following is used when Driver Model is enabled for MMC
  * @dev: pointer for the device
  * @non_removable: 0: removable; 1: non-removable
+ * @broken_cd: 0: use GPIO for card detect; 1: Do not use GPIO for card detect
  * @wp_enable: 1: enable checking wp; 0: no check
  * @vs18_enable: 1: use 1.8V voltage; 0: use 3.3V
  * @flags: ESDHC_FLAG_xx in include/fsl_esdhc_imx.h
@@ -138,6 +139,7 @@ struct fsl_esdhc_priv {
 #endif
 	struct udevice *dev;
 	int non_removable;
+	int broken_cd;
 	int wp_enable;
 	int vs18_enable;
 	u32 flags;
@@ -1092,6 +1094,9 @@ static int esdhc_getcd_common(struct fsl_esdhc_priv *priv)
 #if CONFIG_IS_ENABLED(DM_MMC)
 	if (priv->non_removable)
 		return 1;
+
+	if (priv->broken_cd)
+		return 1;
 #ifdef CONFIG_DM_GPIO
 	if (dm_gpio_is_valid(&priv->cd_gpio))
 		return dm_gpio_get_value(&priv->cd_gpio);
@@ -1450,6 +1455,9 @@ static int fsl_esdhc_probe(struct udevice *dev)
 			     ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT);
 	priv->strobe_dll_delay_target = val;
 
+	if (dev_read_bool(dev, "broken-cd"))
+		priv->broken_cd = 1;
+
 	if (dev_read_bool(dev, "non-removable")) {
 		priv->non_removable = 1;
 	 } else {
-- 
2.17.1

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

* [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass the "broken-cd" property
  2020-01-06 23:11 [PATCH 1/2] mmc: fsl_esdhc_imx: Handle the "broken-cd" property Fabio Estevam
@ 2020-01-06 23:11 ` Fabio Estevam
  2020-01-07 14:19   ` Stefano Babic
                     ` (2 more replies)
  2020-01-07 14:19 ` [PATCH 1/2] mmc: fsl_esdhc_imx: Handle " Stefano Babic
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 10+ messages in thread
From: Fabio Estevam @ 2020-01-06 23:11 UTC (permalink / raw)
  To: u-boot

imx6ul-14x14-evk does not have a GPIO dedicated for reading the card
detect pin on the eSDHC2 port. In such cases the "broken-cd" property
must be passed, otherwise the card cannot be detected.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 arch/arm/dts/imx6ul-14x14-evk.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/imx6ul-14x14-evk.dtsi b/arch/arm/dts/imx6ul-14x14-evk.dtsi
index d1baf0f081..463d7ca124 100644
--- a/arch/arm/dts/imx6ul-14x14-evk.dtsi
+++ b/arch/arm/dts/imx6ul-14x14-evk.dtsi
@@ -268,6 +268,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_usdhc2>;
 	no-1-8-v;
+	broken-cd;
 	keep-power-in-suspend;
 	wakeup-source;
 	status = "okay";
-- 
2.17.1

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

* [PATCH 1/2] mmc: fsl_esdhc_imx: Handle the "broken-cd" property
  2020-01-06 23:11 [PATCH 1/2] mmc: fsl_esdhc_imx: Handle the "broken-cd" property Fabio Estevam
  2020-01-06 23:11 ` [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass " Fabio Estevam
@ 2020-01-07 14:19 ` Stefano Babic
  2020-01-14 18:52 ` Fabio Estevam
  2020-01-15 12:47 ` sbabic at denx.de
  3 siblings, 0 replies; 10+ messages in thread
From: Stefano Babic @ 2020-01-07 14:19 UTC (permalink / raw)
  To: u-boot

On 07/01/20 00:11, Fabio Estevam wrote:
> When no GPIO is used to read the card detect status the following
> error is seen:
> 
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1                                                 
> Loading Environment from MMC... MMC: no card present                           
> *** Warning - No block device, using default environment 
> 
> Fix it by handling the "broken-cd" property in the same way
> that drivers/mmc/sdhci.c does, which considers that the SD card
> is present when the "broken-cd" property is passed.
> 
> Tested on a imx6ul-evk board.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
>  drivers/mmc/fsl_esdhc_imx.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
> index f1afab742d..7d465ef76b 100644
> --- a/drivers/mmc/fsl_esdhc_imx.c
> +++ b/drivers/mmc/fsl_esdhc_imx.c
> @@ -115,6 +115,7 @@ struct esdhc_soc_data {
>   * Following is used when Driver Model is enabled for MMC
>   * @dev: pointer for the device
>   * @non_removable: 0: removable; 1: non-removable
> + * @broken_cd: 0: use GPIO for card detect; 1: Do not use GPIO for card detect
>   * @wp_enable: 1: enable checking wp; 0: no check
>   * @vs18_enable: 1: use 1.8V voltage; 0: use 3.3V
>   * @flags: ESDHC_FLAG_xx in include/fsl_esdhc_imx.h
> @@ -138,6 +139,7 @@ struct fsl_esdhc_priv {
>  #endif
>  	struct udevice *dev;
>  	int non_removable;
> +	int broken_cd;
>  	int wp_enable;
>  	int vs18_enable;
>  	u32 flags;
> @@ -1092,6 +1094,9 @@ static int esdhc_getcd_common(struct fsl_esdhc_priv *priv)
>  #if CONFIG_IS_ENABLED(DM_MMC)
>  	if (priv->non_removable)
>  		return 1;
> +
> +	if (priv->broken_cd)
> +		return 1;
>  #ifdef CONFIG_DM_GPIO
>  	if (dm_gpio_is_valid(&priv->cd_gpio))
>  		return dm_gpio_get_value(&priv->cd_gpio);
> @@ -1450,6 +1455,9 @@ static int fsl_esdhc_probe(struct udevice *dev)
>  			     ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT);
>  	priv->strobe_dll_delay_target = val;
>  
> +	if (dev_read_bool(dev, "broken-cd"))
> +		priv->broken_cd = 1;
> +
>  	if (dev_read_bool(dev, "non-removable")) {
>  		priv->non_removable = 1;
>  	 } else {
> 

Reviewed-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic

-- 
=====================================================================
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] 10+ messages in thread

* [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass the "broken-cd" property
  2020-01-06 23:11 ` [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass " Fabio Estevam
@ 2020-01-07 14:19   ` Stefano Babic
  2020-01-08  1:12   ` Peng Fan
  2020-01-15 12:47   ` sbabic at denx.de
  2 siblings, 0 replies; 10+ messages in thread
From: Stefano Babic @ 2020-01-07 14:19 UTC (permalink / raw)
  To: u-boot

On 07/01/20 00:11, Fabio Estevam wrote:
> imx6ul-14x14-evk does not have a GPIO dedicated for reading the card
> detect pin on the eSDHC2 port. In such cases the "broken-cd" property
> must be passed, otherwise the card cannot be detected.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
>  arch/arm/dts/imx6ul-14x14-evk.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/dts/imx6ul-14x14-evk.dtsi b/arch/arm/dts/imx6ul-14x14-evk.dtsi
> index d1baf0f081..463d7ca124 100644
> --- a/arch/arm/dts/imx6ul-14x14-evk.dtsi
> +++ b/arch/arm/dts/imx6ul-14x14-evk.dtsi
> @@ -268,6 +268,7 @@
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&pinctrl_usdhc2>;
>  	no-1-8-v;
> +	broken-cd;
>  	keep-power-in-suspend;
>  	wakeup-source;
>  	status = "okay";
> 

Reviewed-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic

-- 
=====================================================================
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] 10+ messages in thread

* [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass the "broken-cd" property
  2020-01-06 23:11 ` [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass " Fabio Estevam
  2020-01-07 14:19   ` Stefano Babic
@ 2020-01-08  1:12   ` Peng Fan
  2020-01-08  1:13     ` Fabio Estevam
  2020-01-15 12:47   ` sbabic at denx.de
  2 siblings, 1 reply; 10+ messages in thread
From: Peng Fan @ 2020-01-08  1:12 UTC (permalink / raw)
  To: u-boot

Hi Fabio,

> Subject: [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass the "broken-cd"
> property
> 
> imx6ul-14x14-evk does not have a GPIO dedicated for reading the card detect
> pin on the eSDHC2 port. In such cases the "broken-cd" property must be
> passed, otherwise the card cannot be detected.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
>  arch/arm/dts/imx6ul-14x14-evk.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/dts/imx6ul-14x14-evk.dtsi
> b/arch/arm/dts/imx6ul-14x14-evk.dtsi
> index d1baf0f081..463d7ca124 100644
> --- a/arch/arm/dts/imx6ul-14x14-evk.dtsi
> +++ b/arch/arm/dts/imx6ul-14x14-evk.dtsi
> @@ -268,6 +268,7 @@
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&pinctrl_usdhc2>;
>  	no-1-8-v;
> +	broken-cd;

Has this been in Kernel dts?

Thanks,
Peng.

>  	keep-power-in-suspend;
>  	wakeup-source;
>  	status = "okay";
> --
> 2.17.1

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

* [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass the "broken-cd" property
  2020-01-08  1:12   ` Peng Fan
@ 2020-01-08  1:13     ` Fabio Estevam
  2020-01-09 12:01       ` Fabio Estevam
  0 siblings, 1 reply; 10+ messages in thread
From: Fabio Estevam @ 2020-01-08  1:13 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On Tue, Jan 7, 2020 at 10:12 PM Peng Fan <peng.fan@nxp.com> wrote:

> Has this been in Kernel dts?

I have sent a patch to add 'broken-cd' in the kernel dts:
http://lists.infradead.org/pipermail/linux-arm-kernel/2020-January/703473.html

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

* [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass the "broken-cd" property
  2020-01-08  1:13     ` Fabio Estevam
@ 2020-01-09 12:01       ` Fabio Estevam
  0 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2020-01-09 12:01 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On Tue, Jan 7, 2020 at 10:13 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> Hi Peng,
>
> On Tue, Jan 7, 2020 at 10:12 PM Peng Fan <peng.fan@nxp.com> wrote:
>
> > Has this been in Kernel dts?
>
> I have sent a patch to add 'broken-cd' in the kernel dts:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2020-January/703473.html

Just to let you know that the dts patch has been applied:
https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/commit/?h=for-next&id=3b49b6cde5136972dfa417112a11583a6924204a

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

* [PATCH 1/2] mmc: fsl_esdhc_imx: Handle the "broken-cd" property
  2020-01-06 23:11 [PATCH 1/2] mmc: fsl_esdhc_imx: Handle the "broken-cd" property Fabio Estevam
  2020-01-06 23:11 ` [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass " Fabio Estevam
  2020-01-07 14:19 ` [PATCH 1/2] mmc: fsl_esdhc_imx: Handle " Stefano Babic
@ 2020-01-14 18:52 ` Fabio Estevam
  2020-01-15 12:47 ` sbabic at denx.de
  3 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2020-01-14 18:52 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On Mon, Jan 6, 2020 at 8:11 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> When no GPIO is used to read the card detect status the following
> error is seen:
>
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
> Loading Environment from MMC... MMC: no card present
> *** Warning - No block device, using default environment
>
> Fix it by handling the "broken-cd" property in the same way
> that drivers/mmc/sdhci.c does, which considers that the SD card
> is present when the "broken-cd" property is passed.
>
> Tested on a imx6ul-evk board.
>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Any comments about this series, please?

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

* [PATCH 1/2] mmc: fsl_esdhc_imx: Handle the "broken-cd" property
  2020-01-06 23:11 [PATCH 1/2] mmc: fsl_esdhc_imx: Handle the "broken-cd" property Fabio Estevam
                   ` (2 preceding siblings ...)
  2020-01-14 18:52 ` Fabio Estevam
@ 2020-01-15 12:47 ` sbabic at denx.de
  3 siblings, 0 replies; 10+ messages in thread
From: sbabic at denx.de @ 2020-01-15 12:47 UTC (permalink / raw)
  To: u-boot

> When no GPIO is used to read the card detect status the following
> error is seen:
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1                                                 
> Loading Environment from MMC... MMC: no card present                           
> *** Warning - No block device, using default environment 
> Fix it by handling the "broken-cd" property in the same way
> that drivers/mmc/sdhci.c does, which considers that the SD card
> is present when the "broken-cd" property is passed.
> Tested on a imx6ul-evk board.
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> Reviewed-by: Stefano Babic <sbabic@denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
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] 10+ messages in thread

* [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass the "broken-cd" property
  2020-01-06 23:11 ` [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass " Fabio Estevam
  2020-01-07 14:19   ` Stefano Babic
  2020-01-08  1:12   ` Peng Fan
@ 2020-01-15 12:47   ` sbabic at denx.de
  2 siblings, 0 replies; 10+ messages in thread
From: sbabic at denx.de @ 2020-01-15 12:47 UTC (permalink / raw)
  To: u-boot

> imx6ul-14x14-evk does not have a GPIO dedicated for reading the card
> detect pin on the eSDHC2 port. In such cases the "broken-cd" property
> must be passed, otherwise the card cannot be detected.
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> Reviewed-by: Stefano Babic <sbabic@denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
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] 10+ messages in thread

end of thread, other threads:[~2020-01-15 12:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06 23:11 [PATCH 1/2] mmc: fsl_esdhc_imx: Handle the "broken-cd" property Fabio Estevam
2020-01-06 23:11 ` [PATCH 2/2] ARM: dts: imx6ul-14x14-evk: Pass " Fabio Estevam
2020-01-07 14:19   ` Stefano Babic
2020-01-08  1:12   ` Peng Fan
2020-01-08  1:13     ` Fabio Estevam
2020-01-09 12:01       ` Fabio Estevam
2020-01-15 12:47   ` sbabic at denx.de
2020-01-07 14:19 ` [PATCH 1/2] mmc: fsl_esdhc_imx: Handle " Stefano Babic
2020-01-14 18:52 ` Fabio Estevam
2020-01-15 12:47 ` sbabic at denx.de

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.