drivers/gpio/gpio-realtek-otto.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
This patch series changes gpio-realtek-otto to be functional around
SWAP_IO_SPACE config.
Firstly the ioread32 and iowrite32 in realtek_gpio_update_line_imr()
have to be changed to their __raw variants as it is the only point in
the driver where both devices with ports reversed and without meet.
Secondly, the bank_read/write and the flag for generic gpio config
have to be able to be changed to the opposite one when SWAP_IO_SPACE
is enabled. To avoid breaking any existing device tree out in the wild,
make them overridable by endian properties from the device tree node and
keep the current GPIO_PORTS_REVERSED quirk as it is.
I have tested it on my RTL9607C machine with SWAP_IO_SPACE enabled
and with big-endian property set under gpio controller node and it
was working fine.
---
Changes in v2:
- added the review-by tag from Linus Walleij.
- changed the patch 1 to instead use endian preprties as overrides on top of existing
GPIO_PORTS_REVERSED quirk to not break any exsiting device trees as they don't use
endian properties.
- Link to v1: https://lore.kernel.org/all/20260511131520.98420-1-adilov@disroot.org/
Rustam Adilov (2):
gpio: realtek-otto: use __raw_readl/writel in
realtek_gpio_update_line_imr()
gpio: realtek-otto: make bank_read/write overridable by endian
property
drivers/gpio/gpio-realtek-otto.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
--
2.55.0
On Sat, Aug 15, 2026 at 02:44:49PM +0500, Rustam Adilov wrote: > This patch series changes gpio-realtek-otto to be functional around > SWAP_IO_SPACE config. > > Firstly the ioread32 and iowrite32 in realtek_gpio_update_line_imr() > have to be changed to their __raw variants as it is the only point in > the driver where both devices with ports reversed and without meet. > > Secondly, the bank_read/write and the flag for generic gpio config > have to be able to be changed to the opposite one when SWAP_IO_SPACE > is enabled. To avoid breaking any existing device tree out in the wild, > make them overridable by endian properties from the device tree node and > keep the current GPIO_PORTS_REVERSED quirk as it is. > > I have tested it on my RTL9607C machine with SWAP_IO_SPACE enabled > and with big-endian property set under gpio controller node and it > was working fine. Convert the driver to use regmap MMIO and most of the code in this series won't be needed. Also it will give some benefits (like register caching and debugfs monitoring). -- With Best Regards, Andy Shevchenko
On Sat, 15 Aug 2026 14:44:49 +0500, Rustam Adilov wrote:
> This patch series changes gpio-realtek-otto to be functional around
> SWAP_IO_SPACE config.
>
> Firstly the ioread32 and iowrite32 in realtek_gpio_update_line_imr()
> have to be changed to their __raw variants as it is the only point in
> the driver where both devices with ports reversed and without meet.
>
> [...]
Applied, thanks!
[1/2] gpio: realtek-otto: use __raw_readl/writel in realtek_gpio_update_line_imr()
https://git.kernel.org/brgl/c/61ef599b782e776437886f2be0623b3c9055e5d3
[2/2] gpio: realtek-otto: make bank_read/write overridable by endian property
https://git.kernel.org/brgl/c/785ec26c37e56ee5f142b6684f7c15c7ca7430a3
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
© 2016 - 2026 Red Hat, Inc.