[PATCH v3 2/2] net: dsa: mt7530: Use GPIO polarity to generate correct reset sequence
Andrew Lunn
andrew at lunn.ch
Sun Nov 30 12:17:23 PST 2025
On Sun, Nov 30, 2025 at 10:07:31AM +0200, Vladimir Oltean wrote:
> On Sun, Nov 30, 2025 at 02:11:05AM +0100, Andrew Lunn wrote:
> > > - gpiod_set_value_cansleep(priv->reset, 0);
> > > + int is_active_low = !!gpiod_is_active_low(priv->reset);
> > > + gpiod_set_value_cansleep(priv->reset, is_active_low);
> >
> > I think you did not correctly understand what Russell said. You pass
> > the logical value to gpiod_set_value(). If the GPIO has been marked as
> > active LOW, the GPIO core will invert the logical values to the raw
> > value. You should not be using gpiod_is_active_low().
> >
> > But as i said to the previous patch, i would just leave everything as
> > it is, except document the issue.
> >
> > Andrew
> >
>
> It was my suggestion to do it like this (but I don't understand why I'm
> again not in CC).
>
> We _know_ that the reset pin of the switch should be active low. So by
> using gpiod_is_active_low(), we can determine whether the device tree is
> wrong or not, and we can work with a wrong device tree too (just invert
> the logical values).
Assuming there is not a NOT gate placed between the GPIO and the reset
pin, because the board designer decided to do that for some reason?
So lets work on the commit message some more, but i'm still not
convinced it is worth the effort, unless there is some board today
which really is broken and cannot be fixed unless a change like this
is made.
Andrew
More information about the Linux-mediatek
mailing list