Re: [PATCH 1/2] gpio: realtek-otto: use __raw_readl/writel in realtek_gpio_update_line_imr()

Sander Vanheule <[email protected]> Mon, 20 Jul 2026 18:32:14 +0200
Newsgroups org.kernel.vger.linux-mips,org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel,org.kernel.vger.linux-watchdog
Message-ID <[email protected]>
Hi,

Adding linux-mips as SWAP_IO_SPACE is mostly a MIPS thing, and some lists/people
for your other pending patches.

On Fri, 2026-07-10 at 23:34 +0500, Rustam Adilov wrote:
> In preparation for upcoming changes to how bank reads and writes
> are defined in this driver, change the ioread32 and iowrite32 to
> their __raw variants. The realtek_gpio_update_line_imr() function
> is used by all devices regardless of GPIO_PORTS_REVERSED flag and
> thus this is the only place where there shouldn't be any byte
> swapping whether SWAP_IO_SPACE config is enabled or not and that
> is only possible with __raw_readl and __raw_writel.
> 
> Signed-off-by: Rustam Adilov <[email protected]>
> ---
>  drivers/gpio/gpio-realtek-otto.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-realtek-otto.c b/drivers/gpio/gpio-realtek-
> otto.c
> index 4a606bad5848..491fde846d46 100644
> --- a/drivers/gpio/gpio-realtek-otto.c
> +++ b/drivers/gpio/gpio-realtek-otto.c
> @@ -176,10 +176,10 @@ static void realtek_gpio_update_line_imr(struct
> realtek_gpio_ctrl *ctrl, unsigne
>  	u32 reg_val;
>  
>  	reg += 4 * (line_shift / 32);
> -	reg_val = ioread32(reg);
> +	reg_val = __raw_readl(reg);
>  	reg_val &= ~(REALTEK_GPIO_IMR_LINE_MASK << shift);
>  	reg_val |= (irq_type & irq_mask & REALTEK_GPIO_IMR_LINE_MASK) <<
> shift;
> -	iowrite32(reg_val, reg);
> +	__raw_writel(reg_val, reg);
>  }
>  
>  static void realtek_gpio_irq_ack(struct irq_data *data)

As per my earlier message on your watchdog patch [1], I'm still not convinced
converting all existing drivers [2, 3] to work around an issue with the USB
framework is the right thing to do. You claim the required USB changes are not
upstreamable, but I have not seen you make an attempt at doing so.

Can the people from linux-mips shine their light on whether using __raw_*() to
work around the effects of SWAP_IO_SPACE is reasonable? My gut feeling is this
indicates SWAP_IO_SPACE shouldn't be enabled. Markus has apparently made the
same remark [4].

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/linux-watchdog/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/
[4] https://lore.kernel.org/all/[email protected]/

Best,
Sander