All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O
@ 2017-05-08  7:02 Peng Fan
  2017-05-08  7:02 ` [U-Boot] [PATCH V2 2/4] dm: mmc: fsl_esdhc: handle vqmmc supply Peng Fan
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Peng Fan @ 2017-05-08  7:02 UTC (permalink / raw)
  To: u-boot

When using eMMC with 1.8V I/O, the VSELECT bit need to be set in
the USDHC controller when init.

This patch adds a parameter "vs18_enable" in fsl_esdhc_cfg
structure and priv data, so each controller can have different
settings.

We could not use CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT, it has problem
that it will apply to all USDHC controllers and it only set the 1.8V
at init phase. So if user does not select to the eMMC device,
the voltage on the I/O pins are not correct.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
---

V2: None

 drivers/mmc/fsl_esdhc.c | 9 +++++++++
 include/fsl_esdhc.h     | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index f3c6358..bddfe24 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -92,6 +92,7 @@ struct fsl_esdhc {
  * @dev: pointer for the device
  * @non_removable: 0: removable; 1: non-removable
  * @wp_enable: 1: enable checking wp; 0: no check
+ * @vs18_enable: 1: use 1.8V voltage; 0: use 3.3V
  * @cd_gpio: gpio for card detection
  * @wp_gpio: gpio for write protection
  */
@@ -104,6 +105,7 @@ struct fsl_esdhc_priv {
 	struct udevice *dev;
 	int non_removable;
 	int wp_enable;
+	int vs18_enable;
 #ifdef CONFIG_DM_GPIO
 	struct gpio_desc cd_gpio;
 	struct gpio_desc wp_gpio;
@@ -673,6 +675,9 @@ static int esdhc_init(struct mmc *mmc)
 	esdhc_setbits32(&regs->vendorspec, ESDHC_VENDORSPEC_VSELECT);
 #endif
 
+	if (priv->vs18_enable)
+		esdhc_setbits32(&regs->vendorspec, ESDHC_VENDORSPEC_VSELECT);
+
 	return 0;
 }
 
@@ -733,6 +738,7 @@ static int fsl_esdhc_cfg_to_priv(struct fsl_esdhc_cfg *cfg,
 	priv->bus_width = cfg->max_bus_width;
 	priv->sdhc_clk = cfg->sdhc_clk;
 	priv->wp_enable  = cfg->wp_enable;
+	priv->vs18_enable  = cfg->vs18_enable;
 
 	return 0;
 };
@@ -759,6 +765,9 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv)
 			VENDORSPEC_HCKEN | VENDORSPEC_IPGEN | VENDORSPEC_CKEN);
 #endif
 
+	if (priv->vs18_enable)
+		esdhc_setbits32(&regs->vendorspec, ESDHC_VENDORSPEC_VSELECT);
+
 	writel(SDHCI_IRQ_EN_BITS, &regs->irqstaten);
 	memset(&priv->cfg, 0, sizeof(priv->cfg));
 
diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h
index e15d3ae..7a5d653 100644
--- a/include/fsl_esdhc.h
+++ b/include/fsl_esdhc.h
@@ -178,6 +178,7 @@ struct fsl_esdhc_cfg {
 	u32	sdhc_clk;
 	u8	max_bus_width;
 	u8	wp_enable;
+	u8	vs18_enable; /* Use 1.8V if set to 1 */
 	struct mmc_config cfg;
 };
 
-- 
2.6.2

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

* [U-Boot] [PATCH V2 2/4] dm: mmc: fsl_esdhc: handle vqmmc supply
  2017-05-08  7:02 [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O Peng Fan
@ 2017-05-08  7:02 ` Peng Fan
  2017-05-10 11:32   ` Jaehoon Chung
  2017-05-08  7:02 ` [U-Boot] [PATCH V2 3/4] imx: warp: use vs18_enable Peng Fan
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Peng Fan @ 2017-05-08  7:02 UTC (permalink / raw)
  To: u-boot

Handle vqmmc supply. Some boards have a fixed I/O voltage
at 1.8V for emmc, so the usdhc also needs to be configured
as 1.8V by setting VSELECT bit. The vs18_enable is the one
that used to checking whether setting VSELECT or not in
the driver. So if vqmmc supply is 1.8V, set vs18_enable,
the driver will set VSELECT.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
---

V2:
 Include regulator header file, fix dev_dbg usage

 drivers/mmc/fsl_esdhc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index bddfe24..8687083 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -16,6 +16,7 @@
 #include <hwconfig.h>
 #include <mmc.h>
 #include <part.h>
+#include <power/regulator.h>
 #include <malloc.h>
 #include <fsl_esdhc.h>
 #include <fdt_support.h>
@@ -968,6 +969,7 @@ static int fsl_esdhc_probe(struct udevice *dev)
 	struct fsl_esdhc_priv *priv = dev_get_priv(dev);
 	const void *fdt = gd->fdt_blob;
 	int node = dev_of_offset(dev);
+	struct udevice *vqmmc_dev;
 	fdt_addr_t addr;
 	unsigned int val;
 	int ret;
@@ -1005,6 +1007,23 @@ static int fsl_esdhc_probe(struct udevice *dev)
 	if (ret)
 		priv->wp_enable = 0;
 #endif
+
+	priv->vs18_enable = 0;
+
+#ifdef CONFIG_DM_REGULATOR
+	/*
+	 * If emmc I/O has a fixed voltage at 1.8V, this must be provided,
+	 * otherwise, emmc will work abnormally.
+	 */
+	ret = device_get_supply_regulator(dev, "vqmmc-supply", &vqmmc_dev);
+	if (ret) {
+		dev_dbg(dev, "no vqmmc-supply\n");
+	} else {
+		if (regulator_get_value(vqmmc_dev) == 1800000)
+			priv->vs18_enable = 1;
+	}
+#endif
+
 	/*
 	 * TODO:
 	 * Because lack of clk driver, if SDHC clk is not enabled,
-- 
2.6.2

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

* [U-Boot] [PATCH V2 3/4] imx: warp: use vs18_enable
  2017-05-08  7:02 [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O Peng Fan
  2017-05-08  7:02 ` [U-Boot] [PATCH V2 2/4] dm: mmc: fsl_esdhc: handle vqmmc supply Peng Fan
@ 2017-05-08  7:02 ` Peng Fan
  2017-05-08  7:02 ` [U-Boot] [PATCH V2 4/4] mmc: fsl_esdhc: drop CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT Peng Fan
  2017-05-09 11:08 ` [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O Jagan Teki
  3 siblings, 0 replies; 9+ messages in thread
From: Peng Fan @ 2017-05-08  7:02 UTC (permalink / raw)
  To: u-boot

Use vs18_enable, and drop CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
---

V2:
None

 board/warp/warp.c      | 2 +-
 include/configs/warp.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/board/warp/warp.c b/board/warp/warp.c
index 0bc0a6a..b1b528a 100644
--- a/board/warp/warp.c
+++ b/board/warp/warp.c
@@ -62,7 +62,7 @@ static void setup_iomux_uart(void)
 }
 
 static struct fsl_esdhc_cfg usdhc_cfg[1] = {
-	{USDHC2_BASE_ADDR},
+	{USDHC2_BASE_ADDR, 0, 0, 0, 1},
 };
 
 int board_mmc_getcd(struct mmc *mmc)
diff --git a/include/configs/warp.h b/include/configs/warp.h
index 5274b27..387a079 100644
--- a/include/configs/warp.h
+++ b/include/configs/warp.h
@@ -23,7 +23,6 @@
 
 /* MMC Configs */
 #define CONFIG_SYS_FSL_ESDHC_ADDR	USDHC2_BASE_ADDR
-#define CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT
 #define CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE
 #define CONFIG_SUPPORT_EMMC_BOOT
 
-- 
2.6.2

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

* [U-Boot] [PATCH V2 4/4] mmc: fsl_esdhc: drop CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT
  2017-05-08  7:02 [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O Peng Fan
  2017-05-08  7:02 ` [U-Boot] [PATCH V2 2/4] dm: mmc: fsl_esdhc: handle vqmmc supply Peng Fan
  2017-05-08  7:02 ` [U-Boot] [PATCH V2 3/4] imx: warp: use vs18_enable Peng Fan
@ 2017-05-08  7:02 ` Peng Fan
  2017-05-09 11:08 ` [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O Jagan Teki
  3 siblings, 0 replies; 9+ messages in thread
From: Peng Fan @ 2017-05-08  7:02 UTC (permalink / raw)
  To: u-boot

CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT is not the correct method
to set I/O to 1.8. To boards that does not support vqmmc-supply,
use vs18_enable in fsl_esdhc_cfg. If regulator is supported,
use fixed 1.8V regulator for vqmmc-supply.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
---

V2:
 None

 doc/README.fsl-esdhc         | 2 --
 drivers/mmc/fsl_esdhc.c      | 4 ----
 scripts/config_whitelist.txt | 1 -
 3 files changed, 7 deletions(-)

diff --git a/doc/README.fsl-esdhc b/doc/README.fsl-esdhc
index 7e71387..29cc661 100644
--- a/doc/README.fsl-esdhc
+++ b/doc/README.fsl-esdhc
@@ -20,5 +20,3 @@ Freescale esdhc-specific options
 	- CONFIG_SYS_FSL_ESDHC_BE
 		ESDHC IP is in big-endian mode. Accessing ESDHC registers can be determined
 		by ESDHC IP's endian mode or processor's endian mode.
-
-	- CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT forces to run at 1.8V.
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 8687083..b23b286 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -672,10 +672,6 @@ static int esdhc_init(struct mmc *mmc)
 	/* Set timout to the maximum value */
 	esdhc_clrsetbits32(&regs->sysctl, SYSCTL_TIMEOUT_MASK, 14 << 16);
 
-#ifdef CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT
-	esdhc_setbits32(&regs->vendorspec, ESDHC_VENDORSPEC_VSELECT);
-#endif
-
 	if (priv->vs18_enable)
 		esdhc_setbits32(&regs->vendorspec, ESDHC_VENDORSPEC_VSELECT);
 
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index ed349b9..255e22f 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -3870,7 +3870,6 @@ CONFIG_SYS_FSL_ERRATUM_A_004934
 CONFIG_SYS_FSL_ESDHC_ADDR
 CONFIG_SYS_FSL_ESDHC_BE
 CONFIG_SYS_FSL_ESDHC_BROKEN_TIMEOUT
-CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT
 CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE
 CONFIG_SYS_FSL_ESDHC_LE
 CONFIG_SYS_FSL_ESDHC_NUM
-- 
2.6.2

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

* [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O
  2017-05-08  7:02 [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O Peng Fan
                   ` (2 preceding siblings ...)
  2017-05-08  7:02 ` [U-Boot] [PATCH V2 4/4] mmc: fsl_esdhc: drop CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT Peng Fan
@ 2017-05-09 11:08 ` Jagan Teki
  2017-05-09 12:49   ` Peng Fan
  3 siblings, 1 reply; 9+ messages in thread
From: Jagan Teki @ 2017-05-09 11:08 UTC (permalink / raw)
  To: u-boot

On Mon, May 8, 2017 at 12:32 PM, Peng Fan <peng.fan@nxp.com> wrote:
> When using eMMC with 1.8V I/O, the VSELECT bit need to be set in
> the USDHC controller when init.
>
> This patch adds a parameter "vs18_enable" in fsl_esdhc_cfg
> structure and priv data, so each controller can have different
> settings.
>
> We could not use CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT, it has problem
> that it will apply to all USDHC controllers and it only set the 1.8V
> at init phase. So if user does not select to the eMMC device,
> the voltage on the I/O pins are not correct.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: York Sun <york.sun@nxp.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>
> V2: None
>
>  drivers/mmc/fsl_esdhc.c | 9 +++++++++
>  include/fsl_esdhc.h     | 1 +
>  2 files changed, 10 insertions(+)
>
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index f3c6358..bddfe24 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -92,6 +92,7 @@ struct fsl_esdhc {
>   * @dev: pointer for the device
>   * @non_removable: 0: removable; 1: non-removable
>   * @wp_enable: 1: enable checking wp; 0: no check
> + * @vs18_enable: 1: use 1.8V voltage; 0: use 3.3V
>   * @cd_gpio: gpio for card detection
>   * @wp_gpio: gpio for write protection
>   */
> @@ -104,6 +105,7 @@ struct fsl_esdhc_priv {
>         struct udevice *dev;
>         int non_removable;
>         int wp_enable;
> +       int vs18_enable;

I think this can be achieved with adding "no-1-8-v" property.

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.

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

* [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O
  2017-05-09 11:08 ` [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O Jagan Teki
@ 2017-05-09 12:49   ` Peng Fan
  2017-05-09 13:21     ` Jagan Teki
  0 siblings, 1 reply; 9+ messages in thread
From: Peng Fan @ 2017-05-09 12:49 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Jagan Teki [mailto:jagannadh.teki at gmail.com]
> Sent: Tuesday, May 09, 2017 7:09 PM
> To: Peng Fan <peng.fan@nxp.com>
> Cc: Stefano Babic <sbabic@denx.de>; u-boot at lists.denx.de
> Subject: Re: [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable
> for 1.8V fix I/O
> 
> On Mon, May 8, 2017 at 12:32 PM, Peng Fan <peng.fan@nxp.com> wrote:
> > When using eMMC with 1.8V I/O, the VSELECT bit need to be set in the
> > USDHC controller when init.
> >
> > This patch adds a parameter "vs18_enable" in fsl_esdhc_cfg structure
> > and priv data, so each controller can have different settings.
> >
> > We could not use CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT, it has problem
> > that it will apply to all USDHC controllers and it only set the 1.8V
> > at init phase. So if user does not select to the eMMC device, the
> > voltage on the I/O pins are not correct.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > Cc: Jaehoon Chung <jh80.chung@samsung.com>
> > Cc: York Sun <york.sun@nxp.com>
> > Cc: Stefano Babic <sbabic@denx.de>
> > ---
> >
> > V2: None
> >
> >  drivers/mmc/fsl_esdhc.c | 9 +++++++++
> >  include/fsl_esdhc.h     | 1 +
> >  2 files changed, 10 insertions(+)
> >
> > diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index
> > f3c6358..bddfe24 100644
> > --- a/drivers/mmc/fsl_esdhc.c
> > +++ b/drivers/mmc/fsl_esdhc.c
> > @@ -92,6 +92,7 @@ struct fsl_esdhc {
> >   * @dev: pointer for the device
> >   * @non_removable: 0: removable; 1: non-removable
> >   * @wp_enable: 1: enable checking wp; 0: no check
> > + * @vs18_enable: 1: use 1.8V voltage; 0: use 3.3V
> >   * @cd_gpio: gpio for card detection
> >   * @wp_gpio: gpio for write protection
> >   */
> > @@ -104,6 +105,7 @@ struct fsl_esdhc_priv {
> >         struct udevice *dev;
> >         int non_removable;
> >         int wp_enable;
> > +       int vs18_enable;
> 
> I think this can be achieved with adding "no-1-8-v" property.

We need to support non-dts case.

Regards,
Peng.

> 
> thanks!
> --
> Jagan Teki
> Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream
> Maintainer Hyderabad, India.

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

* [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O
  2017-05-09 12:49   ` Peng Fan
@ 2017-05-09 13:21     ` Jagan Teki
  0 siblings, 0 replies; 9+ messages in thread
From: Jagan Teki @ 2017-05-09 13:21 UTC (permalink / raw)
  To: u-boot

On Tue, May 9, 2017 at 6:19 PM, Peng Fan <peng.fan@nxp.com> wrote:
>
>
>> -----Original Message-----
>> From: Jagan Teki [mailto:jagannadh.teki at gmail.com]
>> Sent: Tuesday, May 09, 2017 7:09 PM
>> To: Peng Fan <peng.fan@nxp.com>
>> Cc: Stefano Babic <sbabic@denx.de>; u-boot at lists.denx.de
>> Subject: Re: [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable
>> for 1.8V fix I/O
>>
>> On Mon, May 8, 2017 at 12:32 PM, Peng Fan <peng.fan@nxp.com> wrote:
>> > When using eMMC with 1.8V I/O, the VSELECT bit need to be set in the
>> > USDHC controller when init.
>> >
>> > This patch adds a parameter "vs18_enable" in fsl_esdhc_cfg structure
>> > and priv data, so each controller can have different settings.
>> >
>> > We could not use CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT, it has problem
>> > that it will apply to all USDHC controllers and it only set the 1.8V
>> > at init phase. So if user does not select to the eMMC device, the
>> > voltage on the I/O pins are not correct.
>> >
>> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> > Cc: Jaehoon Chung <jh80.chung@samsung.com>
>> > Cc: York Sun <york.sun@nxp.com>
>> > Cc: Stefano Babic <sbabic@denx.de>
>> > ---
>> >
>> > V2: None
>> >
>> >  drivers/mmc/fsl_esdhc.c | 9 +++++++++
>> >  include/fsl_esdhc.h     | 1 +
>> >  2 files changed, 10 insertions(+)
>> >
>> > diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index
>> > f3c6358..bddfe24 100644
>> > --- a/drivers/mmc/fsl_esdhc.c
>> > +++ b/drivers/mmc/fsl_esdhc.c
>> > @@ -92,6 +92,7 @@ struct fsl_esdhc {
>> >   * @dev: pointer for the device
>> >   * @non_removable: 0: removable; 1: non-removable
>> >   * @wp_enable: 1: enable checking wp; 0: no check
>> > + * @vs18_enable: 1: use 1.8V voltage; 0: use 3.3V
>> >   * @cd_gpio: gpio for card detection
>> >   * @wp_gpio: gpio for write protection
>> >   */
>> > @@ -104,6 +105,7 @@ struct fsl_esdhc_priv {
>> >         struct udevice *dev;
>> >         int non_removable;
>> >         int wp_enable;
>> > +       int vs18_enable;
>>
>> I think this can be achieved with adding "no-1-8-v" property.
>
> We need to support non-dts case.

true, try to support dt as well.

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.

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

* [U-Boot] [PATCH V2 2/4] dm: mmc: fsl_esdhc: handle vqmmc supply
  2017-05-08  7:02 ` [U-Boot] [PATCH V2 2/4] dm: mmc: fsl_esdhc: handle vqmmc supply Peng Fan
@ 2017-05-10 11:32   ` Jaehoon Chung
  2017-05-11  0:46     ` Peng Fan
  0 siblings, 1 reply; 9+ messages in thread
From: Jaehoon Chung @ 2017-05-10 11:32 UTC (permalink / raw)
  To: u-boot

On 05/08/2017 04:02 PM, Peng Fan wrote:
> Handle vqmmc supply. Some boards have a fixed I/O voltage
> at 1.8V for emmc, so the usdhc also needs to be configured
> as 1.8V by setting VSELECT bit. The vs18_enable is the one
> that used to checking whether setting VSELECT or not in
> the driver. So if vqmmc supply is 1.8V, set vs18_enable,
> the driver will set VSELECT.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: York Sun <york.sun@nxp.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
> 
> V2:
>  Include regulator header file, fix dev_dbg usage
> 
>  drivers/mmc/fsl_esdhc.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index bddfe24..8687083 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -16,6 +16,7 @@
>  #include <hwconfig.h>
>  #include <mmc.h>
>  #include <part.h>
> +#include <power/regulator.h>
>  #include <malloc.h>
>  #include <fsl_esdhc.h>
>  #include <fdt_support.h>
> @@ -968,6 +969,7 @@ static int fsl_esdhc_probe(struct udevice *dev)
>  	struct fsl_esdhc_priv *priv = dev_get_priv(dev);
>  	const void *fdt = gd->fdt_blob;
>  	int node = dev_of_offset(dev);
> +	struct udevice *vqmmc_dev;
>  	fdt_addr_t addr;
>  	unsigned int val;
>  	int ret;
> @@ -1005,6 +1007,23 @@ static int fsl_esdhc_probe(struct udevice *dev)
>  	if (ret)
>  		priv->wp_enable = 0;
>  #endif
> +
> +	priv->vs18_enable = 0;
> +
> +#ifdef CONFIG_DM_REGULATOR
> +	/*
> +	 * If emmc I/O has a fixed voltage at 1.8V, this must be provided,
> +	 * otherwise, emmc will work abnormally.
> +	 */
> +	ret = device_get_supply_regulator(dev, "vqmmc-supply", &vqmmc_dev);
> +	if (ret) {
> +		dev_dbg(dev, "no vqmmc-supply\n");
> +	} else {
> +		if (regulator_get_value(vqmmc_dev) == 1800000)
> +			priv->vs18_enable = 1;

Doesn't need to enable regulator?

Best Regards,
Jaehoon Chung

> +	}
> +#endif
> +
>  	/*
>  	 * TODO:
>  	 * Because lack of clk driver, if SDHC clk is not enabled,
> 

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

* [U-Boot] [PATCH V2 2/4] dm: mmc: fsl_esdhc: handle vqmmc supply
  2017-05-10 11:32   ` Jaehoon Chung
@ 2017-05-11  0:46     ` Peng Fan
  0 siblings, 0 replies; 9+ messages in thread
From: Peng Fan @ 2017-05-11  0:46 UTC (permalink / raw)
  To: u-boot

Hi Jaehoon,

> -----Original Message-----
> From: Jaehoon Chung [mailto:jh80.chung at samsung.com]
> Sent: Wednesday, May 10, 2017 7:33 PM
> To: Peng Fan <peng.fan@nxp.com>; sbabic at denx.de
> Cc: van.freenix at gmail.com; u-boot at lists.denx.de; york sun
> <york.sun@nxp.com>
> Subject: Re: [PATCH V2 2/4] dm: mmc: fsl_esdhc: handle vqmmc supply
> 
> On 05/08/2017 04:02 PM, Peng Fan wrote:
> > Handle vqmmc supply. Some boards have a fixed I/O voltage at 1.8V for
> > emmc, so the usdhc also needs to be configured as 1.8V by setting
> > VSELECT bit. The vs18_enable is the one that used to checking whether
> > setting VSELECT or not in the driver. So if vqmmc supply is 1.8V, set
> > vs18_enable, the driver will set VSELECT.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > Cc: Jaehoon Chung <jh80.chung@samsung.com>
> > Cc: York Sun <york.sun@nxp.com>
> > Cc: Stefano Babic <sbabic@denx.de>
> > ---
> >
> > V2:
> >  Include regulator header file, fix dev_dbg usage
> >
> >  drivers/mmc/fsl_esdhc.c | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> >
> > diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index
> > bddfe24..8687083 100644
> > --- a/drivers/mmc/fsl_esdhc.c
> > +++ b/drivers/mmc/fsl_esdhc.c
> > @@ -16,6 +16,7 @@
> >  #include <hwconfig.h>
> >  #include <mmc.h>
> >  #include <part.h>
> > +#include <power/regulator.h>
> >  #include <malloc.h>
> >  #include <fsl_esdhc.h>
> >  #include <fdt_support.h>
> > @@ -968,6 +969,7 @@ static int fsl_esdhc_probe(struct udevice *dev)
> >  	struct fsl_esdhc_priv *priv = dev_get_priv(dev);
> >  	const void *fdt = gd->fdt_blob;
> >  	int node = dev_of_offset(dev);
> > +	struct udevice *vqmmc_dev;
> >  	fdt_addr_t addr;
> >  	unsigned int val;
> >  	int ret;
> > @@ -1005,6 +1007,23 @@ static int fsl_esdhc_probe(struct udevice *dev)
> >  	if (ret)
> >  		priv->wp_enable = 0;
> >  #endif
> > +
> > +	priv->vs18_enable = 0;
> > +
> > +#ifdef CONFIG_DM_REGULATOR
> > +	/*
> > +	 * If emmc I/O has a fixed voltage at 1.8V, this must be provided,
> > +	 * otherwise, emmc will work abnormally.
> > +	 */
> > +	ret = device_get_supply_regulator(dev, "vqmmc-supply",
> &vqmmc_dev);
> > +	if (ret) {
> > +		dev_dbg(dev, "no vqmmc-supply\n");
> > +	} else {
> > +		if (regulator_get_value(vqmmc_dev) == 1800000)
> > +			priv->vs18_enable = 1;
> 
> Doesn't need to enable regulator?

Need to enable, thanks. Will send out V3.

Regards,
Peng.

> 
> Best Regards,
> Jaehoon Chung
> 
> > +	}
> > +#endif
> > +
> >  	/*
> >  	 * TODO:
> >  	 * Because lack of clk driver, if SDHC clk is not enabled,
> >

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

end of thread, other threads:[~2017-05-11  0:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-08  7:02 [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O Peng Fan
2017-05-08  7:02 ` [U-Boot] [PATCH V2 2/4] dm: mmc: fsl_esdhc: handle vqmmc supply Peng Fan
2017-05-10 11:32   ` Jaehoon Chung
2017-05-11  0:46     ` Peng Fan
2017-05-08  7:02 ` [U-Boot] [PATCH V2 3/4] imx: warp: use vs18_enable Peng Fan
2017-05-08  7:02 ` [U-Boot] [PATCH V2 4/4] mmc: fsl_esdhc: drop CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT Peng Fan
2017-05-09 11:08 ` [U-Boot] [PATCH V2 1/4] mmc: fsl_esdhc: introduce vs18_enable for 1.8V fix I/O Jagan Teki
2017-05-09 12:49   ` Peng Fan
2017-05-09 13:21     ` Jagan Teki

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.