diff mbox series

[U-Boot,7/9] mmc: sunxi: Honour non-removable property in DT

Message ID 20190119013055.28023-8-andre.przywara@arm.com
State Accepted
Commit 4233698dd37536f2595ec773ca841360195cd310
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series sunxi: enable DM_MMC | expand

Commit Message

Andre Przywara Jan. 19, 2019, 1:30 a.m. UTC
If a board DT describes a cd-gpios property, but also marks the storage
as non-removable, we must ignore the GPIO (as Linux does).

Teach the DM_MMC part of the Allwinner MMC driver about the
non-removable DT property, to fix DM_MMC access on the SoPine and
Pine64-LTS board.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/mmc/sunxi_mmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jagan Teki Jan. 25, 2019, 7:16 a.m. UTC | #1
On Sat, Jan 19, 2019 at 7:03 AM Andre Przywara <andre.przywara@arm.com> wrote:
>
> If a board DT describes a cd-gpios property, but also marks the storage
> as non-removable, we must ignore the GPIO (as Linux does).
>
> Teach the DM_MMC part of the Allwinner MMC driver about the
> non-removable DT property, to fix DM_MMC access on the SoPine and
> Pine64-LTS board.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  drivers/mmc/sunxi_mmc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
> index 87424c23dc..374775194d 100644
> --- a/drivers/mmc/sunxi_mmc.c
> +++ b/drivers/mmc/sunxi_mmc.c
> @@ -658,7 +658,8 @@ static int sunxi_mmc_probe(struct udevice *dev)
>                 return ret;
>
>         /* This GPIO is optional */
> -       if (!gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio,
> +       if (!dev_read_bool(dev, "non-removable") &&
> +           !gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio,

How about fixing this in dts?
Andre Przywara Jan. 25, 2019, 9:28 a.m. UTC | #2
On Fri, 25 Jan 2019 12:46:38 +0530
Jagan Teki <jagan@amarulasolutions.com> wrote:

> On Sat, Jan 19, 2019 at 7:03 AM Andre Przywara
> <andre.przywara@arm.com> wrote:
> >
> > If a board DT describes a cd-gpios property, but also marks the
> > storage as non-removable, we must ignore the GPIO (as Linux does).
> >
> > Teach the DM_MMC part of the Allwinner MMC driver about the
> > non-removable DT property, to fix DM_MMC access on the SoPine and
> > Pine64-LTS board.
> >
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > ---
> >  drivers/mmc/sunxi_mmc.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
> > index 87424c23dc..374775194d 100644
> > --- a/drivers/mmc/sunxi_mmc.c
> > +++ b/drivers/mmc/sunxi_mmc.c
> > @@ -658,7 +658,8 @@ static int sunxi_mmc_probe(struct udevice *dev)
> >                 return ret;
> >
> >         /* This GPIO is optional */
> > -       if (!gpio_request_by_name(dev, "cd-gpios", 0,
> > &priv->cd_gpio,
> > +       if (!dev_read_bool(dev, "non-removable") &&
> > +           !gpio_request_by_name(dev, "cd-gpios", 0,
> > &priv->cd_gpio,  
> 
> How about fixing this in dts?

Sure, eventually, once I confirmed that there is really no CD wire
connected. But since Linux can cope with that, U-Boot should do so as
well.

Cheers,
Andre.
Jagan Teki Jan. 29, 2019, 6:20 p.m. UTC | #3
On Sat, Jan 19, 2019 at 7:03 AM Andre Przywara <andre.przywara@arm.com> wrote:
>
> If a board DT describes a cd-gpios property, but also marks the storage
> as non-removable, we must ignore the GPIO (as Linux does).
>
> Teach the DM_MMC part of the Allwinner MMC driver about the
> non-removable DT property, to fix DM_MMC access on the SoPine and
> Pine64-LTS board.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---

Applied to u-boot-sunxi/master
diff mbox series

Patch

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 87424c23dc..374775194d 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -658,7 +658,8 @@  static int sunxi_mmc_probe(struct udevice *dev)
 		return ret;
 
 	/* This GPIO is optional */
-	if (!gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio,
+	if (!dev_read_bool(dev, "non-removable") &&
+	    !gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio,
 				  GPIOD_IS_IN)) {
 		int cd_pin = gpio_get_number(&priv->cd_gpio);