From: Fil Dunsky via B4 Relay <devnull+filipp.dunsky.gmail.com@kernel.org>
To: Philipp Zabel <p.zabel@pengutronix.de>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Hans Ulli Kroll <ulli.kroll@googlemail.com>,
Linus Walleij <linusw@kernel.org>,
Russell King <linux@armlinux.org.uk>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH net-next 2/5] reset: Add Cortina CS7542 network engine domain control
Date: Mon, 23 Nov 2026 21:44:11 +0300 [thread overview]
Message-ID: <20261123-b4-cs7542-ethernet-v1-2-fdb5e8c2d508@gmail.com> (raw)
In-Reply-To: <20261123-b4-cs7542-ethernet-v1-0-fdb5e8c2d508@gmail.com>
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
next prev parent reply other threads:[~2026-11-23 18:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 18:44 [PATCH net-next 0/5] net: cortina: Add CS7542 network engine support Fil Dunsky via B4 Relay
2026-11-23 18:44 ` [PATCH net-next 1/5] dt-bindings: reset: Add Cortina CS7542 network engine reset domain Fil Dunsky via B4 Relay
2026-11-23 18:44 ` Fil Dunsky via B4 Relay [this message]
2026-11-23 18:44 ` [PATCH net-next 3/5] dt-bindings: net: Add Cortina CS7542 network engine Fil Dunsky via B4 Relay
2026-11-23 18:44 ` [PATCH net-next 4/5] net: cortina: Add CS7542 CPU network datapath Fil Dunsky via B4 Relay
2026-11-23 18:44 ` [PATCH net-next 5/5] MAINTAINERS: Add CS7542 network engine support Fil Dunsky via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261123-b4-cs7542-ethernet-v1-2-fdb5e8c2d508@gmail.com \
--to=devnull+filipp.dunsky.gmail.com@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@kernel.org \
--cc=filipp.dunsky@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=ulli.kroll@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®