mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] gpio: realtek-otto: Add RTL9311B support
@ 2026-11-09  5:28 Joshua Scott
  2026-11-09  5:28 ` [PATCH v2 1/2] dt-bindings: gpio: realtek-otto: Add RTL9311B Joshua Scott
  2026-11-09  5:28 ` [PATCH v2 2/2] gpio: realtek-otto: Allow building for the RTL9311B Joshua Scott
  0 siblings, 2 replies; 4+ messages in thread
From: Joshua Scott @ 2026-11-09  5:28 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, linux-gpio
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Sander Vanheule, Bert Vermeulen, linux-kernel, Joshua Scott

The Realtek RTL9311B is a network switch with integrated ARMv8 CPU. Its
GPIO controller is the same as the RTL9310's. This series adds a
compatible for it, with the RTL9310 compatible as a fallback, and lets
the driver be built for ARCH_REALTEK.

The RTL9311B node lists "realtek,rtl9311b-gpio", "realtek,rtl9310-gpio",
"realtek,otto-gpio". The driver binds through "realtek,rtl9310-gpio",
which keeps the interrupt controller; "realtek,otto-gpio" alone would
bind with interrupts disabled.

Tested on an RTL9311B board with an Infineon SLM9670 TPM on a spi-gpio
bus using GPIO3-6: the TPM probes with tpm_tis_spi and responds to PCR
reads and TPM2_GetRandom. With the v2 compatible list, the controller
binds through the RTL9310 entry and registers its interrupt controller.

These patches were prepared with the help of Claude Code
(claude-opus-5-5), which drafted the code changes and changelogs. I
reviewed them and tested them on hardware.

Changes in v2:
- Use "realtek,rtl9310-gpio" as a fallback for the RTL9311B, and drop
  the driver's "realtek,rtl9311b-gpio" match entry, as the RTL9311B is
  fully compatible with the RTL9310 (Krzysztof)
- The driver patch now only changes Kconfig, so retitle it
  "gpio: realtek-otto: Allow building for the RTL9311B"

v1: https://lore.kernel.org/r/20261103215316.1544492-1-joshua.scott@alliedtelesis.co.nz

Joshua Scott (2):
  dt-bindings: gpio: realtek-otto: Add RTL9311B
  gpio: realtek-otto: Allow building for the RTL9311B

 .../bindings/gpio/realtek,otto-gpio.yaml      | 22 ++++++++++++-------
 drivers/gpio/Kconfig                          |  5 +++--
 2 files changed, 17 insertions(+), 10 deletions(-)


base-commit: cbbddb6b08cc9900a87cccaa9b22bbe06aa4f50a
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] dt-bindings: gpio: realtek-otto: Add RTL9311B
  2026-11-09  5:28 [PATCH v2 0/2] gpio: realtek-otto: Add RTL9311B support Joshua Scott
@ 2026-11-09  5:28 ` Joshua Scott
  2026-11-10 11:44   ` Krzysztof Kozlowski
  2026-11-09  5:28 ` [PATCH v2 2/2] gpio: realtek-otto: Allow building for the RTL9311B Joshua Scott
  1 sibling, 1 reply; 4+ messages in thread
From: Joshua Scott @ 2026-11-09  5:28 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, linux-gpio
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Sander Vanheule, Bert Vermeulen, linux-kernel, Joshua Scott

The Realtek RTL9311B is a network switch with integrated ARMv8 CPU. It
has the same GPIO controller as the RTL9310, with one bank of 20 GPIOs.
Add a compatible for it, with the RTL9310 compatible as a fallback.

Signed-off-by: Joshua Scott <joshua.scott@alliedtelesis.co.nz>
---
Changes in v2:
- Add the RTL9311B as its own compatible list, with "realtek,rtl9310-gpio"
  as a fallback, instead of adding it to the enum used with
  "realtek,otto-gpio" alone

 .../bindings/gpio/realtek,otto-gpio.yaml      | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml b/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml
index 33c25df7b815..a337345a1e90 100644
--- a/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml
+++ b/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml
@@ -15,6 +15,7 @@ description: |
   of two banks of 32 GPIOs. These GPIOs can generate edge-triggered interrupts.
   Each bank's interrupts are cascased into one interrupt line on the parent
   interrupt controller, if provided.
+  The Arm-based RTL9311B has the same controller, with one bank.
   This binding allows defining a single bank in the devicetree. The interrupt
   controller is not supported on the fallback compatible name, which only
   allows for GPIO port use.
@@ -24,14 +25,19 @@ properties:
     pattern: "^gpio@[0-9a-f]+$"
 
   compatible:
-    items:
-      - enum:
-          - realtek,rtl8380-gpio
-          - realtek,rtl8390-gpio
-          - realtek,rtl9300-gpio
-          - realtek,rtl9310-gpio
-          - realtek,rtl9607-gpio
-      - const: realtek,otto-gpio
+    oneOf:
+      - items:
+          - enum:
+              - realtek,rtl8380-gpio
+              - realtek,rtl8390-gpio
+              - realtek,rtl9300-gpio
+              - realtek,rtl9310-gpio
+              - realtek,rtl9607-gpio
+          - const: realtek,otto-gpio
+      - items:
+          - const: realtek,rtl9311b-gpio
+          - const: realtek,rtl9310-gpio
+          - const: realtek,otto-gpio
 
   reg: true
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] gpio: realtek-otto: Allow building for the RTL9311B
  2026-11-09  5:28 [PATCH v2 0/2] gpio: realtek-otto: Add RTL9311B support Joshua Scott
  2026-11-09  5:28 ` [PATCH v2 1/2] dt-bindings: gpio: realtek-otto: Add RTL9311B Joshua Scott
@ 2026-11-09  5:28 ` Joshua Scott
  1 sibling, 0 replies; 4+ messages in thread
From: Joshua Scott @ 2026-11-09  5:28 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, linux-gpio
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Sander Vanheule, Bert Vermeulen, linux-kernel, Joshua Scott

The Realtek RTL9311B is a network switch with integrated ARMv8 CPU. It
has the same GPIO controller as the RTL9310. Allow the driver to be
built for ARCH_REALTEK.

Signed-off-by: Joshua Scott <joshua.scott@alliedtelesis.co.nz>
---
Changes in v2:
- Drop the "realtek,rtl9311b-gpio" match entry, as the RTL9311B now
  binds through "realtek,rtl9310-gpio" (Krzysztof)
- Retitle from "gpio: realtek-otto: Add RTL9311B support", as only the
  Kconfig change remains

 drivers/gpio/Kconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 55e4280029d8..bc584da1abbb 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -645,14 +645,15 @@ config GPIO_RDA
 
 config GPIO_REALTEK_OTTO
 	tristate "Realtek Otto GPIO support"
-	depends on MACH_REALTEK_RTL || COMPILE_TEST
+	depends on MACH_REALTEK_RTL || ARCH_REALTEK || COMPILE_TEST
 	default MACH_REALTEK_RTL
 	select GPIO_GENERIC
 	select GPIOLIB_IRQCHIP
 	help
 	  The GPIO controller on the Otto MIPS platform supports up to two
 	  banks of 32 GPIOs, with edge triggered interrupts. The 32 GPIOs
-	  are grouped in four 8-bit wide ports.
+	  are grouped in four 8-bit wide ports. The Arm-based RTL9311B has
+	  the same controller.
 
 	  When built as a module, the module will be called realtek_otto_gpio.
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: gpio: realtek-otto: Add RTL9311B
  2026-11-09  5:28 ` [PATCH v2 1/2] dt-bindings: gpio: realtek-otto: Add RTL9311B Joshua Scott
@ 2026-11-10 11:44   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-10 11:44 UTC (permalink / raw)
  To: Joshua Scott
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree, Sander Vanheule,
	Bert Vermeulen, linux-kernel

On Mon, Nov 09, 2026 at 06:28:07PM +1300, Joshua Scott wrote:
> The Realtek RTL9311B is a network switch with integrated ARMv8 CPU. It
> has the same GPIO controller as the RTL9310, with one bank of 20 GPIOs.
> Add a compatible for it, with the RTL9310 compatible as a fallback.
> 
> Signed-off-by: Joshua Scott <joshua.scott@alliedtelesis.co.nz>
> ---
> Changes in v2:
> - Add the RTL9311B as its own compatible list, with "realtek,rtl9310-gpio"
>   as a fallback, instead of adding it to the enum used with
>   "realtek,otto-gpio" alone
> 
>  .../bindings/gpio/realtek,otto-gpio.yaml      | 22 ++++++++++++-------
>  1 file changed, 14 insertions(+), 8 deletions(-)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-10 11:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09  5:28 [PATCH v2 0/2] gpio: realtek-otto: Add RTL9311B support Joshua Scott
2026-11-09  5:28 ` [PATCH v2 1/2] dt-bindings: gpio: realtek-otto: Add RTL9311B Joshua Scott
2026-11-10 11:44   ` Krzysztof Kozlowski
2026-11-09  5:28 ` [PATCH v2 2/2] gpio: realtek-otto: Allow building for the RTL9311B Joshua Scott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®