soc: cortina: Add CS7542 global clocks, reset controller and pinctrl
Subsystems (5)
v5 cover soc: cortina: Add CS7542 global clocks, reset controller and pinctrl
The CS7542 global register block selects the CPU and bus clocks, gates the three PCIe ports and provides the PCIe and network reset lines. Its pinctrl child selects GPIO or peripheral functions on the same pads. This series includes the clock changes previously posted in the global controls series together with the original clock and pinctrl patches.
The early clock provider supplies timer clocks before platform devices probe. A separate platform driver in drivers/reset/ uses the same syscon regmap. The PCIe and Ethernet consumers control the timing and ordering of their own resets.
The global reset provider also exposes the separate flash reset at RESET bit 14, for NAND consumers to acquire without asserting a pulse.
Validation: both binding commits pass dt_binding_check independently. The clock driver builds in, and the reset and pinctrl drivers build both built-in and as modules on ARM with W=1/-Werror, COMPILE_TEST disabled and without the platform series. The equivalent OpenWrt backport has been exercised on Almond+; these checks do not claim fault injection on hardware.
Changes in v5:
- Treat failed regmap reads as unprepared in the PCIe gate state callback.
- Use devm_kzalloc_obj() for the native reset controller allocation.
- Describe the separate flash reset and add its reset identifier.
- Retain Linus Walleij's Reviewed-by on the unchanged pinctrl driver.
- Link to v4: https://patch.msgid.link/[email protected]
Changes in v4:
- Combine the strap-selected clocks and PCIe gates in one clock driver.
- Move reset registration to a separate driver in drivers/reset/.
- Expose the seven network-engine reset lines individually. Leave the
PCIe reset pulse timing to the PCIe driver.
- Fold in the global-controls binding and its clock and reset IDs.
- Global-controls v1: https://lore.kernel.org/all/[email protected]/
- Link to v3: https://lore.kernel.org/all/[email protected]/
Changes in v3:
- Introduce the parent pinctrl property and schema reference together with the pinctrl binding in patch 2, so patch 1 validates independently.
- Re-run dt_binding_check and examples at both binding commits. The final source tree and driver code are unchanged from v2.
- Link to v2: https://patch.msgid.link/[email protected]
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]
---
Fil Dunsky (6):
dt-bindings: soc: Add Cortina Systems CS7542 global controls
dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux
clk: Add Cortina Systems CS7542 clocks
reset: Add Cortina Systems CS7542 global reset controller
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 | 60 +++++++ MAINTAINERS | 12 ++ drivers/clk/Kconfig | 9 + drivers/clk/Makefile | 1 + drivers/clk/clk-cs7542.c | 161 +++++++++++++++++ drivers/pinctrl/Kconfig | 13 ++ drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-cs7542.c | 195 +++++++++++++++++++++ drivers/reset/Kconfig | 10 ++ drivers/reset/Makefile | 1 + drivers/reset/reset-cs7542.c | 135 ++++++++++++++ include/dt-bindings/clock/cortina,cs7542-clock.h | 13 ++ include/dt-bindings/reset/cortina,cs7542-reset.h | 20 +++ 14 files changed, 715 insertions(+)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261123-cs7542-syscon-273d545c7af2
Best regards,
Signature · 1 line
Fil Dunsky <[email protected]>
PATCH v5 1/6 dt-bindings: soc: Add Cortina Systems CS7542 global controls
Describe the shared syscon, its strap-selected clocks, three PCIe gates and level resets. Reserve the former group reset ID and assign individual IDs to the seven network reset signals.
--- .../soc/cortina/cortina,cs7542-syscon.yaml | 56 ++++++++++++++++++++++ include/dt-bindings/clock/cortina,cs7542-clock.h | 13 +++++ include/dt-bindings/reset/cortina,cs7542-reset.h | 20 ++++++++ 3 files changed, 89 insertions(+)
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml new file +56 -0
@@ -0,0 +1,56 @@ +# 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, + and the three PCIe clock gates and controller reset lines. Individual + reset lines control NI, FE, TM, scheduler, QM, NI XRAM and the entire DMA + block (LSO and SSP). The network engine consumer must acquire all seven + lines exclusively; it cannot run concurrently with a separate SSP DMA + user. The flash controller has a separate reset. SDRAM is excluded. + Reset identifier 3 is reserved. + Clock specifiers are defined in dt-bindings/clock/cortina,cs7542-clock.h; + reset specifiers are defined in dt-bindings/reset/cortina,cs7542-reset.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 + + "#reset-cells": + const: 1 + +required: + - compatible + - reg + - "#clock-cells" + +additionalProperties: false + +examples: + - | + syscon@f0000000 { + compatible = "cortina,cs7542-syscon", "syscon", "simple-mfd"; + reg = <0xf0000000 0x100>; + #clock-cells = <1>; + #reset-cells = <1>; + };
include/dt-bindings/clock/cortina,cs7542-clock.h new file +13 -0
@@ -0,0 +1,13 @@ +/* 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 + +#define CS7542_CLK_PCIE0 3 +#define CS7542_CLK_PCIE1 4 +#define CS7542_CLK_PCIE2 5 + +#endif
include/dt-bindings/reset/cortina,cs7542-reset.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +#ifndef _DT_BINDINGS_RESET_CORTINA_CS7542_H +#define _DT_BINDINGS_RESET_CORTINA_CS7542_H + +#define CS7542_RESET_PCIE0 0 +#define CS7542_RESET_PCIE1 1 +#define CS7542_RESET_PCIE2 2 + +/* Reserved legacy composite ID; never reinterpret it as an individual line. */ +#define CS7542_RESET_NE 3 +#define CS7542_RESET_NI 4 +#define CS7542_RESET_FE 5 +#define CS7542_RESET_TM 6 +#define CS7542_RESET_SCH 7 +#define CS7542_RESET_QM 8 +#define CS7542_RESET_DMA 9 +#define CS7542_RESET_NI_XRAM 10 +#define CS7542_RESET_FLASH 11 + +#endif
Signature · 1 line
2.53.0
Re: [PATCH v5 1/6] dt-bindings: soc: Add Cortina Systems CS7542 global controls
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml line 31
Quoted 7 lines · Fil Dunsky
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml new file +7
-0+ +properties: + compatible: + items: + - const: cortina,cs7542-syscon + - const: syscon + - const: simple-mfd
You do not have any children, this cannot be a simple-mfd.
Quoted 4 lines
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml new file +4
-0+ + reg: + maxItems: 1 +
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml line 45
Quoted 10 lines
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml new file +10
-0+ "#clock-cells": + const: 1 + + "#reset-cells": + const: 1 + +required: + - compatible + - reg + - "#clock-cells"
Also, reset-cells should be required.
Quoted 36 lines
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml new file +11
-0+ +additionalProperties: false + +examples: + - | + syscon@f0000000 { + compatible = "cortina,cs7542-syscon", "syscon", "simple-mfd"; + reg = <0xf0000000 0x100>; + #clock-cells = <1>; + #reset-cells = <1>; + };include/dt-bindings/clock/cortina,cs7542-clock.h new file +13
-0@@ -0,0 +1,13 @@ +/* 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 + +#define CS7542_CLK_PCIE0 3 +#define CS7542_CLK_PCIE1 4 +#define CS7542_CLK_PCIE2 5 + +#endif include/dt-bindings/reset/cortina,cs7542-reset.h new file +0
-0
include/dt-bindings/reset/cortina,cs7542-reset.h line 9
Quoted 9 lines
include/dt-bindings/reset/cortina,cs7542-reset.h new file +9
-0@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +#ifndef _DT_BINDINGS_RESET_CORTINA_CS7542_H +#define _DT_BINDINGS_RESET_CORTINA_CS7542_H + +#define CS7542_RESET_PCIE0 0 +#define CS7542_RESET_PCIE1 1 +#define CS7542_RESET_PCIE2 2 + +/* Reserved legacy composite ID; never reinterpret it as an individual line. */
This is confusing. Please do not add legacy bindings. Drop everything which is legacy here.
include/dt-bindings/reset/cortina,cs7542-reset.h line 19
Quoted 10 lines
include/dt-bindings/reset/cortina,cs7542-reset.h new file +10
-0+#define CS7542_RESET_NE 3 +#define CS7542_RESET_NI 4 +#define CS7542_RESET_FE 5 +#define CS7542_RESET_TM 6 +#define CS7542_RESET_SCH 7 +#define CS7542_RESET_QM 8 +#define CS7542_RESET_DMA 9 +#define CS7542_RESET_NI_XRAM 10 +#define CS7542_RESET_FLASH 11 +
Best regards,
Krzysztof
PATCH v5 2/6 dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux
In reply to Fil DunskyDescribe the GPIO and UART mux functions and reference the child schema from the global control block.
--- .../bindings/pinctrl/cortina,cs7542-pinctrl.yaml | 84 ++++++++++++++++++++++ .../soc/cortina/cortina,cs7542-syscon.yaml | 4 ++ 2 files changed, 88 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"; + }; + }; + };
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml +4 -0
@@ -39,6 +39,10 @@ properties: "#reset-cells": const: 1 + pinctrl: + type: object + $ref: /schemas/pinctrl/cortina,cs7542-pinctrl.yaml# + required: - compatible - reg
Signature · 1 line
2.53.0
Re: [PATCH v5 2/6] dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux
Quoted 5 lines · Fil Dunsky
Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml new file +5
-0+ pinctrl { + compatible = "cortina,cs7542-pinctrl"; + + reset-pins { + function = "gpio";
Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml line 84
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml new file +10
-0+ pins = "gpio37"; + }; + + aux-uarts-pins { + function = "uart"; + pins = "gpio72", "gpio73", "gpio74", "gpio75", + "gpio76", "gpio77"; + }; + }; + };
Skip the example here and make the parent device schema example complete.
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml properties: · line 44
Quoted 11 lines
Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml +3
-0@@ -39,6 +39,10 @@ properties: "#reset-cells": const: 1 + pinctrl: + type: object + $ref: /schemas/pinctrl/cortina,cs7542-pinctrl.yaml#
OK, so this explains previous odd choice. Please re-order these patches and this hunk goes to MFD patch which will be 2/6.
Best regards,
Krzysztof
PATCH v5 3/6 clk: Add Cortina Systems CS7542 clocks
In reply to Fil DunskyRegister the APB, CPU and AXI clocks from the boot strap and the three PCIe gates through one provider on the global syscon. Timers require the APB rate before platform device registration.
--- drivers/clk/Kconfig | 9 +++ drivers/clk/Makefile | 1 + drivers/clk/clk-cs7542.c | 161 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 171 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 clocks" + depends on OF && HAS_IOMEM + select MFD_SYSCON + help + Read the boot straps to provide the APB, CPU and AXI clocks. + Also provide the three PCIe clock gates. The APB clock is needed + by the timers before platform devices probe. + 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 +161 -0
161 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v5 4/6 reset: Add Cortina Systems CS7542 global reset controller
In reply to Fil DunskyUse the shared syscon regmap to control three PCIe and seven network engine reset signals. PCIe consumers supply their own assert and recovery timing. Verify level transitions of the network resets before the consumer releases DMA buffers. Reject the unassigned group ID to preserve exclusive ownership of the underlying lines.
The clock provider registers early for timers. Match the platform device for the same syscon when reset consumers can probe.
--- drivers/reset/Kconfig | 10 ++++ drivers/reset/Makefile | 1 + drivers/reset/reset-cs7542.c | 135 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+)
drivers/reset/Kconfig +10 -0
@@ -73,6 +73,16 @@ config RESET_BRCMSTB_RESCAL This enables the RESCAL reset controller for SATA, PCIe0, or PCIe1 on BCM7216 or the BCM2712. +config RESET_CS7542 + tristate "Cortina Systems CS7542 reset controller" + depends on OF && HAS_IOMEM + select MFD_SYSCON + help + Control the individual PCIe and network engine reset signals in + the CS7542 global register block. + The PCIe controllers have independent level resets. The network + engine uses seven reset lines, including the shared DMA block. + config RESET_DR1V90 tristate "Anlogic DR1V90 reset controller" depends on ARCH_ANLOGIC || COMPILE_TEST
drivers/reset/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o obj-$(CONFIG_RESET_BRCMSTB) += reset-brcmstb.o obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o +obj-$(CONFIG_RESET_CS7542) += reset-cs7542.o obj-$(CONFIG_RESET_DR1V90) += reset-dr1v90.o obj-$(CONFIG_RESET_EIC7700) += reset-eic7700.o obj-$(CONFIG_RESET_EIC7700_HSP) += reset-eic7700-hsp.o
drivers/reset/reset-cs7542.c new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v5 5/6 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 v5 6/6 MAINTAINERS: Add CS7542 global control support
In reply to Fil DunskyAdd contacts and paths for the CS7542 clock, reset and pinctrl drivers and their device tree bindings.
--- MAINTAINERS | 12 ++++++++++++ 1 file changed, 12 insertions(+)
MAINTAINERS +12 -0
@@ -2949,6 +2949,18 @@ 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: drivers/reset/reset-cs7542.c +F: include/dt-bindings/clock/cortina,cs7542-clock.h +F: include/dt-bindings/reset/cortina,cs7542-reset.h + ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE M: Hans Ulli Kroll <[email protected]> M: Linus Walleij <[email protected]>
Signature · 1 line
2.53.0