[PATCH] realtek: fix RTL8231 gpio expander for high GPIOs

Paul Fertser fercerpav at gmail.com
Mon Sep 20 10:16:30 PDT 2021


Hi Sander,

Thank you for review, it made me think about consistency.

On Mon, Sep 20, 2021 at 05:45:06PM +0200, Sander Vanheule wrote:
> On Fri, 2021-09-17 at 16:11 +0300, Paul Fertser wrote:
> >         rtl8231_write(gpios, RTL8231_GPIO_PIN_SEL(0), 0xffff);
> >         rtl8231_write(gpios, RTL8231_GPIO_PIN_SEL(16), 0xffff);
> > +       rtl8231_write(gpios, RTL8231_GPIO_PIN_SEL(32), 7 | (7 << 5));
> 
> Pins 35-36 cannot serve as LED output, but their GPIO direction can still be changed.
> Since the select bit for pins 35-36 should always read '1' (the GPIO pin function), this
> should probably be:
> 
> 	rtl8231_write(gpios, RTL8231_GPIO_PIN_SEL(32), 0x1f | (0x1f << 5));

So we are not changing the direction for GPIOs 0-31 and it's probably
a good thing since probably the bootloader has already configured them
in some desired way. Guess the same idea should be applied to high
GPIOs too, please see my v2.

-- 
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercerpav at gmail.com



More information about the openwrt-devel mailing list