🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
5 messages
5 total messages Started by Fil Dunsky via B4 Relay Mon, 23 Nov 2026 18:44
[PATCH net-next 0/5] net: cortina: Add CS7542 network engine support
#21241
Author: Fil Dunsky via B4 Relay
Date: Mon, 23 Nov 2026 18:44
81 lines
14977 bytes
Add a CPU datapath for the Cortina Systems CS7542 network engine and
an exclusive reset provider for its NI/FE/TM/QM/scheduler/XRAM and
DMA-LSO/SSP domain. The three GMACs use phylink; Almond+ connects two
of them to the CPU ports of a QCA8337 switch handled by DSA.

The driver uses NAPI receive queues and a shared coherent TX ring,
with scatter-gather TX and multi-buffer RX. Hardware-returned RX
addresses are checked against tracked mappings and their ownership.
Indirect initialization waits are bounded and errors prevent activation.
Unregister/remove drains ports and software work, then confirms the
complete reset domain before releasing DMA allocations. If reset fails
after activation, those allocations remain pinned until reboot.

The whole DMA-LSO/SSP block is exclusively owned. Another SSP DMA user
cannot run concurrently; the separately prepared CS7542 NAND driver
uses PIO. Initial QM support requires a no-map reservation of the upper
64 MiB of the verified 512 MiB DDR layout. Hardware offload, unverified
coalescing clock assumptions and power management are not advertised.

This series depends on the CS7542 global clock/pinctrl v1 series:
https://lore.kernel.org/all/20261123-cs7542-syscon-v1-0-49858e631449@gmail.com/
Both series are based on Linux v7.4-rc4. Board DTS enablement is
kept in the integration branch and OpenWrt target, outside these five
patches. The reset provider and Ethernet driver do not depend on the
Cortina platform Kconfig symbol or COMPILE_TEST.

Validation on Securifi Almond+:
- Full independent ARM vmlinux and module builds, =y and =m, with
  COMPILE_TEST=n and no platform series; DT schemas and examples.
- Actual helper fault-path tests under ASan/UBSan, including RX ownership,
  TX mapping rollback, probe failures, table timeouts and reset failures.
- RAM module lifecycle: 132 checks / 0 failures, ten load/unload cycles,
  active-port teardown, reset readback and reset-failure DMA retention.
- External LAN1: 600/600 UDP echoes with byte comparison and 20/20 ICMPv6
  packets with 1400-byte payloads; no GMAC RX/TX errors.
- QCA CPU6-to-CPU0: 448/448 nonlinear packets, including RX buffer
  boundaries and 8192-byte payloads, with TX descriptor-ring wrap.
- Combined RAM test with PCIe and read-only NAND: all six PCIe devices,
  protected NAND hashes while the NE reset is held, and Ethernet reload.
- The original 14 protected flash/configuration hashes remained unchanged
  after returning to the installed OpenWrt.

Only LAN1 has been externally cable-tested in these runs. No throughput
or entropy claim follows from these functional checks.

---
Fil Dunsky (5):
      dt-bindings: reset: Add Cortina CS7542 network engine reset domain
      reset: Add Cortina CS7542 network engine domain control
      dt-bindings: net: Add Cortina CS7542 network engine
      net: cortina: Add CS7542 CPU network datapath
      MAINTAINERS: Add CS7542 network engine support

 .../bindings/net/cortina,cs7542-ethernet.yaml      |  139 ++
 .../bindings/reset/cortina,cs7542-ne-reset.yaml    |   42 +
 .../soc/cortina/cortina,cs7542-syscon.yaml         |    4 +
 MAINTAINERS                                        |    9 +
 drivers/net/ethernet/cortina/Kconfig               |   14 +
 drivers/net/ethernet/cortina/Makefile              |    3 +
 drivers/net/ethernet/cortina/cs752x_fe.c           |  477 ++++++
 drivers/net/ethernet/cortina/cs752x_ne.c           | 1783 ++++++++++++++++++++
 drivers/net/ethernet/cortina/cs752x_ne.h           |   13 +
 drivers/net/ethernet/cortina/cs752x_sch_tm.c       |  679 ++++++++
 drivers/reset/Kconfig                              |   10 +
 drivers/reset/Makefile                             |    2 +
 drivers/reset/reset-cs7542-ne.c                    |  114 ++
 13 files changed, 3289 insertions(+)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261123-b4-cs7542-ethernet-59c15dbc7e7e
prerequisite-message-id: 20261123-cs7542-syscon-v1-0-49858e631449@gmail.com
prerequisite-patch-id: 4b568d742095f1a61312c911d2b6e81c8e754312
prerequisite-patch-id: a4bba26a3aac57e4e4229a727fdf94677373493a
prerequisite-patch-id: f8a2ba71717f71ca2bedda986f8b861995cdc586
prerequisite-patch-id: 7a2275c69dcde437fc8badf2bba06d451943a66f
prerequisite-patch-id: 25220835f5d2506a01ba652d86f9b9ac3ad5121a

Best regards,
--  
Fil Dunsky <filipp.dunsky@gmail.com>
[PATCH net-next 2/5] reset: Add Cortina CS7542 network engine domain control
#21242
Author: Fil Dunsky via B4 Relay
Date: Mon, 23 Nov 2026 18:44
169 lines
15870 bytes
From: Fil Dunsky <filipp.dunsky@gmail.com>

Expose the NI, FE, TM, scheduler, QM, DMA-LSO/SSP and XRAM resets as one
exclusive logical domain. Change all owned bits in one masked
global-regmap update, preserve neighboring resets and require bounded
hardware readback. Return an error for a partially asserted domain.

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

diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index eda9c698a..8218d639f 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -15,6 +15,16 @@ menuconfig RESET_CONTROLLER
 
 if RESET_CONTROLLER
 
+config RESET_CS7542_NE
+	tristate "Cortina CS7542 network engine reset domain"
+	depends on OF && HAS_IOMEM
+	select MFD_SYSCON
+	help
+	  Control the combined NI/FE/TM/SCH/QM/XRAM and DMA-LSO/SSP domain.
+	  The consumer must exclusively own the entire network and DMA block.
+	  Use this with the network engine driver when no separate SSP DMA
+	  consumer is enabled; the NAND controller may operate through PIO.
+
 config RESET_A10SR
 	tristate "Altera Arria10 System Resource Reset"
 	depends on MFD_ALTERA_A10SR || COMPILE_TEST
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 489fafd6b..c24b8e281 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -55,3 +55,5 @@ obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
 obj-$(CONFIG_RESET_UNIPHIER_GLUE) += reset-uniphier-glue.o
 obj-$(CONFIG_RESET_ZYNQ) += reset-zynq.o
 obj-$(CONFIG_RESET_ZYNQMP) += reset-zynqmp.o
+
+obj-$(CONFIG_RESET_CS7542_NE) += reset-cs7542-ne.o
diff --git a/drivers/reset/reset-cs7542-ne.c b/drivers/reset/reset-cs7542-ne.c
new file mode 100644
index 000000000..81442c6a9
--- /dev/null
+++ b/drivers/reset/reset-cs7542-ne.c
@@ -0,0 +1,114 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* The network engine and DMA-LSO/SSP reset domain has one exclusive owner. */
+#include <linux/bitfield.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/slab.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>
+
+#define CS7542_GLOBAL_RESET	0x04
+/* 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))
+
+struct cs7542_ne_reset {
+	struct reset_controller_dev rcdev;
+	struct regmap *map;
+};
+
+static int cs7542_ne_reset_update(struct reset_controller_dev *rcdev,
+				  unsigned long id, bool asserted)
+{
+	struct cs7542_ne_reset *rst = container_of(rcdev, struct cs7542_ne_reset, rcdev);
+	unsigned int value, target = asserted ? CS7542_NE_RESET_MASK : 0;
+	int ret;
+
+	if (id)
+		return -EINVAL;
+	ret = regmap_update_bits(rst->map, CS7542_GLOBAL_RESET,
+				 CS7542_NE_RESET_MASK, target);
+	if (ret)
+		return ret;
+	return regmap_read_poll_timeout(rst->map, CS7542_GLOBAL_RESET, value,
+				       (value & CS7542_NE_RESET_MASK) == target,
+				       1, 1000);
+}
+
+static int cs7542_ne_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
+{
+	return cs7542_ne_reset_update(rcdev, id, true);
+}
+
+static int cs7542_ne_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
+{
+	return cs7542_ne_reset_update(rcdev, id, false);
+}
+
+static int cs7542_ne_reset_status(struct reset_controller_dev *rcdev, unsigned long id)
+{
+	struct cs7542_ne_reset *rst = container_of(rcdev, struct cs7542_ne_reset, rcdev);
+	unsigned int value;
+	int ret;
+
+	if (id)
+		return -EINVAL;
+	ret = regmap_read(rst->map, CS7542_GLOBAL_RESET, &value);
+	if (ret)
+		return ret;
+	value &= CS7542_NE_RESET_MASK;
+	if (value && value != CS7542_NE_RESET_MASK)
+		return -EIO;
+	return !!value;
+}
+
+static int cs7542_ne_reset_xlate(struct reset_controller_dev *rcdev,
+				 const struct of_phandle_args *spec)
+{
+	return spec->args_count ? -EINVAL : 0;
+}
+
+static const struct reset_control_ops cs7542_ne_reset_ops = {
+	.assert = cs7542_ne_reset_assert,
+	.deassert = cs7542_ne_reset_deassert,
+	.status = cs7542_ne_reset_status,
+};
+
+static int cs7542_ne_reset_probe(struct platform_device *pdev)
+{
+	struct cs7542_ne_reset *rst;
+
+	rst = devm_kzalloc_obj(&pdev->dev, *rst);
+	if (!rst)
+		return -ENOMEM;
+	rst->map = syscon_node_to_regmap(pdev->dev.of_node->parent);
+	if (IS_ERR(rst->map))
+		return dev_err_probe(&pdev->dev, PTR_ERR(rst->map), "global syscon\n");
+	rst->rcdev.dev = &pdev->dev;
+	rst->rcdev.owner = THIS_MODULE;
+	rst->rcdev.ops = &cs7542_ne_reset_ops;
+	rst->rcdev.nr_resets = 1;
+	rst->rcdev.of_node = pdev->dev.of_node;
+	rst->rcdev.of_reset_n_cells = 0;
+	rst->rcdev.of_xlate = cs7542_ne_reset_xlate;
+	return devm_reset_controller_register(&pdev->dev, &rst->rcdev);
+}
+
+static const struct of_device_id cs7542_ne_reset_match[] = {
+	{ .compatible = "cortina,cs7542-ne-reset" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, cs7542_ne_reset_match);
+
+static struct platform_driver cs7542_ne_reset_driver = {
+	.probe = cs7542_ne_reset_probe,
+	.driver = {
+		.name = "cs7542-ne-reset",
+		.of_match_table = cs7542_ne_reset_match,
+	},
+};
+module_platform_driver(cs7542_ne_reset_driver);
+
+MODULE_DESCRIPTION("Cortina CS7542 exclusive network engine reset domain");
+MODULE_LICENSE("GPL");

-- 
2.53.0
[PATCH net-next 3/5] dt-bindings: net: Add Cortina CS7542 network engine
#21243
Author: Fil Dunsky via B4 Relay
Date: Mon, 23 Nov 2026 18:44
162 lines
15221 bytes
From: Fil Dunsky <filipp.dunsky@gmail.com>

Describe the GMAC ports, network-engine register banks, complete
exclusively owned LSO/SSP DMA resources and engine reset. Require an
explicit no-map queue-manager DDR reservation for the verified 512 MiB
memory layout. A separate SSP DMA consumer cannot coexist; NAND PIO does
not use that block.

Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
 .../bindings/net/cortina,cs7542-ethernet.yaml      | 139 +++++++++++++++++++++
 1 file changed, 139 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/cortina,cs7542-ethernet.yaml b/Documentation/devicetree/bindings/net/cortina,cs7542-ethernet.yaml
new file mode 100644
index 000000000..94bda9e0b
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/cortina,cs7542-ethernet.yaml
@@ -0,0 +1,139 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/cortina,cs7542-ethernet.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cortina Systems CS7542 network engine
+
+maintainers:
+  - Fil Dunsky <filipp.dunsky@gmail.com>
+
+description: |
+  The CS7542 network engine contains three GMACs, the network interface (NI),
+  forwarding engine (FE), queue manager (QM), traffic manager (TM), scheduler,
+  CPU XRAM interface and packet DMA. The CPU datapath uses the DMA-LSO TX
+  queue and QM-managed RX buffers. The complete DMA-LSO/SSP register block
+  and the combined reset domain must be exclusively owned by this device;
+  a separate SSP DMA consumer cannot operate concurrently. A NAND controller
+  using PIO does not consume that DMA block.
+
+properties:
+  compatible:
+    const: cortina,cs7542-ethernet
+
+  reg:
+    items:
+      - description: NI registers
+      - description: Complete DMA-LSO and DMA-SSP registers
+      - description: FE registers and indirect table interfaces
+      - description: QM registers
+      - description: TM registers
+      - description: Scheduler registers
+      - description: CPU XRAM
+
+  reg-names:
+    items:
+      - const: ni
+      - const: dma
+      - const: fe
+      - const: qm
+      - const: tm
+      - const: sch
+      - const: xram
+
+  interrupts:
+    items:
+      - description: GMAC0 CPU receive queue interrupt
+      - description: GMAC1 CPU receive queue interrupt
+      - description: GMAC2 CPU receive queue interrupt
+
+  interrupt-names:
+    items:
+      - const: eth0
+      - const: eth1
+      - const: eth2
+
+  cortina,global-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Global control syscon for network drive strength and status.
+
+  resets:
+    maxItems: 1
+    description: Exclusive atomic reset of the complete NE and DMA-LSO/SSP domain.
+
+  reset-names:
+    const: engine
+
+  memory-region:
+    maxItems: 1
+    description: |
+      Reserved no-map DDR region used by the packet queue manager. Initial
+      support uses the upper 64 MiB of the 512 MiB DDR layout at 0x1c000000.
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^ethernet-port@[0-2]$":
+    type: object
+    $ref: ethernet-controller.yaml#
+    unevaluatedProperties: false
+    properties:
+      reg:
+        maxItems: 1
+      phy-mode:
+        enum: [rgmii, rgmii-id, rgmii-rxid, rgmii-txid]
+    required:
+      - reg
+      - phy-mode
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - interrupt-names
+  - cortina,global-syscon
+  - resets
+  - reset-names
+  - memory-region
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    ethernet@f0010000 {
+        compatible = "cortina,cs7542-ethernet";
+        reg = <0xf0010000 0x500>, <0xf0090000 0x800>,
+              <0xf0020000 0x4000>, <0xf0030000 0x400>,
+              <0xf0040000 0x800>, <0xf0060000 0x100>,
+              <0xf0400000 0x100000>;
+        reg-names = "ni", "dma", "fe", "qm", "tm", "sch", "xram";
+        interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-names = "eth0", "eth1", "eth2";
+        cortina,global-syscon = <&global>;
+        resets = <&ne_reset>;
+        reset-names = "engine";
+        memory-region = <&qm_reserved>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ethernet-port@1 {
+            reg = <1>;
+            phy-mode = "rgmii";
+            fixed-link {
+                speed = <1000>;
+                full-duplex;
+            };
+        };
+    };

-- 
2.53.0
Re: [PATCH net-next 3/5] dt-bindings: net: Add Cortina CS7542 network engine
#21342
Author: Andrew Lunn
Date: Mon, 23 Nov 2026 22:05
28 lines
9485 bytes
> +description: |
> +  The CS7542 network engine contains three GMACs, the network interface (NI),
> +  forwarding engine (FE), queue manager (QM), traffic manager (TM), scheduler,
> +  CPU XRAM interface and packet DMA.

Is this three independent MACs, or are we talking about a switch? Can
frames be forward from port to port without the CPU being involved?

> +        ethernet-port@1 {
> +            reg = <1>;
> +            phy-mode = "rgmii";
> +            fixed-link {
> +                speed = <1000>;
> +                full-duplex;
> +            };

This is unusual for an example, in two different ways.

1) rgmii often wrong.

https://elixir.bootlin.com/linux/v6.15/source/Documentation/devicetree/bindings/net/ethernet-controller.yaml#L287

Does the PCB have extra long clock lines?

2) Why fixed link? Does this connect to an Ethernet switch?

   Andrew
Re: [PATCH net-next 3/5] dt-bindings: net: Add Cortina CS7542 network engine
#21352
Author: Fil Dunsky
Date: Mon, 23 Nov 2026 22:31
26 lines
12721 bytes
The hardware has three GMAC interfaces feeding a shared NI/FE, queue
manager, traffic manager and scheduler. The forwarding engine can steer
frames between GMAC ports without the CPU, including rewrite/NAT in the
vendor acceleration path. The posted driver configures CPU forwarding
and exposes the three MAC interfaces; it does not enable hardware flow
forwarding. I should make that shared datapath clearer in the binding.

On Almond+ there is also a separate QCA8337 Ethernet switch. GMAC1 is
wired to its CPU port 0, and GMAC0 to CPU port 6; the external copper
PHYs belong to that switch. Those MAC-to-switch connections are the
reason for the fixed 1 Gbit/s links in the example.

You are right about the phy-mode description. Both QCA CPU port nodes
already use rgmii-id, so qca8k programs the internal clock delays there.
I used rgmii on the SoC side to mean that its peer supplies the delays,
but that is not what the PCB-level phy-mode describes. I have no evidence
of deliberately extended PCB clock traces. I will correct the example
and the SoC MAC nodes to rgmii-id, and explain the fixed MAC-to-switch
connection. The existing QCA delay programming remains in place; the NI
driver does not add another set of internal delays.

I will keep the Ethernet reroll within the requested netdev cadence.

Thanks,
Fil
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads