Message ID | 1494226966-11989-2-git-send-email-peng.fan@nxp.com |
---|---|
State | Changes Requested |
Headers | show |
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, >
Hi Jaehoon, > -----Original Message----- > From: Jaehoon Chung [mailto:jh80.chung@samsung.com] > Sent: Wednesday, May 10, 2017 7:33 PM > To: Peng Fan <peng.fan@nxp.com>; sbabic@denx.de > Cc: van.freenix@gmail.com; u-boot@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, > >
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,
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(+)