soc: cortina: Add CS7542 global clocks and pin multiplexer
Subsystems (4)
v2 cover soc: cortina: Add CS7542 global clocks and pin multiplexer
The CS7542 global control block contains boot strap status and five GPIO/peripheral mux registers, alongside reset and SMP controls. Add a shared syscon binding, an early strap-selected clock provider, and a pinctrl child using that same regmap.
The source material is the GPL vendor kernel and the existing OpenWrt port. OpenWrt previously used a board-fixed APB clock and a temporary machine initcall to select GPIO37 and the UART1-3 pins. An older port read the strap to publish APB, CPU and AXI fixed clocks. This series replaces those mechanisms with subsystem drivers, without moving mux writes back into the GPIO controller.
The clock provider only reports the seven known strap configurations; it does not program PLLs, dividers or gates, and does not implement DVFS. Reserved encoding 7 is rejected. It is initialized before ARM timer discovery, while keeping the syscon node available to populate the pinctrl child.
The pin mux driver supports GPIO on the five 32-line banks and the six UART pins (72-77) used by the OpenWrt workaround. Other peripheral functions, pulls and drive strengths are intentionally not exposed. A GPIO/peripheral selection updates only its own bit through regmap.
These five patches are based on v7.4-rc4 and do not depend on the pending platform, GPIO or INTC series. A separate peripheral DTS series, based on platform v9, adds the syscon node, replaces the fixed APB clock, connects CPU clocks and selects GPIO37 and UART1-3 on the Almond+. The existing SMP release register remains accessed by the platform code.
Validation:
- full ARM multi_v7_defconfig vmlinux and modules builds with W=1:
GCC 14.2 clock=y/pinctrl=y and Clang 21.1.8 clock=y/pinctrl=m, COMPILE_TEST=n, without the pending platform series; both passed
- final linked kernel symbols and pinctrl module/modpost checked; no warnings in the new drivers (other kernel code emits warnings)
- dt_binding_check including both examples; positive GPIO/UART cases and rejection of invalid UART37, GPIO160 and unsupported pin config
- host harnesses running the actual clock init and mux routines with failure-injecting mocked APIs: all strap settings, registration/error cleanup, every mux pin/bank boundary, neighbour preservation
- component and DTB/schema checks of the separate integration tree
The v1 clock and pinctrl sources booted on a Securifi
Almond+ in an OpenWrt 6.18.64 RAM kernel. Before entry, GPIO37 and UART72-77 were deliberately set to the opposite mux state; the default pinctrl state restored them. APB/CPU/AXI rates were 150/750/150 MHz. The test recorded a physical reset-button press/release with matching IRQ-backed hotplug events, opened UART1-3 at 115200, read the I2C device at 0x48, received the expected NACK at 0x49, and exercised watchdog calls from CPU1 and 20-second expiry. All 27 checks passed. Raw I2C checks used a test DTB with the touchscreen consumer disabled; production OpenWrt keeps it enabled. The device returned to installed OpenWrt 6.18.60 with unchanged configuration hashes. This is hardware evidence for these driver sources on 6.18.64, not a boot test of the standalone v7.4-rc4 series or of DVFS and suspend.
The v1 production OpenWrt 6.18.64 image was also installed, preserving configuration. The default mux and clock rates were confirmed after boot; GPIO37 press/release and IRQ-backed hotplug events, UART1-3 termios configuration and watchdog keepalives/20-second expiry reset passed. The protected bootloader/environment, retained UBI volumes and configuration hashes were unchanged after the upgrade and reset.
The v1 clock/pinctrl sources additionally booted in a Linux 7.4-rc4 RAM integration kernel with platform v9, the accepted watchdog and local RTC/TRNG drafts. Both CPUs came online; the final RTC calendar, TRNG and watchdog harness passed 16 checks and returned to OpenWrt. This is an integration boot, not a repeated physical-button or UART1-3 test on 7.4; those source-level hardware checks above used 6.18.64.
Additional v2 validation: the actual pinctrl core pin_request reproduces the old GPIO-hog request failure and passes after the callback is added, while a UART-selected pin remains exclusive. The updated source also boots in the combined Linux 7.4 Almond+ RAM kernel.
---
Changes in v2:
- Identify GPIO mux functions with function_is_gpio so strict ownership allows a GPIO consumer after the default GPIO state; UART stays exclusive.
- Link to v1: https://patch.msgid.link/[email protected]
To: Fil Dunsky <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: Stephen Boyd <[email protected]>
To: Brian Masney <[email protected]>
To: Jerome Brunet <[email protected]>
To: Linus Walleij <[email protected]>
To: Bartosz Golaszewski <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Fil Dunsky (5):
dt-bindings: soc: Add Cortina Systems CS7542 global control block
dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux
clk: Add Cortina Systems CS7542 strap-selected clocks
pinctrl: Add Cortina Systems CS7542 pin multiplexer
MAINTAINERS: Add CS7542 global control support
.../bindings/pinctrl/cortina,cs7542-pinctrl.yaml | 84 +++++++++ .../soc/cortina/cortina,cs7542-syscon.yaml | 49 ++++++ MAINTAINERS | 10 ++ drivers/clk/Kconfig | 9 + drivers/clk/Makefile | 1 + drivers/clk/clk-cs7542.c | 90 ++++++++++ drivers/pinctrl/Kconfig | 13 ++ drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-cs7542.c | 195 +++++++++++++++++++++ include/dt-bindings/clock/cortina,cs7542-clock.h | 9 + 10 files changed, 461 insertions(+)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261123-cs7542-syscon-273d545c7af2
Best regards,
Signature · 1 line
Fil Dunsky <[email protected]>
PATCH v2 1/5 dt-bindings: soc: Add Cortina Systems CS7542 global control block
Describe the shared global register block and its strap-selected APB, CPU and AXI clocks. A pinctrl child will share the syscon regmap. Keep clock IDs in the order used by the previous out-of-tree CS75xx clock provider.
AI assistance: Codex prepared this change from the existing OpenWrt port and GPL vendor sources.
--- .../soc/cortina/cortina,cs7542-syscon.yaml | 49 ++++++++++++++++++++++ include/dt-bindings/clock/cortina,cs7542-clock.h | 9 ++++ 2 files changed, 58 insertions(+)
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml new file +49 -0
@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/cortina/cortina,cs7542-syscon.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cortina Systems CS7542 global control block + +maintainers: + - Fil Dunsky <[email protected]> + +description: + The global control block contains the boot strap status, GPIO/peripheral + mux registers, reset controls and the secondary CPU release register. + It provides the APB, CPU and AXI clock rates selected by the boot straps. + The clock specifiers are defined in dt-bindings/clock/cortina,cs7542-clock.h. + The pin controller uses the same register map through its parent syscon. + +properties: + compatible: + items: + - const: cortina,cs7542-syscon + - const: syscon + - const: simple-mfd + + reg: + maxItems: 1 + + "#clock-cells": + const: 1 + + pinctrl: + type: object + $ref: /schemas/pinctrl/cortina,cs7542-pinctrl.yaml# + +required: + - compatible + - reg + - "#clock-cells" + +additionalProperties: false + +examples: + - | + syscon@f0000000 { + compatible = "cortina,cs7542-syscon", "syscon", "simple-mfd"; + reg = <0xf0000000 0x100>; + #clock-cells = <1>; + };
include/dt-bindings/clock/cortina,cs7542-clock.h new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +#ifndef _DT_BINDINGS_CLOCK_CORTINA_CS7542_H +#define _DT_BINDINGS_CLOCK_CORTINA_CS7542_H + +#define CS7542_CLK_APB 0 +#define CS7542_CLK_CPU 1 +#define CS7542_CLK_AXI 2 + +#endif
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v2 1/5] dt-bindings: soc: Add Cortina Systems CS7542 global control block
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] dt-bindings: soc: cs7542-syscon references missing cs7542-pinctrl schema --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] dt-bindings: soc: cs7542-syscon references missing cs7542-pinctrl schema
--
commit 07450862dd3e19e1c7ed8329f2ae5067c2a63e4a
Author: Fil Dunsky <[email protected]>
dt-bindings: soc: Add Cortina Systems CS7542 global control block
This commit adds the devicetree binding schema and clock specifier header for the Cortina Systems CS7542 global control block.
Quoted 6 lines
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml new file +0
-0@@ -0,0 +1,49 @@
[ ... ]
Quoted 6 lines
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml new file +6
-0+properties: + compatible: + items: + - const: cortina,cs7542-syscon + - const: syscon + - const: simple-mfd
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml line 34
Quoted 10 lines
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml new file +10
-0+ + reg: + maxItems: 1 + + "#clock-cells": + const: 1 + + pinctrl: + type: object + $ref: /schemas/pinctrl/cortina,cs7542-pinctrl.yaml#
[Severity: Low]
Does referencing /schemas/pinctrl/cortina,cs7542-pinctrl.yaml# here break dt_binding_check at this commit?
Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml is not introduced until the following patch in the series, commit "dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux", so running make dt_binding_check on this commit alone (or if the soc and pinctrl patches go through separate trees) fails with an unresolvable schema reference. Adding the pinctrl property to cortina,cs7542-syscon.yaml in the patch that introduces cortina,cs7542-pinctrl.yaml would keep each commit self-contained.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 2/5 dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux
In reply to Fil DunskyDescribe the GPIO/peripheral selector in the global control block. Expose GPIO selection for all five banks and the UART signals used by the OpenWrt port, without inventing routes for other peripherals. Register offsets and masks are kept out of the device tree ABI.
AI assistance: Codex prepared this change from the existing OpenWrt port and GPL vendor sources.
--- .../bindings/pinctrl/cortina,cs7542-pinctrl.yaml | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+)
Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml new file +84 -0
@@ -0,0 +1,84 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/cortina,cs7542-pinctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cortina Systems CS7542 pin multiplexer + +maintainers: + - Fil Dunsky <[email protected]> + +description: + The pin multiplexer is a child of the CS7542 global control syscon. + Five 32-bit registers select GPIO mode when a pin's bit is set, or the + peripheral signal when it is clear. Pin numbers match the five GPIO + banks, from gpio0 to gpio159. Initially only GPIO mode and the UART + signals on gpio72 through gpio77 are supported. Other peripheral + routes and electrical configuration are not described here. + +allOf: + - $ref: pinctrl.yaml# + +properties: + compatible: + const: cortina,cs7542-pinctrl + +patternProperties: + '-pins$': + type: object + $ref: pinmux-node.yaml# + additionalProperties: false + + properties: + function: + enum: [gpio, uart] + + pins: + items: + pattern: '^gpio([0-9]|[1-9][0-9]|1[0-5][0-9])$' + minItems: 1 + maxItems: 160 + + required: + - function + - pins + + allOf: + - if: + properties: + function: + const: uart + then: + properties: + pins: + items: + enum: [gpio72, gpio73, gpio74, gpio75, gpio76, gpio77] + +required: + - compatible + +additionalProperties: false + +examples: + - | + syscon@f0000000 { + compatible = "cortina,cs7542-syscon", "syscon", "simple-mfd"; + reg = <0xf0000000 0x100>; + #clock-cells = <1>; + + pinctrl { + compatible = "cortina,cs7542-pinctrl"; + + reset-pins { + function = "gpio"; + pins = "gpio37"; + }; + + aux-uarts-pins { + function = "uart"; + pins = "gpio72", "gpio73", "gpio74", "gpio75", + "gpio76", "gpio77"; + }; + }; + };
Signature · 1 line
2.53.0
PATCH v2 3/5 clk: Add Cortina Systems CS7542 strap-selected clocks
In reply to Fil DunskyRegister APB, CPU and AXI fixed-rate outputs from GLOBAL_STRAP[3:1], using the seven configurations recorded in the vendor kernel. Reject the reserved encoding instead of publishing a guessed frequency.
Register before timer initialization and leave the syscon platform node available for its pinctrl child. Use the shared regmap, only read strap status, and unwind all registered clocks if provider setup fails. This is intentionally not a DVFS or programmable PLL driver.
AI assistance: Codex prepared this change from the existing OpenWrt port and GPL vendor sources.
--- drivers/clk/Kconfig | 9 +++++ drivers/clk/Makefile | 1 + drivers/clk/clk-cs7542.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+)
drivers/clk/Kconfig +9 -0
@@ -58,6 +58,15 @@ config LMK04832 Say yes here to build support for Texas Instruments' LMK04832 Ultra Low-Noise JESD204B Compliant Clock Jitter Cleaner With Dual Loop PLLs +config COMMON_CLK_CS7542 + bool "Cortina Systems CS7542 strap-selected clocks" + depends on OF && HAS_IOMEM + select MFD_SYSCON + help + Read the boot straps of the CS7542 global control block to provide + its APB, CPU and AXI clocks. This driver does not change PLLs or + dividers. It is built in because the APB clock is needed by timers. + config COMMON_CLK_APPLE_NCO tristate "Clock driver for Apple SoC NCOs" depends on ARCH_APPLE || COMPILE_TEST
drivers/clk/Makefile +1 -0
@@ -63,6 +63,7 @@ obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o obj-$(CONFIG_COMMON_CLK_BD718XX) += clk-bd718x7.o obj-$(CONFIG_COMMON_CLK_BM1880) += clk-bm1880.o obj-$(CONFIG_COMMON_CLK_CDCE706) += clk-cdce706.o +obj-$(CONFIG_COMMON_CLK_CS7542) += clk-cs7542.o obj-$(CONFIG_COMMON_CLK_CDCE925) += clk-cdce925.o obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o
drivers/clk/clk-cs7542.c new file +90 -0
90 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v2 4/5 pinctrl: Add Cortina Systems CS7542 pin multiplexer
In reply to Fil DunskyUse the global syscon regmap for the five GPIO mux registers. Each bit selects GPIO when set and a peripheral signal when clear. Support GPIO on all 160 lines and the six UART pins exercised by the OpenWrt port. Do not guess mux settings for the other peripherals.
Use masked regmap updates so independent pins and users of the shared block retain their settings. No register changes are made merely by probing; only a selected state or a GPIO request changes a pin. Register and initialize the controller before enabling its own hogs.
AI assistance: Codex prepared this change from the existing OpenWrt port and GPL vendor sources.
--- drivers/pinctrl/Kconfig | 13 +++ drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-cs7542.c | 195 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 209 insertions(+)
drivers/pinctrl/Kconfig +13 -0
@@ -188,6 +188,19 @@ config PINCTRL_BM1880 help Pinctrl driver for Bitmain BM1880 SoC. +config PINCTRL_CS7542 + tristate "Cortina Systems CS7542 pin multiplexer" + depends on OF && HAS_IOMEM + select MFD_SYSCON + select PINMUX + select GENERIC_PINCONF + help + Select GPIO mode or the supported peripheral signals in the CS7542 + global control block. This driver shares the syscon register map + with the clock provider and leaves unrelated pins unchanged. + Electrical pin configuration and other peripheral routes are not + implemented. + config PINCTRL_CY8C95X0 tristate "Cypress CY8C95X0 I2C pinctrl and GPIO driver" depends on I2C
drivers/pinctrl/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-$(CONFIG_PINCTRL_AW9523) += pinctrl-aw9523.o obj-$(CONFIG_PINCTRL_AXP209) += pinctrl-axp209.o obj-$(CONFIG_PINCTRL_BM1880) += pinctrl-bm1880.o obj-$(CONFIG_PINCTRL_CY8C95X0) += pinctrl-cy8c95x0.o +obj-$(CONFIG_PINCTRL_CS7542) += pinctrl-cs7542.o obj-$(CONFIG_PINCTRL_DA850_PUPD) += pinctrl-da850-pupd.o obj-$(CONFIG_PINCTRL_DA9062) += pinctrl-da9062.o obj-$(CONFIG_PINCTRL_DIGICOLOR) += pinctrl-digicolor.o
drivers/pinctrl/pinctrl-cs7542.c new file +195 -0
195 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v2 5/5 MAINTAINERS: Add CS7542 global control support
In reply to Fil DunskyTrack the global control binding, strap clock provider and pin multiplexer independently of the pending platform series.
AI assistance: Codex prepared this change from the existing OpenWrt port and GPL vendor sources.
--- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+)
MAINTAINERS +10 -0
@@ -2949,6 +2949,16 @@ F: tools/perf/tests/shell/coresight/* F: tools/perf/util/cs-etm-decoder/* F: tools/perf/util/cs-etm.* +ARM/CORTINA SYSTEMS CS7542 GLOBAL CONTROL +M: Fil Dunsky <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml +F: Documentation/devicetree/bindings/soc/cortina/ +F: drivers/clk/clk-cs7542.c +F: drivers/pinctrl/pinctrl-cs7542.c +F: include/dt-bindings/clock/cortina,cs7542-clock.h + ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE M: Hans Ulli Kroll <[email protected]> M: Linus Walleij <[email protected]>
Signature · 1 line
2.53.0