Skip to contentSkip to conversation

gpio: Add Cortina Systems CS75xx GPIO driver

PATCH Superseded Fil Dunsky 4 participants 7 messages Nov 19 – Nov 22

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Fil Dunsky

author
#0 lore raw

v5 cover gpio: Add Cortina Systems CS75xx GPIO driver

The Cortina Systems CS75xx ("Goldengate G2") SoCs have five banks of 32 GPIO lines, each bank with its own interrupt. This series adds the binding and a driver based on gpio-mmio; level and edge triggers are supported, both edges are emulated by flipping the polarity.

Each pin is either a GPIO line or belongs to a peripheral (NAND, Ethernet, UART, I2C, ...). That choice is made in the global control block, which is not part of the GPIO controller: as discussed on v1 [1], the driver does not touch the pin mux and leaves it as the boot loader set it up, until there is a pin controller driver for that block. Testing the reset button on the Securifi Almond+ requires selecting GPIO37 in the global pin mux before gpio-keys is probed; the current boot path does not provide that setup. The tests used a separate, board-specific setup step. The GPIO driver does not program the mux.

The driver used to be part of a series with the interrupt controller, I2C and watchdog drivers and the device tree changes. That series is now split per subsystem. The driver can be built with COMPILE_TEST without the platform series [2], which is under review separately. The other Kconfig option, ARCH_CORTINA_ACCESS, is defined by that series in arch/arm/mach-goldengate/Kconfig; it is not in mainline yet. There is no code dependency on the platform series. The device tree nodes will follow with the other CS75xx dts changes once the platform is merged.

There is no public documentation; the register layout comes from the GPL vendor kernels. Tested on a Securifi Almond+ (CS7542): the reset button (GPIO 37) works as an active-low gpio-keys input, and the SX8650 touchscreen uses a level-triggered GPIO interrupt.

[1] https://lore.kernel.org/all/20261012-dreamlike-hazily-19bb60326f0a@spud/
[2] https://lore.kernel.org/all/[email protected]/

---
Changes in v5:
- explain that ARCH_CORTINA_ACCESS is introduced by the platform series; COMPILE_TEST allows building this driver without that series
- correct the pin mux setup required for testing the Almond+ reset button
- clear the interrupt status after changing the trigger type, so that unmasking an edge interrupt does not fire a stale event (sashiko-bot)
- collect Reviewed-by tags; Linus, I kept yours over the one-line change above
- Link to v4: https://patch.msgid.link/[email protected]

Changes in v4:
- rebase on v7.4-rc1
- split out of "Cortina Systems CS75xx: interrupt controller, GPIO, I2C and TWD watchdog" so that each driver can go through its own tree; no longer based on the platform series
- the pin mux registers are not part of the GPIO controller (Conor): the binding has a single reg entry and the driver no longer switches the
pin mux when a line is requested
(Rob, your Reviewed-by on v3 is not carried because of this change)
- switch a line to input for an interrupt only when it is not requested; flip the polarity of a both-edges line after the ack, so that an edge
in between is not lost (sashiko-bot)
- drop the gpio_chip owner, gpiolib sets it; sort the Makefile entry
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- rebase on v6 of the platform series
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- rebase on v5 of the platform series
- do not include <linux/mod_devicetable.h> (Uwe)
- update the both-edges mask only for a valid trigger type and test it under the lock in the interrupt handler; refuse more than 32 lines (sashiko-bot)
- Link to v1: https://patch.msgid.link/[email protected]

To: Linus Walleij <[email protected]>
To: Bartosz Golaszewski <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
Fil Dunsky (2):
dt-bindings: gpio: Add Cortina Systems CS7542 GPIO controller
gpio: Add Cortina Systems CS75xx GPIO driver

 .../bindings/gpio/cortina,cs7542-gpio.yaml         |  65 +++++
 drivers/gpio/Kconfig                               |  12 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-cs75xx.c                         | 283 +++++++++++++++++++++
 4 files changed, 361 insertions(+)

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261015-cs75xx-gpio-ed0a37ee4a68

Best regards,

Signature · 1 line
Fil Dunsky <[email protected]>
author
#1 lore raw

PATCH v5 1/2 dt-bindings: gpio: Add Cortina Systems CS7542 GPIO controller

The Cortina Systems CS75xx SoCs have five banks of 32 GPIO lines. Each pin is shared between a GPIO line and a peripheral function; the pin mux lives in the global control block and is not described here.

---
 .../bindings/gpio/cortina,cs7542-gpio.yaml         | 65 ++++++++++++++++++++++
 1 file changed, 65 insertions(+)
Documentation/devicetree/bindings/gpio/cortina,cs7542-gpio.yaml new file +65 -0
new file mode 100644
index 000000000..faa302180
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/cortina,cs7542-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cortina Systems CS7542 GPIO controller
+
+maintainers:
+  - Fil Dunsky <[email protected]>
+
+description:
+  The Cortina Systems CS75xx (Goldengate G2) SoCs have five banks of 32
+  GPIO lines, each with its own interrupt. Every pin is shared between a
+  GPIO line and a peripheral function; the choice is made in the global
+  control block and is not part of the GPIO controller.
+
+properties:
+  compatible:
+    const: cortina,cs7542-gpio
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+  gpio-line-names:
+    maxItems: 32
+
+  gpio-reserved-ranges: true
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - gpio-controller
+  - "#gpio-cells"
+  - interrupt-controller
+  - "#interrupt-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio@f00701f0 {
+        compatible = "cortina,cs7542-gpio";
+        reg = <0xf00701f0 0x20>;
+        interrupt-parent = <&intc>;
+        interrupts = <7>;
+        gpio-controller;
+        #gpio-cells = <2>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+    };
Signature · 1 line
2.53.0
maintainer Reviewed-by on v5 1/2
#2 lore raw

Re: [PATCH v5 1/2] dt-bindings: gpio: Add Cortina Systems CS7542 GPIO controller

Quoted 8 lines · On Thu, Nov 19, 2026 at 12:03 PM Fil Dunsky via B4 Relay…

From: Fil Dunsky <[email protected]>

The Cortina Systems CS75xx SoCs have five banks of 32 GPIO lines. Each pin is shared between a GPIO line and a peripheral function; the pin mux lives in the global control block and is not described here.

Yours,
Linus Walleij

author
#3 lore raw

PATCH v5 2/2 gpio: Add Cortina Systems CS75xx GPIO driver

In reply to Fil Dunsky

Add a driver for the GPIO banks of the Cortina Systems CS75xx SoCs. The data and direction registers are handled by gpio-mmio; each bank has its own interrupt with level and edge triggers, both edges are emulated by flipping the polarity.

A pin only works as a GPIO when the pin mux in the global control block selects the GPIO function. That is not part of the GPIO controller and is left to the boot loader until there is a pin controller driver.

---
 drivers/gpio/Kconfig       |  12 ++
 drivers/gpio/Makefile      |   1 +
 drivers/gpio/gpio-cs75xx.c | 283 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 296 insertions(+)
drivers/gpio/Kconfig +12 -0
index 55e428002..cc00cfe48 100644
@@ -300,6 +300,18 @@ config GPIO_CLPS711X
 	help
 	  Say yes here to support GPIO on CLPS711X SoCs.
 
+config GPIO_CS75XX
+	tristate "Cortina Systems CS75xx GPIO support"
+	depends on ARCH_CORTINA_ACCESS || COMPILE_TEST
+	select GPIO_GENERIC
+	select GPIOLIB_IRQCHIP
+	help
+	  Say yes here to support the GPIO banks of the Cortina Systems
+	  CS75xx SoCs, including their interrupts.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called gpio-cs75xx.
+
 config GPIO_DAVINCI
 	tristate "TI Davinci/Keystone GPIO support"
 	default y if ARCH_DAVINCI
drivers/gpio/Makefile +1 -0
index 88f748846..2c2e18ef2 100644
@@ -60,6 +60,7 @@ obj-$(CONFIG_GPIO_SNPS_CREG)		+= gpio-creg-snps.o
 obj-$(CONFIG_GPIO_CROS_EC)		+= gpio-cros-ec.o
 obj-$(CONFIG_GPIO_CRYSTAL_COVE)		+= gpio-crystalcove.o
 obj-$(CONFIG_GPIO_CS5535)		+= gpio-cs5535.o
+obj-$(CONFIG_GPIO_CS75XX)		+= gpio-cs75xx.o
 obj-$(CONFIG_GPIO_DA9052)		+= gpio-da9052.o
 obj-$(CONFIG_GPIO_DA9055)		+= gpio-da9055.o
 obj-$(CONFIG_GPIO_DAVINCI)		+= gpio-davinci.o
drivers/gpio/gpio-cs75xx.c new file +283 -0

283 lines not on this page · raw message

Signature · 1 line
2.53.0
#4 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] gpio: cs75xx: Kconfig depends on undefined symbol ARCH_CORTINA_ACCESS --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] gpio: cs75xx: Kconfig depends on undefined symbol ARCH_CORTINA_ACCESS
--

commit 7ff70214d7eee77eeaf70112de74f2b1043247c0
Author: Fil Dunsky <[email protected]>

gpio: Add Cortina Systems CS75xx GPIO driver

This commit adds a GPIO and interrupt controller driver for the Cortina Systems CS75xx SoCs using gpio-mmio.

drivers/gpio/Kconfig config GPIO_CLPS711X · line 305

Quoted 11 lines
drivers/gpio/Kconfig +3 -0
index 55e4280029d86..cc00cfe48d941 100644
@@ -300,6 +300,18 @@ config GPIO_CLPS711X
 	help
 	  Say yes here to support GPIO on CLPS711X SoCs.
 
+config GPIO_CS75XX
+	tristate "Cortina Systems CS75xx GPIO support"
+	depends on ARCH_CORTINA_ACCESS || COMPILE_TEST

[Severity: Low]
Is ARCH_CORTINA_ACCESS defined in Kconfig? Without a Kconfig definition for it, GPIO_CS75XX can only be enabled when COMPILE_TEST is set, and scripts/checkkconfigsymbols.py flags ARCH_CORTINA_ACCESS as an undefined symbol.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#5 lore raw
In reply to Fil Dunsky
Quoted 24 lines · Fil Dunsky

The Cortina Systems CS75xx ("Goldengate G2") SoCs have five banks of 32 GPIO lines, each bank with its own interrupt. This series adds the binding and a driver based on gpio-mmio; level and edge triggers are supported, both edges are emulated by flipping the polarity.

Each pin is either a GPIO line or belongs to a peripheral (NAND, Ethernet, UART, I2C, ...). That choice is made in the global control block, which is not part of the GPIO controller: as discussed on v1 [1], the driver does not touch the pin mux and leaves it as the boot loader set it up, until there is a pin controller driver for that block. Testing the reset button on the Securifi Almond+ requires selecting GPIO37 in the global pin mux before gpio-keys is probed; the current boot path does not provide that setup. The tests used a separate, board-specific setup step. The GPIO driver does not program the mux.

The driver used to be part of a series with the interrupt controller, I2C and watchdog drivers and the device tree changes. That series is now split per subsystem. The driver can be built with COMPILE_TEST without the platform series [2], which is under review separately. The other Kconfig option, ARCH_CORTINA_ACCESS, is defined by that series in arch/arm/mach-goldengate/Kconfig; it is not in mainline yet. There is no code dependency on the platform series. The device tree nodes will follow with the other CS75xx dts changes once the platform is merged.

Quoted 8 lines

There is no public documentation; the register layout comes from the GPL vendor kernels. Tested on a Securifi Almond+ (CS7542): the reset button (GPIO 37) works as an active-low gpio-keys input, and the SX8650 touchscreen uses a level-triggered GPIO interrupt.

[1] https://lore.kernel.org/all/20261012-dreamlike-hazily-19bb60326f0a@spud/
[2] https://lore.kernel.org/all/[email protected]/

The driver looks good but I cannot pick it up while it references a Kconfig symbol that's not upstream.

Bart

author
#6 lore raw

Hi Bart,

Quoted 2 lines · Bartosz Golaszewski

The driver looks good but I cannot pick it up while it references a Kconfig symbol that's not upstream.

You're right. I have replaced ARCH_CORTINA_ACCESS || COMPILE_TEST with OF. The driver only uses generic MMIO, GPIO and IRQ APIs; HAS_IOMEM is already required by the enclosing MMIO GPIO menu. There is no need to keep an architecture-specific condition here.

I checked built-in and module builds on ARM with GCC and x86-64 with Clang, with OF=y and COMPILE_TEST=n, using just the GPIO series on v7.4-rc1 without the CS75xx platform series. All four builds passed, including vmlinux for the built-in cases and the modules for the modular cases. The GPIO driver code is unchanged.

I am sending v6 with this Kconfig change and an updated cover letter.

Thanks,
Fil