Message ID | 20200515140100.3306517-2-hs@denx.de |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | gpio: add possibility to search for gpio label name | expand |
Hi Heiko > From: Heiko Schocher <hs@denx.de> > Sent: vendredi 15 mai 2020 16:01 > > save the GPIOD_ flags also in the gpio descriptor. > > Signed-off-by: Heiko Schocher <hs@denx.de> > > > --- > > Changes in v5: > - add comment from patrick, update the descriptor flags > in _dm_gpio_set_dir_flags() if setting direction was OK. > > Changes in v4: > - new in version 4 > > Changes in v3: None > Changes in v2: None > > drivers/gpio/gpio-uclass.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com> Fixes: 788ea834124b ("gpio: add function _dm_gpio_set_dir_flags") Thanks Patrick
On Fri, 15 May 2020 at 08:01, Heiko Schocher <hs@denx.de> wrote: > > save the GPIOD_ flags also in the gpio descriptor. > > Signed-off-by: Heiko Schocher <hs@denx.de> > > > --- > > Changes in v5: > - add comment from patrick, update the descriptor flags > in _dm_gpio_set_dir_flags() if setting direction was OK. > > Changes in v4: > - new in version 4 > > Changes in v3: None > Changes in v2: None > > drivers/gpio/gpio-uclass.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > Would be good mention 'why' in patches like this. Reviewed-by: Simon Glass <sjg@chromium.org>
Hi Heiko, On Fri, May 15 2020, Heiko Schocher wrote: > save the GPIOD_ flags also in the gpio descriptor. > > Signed-off-by: Heiko Schocher <hs@denx.de> > Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com> > Reviewed-by: Simon Glass <sjg@chromium.org> This fixes SD card access on Hummingboard2. Current master uses the wrong out polarity to control the SD card power regulator. Tested-by: Baruch Siach <baruch@tkos.co.il> Should go to v2020.07 I believe. One more comment below. > @@ -614,10 +618,6 @@ int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags) > flags |= desc->flags; > ret = _dm_gpio_set_dir_flags(desc, flags); > > - /* update the descriptor flags */ > - if (ret) > - desc->flags = flags; > - > return ret; You can just do return _dm_gpio_set_dir_flags(desc, flags); here instead. Thanks, baruch
Hello Baruch, Am 02.07.2020 um 21:05 schrieb Baruch Siach: > Hi Heiko, > > On Fri, May 15 2020, Heiko Schocher wrote: >> save the GPIOD_ flags also in the gpio descriptor. >> >> Signed-off-by: Heiko Schocher <hs@denx.de> >> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com> >> Reviewed-by: Simon Glass <sjg@chromium.org> > > This fixes SD card access on Hummingboard2. Current master uses the > wrong out polarity to control the SD card power regulator. > > Tested-by: Baruch Siach <baruch@tkos.co.il> > > Should go to v2020.07 I believe. Toms decision... but it seems this bug pops up on more and more boards, as also some days ago Walter reported that this patch fixes a problem on iMX6 Hummingboard with mmc... There is also a v6 version of this patchset ... see: http://patchwork.ozlabs.org/project/uboot/list/?series=178637 > One more comment below. > >> @@ -614,10 +618,6 @@ int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags) >> flags |= desc->flags; >> ret = _dm_gpio_set_dir_flags(desc, flags); >> >> - /* update the descriptor flags */ >> - if (ret) >> - desc->flags = flags; >> - >> return ret; > > You can just do > > return _dm_gpio_set_dir_flags(desc, flags); > > here instead. Yes! I would let the patch as it is and (I or you?) send a fix on top? bye, Heiko
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index d3cea11f76..d241263970 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -599,6 +599,10 @@ static int _dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags) } } + /* save the flags also in descriptor */ + if (!ret) + desc->flags = flags; + return ret; } @@ -614,10 +618,6 @@ int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags) flags |= desc->flags; ret = _dm_gpio_set_dir_flags(desc, flags); - /* update the descriptor flags */ - if (ret) - desc->flags = flags; - return ret; }
save the GPIOD_ flags also in the gpio descriptor. Signed-off-by: Heiko Schocher <hs@denx.de> --- Changes in v5: - add comment from patrick, update the descriptor flags in _dm_gpio_set_dir_flags() if setting direction was OK. Changes in v4: - new in version 4 Changes in v3: None Changes in v2: None drivers/gpio/gpio-uclass.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)