[PATCH v5 1/2] gpio: i2c-gpio: Drop use of dm_gpio_set_dir()
Harm Berntsen
harm.berntsen at nedap.com
Mon Mar 8 20:07:35 CET 2021
The dm_gpio_set_dir_flags does a bitwise OR with the new flags. This
means that the i2c driver cannot switch the pin from input to output or
vice versa. check_dir_flags fails here:
check_dir_flags: flags 0x6 has GPIOD_IS_OUT and GPIOD_IS_IN
On my board, removing the logical OR in dm_gpio_set_dir_flags fixes the
issue. The _dm_gpio_set_dir_flags function stores the passed flags
directly into the descriptor. This means that by removing the logical
OR all the existing flags will be lost which is also not what we want.
So the code needs to be able to unset the IN/OUT direction bits. I
don't feel like I'm familiar enough with the GPIO code to do a good
suggestion. Maybe Patrick could help us out here?
-----Original Message-----
From: Simon Glass <sjg at chromium.org>
To: Harm Berntsen <harm.berntsen at nedap.com>
Cc: hs at denx.de <hs at denx.de>, trini at konsulko.com <trini at konsulko.com>,
u-boot at lists.denx.de <u-boot at lists.denx.de>, patrick.delaunay at st.com
<patrick.delaunay at st.com>
Subject: Re: [PATCH v5 1/2] gpio: i2c-gpio: Drop use of
dm_gpio_set_dir()
Date: Mon, 08 Mar 2021 10:05:24 -0500
Hi Harm,
On Mon, 8 Mar 2021 at 09:35, Harm Berntsen <harm.berntsen at nedap.com>
wrote:
>
> I've just tested this on top of the current master (90964ab5) and
> this
> breaks my board (Kirkwood CPU with MVEBU_GPIO=y and DM_I2C_GPIO=y).
> I'll do some debugging to see what goes wrong.
Thank you for that.
Once we figure this out we should add a test.
>
> -----Original Message-----
> From: Tom Rini <trini at konsulko.com>
> To: Heiko Schocher <hs at denx.de>, Harm Berntsen
> <harm.berntsen at nedap.com>
> Cc: Simon Glass <sjg at chromium.org>, U-Boot Mailing List
> <u-boot at lists.denx.de>, Patrick Delaunay <patrick.delaunay at st.com>
> Subject: Re: [PATCH v5 1/2] gpio: i2c-gpio: Drop use of
> dm_gpio_set_dir()
> Date: Mon, 08 Mar 2021 08:16:53 -0500
>
> On Mon, Mar 08, 2021 at 05:59:45AM +0100, Heiko Schocher wrote:
> > Hello Simon,
> >
> > On 08.03.21 04:45, Simon Glass wrote:
> > > This is the only driver that uses this function. Update it to use
> > > the
> > > alternative which is dm_gpio_set_dir_flags().
> > >
> > > Signed-off-by: Simon Glass <sjg at chromium.org>
> > > ---
> > >
> > > (no changes since v1)
> > >
> > > drivers/i2c/i2c-gpio.c | 19 +++++++++----------
> > > 1 file changed, 9 insertions(+), 10 deletions(-)
> >
> > Reviewed-by: Heiko Schocher <hs at denx.de>
>
> The series is at:
> https://patchwork.ozlabs.org/project/uboot/list/?series=232639&state=*
> and I'd really like to see a tested-by. Harm, are you able to test
> this
> still since you had to fix this area before? Thanks!
Regards,
Simon
More information about the U-Boot
mailing list