From nobody Mon Sep 28 23:07:48 2026 Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76F1B39099E; Sat, 15 Aug 2026 09:45:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786787121; cv=none; b=qBQQTDwoUtQX1HYuBfN1/Zx9Q7+EoTdEqk44Ou0qnjrzSL84cwLO/0pqzNYZXqJA/Fm6wSao7zYxEMPSSZqts1cwZPPTi851AYMx1bJZ+R0g01bDyjwQvVcFoEvA+XczEiIGVkNo/hKzcdUmygdX+gDcj54eJmyf+kafYClDqGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786787121; c=relaxed/simple; bh=d+LwmZOwyCG9zwHI51gv1lxQlQGxVKFHZaI8LM6iYkY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EtSqrQPmKOmOudkjt7veFTEOTPQdjXY2PYs7e5s2OE4cRJEQ+rzM7Pa6yWNHew3maYMhImCgWn2qaCJ6nXcIcXIb8/3MCVAIKmGnYjX/z63I1y1YDIyqF5RoWJL8RPlmNcCbx7vCBUXkMlIBbLSav9FnrQnL0IWP7vxEU7X/Cfc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=XaVsbyaF; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="XaVsbyaF" Received: from mail01.layka.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id B48218838D; Sat, 15 Aug 2026 11:45:18 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id OgtZX9krEqU2; Sat, 15 Aug 2026 11:45:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1786787118; bh=d+LwmZOwyCG9zwHI51gv1lxQlQGxVKFHZaI8LM6iYkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XaVsbyaFr1VStYScIQ6pRUgFcIVUPFydAKM0Fzv9zbsBKEQ7rxFxQ1s14Wvx7gXkI sQXghEtbSwf41aXs/rY2e45m3xwF/AoLSAAtaGNIYmFBIZGBSWxJJ/HeYS/46FCnnH xS5+Q3faDgERMQ3V+vUVAQFK02ANgG6m0Zw0iNrvbgAhJCjkS/hQ6nc+zF1GmrUA5C h85XlRYn+UHEZKyS0P0FZDa0MOWsYRAklS84STtMG0BBxgHZf90ZXF/31aRuOxVoZg IDEJu9mhxEAvqMOd2Cld3CRU40P+KqoLsbALdWJN/uomEMm4xp889iAQU2ej/1c/iY uvo7NVInWF25w== From: Rustam Adilov To: Linus Walleij , Bartosz Golaszewski , Sander Vanheule , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rustam Adilov Subject: [PATCH v2 1/2] gpio: realtek-otto: use __raw_readl/writel in realtek_gpio_update_line_imr() Date: Sat, 15 Aug 2026 14:44:50 +0500 Message-ID: <20260815094451.31792-2-adilov@disroot.org> In-Reply-To: <20260815094451.31792-1-adilov@disroot.org> References: <20260815094451.31792-1-adilov@disroot.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Linus Walleij Signed-off-by: Rustam Adilov --- 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-o= tto.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 realt= ek_gpio_ctrl *ctrl, unsigne u32 reg_val; =20 reg +=3D 4 * (line_shift / 32); - reg_val =3D ioread32(reg); + reg_val =3D __raw_readl(reg); reg_val &=3D ~(REALTEK_GPIO_IMR_LINE_MASK << shift); reg_val |=3D (irq_type & irq_mask & REALTEK_GPIO_IMR_LINE_MASK) << shift; - iowrite32(reg_val, reg); + __raw_writel(reg_val, reg); } =20 static void realtek_gpio_irq_ack(struct irq_data *data) --=20 2.55.0 From nobody Mon Sep 28 23:07:48 2026 Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA1072D594F; Sat, 15 Aug 2026 09:45:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786787133; cv=none; b=VFUbLMHeqrUXCrk0Sefmrtx5CrfUY8ZnyBfGIItR50O93UIRtEP6YvgKHUizwEGV9rVs5ohVlcstgVaFMyxSyK6O2RArRra65d6+GWcdUvwG2GRzJga0TmuepLCcGXQHPFVkfOZk44WvVx65+6mFYE8OwQizPWt3A0d2uifgZY8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786787133; c=relaxed/simple; bh=GqNseVANk3TNRwPc/14VjBhTl29gg9e9ev+oIaAD92o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mkErAjdzBzl+XQtGVXvTh49PdCbZSttFHD+gPS5RZp59TJ7wrsonxp9QIaYZdaHEdEdTL4Pe0GuJe6fnKVy/iP9of0w3j+qeTDYq7LwZXvc3BhWkaUiOq/XKxDolk3nTHPN7S70CUpQt1MEFmqviZ9bAXVoSqNz5X1luS9bl3Cs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=Q0fmO2Cx; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="Q0fmO2Cx" Received: from mail01.layka.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 59F5487E4A; Sat, 15 Aug 2026 11:45:30 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 8uSvJLIwzw0s; Sat, 15 Aug 2026 11:45:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1786787129; bh=GqNseVANk3TNRwPc/14VjBhTl29gg9e9ev+oIaAD92o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Q0fmO2CxiCgDk7l0HM3eN8n5l9UTG/ISXsJvvRWB0W7eVJOq5PwrHLezziSLrS2F8 FtN6j1rEXpF+JUAS/jSJeccH0FjzWBAzGA8XoRIKKpwno3XIBZ6PxenKw9tVqzfzoU Wo+LRNPnuUha+YsHu46vNIHNN8lAOCccy/1LFtMxOBVMfbbtrItSM1O+AIwaZWU+kk KP6Ev2k1wEG31o2rDpl/iWMahC/2KD6tVzY/Vqgo4owc1tuJWKMwpOYs2i3hPamRTd iFteugnfrkM6LC3x89Pb38PL8E7LrZShFGE0NDm5MxaFNIVJYEkG3TKzF4EF5rrjfW Oa5tEFlwNbjpg== From: Rustam Adilov To: Linus Walleij , Bartosz Golaszewski , Sander Vanheule , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rustam Adilov Subject: [PATCH v2 2/2] gpio: realtek-otto: make bank_read/write overridable by endian property Date: Sat, 15 Aug 2026 14:44:51 +0500 Message-ID: <20260815094451.31792-3-adilov@disroot.org> In-Reply-To: <20260815094451.31792-1-adilov@disroot.org> References: <20260815094451.31792-1-adilov@disroot.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In order to have a working gpio controller with SWAP_IO_SPACE, the bank_read/bank_write functions and the gen_gc_flag used for gpio_generic_chip_config must be able to be changed to their respective counterparts. To do that, introduce checks for the presence of endian property under the device tree node and if so, override what has been set by GPIO_PORTS_REVERSED quirk flag. This way, existing device trees are kept working as they were originally. Both big-endian and little-endian properties must be checked because there are devices that have GPIO_PORTS_REVERSED flag and the others that don't. Signed-off-by: Rustam Adilov --- drivers/gpio/gpio-realtek-otto.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpio/gpio-realtek-otto.c b/drivers/gpio/gpio-realtek-o= tto.c index 491fde846d46..e079b5180760 100644 --- a/drivers/gpio/gpio-realtek-otto.c +++ b/drivers/gpio/gpio-realtek-otto.c @@ -405,6 +405,16 @@ static int realtek_gpio_probe(struct platform_device *= pdev) ctrl->line_imr_pos =3D realtek_gpio_line_imr_pos_swapped; } =20 + if (device_property_read_bool(dev, "little-endian")) { + gen_gc_flags =3D 0; + ctrl->bank_read =3D realtek_gpio_bank_read; + ctrl->bank_write =3D realtek_gpio_bank_write; + } else if (device_is_big_endian(dev)) { + gen_gc_flags =3D GPIO_GENERIC_BIG_ENDIAN_BYTE_ORDER; + ctrl->bank_read =3D realtek_gpio_bank_read_swapped; + ctrl->bank_write =3D realtek_gpio_bank_write_swapped; + } + config =3D (struct gpio_generic_chip_config) { .dev =3D dev, .sz =3D 4, --=20 2.55.0