* [PATCH 1/3] dt-bindings: soc: Describe CS7542 global gates and reset domains
2026-11-23 21:50 [PATCH 0/3] soc: cortina: Add CS7542 shared gates and reset domains Fil Dunsky via B4 Relay
@ 2026-11-23 21:50 ` Fil Dunsky via B4 Relay
2026-11-23 21:50 ` [PATCH 2/3] clk: cs7542: Add global PCIe controls and network engine reset Fil Dunsky via B4 Relay
2026-11-23 21:51 ` [PATCH 3/3] MAINTAINERS: Track CS7542 global reset specifiers Fil Dunsky via B4 Relay
2 siblings, 0 replies; 4+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-23 21:50 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Stephen Boyd,
Brian Masney, Jerome Brunet, Philipp Zabel
Cc: linux-arm-kernel, devicetree, linux-kernel, linux-clk
From: Fil Dunsky <filipp.dunsky@gmail.com>
Expose PCIe gates and resets and the exclusive network engine composite
reset on the existing global syscon node. Preserve clock indices 0..2,
add PCIe clock indices 3..5 and reset indices 0..2, and give the NE domain
index 3. No virtual control child is required. The optional reset-cells
property preserves compatibility with clock-only users.
AI assistance: Codex prepared this draft from the posted CS7542 series.
Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
.../bindings/soc/cortina/cortina,cs7542-syscon.yaml | 14 ++++++++++++--
include/dt-bindings/clock/cortina,cs7542-clock.h | 4 ++++
include/dt-bindings/reset/cortina,cs7542-reset.h | 12 ++++++++++++
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml b/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml
index fb074de87..12f750dab 100644
--- a/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml
+++ b/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml
@@ -12,8 +12,14 @@ maintainers:
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.
+ It provides the APB, CPU and AXI clock rates selected by the boot straps,
+ and the three PCIe clock gates and controller reset lines. The network
+ engine reset domain covers NI, FE, TM, scheduler, QM, NI XRAM and the
+ entire DMA block (LSO and SSP). It excludes SDRAM. The network engine
+ consumer must own this complete domain exclusively; it cannot run
+ concurrently with a separate SSP DMA user.
+ 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:
@@ -29,6 +35,9 @@ properties:
"#clock-cells":
const: 1
+ "#reset-cells":
+ const: 1
+
pinctrl:
type: object
$ref: /schemas/pinctrl/cortina,cs7542-pinctrl.yaml#
@@ -46,4 +55,5 @@ examples:
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
index 34d544238..c68c6ba20 100644
--- a/include/dt-bindings/clock/cortina,cs7542-clock.h
+++ b/include/dt-bindings/clock/cortina,cs7542-clock.h
@@ -6,4 +6,8 @@
#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..546e643a3
--- /dev/null
+++ b/include/dt-bindings/reset/cortina,cs7542-reset.h
@@ -0,0 +1,12 @@
+/* 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
+
+/* NI, FE, TM, scheduler, QM, NI XRAM and DMA-LSO/SSP, excluding SDRAM. */
+#define CS7542_RESET_NE 3
+
+#endif
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/3] clk: cs7542: Add global PCIe controls and network engine reset
2026-11-23 21:50 [PATCH 0/3] soc: cortina: Add CS7542 shared gates and reset domains Fil Dunsky via B4 Relay
2026-11-23 21:50 ` [PATCH 1/3] dt-bindings: soc: Describe CS7542 global " Fil Dunsky via B4 Relay
@ 2026-11-23 21:50 ` Fil Dunsky via B4 Relay
2026-11-23 21:51 ` [PATCH 3/3] MAINTAINERS: Track CS7542 global reset specifiers Fil Dunsky via B4 Relay
2 siblings, 0 replies; 4+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-23 21:50 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Stephen Boyd,
Brian Masney, Jerome Brunet, Philipp Zabel
Cc: linux-arm-kernel, devicetree, linux-kernel, linux-clk
From: Fil Dunsky <filipp.dunsky@gmail.com>
Register PCIe gates and controller resets through the early global
provider. Add the network engine composite reset using the same syscon
regmap, with the existing 1 us/1000 us readback polling and partial-domain
status error from the posted NE reset driver. Keep the PCIe reset pulse
delays and all provider-registration failure cleanup. NE pulse reset
remains unsupported; the Ethernet consumer needs assert/deassert/status.
Both independent consumers can use this common provider without a
PCIe-host dependency or a resource-less network reset child.
AI assistance: Codex prepared this draft from the posted CS7542 series.
Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
drivers/clk/Kconfig | 7 +-
drivers/clk/clk-cs7542.c | 211 ++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 195 insertions(+), 23 deletions(-)
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 47b5265fe..cba07bed3 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -59,13 +59,16 @@ config LMK04832
Low-Noise JESD204B Compliant Clock Jitter Cleaner With Dual Loop PLLs
config COMMON_CLK_CS7542
- bool "Cortina Systems CS7542 strap-selected clocks"
+ bool "Cortina Systems CS7542 global clocks and resets"
depends on OF && HAS_IOMEM
select MFD_SYSCON
+ select RESET_CONTROLLER
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.
+ dividers. It also provides the three PCIe clock gates and resets,
+ and the exclusive network engine and DMA-LSO/SSP reset domain.
+ It is built in because the APB clock is needed by timers.
config COMMON_CLK_APPLE_NCO
tristate "Clock driver for Apple SoC NCOs"
diff --git a/drivers/clk/clk-cs7542.c b/drivers/clk/clk-cs7542.c
index 4e6c1e98a..17b7109a9 100644
--- a/drivers/clk/clk-cs7542.c
+++ b/drivers/clk/clk-cs7542.c
@@ -1,24 +1,29 @@
// SPDX-License-Identifier: GPL-2.0-only
-/* Cortina Systems CS7542 strap-selected clocks */
+/* Cortina Systems CS7542 global clocks and reset domains. */
#include <linux/bitfield.h>
#include <linux/clk-provider.h>
+#include <linux/delay.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/mfd/syscon.h>
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/printk.h>
#include <linux/regmap.h>
+#include <linux/reset-controller.h>
#include <linux/slab.h>
#include <dt-bindings/clock/cortina,cs7542-clock.h>
+#include <dt-bindings/reset/cortina,cs7542-reset.h>
#define CS7542_GLOBAL_STRAP 0x0c
#define CS7542_STRAP_SPEED GENMASK(3, 1)
-#define CS7542_NUM_CLKS 3
+#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_CLKS] = {
+static const unsigned long cs7542_rates[][CS7542_NUM_FIXED_CLKS] = {
/* APB, CPU, AXI */
{ 100000000, 400000000, 133333333 },
{ 100000000, 600000000, 150000000 },
@@ -33,14 +38,142 @@ 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 CS7542_NUM_RESETS 4
+/* NI, FE, TM, SCH, QM, DMA-LSO/SSP, NI XRAM; never reset SDRAM (bit 4). */
+#define CS7542_NE_RESET_MASK (GENMASK(3, 0) | BIT(5) | BIT(16) | BIT(17))
+#define GLOBAL_RESET 0x04
+#define GLOBAL_CONFIG 0x10
+
+struct cs7542_gate {
+ struct clk_hw hw;
+ struct regmap *map;
+ u32 mask;
+};
+
+struct cs7542_control {
+ struct reset_controller_dev rcdev;
+ struct regmap *map;
+ 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);
+ unsigned int value;
+ int ret;
+
+ ret = regmap_read(gate->map, GLOBAL_CONFIG, &value);
+ return ret ? ret : !!(value & gate->mask);
+}
+
+static const struct clk_ops cs7542_gate_ops = {
+ .prepare = cs7542_gate_prepare,
+ .unprepare = cs7542_gate_unprepare,
+ .is_prepared = cs7542_gate_is_prepared,
+};
+
+static int cs7542_reset_update(struct reset_controller_dev *rcdev,
+ unsigned long id, bool assert)
+{
+ struct cs7542_control *ctl = container_of(rcdev, struct cs7542_control, rcdev);
+ unsigned int value;
+ u32 mask, target;
+ int ret;
+
+ if (id >= CS7542_NUM_RESETS)
+ return -EINVAL;
+ mask = id == CS7542_RESET_NE ? CS7542_NE_RESET_MASK : BIT(6 + id);
+ target = assert ? mask : 0;
+ ret = regmap_update_bits(ctl->map, GLOBAL_RESET, mask, target);
+ if (ret || id != CS7542_RESET_NE)
+ return ret;
+ return regmap_read_poll_timeout(ctl->map, 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_control *ctl = container_of(rcdev, struct cs7542_control, rcdev);
+ unsigned int value;
+ u32 mask;
+ int ret;
+
+ if (id >= CS7542_NUM_RESETS)
+ return -EINVAL;
+ mask = id == CS7542_RESET_NE ? CS7542_NE_RESET_MASK : BIT(6 + id);
+ ret = regmap_read(ctl->map, GLOBAL_RESET, &value);
+ if (ret)
+ return ret;
+ value &= mask;
+ if (id == CS7542_RESET_NE && value && value != mask)
+ return -EIO;
+ return !!value;
+}
+
+static int cs7542_reset_pulse(struct reset_controller_dev *rcdev, unsigned long id)
+{
+ int ret;
+
+ if (id >= CS7542_NUM_RESETS)
+ return -EINVAL;
+ if (id == CS7542_RESET_NE)
+ return -EOPNOTSUPP;
+
+ ret = cs7542_reset_assert(rcdev, id);
+ if (ret)
+ return ret;
+ usleep_range(10000, 12000);
+ ret = cs7542_reset_deassert(rcdev, id);
+ if (ret)
+ return ret;
+ usleep_range(10000, 12000);
+ return 0;
+}
+
+static const struct reset_control_ops cs7542_reset_ops = {
+ .assert = cs7542_reset_assert,
+ .deassert = cs7542_reset_deassert,
+ .status = cs7542_reset_status,
+ .reset = cs7542_reset_pulse,
};
static void __init cs7542_clk_init(struct device_node *np)
{
- struct clk_hw_onecell_data *data;
+ struct cs7542_control *ctl;
struct regmap *map;
unsigned int strap, speed;
- int i, ret;
+ int i, j, ret;
map = syscon_node_to_regmap(np);
if (IS_ERR(map)) {
@@ -60,30 +193,66 @@ static void __init cs7542_clk_init(struct device_node *np)
return;
}
- data = kzalloc_flex(*data, hws, CS7542_NUM_CLKS);
- if (!data)
+ ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
+ if (!ctl)
+ return;
+ ctl->map = map;
+ ctl->clks = kzalloc_flex(*ctl->clks, hws, CS7542_NUM_CLKS);
+ if (!ctl->clks) {
+ kfree(ctl);
return;
- data->num = CS7542_NUM_CLKS;
-
- for (i = 0; i < CS7542_NUM_CLKS; i++) {
- data->hws[i] = clk_hw_register_fixed_rate(NULL,
- cs7542_clock_names[i], NULL,
- 0, cs7542_rates[speed][i]);
- if (IS_ERR(data->hws[i])) {
- ret = PTR_ERR(data->hws[i]);
- goto err_unregister;
+ }
+ 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;
}
}
- ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, data);
+ 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;
+ }
+
+ ctl->rcdev.owner = THIS_MODULE;
+ ctl->rcdev.ops = &cs7542_reset_ops;
+ ctl->rcdev.of_node = np;
+ ctl->rcdev.nr_resets = CS7542_NUM_RESETS;
+ ret = reset_controller_register(&ctl->rcdev);
+ if (ret)
+ goto err_unregister_gates;
+
+ ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, ctl->clks);
if (!ret)
return;
-err_unregister:
+ reset_controller_unregister(&ctl->rcdev);
+err_unregister_gates:
+ while (j--)
+ clk_hw_unregister(&ctl->gates[j].hw);
+err_unregister_fixed:
while (i--)
- clk_hw_unregister_fixed_rate(data->hws[i]);
- kfree(data);
- pr_err("%pOF: cannot register clocks: %d\n", np, ret);
+ clk_hw_unregister_fixed_rate(ctl->clks->hws[i]);
+ kfree(ctl->clks);
+ kfree(ctl);
+ pr_err("%pOF: cannot register global controls: %d\n", np, ret);
}
/* Timers need APB before platform devices, but the pinctrl child must probe. */
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread