Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 1/6] dt-bindings: soc: Add Cortina Systems CS7542 global controls
       [not found] <20261127-cs7542-syscon-v5-0-d5a373c72b05@gmail.com>
@ 2026-11-27 20:50 ` Fil Dunsky via B4 Relay
  2026-11-27 20:50 ` [PATCH v5 2/6] dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux Fil Dunsky via B4 Relay
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-27 20:50 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
	Stephen Boyd, Brian Masney, Jerome Brunet, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-clk, linux-gpio

From: Fil Dunsky <filipp.dunsky@gmail.com>

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.

Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
 .../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(+)

diff --git a/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml b/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml
new file mode 100644
index 000000000..59bd1cfe3
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml
@@ -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 <filipp.dunsky@gmail.com>
+
+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>;
+    };
diff --git a/include/dt-bindings/clock/cortina,cs7542-clock.h b/include/dt-bindings/clock/cortina,cs7542-clock.h
new file mode 100644
index 000000000..c68c6ba20
--- /dev/null
+++ b/include/dt-bindings/clock/cortina,cs7542-clock.h
@@ -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
diff --git a/include/dt-bindings/reset/cortina,cs7542-reset.h b/include/dt-bindings/reset/cortina,cs7542-reset.h
new file mode 100644
index 000000000..136d21432
--- /dev/null
+++ b/include/dt-bindings/reset/cortina,cs7542-reset.h
@@ -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

-- 
2.53.0




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

* [PATCH v5 2/6] dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux
       [not found] <20261127-cs7542-syscon-v5-0-d5a373c72b05@gmail.com>
  2026-11-27 20:50 ` [PATCH v5 1/6] dt-bindings: soc: Add Cortina Systems CS7542 global controls Fil Dunsky via B4 Relay
@ 2026-11-27 20:50 ` Fil Dunsky via B4 Relay
  2026-11-27 20:50 ` [PATCH v5 3/6] clk: Add Cortina Systems CS7542 clocks Fil Dunsky via B4 Relay
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-27 20:50 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
	Stephen Boyd, Brian Masney, Jerome Brunet, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-clk, linux-gpio

From: Fil Dunsky <filipp.dunsky@gmail.com>

Describe the GPIO and UART mux functions and reference the child
schema from the global control block.

Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
 .../bindings/pinctrl/cortina,cs7542-pinctrl.yaml   | 84 ++++++++++++++++++++++
 .../soc/cortina/cortina,cs7542-syscon.yaml         |  4 ++
 2 files changed, 88 insertions(+)

diff --git a/Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml
new file mode 100644
index 000000000..cd5c81a0d
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml
@@ -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 <filipp.dunsky@gmail.com>
+
+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";
+            };
+        };
+    };
diff --git a/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml b/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml
index 59bd1cfe3..384c0eac2 100644
--- a/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml
+++ b/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml
@@ -39,6 +39,10 @@ properties:
   "#reset-cells":
     const: 1
 
+  pinctrl:
+    type: object
+    $ref: /schemas/pinctrl/cortina,cs7542-pinctrl.yaml#
+
 required:
   - compatible
   - reg

-- 
2.53.0




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

* [PATCH v5 3/6] clk: Add Cortina Systems CS7542 clocks
       [not found] <20261127-cs7542-syscon-v5-0-d5a373c72b05@gmail.com>
  2026-11-27 20:50 ` [PATCH v5 1/6] dt-bindings: soc: Add Cortina Systems CS7542 global controls Fil Dunsky via B4 Relay
  2026-11-27 20:50 ` [PATCH v5 2/6] dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux Fil Dunsky via B4 Relay
@ 2026-11-27 20:50 ` Fil Dunsky via B4 Relay
  2026-11-27 20:50 ` [PATCH v5 4/6] reset: Add Cortina Systems CS7542 global reset controller Fil Dunsky via B4 Relay
  2026-11-27 20:50 ` [PATCH v5 6/6] MAINTAINERS: Add CS7542 global control support Fil Dunsky via B4 Relay
  4 siblings, 0 replies; 5+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-27 20:50 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
	Stephen Boyd, Brian Masney, Jerome Brunet, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-clk, linux-gpio

From: Fil Dunsky <filipp.dunsky@gmail.com>

Register 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.

Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
 drivers/clk/Kconfig      |   9 +++
 drivers/clk/Makefile     |   1 +
 drivers/clk/clk-cs7542.c | 161 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 171 insertions(+)

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 37a8e35d4..acf16b40c 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -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
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 52d138d4f..16b1168c8 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -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
diff --git a/drivers/clk/clk-cs7542.c b/drivers/clk/clk-cs7542.c
new file mode 100644
index 000000000..643bfaf84
--- /dev/null
+++ b/drivers/clk/clk-cs7542.c
@@ -0,0 +1,161 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Cortina Systems CS7542 global clocks. */
+
+#include <linux/bitfield.h>
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/mfd/syscon.h>
+#include <linux/of.h>
+#include <linux/printk.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#include <dt-bindings/clock/cortina,cs7542-clock.h>
+
+#define CS7542_GLOBAL_STRAP	0x0c
+#define CS7542_STRAP_SPEED	GENMASK(3, 1)
+#define CS7542_NUM_FIXED_CLKS	3
+#define CS7542_NUM_CLKS		6
+
+/* Rates from the GPL vendor kernel's get_platform_clk(). */
+static const unsigned long cs7542_rates[][CS7542_NUM_FIXED_CLKS] = {
+	/* APB, CPU, AXI */
+	{ 100000000, 400000000, 133333333 },
+	{ 100000000, 600000000, 150000000 },
+	{ 100000000, 700000000, 140000000 },
+	{ 100000000, 800000000, 160000000 },
+	{ 100000000, 900000000, 150000000 },
+	{ 150000000, 750000000, 150000000 },
+	{ 170000000, 850000000, 141666667 },
+};
+
+static const char * const cs7542_clock_names[] = {
+	[CS7542_CLK_APB] = "cs7542-apb",
+	[CS7542_CLK_CPU] = "cs7542-cpu",
+	[CS7542_CLK_AXI] = "cs7542-axi",
+	[CS7542_CLK_PCIE0] = "cs7542-pcie0",
+	[CS7542_CLK_PCIE1] = "cs7542-pcie1",
+	[CS7542_CLK_PCIE2] = "cs7542-pcie2",
+};
+
+#define CS7542_PORTS	3
+#define GLOBAL_CONFIG	0x10
+
+struct cs7542_gate {
+	struct clk_hw hw;
+	struct regmap *map;
+	u32 mask;
+};
+
+struct cs7542_clocks {
+	struct cs7542_gate gates[CS7542_PORTS];
+	struct clk_hw_onecell_data *clks;
+};
+
+static int cs7542_gate_prepare(struct clk_hw *hw)
+{
+	struct cs7542_gate *gate = container_of(hw, struct cs7542_gate, hw);
+
+	return regmap_update_bits(gate->map, GLOBAL_CONFIG, gate->mask, gate->mask);
+}
+
+static void cs7542_gate_unprepare(struct clk_hw *hw)
+{
+	struct cs7542_gate *gate = container_of(hw, struct cs7542_gate, hw);
+
+	regmap_update_bits(gate->map, GLOBAL_CONFIG, gate->mask, 0);
+}
+
+static int cs7542_gate_is_prepared(struct clk_hw *hw)
+{
+	struct cs7542_gate *gate = container_of(hw, struct cs7542_gate, hw);
+
+	return regmap_test_bits(gate->map, GLOBAL_CONFIG, gate->mask) > 0;
+}
+
+static const struct clk_ops cs7542_gate_ops = {
+	.prepare = cs7542_gate_prepare,
+	.unprepare = cs7542_gate_unprepare,
+	.is_prepared = cs7542_gate_is_prepared,
+};
+
+static void __init cs7542_clk_init(struct device_node *np)
+{
+	struct cs7542_clocks *ctl;
+	struct regmap *map;
+	unsigned int strap, speed;
+	int i, j, ret;
+
+	map = syscon_node_to_regmap(np);
+	if (IS_ERR(map)) {
+		pr_err("%pOF: cannot get global regmap: %ld\n", np, PTR_ERR(map));
+		return;
+	}
+
+	ret = regmap_read(map, CS7542_GLOBAL_STRAP, &strap);
+	if (ret) {
+		pr_err("%pOF: cannot read clock strap: %d\n", np, ret);
+		return;
+	}
+
+	speed = FIELD_GET(CS7542_STRAP_SPEED, strap);
+	if (speed >= ARRAY_SIZE(cs7542_rates)) {
+		pr_err("%pOF: unsupported clock strap %u\n", np, speed);
+		return;
+	}
+
+	ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
+	if (!ctl)
+		return;
+	ctl->clks = kzalloc_flex(*ctl->clks, hws, CS7542_NUM_CLKS);
+	if (!ctl->clks) {
+		kfree(ctl);
+		return;
+	}
+	ctl->clks->num = CS7542_NUM_CLKS;
+
+	for (i = 0; i < CS7542_NUM_FIXED_CLKS; i++) {
+		ctl->clks->hws[i] = clk_hw_register_fixed_rate(NULL,
+							       cs7542_clock_names[i], NULL,
+							       0, cs7542_rates[speed][i]);
+		if (IS_ERR(ctl->clks->hws[i])) {
+			ret = PTR_ERR(ctl->clks->hws[i]);
+			goto err_unregister_fixed;
+		}
+	}
+
+	for (j = 0; j < CS7542_PORTS; j++) {
+		struct cs7542_gate *gate = &ctl->gates[j];
+		struct clk_init_data init = {
+			.name = cs7542_clock_names[CS7542_CLK_PCIE0 + j],
+			.ops = &cs7542_gate_ops,
+		};
+
+		/* Gate-only controls: no source frequency is assumed. */
+		gate->map = map;
+		gate->mask = BIT(10 + 2 * j);
+		gate->hw.init = &init;
+		ret = clk_hw_register(NULL, &gate->hw);
+		if (ret)
+			goto err_unregister_gates;
+		ctl->clks->hws[CS7542_CLK_PCIE0 + j] = &gate->hw;
+	}
+
+	ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, ctl->clks);
+	if (!ret)
+		return;
+
+err_unregister_gates:
+	while (j--)
+		clk_hw_unregister(&ctl->gates[j].hw);
+err_unregister_fixed:
+	while (i--)
+		clk_hw_unregister_fixed_rate(ctl->clks->hws[i]);
+	kfree(ctl->clks);
+	kfree(ctl);
+	pr_err("%pOF: cannot register clocks: %d\n", np, ret);
+}
+
+/* Timers need APB before platform devices, but the pinctrl child must probe. */
+CLK_OF_DECLARE_DRIVER(cs7542_clk, "cortina,cs7542-syscon", cs7542_clk_init);

-- 
2.53.0




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

* [PATCH v5 4/6] reset: Add Cortina Systems CS7542 global reset controller
       [not found] <20261127-cs7542-syscon-v5-0-d5a373c72b05@gmail.com>
                   ` (2 preceding siblings ...)
  2026-11-27 20:50 ` [PATCH v5 3/6] clk: Add Cortina Systems CS7542 clocks Fil Dunsky via B4 Relay
@ 2026-11-27 20:50 ` Fil Dunsky via B4 Relay
  2026-11-27 20:50 ` [PATCH v5 6/6] MAINTAINERS: Add CS7542 global control support Fil Dunsky via B4 Relay
  4 siblings, 0 replies; 5+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-27 20:50 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
	Stephen Boyd, Brian Masney, Jerome Brunet, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-clk, linux-gpio

From: Fil Dunsky <filipp.dunsky@gmail.com>

Use 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.

Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
 drivers/reset/Kconfig        |  10 ++++
 drivers/reset/Makefile       |   1 +
 drivers/reset/reset-cs7542.c | 135 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)

diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index eda9c698a..544cb79fa 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -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
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 489fafd6b..df183fc0a 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -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
diff --git a/drivers/reset/reset-cs7542.c b/drivers/reset/reset-cs7542.c
new file mode 100644
index 000000000..6b68a2109
--- /dev/null
+++ b/drivers/reset/reset-cs7542.c
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Cortina Systems CS7542 global reset controller */
+
+#include <linux/bits.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>
+#include <linux/slab.h>
+
+#include <dt-bindings/reset/cortina,cs7542-reset.h>
+
+#define CS7542_GLOBAL_RESET	0x04
+
+static const u32 cs7542_reset_masks[] = {
+	[CS7542_RESET_PCIE0] = BIT(6),
+	[CS7542_RESET_PCIE1] = BIT(7),
+	[CS7542_RESET_PCIE2] = BIT(8),
+	[CS7542_RESET_NI] = BIT(0),
+	[CS7542_RESET_FE] = BIT(1),
+	[CS7542_RESET_TM] = BIT(2),
+	[CS7542_RESET_SCH] = BIT(3),
+	[CS7542_RESET_QM] = BIT(5),
+	[CS7542_RESET_DMA] = BIT(16),
+	[CS7542_RESET_NI_XRAM] = BIT(17),
+	[CS7542_RESET_FLASH] = BIT(14),
+};
+
+struct cs7542_reset {
+	struct reset_controller_dev rcdev;
+	struct regmap *map;
+};
+
+static int cs7542_reset_update(struct reset_controller_dev *rcdev,
+			       unsigned long id, bool assert)
+{
+	struct cs7542_reset *rst = container_of(rcdev, struct cs7542_reset, rcdev);
+	u32 mask = cs7542_reset_masks[id];
+	u32 target = assert ? mask : 0;
+	unsigned int value;
+	int ret;
+
+	ret = regmap_update_bits(rst->map, CS7542_GLOBAL_RESET, mask, target);
+	if (ret || id < CS7542_RESET_NI)
+		return ret;
+
+	return regmap_read_poll_timeout(rst->map, CS7542_GLOBAL_RESET, value,
+					(value & mask) == target, 1, 1000);
+}
+
+static int cs7542_reset_assert(struct reset_controller_dev *rcdev,
+			       unsigned long id)
+{
+	return cs7542_reset_update(rcdev, id, true);
+}
+
+static int cs7542_reset_deassert(struct reset_controller_dev *rcdev,
+				 unsigned long id)
+{
+	return cs7542_reset_update(rcdev, id, false);
+}
+
+static int cs7542_reset_status(struct reset_controller_dev *rcdev,
+			       unsigned long id)
+{
+	struct cs7542_reset *rst = container_of(rcdev, struct cs7542_reset, rcdev);
+
+	return regmap_test_bits(rst->map, CS7542_GLOBAL_RESET, cs7542_reset_masks[id]);
+}
+
+static int cs7542_reset_xlate(struct reset_controller_dev *rcdev,
+			      const struct of_phandle_args *spec)
+{
+	unsigned int id = spec->args[0];
+
+	if (id >= rcdev->nr_resets || !cs7542_reset_masks[id])
+		return -EINVAL;
+
+	return id;
+}
+
+static const struct reset_control_ops cs7542_reset_ops = {
+	.assert = cs7542_reset_assert,
+	.deassert = cs7542_reset_deassert,
+	.status = cs7542_reset_status,
+};
+
+static int cs7542_reset_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct cs7542_reset *rst;
+
+	/* Clock-only descriptions also use this syscon. */
+	if (!of_property_present(dev->of_node, "#reset-cells"))
+		return 0;
+
+	rst = devm_kzalloc_obj(dev, *rst);
+	if (!rst)
+		return -ENOMEM;
+
+	rst->map = syscon_node_to_regmap(dev->of_node);
+	if (IS_ERR(rst->map))
+		return dev_err_probe(dev, PTR_ERR(rst->map), "cannot get global regmap\n");
+
+	rst->rcdev.owner = THIS_MODULE;
+	rst->rcdev.dev = dev;
+	rst->rcdev.of_node = dev->of_node;
+	rst->rcdev.ops = &cs7542_reset_ops;
+	rst->rcdev.nr_resets = ARRAY_SIZE(cs7542_reset_masks);
+	rst->rcdev.of_reset_n_cells = 1;
+	rst->rcdev.of_xlate = cs7542_reset_xlate;
+
+	return devm_reset_controller_register(dev, &rst->rcdev);
+}
+
+static const struct of_device_id cs7542_reset_of_match[] = {
+	{ .compatible = "cortina,cs7542-syscon" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, cs7542_reset_of_match);
+
+static struct platform_driver cs7542_reset_driver = {
+	.probe = cs7542_reset_probe,
+	.driver = {
+		.name = "cs7542-reset",
+		.of_match_table = cs7542_reset_of_match,
+		.suppress_bind_attrs = true,
+	},
+};
+module_platform_driver(cs7542_reset_driver);
+
+MODULE_DESCRIPTION("Cortina Systems CS7542 global reset controller");
+MODULE_LICENSE("GPL");

-- 
2.53.0




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

* [PATCH v5 6/6] MAINTAINERS: Add CS7542 global control support
       [not found] <20261127-cs7542-syscon-v5-0-d5a373c72b05@gmail.com>
                   ` (3 preceding siblings ...)
  2026-11-27 20:50 ` [PATCH v5 4/6] reset: Add Cortina Systems CS7542 global reset controller Fil Dunsky via B4 Relay
@ 2026-11-27 20:50 ` Fil Dunsky via B4 Relay
  4 siblings, 0 replies; 5+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-27 20:50 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
	Stephen Boyd, Brian Masney, Jerome Brunet, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-clk, linux-gpio

From: Fil Dunsky <filipp.dunsky@gmail.com>

Add contacts and paths for the CS7542 clock, reset and pinctrl
drivers and their device tree bindings.

Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
 MAINTAINERS | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 44540a1eb..703e95e83 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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 <filipp.dunsky@gmail.com>
+L:	linux-arm-kernel@lists.infradead.org (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 <ulli.kroll@googlemail.com>
 M:	Linus Walleij <linusw@kernel.org>

-- 
2.53.0




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

end of thread, other threads:[~2026-11-27 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261127-cs7542-syscon-v5-0-d5a373c72b05@gmail.com>
2026-11-27 20:50 ` [PATCH v5 1/6] dt-bindings: soc: Add Cortina Systems CS7542 global controls Fil Dunsky via B4 Relay
2026-11-27 20:50 ` [PATCH v5 2/6] dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux Fil Dunsky via B4 Relay
2026-11-27 20:50 ` [PATCH v5 3/6] clk: Add Cortina Systems CS7542 clocks Fil Dunsky via B4 Relay
2026-11-27 20:50 ` [PATCH v5 4/6] reset: Add Cortina Systems CS7542 global reset controller Fil Dunsky via B4 Relay
2026-11-27 20:50 ` [PATCH v5 6/6] MAINTAINERS: Add CS7542 global control support Fil Dunsky via B4 Relay

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