* [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support
@ 2025-10-16 10:20 Wei Fang
2025-10-16 10:20 ` [PATCH net-next 1/8] dt-bindings: net: netc-blk-ctrl: add compatible string for i.MX94 platforms Wei Fang
` (9 more replies)
0 siblings, 10 replies; 18+ messages in thread
From: Wei Fang @ 2025-10-16 10:20 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, claudiu.manoil, vladimir.oltean,
xiaoning.wang, Frank.Li, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
i.MX94 NETC has two kinds of ENETCs, one is the same as i.MX95, which
can be used as a standalone network port. The other one is an internal
ENETC, it connects to the CPU port of NETC switch through the pseudo
MAC. Also, i.MX94 have multiple PTP Timers, which is different from
i.MX95. Any PTP Timer can be bound to a specified standalone ENETC by
the IERB ETBCR registers. Currently, this patch only add ENETC support
and Timer support for i.MX94. The switch will be added by a separate
patch set.
---
Note that the DTS patch (patch 8/8) is just for referenece, it will be
removed from this patch set when the dt-bindings patches have been
reviewed. It will be sent for review by another thread in the future.
---
Clark Wang (1):
net: enetc: add ptp timer binding support for i.MX94
Wei Fang (7):
dt-bindings: net: netc-blk-ctrl: add compatible string for i.MX94
platforms
dt-bindings: net: enetc: add compatible string for ENETC with pseduo
MAC
dt-bindings: net: ethernet-controller: remove the enum values of speed
net: enetc: add preliminary i.MX94 NETC blocks control support
net: enetc: add basic support for the ENETC with pseudo MAC for i.MX94
net: enetc: add standalone ENETC support for i.MX94
arm64: dts: imx94: add basic NETC nodes and properties
.../bindings/net/ethernet-controller.yaml | 1 -
.../devicetree/bindings/net/fsl,enetc.yaml | 1 +
.../bindings/net/nxp,netc-blk-ctrl.yaml | 1 +
arch/arm64/boot/dts/freescale/imx94.dtsi | 118 ++++++++++
arch/arm64/boot/dts/freescale/imx943-evk.dts | 100 +++++++++
drivers/net/ethernet/freescale/enetc/enetc.c | 28 ++-
drivers/net/ethernet/freescale/enetc/enetc.h | 8 +
.../net/ethernet/freescale/enetc/enetc4_hw.h | 32 ++-
.../net/ethernet/freescale/enetc/enetc4_pf.c | 37 ++--
.../ethernet/freescale/enetc/enetc_ethtool.c | 64 ++++++
.../net/ethernet/freescale/enetc/enetc_hw.h | 1 +
.../freescale/enetc/enetc_pf_common.c | 5 +-
.../ethernet/freescale/enetc/netc_blk_ctrl.c | 202 ++++++++++++++++++
13 files changed, 574 insertions(+), 24 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net-next 1/8] dt-bindings: net: netc-blk-ctrl: add compatible string for i.MX94 platforms
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
@ 2025-10-16 10:20 ` Wei Fang
2025-10-21 20:38 ` Rob Herring (Arm)
2025-10-16 10:20 ` [PATCH net-next 2/8] dt-bindings: net: enetc: add compatible string for ENETC with pseduo MAC Wei Fang
` (8 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Wei Fang @ 2025-10-16 10:20 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, claudiu.manoil, vladimir.oltean,
xiaoning.wang, Frank.Li, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
Add the compatible string "nxp,imx95-netc-blk-ctrl" for i.MX94 platforms.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml b/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml
index 97389fd5dbbf..deea4fd73d76 100644
--- a/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml
+++ b/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml
@@ -21,6 +21,7 @@ maintainers:
properties:
compatible:
enum:
+ - nxp,imx94-netc-blk-ctrl
- nxp,imx95-netc-blk-ctrl
reg:
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net-next 2/8] dt-bindings: net: enetc: add compatible string for ENETC with pseduo MAC
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
2025-10-16 10:20 ` [PATCH net-next 1/8] dt-bindings: net: netc-blk-ctrl: add compatible string for i.MX94 platforms Wei Fang
@ 2025-10-16 10:20 ` Wei Fang
2025-10-21 20:38 ` Rob Herring (Arm)
2025-10-16 10:20 ` [PATCH net-next 3/8] dt-bindings: net: ethernet-controller: remove the enum values of speed Wei Fang
` (7 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Wei Fang @ 2025-10-16 10:20 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, claudiu.manoil, vladimir.oltean,
xiaoning.wang, Frank.Li, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
The ENETC with pseudo MAC is used to connect to the CPU port of the NETC
switch. This ENETC has a different PCI device ID, so add a standard PCI
device compatible string to it.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
Documentation/devicetree/bindings/net/fsl,enetc.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/net/fsl,enetc.yaml b/Documentation/devicetree/bindings/net/fsl,enetc.yaml
index ca70f0050171..aac20ab72ace 100644
--- a/Documentation/devicetree/bindings/net/fsl,enetc.yaml
+++ b/Documentation/devicetree/bindings/net/fsl,enetc.yaml
@@ -27,6 +27,7 @@ properties:
- const: fsl,enetc
- enum:
- pci1131,e101
+ - pci1131,e110
reg:
maxItems: 1
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net-next 3/8] dt-bindings: net: ethernet-controller: remove the enum values of speed
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
2025-10-16 10:20 ` [PATCH net-next 1/8] dt-bindings: net: netc-blk-ctrl: add compatible string for i.MX94 platforms Wei Fang
2025-10-16 10:20 ` [PATCH net-next 2/8] dt-bindings: net: enetc: add compatible string for ENETC with pseduo MAC Wei Fang
@ 2025-10-16 10:20 ` Wei Fang
2025-10-21 20:50 ` Rob Herring
2025-10-16 10:20 ` [PATCH net-next 4/8] net: enetc: add preliminary i.MX94 NETC blocks control support Wei Fang
` (6 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Wei Fang @ 2025-10-16 10:20 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, claudiu.manoil, vladimir.oltean,
xiaoning.wang, Frank.Li, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
Some fixed-link devices have uncommon link speeds. For example, the CPU
port of NXP NETC switch is connected to an ENETC (Ethernet Controller),
they are fully integrated into the NETC IP and connected through the
'pseudo link'. The link speed varies depending on the NETC version. For
example, the speed of NETC v4.3 is 2680 Mbps, other versions may be 8
Gbps or 12.5 Gbps or other speeds. There is no need and pointless to add
these values to ethernet-controller.yaml. Therefore, remove these enum
values so that when performing dtbs_check, no warnings are reported for
the uncommon values.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
Documentation/devicetree/bindings/net/ethernet-controller.yaml | 1 -
1 file changed, 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
index 1bafd687dcb1..7fa02d58c208 100644
--- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
@@ -177,7 +177,6 @@ properties:
description:
Link speed.
$ref: /schemas/types.yaml#/definitions/uint32
- enum: [10, 100, 1000, 2500, 5000, 10000]
full-duplex:
$ref: /schemas/types.yaml#/definitions/flag
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net-next 4/8] net: enetc: add preliminary i.MX94 NETC blocks control support
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
` (2 preceding siblings ...)
2025-10-16 10:20 ` [PATCH net-next 3/8] dt-bindings: net: ethernet-controller: remove the enum values of speed Wei Fang
@ 2025-10-16 10:20 ` Wei Fang
2025-10-16 10:20 ` [PATCH net-next 5/8] net: enetc: add ptp timer binding support for i.MX94 Wei Fang
` (5 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Wei Fang @ 2025-10-16 10:20 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, claudiu.manoil, vladimir.oltean,
xiaoning.wang, Frank.Li, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
NETC blocks control is used for warm reset and pre-boot initialization.
Different versions of NETC blocks control are not exactly the same. We
need to add corresponding netc_devinfo data for each version. The NETC
version of i.MX94 is v4.3, which is different from i.MX95. Currently,
the patch adds the following configurations for ENETCs.
1. Set the link's MII protocol.
2. ENETC 0 (MAC 3) and the switch port 2 (MAC 2) share the same parallel
interface, but due to SoC constraint, they cannot be used simultaneously.
Since the switch is not supported yet, so the interface is assigned to
ENETC 0 by default.
The switch configuration will be added separately in a subsequent patch.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
.../ethernet/freescale/enetc/netc_blk_ctrl.c | 103 ++++++++++++++++++
1 file changed, 103 insertions(+)
diff --git a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
index bcb8eefeb93c..35cfbee00133 100644
--- a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
+++ b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
@@ -47,6 +47,13 @@
#define PCS_PROT_SFI BIT(4)
#define PCS_PROT_10G_SXGMII BIT(6)
+#define IMX94_EXT_PIN_CONTROL 0x10
+#define MAC2_MAC3_SEL BIT(1)
+
+#define IMX94_NETC_LINK_CFG(a) (0x4c + (a) * 4)
+#define NETC_LINK_CFG_MII_PROT GENMASK(3, 0)
+#define NETC_LINK_CFG_IO_VAR GENMASK(19, 16)
+
/* NETC privileged register block register */
#define PRB_NETCRR 0x100
#define NETCRR_SR BIT(0)
@@ -68,6 +75,13 @@
#define IMX95_ENETC1_BUS_DEVFN 0x40
#define IMX95_ENETC2_BUS_DEVFN 0x80
+#define IMX94_ENETC0_BUS_DEVFN 0x100
+#define IMX94_ENETC1_BUS_DEVFN 0x140
+#define IMX94_ENETC2_BUS_DEVFN 0x180
+#define IMX94_ENETC0_LINK 3
+#define IMX94_ENETC1_LINK 4
+#define IMX94_ENETC2_LINK 5
+
/* Flags for different platforms */
#define NETC_HAS_NETCMIX BIT(0)
@@ -192,6 +206,89 @@ static int imx95_netcmix_init(struct platform_device *pdev)
return 0;
}
+static int imx94_enetc_get_link_id(struct device_node *np)
+{
+ int bus_devfn = netc_of_pci_get_bus_devfn(np);
+
+ /* Parse ENETC link number */
+ switch (bus_devfn) {
+ case IMX94_ENETC0_BUS_DEVFN:
+ return IMX94_ENETC0_LINK;
+ case IMX94_ENETC1_BUS_DEVFN:
+ return IMX94_ENETC1_LINK;
+ case IMX94_ENETC2_BUS_DEVFN:
+ return IMX94_ENETC2_LINK;
+ default:
+ return -EINVAL;
+ }
+}
+
+static int imx94_link_config(struct netc_blk_ctrl *priv,
+ struct device_node *np, int link_id)
+{
+ phy_interface_t interface;
+ int mii_proto;
+ u32 val;
+
+ /* The node may be disabled and does not have a 'phy-mode'
+ * or 'phy-connection-type' property.
+ */
+ if (of_get_phy_mode(np, &interface))
+ return 0;
+
+ mii_proto = netc_get_link_mii_protocol(interface);
+ if (mii_proto < 0)
+ return mii_proto;
+
+ val = mii_proto & NETC_LINK_CFG_MII_PROT;
+ if (val == MII_PROT_SERIAL)
+ val = u32_replace_bits(val, IO_VAR_16FF_16G_SERDES,
+ NETC_LINK_CFG_IO_VAR);
+
+ netc_reg_write(priv->netcmix, IMX94_NETC_LINK_CFG(link_id), val);
+
+ return 0;
+}
+
+static int imx94_enetc_link_config(struct netc_blk_ctrl *priv,
+ struct device_node *np)
+{
+ int link_id = imx94_enetc_get_link_id(np);
+
+ if (link_id < 0)
+ return link_id;
+
+ return imx94_link_config(priv, np, link_id);
+}
+
+static int imx94_netcmix_init(struct platform_device *pdev)
+{
+ struct netc_blk_ctrl *priv = platform_get_drvdata(pdev);
+ struct device_node *np = pdev->dev.of_node;
+ u32 val;
+ int err;
+
+ for_each_child_of_node_scoped(np, child) {
+ for_each_child_of_node_scoped(child, gchild) {
+ if (of_device_is_compatible(gchild, "pci1131,e101")) {
+ err = imx94_enetc_link_config(priv, gchild);
+ if (err)
+ return err;
+ }
+ }
+ }
+
+ /* ENETC 0 and switch port 2 share the same parallel interface.
+ * Currently, the switch is not supported, so this interface is
+ * used by ENETC 0 by default.
+ */
+ val = netc_reg_read(priv->netcmix, IMX94_EXT_PIN_CONTROL);
+ val |= MAC2_MAC3_SEL;
+ netc_reg_write(priv->netcmix, IMX94_EXT_PIN_CONTROL, val);
+
+ return 0;
+}
+
static bool netc_ierb_is_locked(struct netc_blk_ctrl *priv)
{
return !!(netc_reg_read(priv->prb, PRB_NETCRR) & NETCRR_LOCK);
@@ -340,8 +437,14 @@ static const struct netc_devinfo imx95_devinfo = {
.ierb_init = imx95_ierb_init,
};
+static const struct netc_devinfo imx94_devinfo = {
+ .flags = NETC_HAS_NETCMIX,
+ .netcmix_init = imx94_netcmix_init,
+};
+
static const struct of_device_id netc_blk_ctrl_match[] = {
{ .compatible = "nxp,imx95-netc-blk-ctrl", .data = &imx95_devinfo },
+ { .compatible = "nxp,imx94-netc-blk-ctrl", .data = &imx94_devinfo },
{},
};
MODULE_DEVICE_TABLE(of, netc_blk_ctrl_match);
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net-next 5/8] net: enetc: add ptp timer binding support for i.MX94
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
` (3 preceding siblings ...)
2025-10-16 10:20 ` [PATCH net-next 4/8] net: enetc: add preliminary i.MX94 NETC blocks control support Wei Fang
@ 2025-10-16 10:20 ` Wei Fang
2025-10-21 7:21 ` Paolo Abeni
2025-10-16 10:20 ` [PATCH net-next 6/8] net: enetc: add basic support for the ENETC with pseudo MAC " Wei Fang
` (4 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Wei Fang @ 2025-10-16 10:20 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, claudiu.manoil, vladimir.oltean,
xiaoning.wang, Frank.Li, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
From: Clark Wang <xiaoning.wang@nxp.com>
The i.MX94 has three PTP timers, and all standalone ENETCs can select
one of them to bind to as their PHC. The 'ptp-timer' property is used
to represent the PTP device of the Ethernet controller. So users can
add 'ptp-timer' to the ENETC node to specify the PTP timer. The driver
parses this property to bind the two hardware devices.
If the "ptp-timer" property is not present, the first timer of the PCIe
bus where the ENETC is located is used as the default bound PTP timer.
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
.../ethernet/freescale/enetc/netc_blk_ctrl.c | 99 +++++++++++++++++++
1 file changed, 99 insertions(+)
diff --git a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
index 35cfbee00133..98f8629a7c52 100644
--- a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
+++ b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
@@ -66,6 +66,7 @@
/* NETC integrated endpoint register block register */
#define IERB_EMDIOFAUXR 0x344
#define IERB_T0FAUXR 0x444
+#define IERB_ETBCR(a) (0x300c + 0x100 * (a))
#define IERB_EFAUXR(a) (0x3044 + 0x100 * (a))
#define IERB_VFAUXR(a) (0x4004 + 0x40 * (a))
#define FAUXR_LDID GENMASK(3, 0)
@@ -78,10 +79,16 @@
#define IMX94_ENETC0_BUS_DEVFN 0x100
#define IMX94_ENETC1_BUS_DEVFN 0x140
#define IMX94_ENETC2_BUS_DEVFN 0x180
+#define IMX94_TIMER0_BUS_DEVFN 0x1
+#define IMX94_TIMER1_BUS_DEVFN 0x101
+#define IMX94_TIMER2_BUS_DEVFN 0x181
#define IMX94_ENETC0_LINK 3
#define IMX94_ENETC1_LINK 4
#define IMX94_ENETC2_LINK 5
+#define NETC_ENETC_ID(a) (a)
+#define NETC_TIMER_ID(a) (a)
+
/* Flags for different platforms */
#define NETC_HAS_NETCMIX BIT(0)
@@ -344,6 +351,97 @@ static int imx95_ierb_init(struct platform_device *pdev)
return 0;
}
+static int imx94_get_enetc_id(struct device_node *np)
+{
+ int bus_devfn = netc_of_pci_get_bus_devfn(np);
+
+ /* Parse ENETC offset */
+ switch (bus_devfn) {
+ case IMX94_ENETC0_BUS_DEVFN:
+ return NETC_ENETC_ID(0);
+ case IMX94_ENETC1_BUS_DEVFN:
+ return NETC_ENETC_ID(1);
+ case IMX94_ENETC2_BUS_DEVFN:
+ return NETC_ENETC_ID(2);
+ default:
+ return -EINVAL;
+ }
+}
+
+static int imx94_get_timer_id(struct device_node *np)
+{
+ int bus_devfn = netc_of_pci_get_bus_devfn(np);
+
+ /* Parse NETC PTP timer ID, the timer0 is on bus 0,
+ * the timer 1 and timer2 is on bus 1.
+ */
+ switch (bus_devfn) {
+ case IMX94_TIMER0_BUS_DEVFN:
+ return NETC_TIMER_ID(0);
+ case IMX94_TIMER1_BUS_DEVFN:
+ return NETC_TIMER_ID(1);
+ case IMX94_TIMER2_BUS_DEVFN:
+ return NETC_TIMER_ID(2);
+ default:
+ return -EINVAL;
+ }
+}
+
+static int imx94_enetc_update_tid(struct netc_blk_ctrl *priv,
+ struct device_node *np)
+{
+ struct device *dev = &priv->pdev->dev;
+ struct device_node *timer_np;
+ int eid, tid;
+
+ eid = imx94_get_enetc_id(np);
+ if (eid < 0) {
+ dev_err(dev, "Failed to get ENETC ID\n");
+ return eid;
+ }
+
+ timer_np = of_parse_phandle(np, "ptp-timer", 0);
+ if (!timer_np) {
+ /* If 'ptp-timer' is not present, the timer1 is the default
+ * timer of all standalone ENETCs, which is on the same PCIe
+ * bus as these ENETCs.
+ */
+ tid = NETC_TIMER_ID(1);
+ goto end;
+ }
+
+ tid = imx94_get_timer_id(timer_np);
+ of_node_put(timer_np);
+ if (tid < 0) {
+ dev_err(dev, "Failed to get NETC Timer ID\n");
+ return tid;
+ }
+
+end:
+ netc_reg_write(priv->ierb, IERB_ETBCR(eid), tid);
+
+ return 0;
+}
+
+static int imx94_ierb_init(struct platform_device *pdev)
+{
+ struct netc_blk_ctrl *priv = platform_get_drvdata(pdev);
+ struct device_node *np = pdev->dev.of_node;
+ int err;
+
+ for_each_child_of_node_scoped(np, child) {
+ for_each_child_of_node_scoped(child, gchild) {
+ if (of_device_is_compatible(gchild, "pci1131,e101")) {
+ err = imx94_enetc_update_tid(priv, gchild);
+ if (err)
+ return err;
+ }
+ }
+ }
+
+ return 0;
+}
+
static int netc_ierb_init(struct platform_device *pdev)
{
struct netc_blk_ctrl *priv = platform_get_drvdata(pdev);
@@ -440,6 +538,7 @@ static const struct netc_devinfo imx95_devinfo = {
static const struct netc_devinfo imx94_devinfo = {
.flags = NETC_HAS_NETCMIX,
.netcmix_init = imx94_netcmix_init,
+ .ierb_init = imx94_ierb_init,
};
static const struct of_device_id netc_blk_ctrl_match[] = {
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net-next 6/8] net: enetc: add basic support for the ENETC with pseudo MAC for i.MX94
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
` (4 preceding siblings ...)
2025-10-16 10:20 ` [PATCH net-next 5/8] net: enetc: add ptp timer binding support for i.MX94 Wei Fang
@ 2025-10-16 10:20 ` Wei Fang
2025-10-21 7:26 ` Paolo Abeni
2025-10-16 10:20 ` [PATCH net-next 7/8] net: enetc: add standalone ENETC support " Wei Fang
` (3 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Wei Fang @ 2025-10-16 10:20 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, claudiu.manoil, vladimir.oltean,
xiaoning.wang, Frank.Li, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
The ENETC with pseudo MAC is an internal port which connects to the CPU
port of the switch. The switch CPU/host ENETC is fully integrated with
the switch and does not require a back-to-back MAC, instead a light
weight "pseudo MAC" provides the delineation between switch and ENETC.
This translates to lower power (less logic and memory) and lower delay
(as there is no serialization delay across this link).
Different from the standalone ENETC which is used as the external port,
the internal ENETC has a different PCIe device ID, and it does not have
Ethernet MAC port registers, instead, it has a small number of pseudo
MAC port registers, so some features are not supported by pseudo MAC,
such as loopback, half duplex, one-step timestamping and so on. In
addition, the speed of the pseudo MAC of i.MX94 is 2.68Gbps.
Therefore, the configuration of this internal ENETC is also somewhat
different from that of the standalone ENETC. So add the basic support
for ENETC with pseudo MAC. More supports will be added in the future.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
drivers/net/ethernet/freescale/enetc/enetc.c | 24 +++++++-
drivers/net/ethernet/freescale/enetc/enetc.h | 8 +++
.../net/ethernet/freescale/enetc/enetc4_hw.h | 32 +++++++++-
.../net/ethernet/freescale/enetc/enetc4_pf.c | 37 ++++++-----
.../ethernet/freescale/enetc/enetc_ethtool.c | 61 +++++++++++++++++++
.../net/ethernet/freescale/enetc/enetc_hw.h | 1 +
.../freescale/enetc/enetc_pf_common.c | 5 +-
7 files changed, 145 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index aae462a0cf5a..88eeb0f51d41 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -14,12 +14,21 @@
u32 enetc_port_mac_rd(struct enetc_si *si, u32 reg)
{
+ /* ENETC with pseudo MAC does not have Ethernet MAC
+ * port registers.
+ */
+ if (enetc_is_pseudo_mac(si))
+ return 0;
+
return enetc_port_rd(&si->hw, reg);
}
EXPORT_SYMBOL_GPL(enetc_port_mac_rd);
void enetc_port_mac_wr(struct enetc_si *si, u32 reg, u32 val)
{
+ if (enetc_is_pseudo_mac(si))
+ return;
+
enetc_port_wr(&si->hw, reg, val);
if (si->hw_features & ENETC_SI_F_QBU)
enetc_port_wr(&si->hw, reg + si->drvdata->pmac_offset, val);
@@ -3350,7 +3359,8 @@ int enetc_hwtstamp_set(struct net_device *ndev,
new_offloads |= ENETC_F_TX_TSTAMP;
break;
case HWTSTAMP_TX_ONESTEP_SYNC:
- if (!enetc_si_is_pf(priv->si))
+ if (!enetc_si_is_pf(priv->si) ||
+ enetc_is_pseudo_mac(priv->si))
return -EOPNOTSUPP;
new_offloads &= ~ENETC_F_TX_TSTAMP_MASK;
@@ -3691,6 +3701,13 @@ static const struct enetc_drvdata enetc4_pf_data = {
.eth_ops = &enetc4_pf_ethtool_ops,
};
+static const struct enetc_drvdata enetc4_ppm_data = {
+ .sysclk_freq = ENETC_CLK_333M,
+ .tx_csum = true,
+ .max_frags = ENETC4_MAX_SKB_FRAGS,
+ .eth_ops = &enetc4_ppm_ethtool_ops,
+};
+
static const struct enetc_drvdata enetc_vf_data = {
.sysclk_freq = ENETC_CLK_400M,
.max_frags = ENETC_MAX_SKB_FRAGS,
@@ -3710,6 +3727,11 @@ static const struct enetc_platform_info enetc_info[] = {
.dev_id = ENETC_DEV_ID_VF,
.data = &enetc_vf_data,
},
+ {
+ .revision = ENETC_REV_4_3,
+ .dev_id = NXP_ENETC_PPM_DEV_ID,
+ .data = &enetc4_ppm_data,
+ },
};
int enetc_get_driver_data(struct enetc_si *si)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h
index 0ec010a7d640..a202dbd4b40a 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.h
+++ b/drivers/net/ethernet/freescale/enetc/enetc.h
@@ -273,6 +273,7 @@ enum enetc_errata {
#define ENETC_SI_F_QBV BIT(1)
#define ENETC_SI_F_QBU BIT(2)
#define ENETC_SI_F_LSO BIT(3)
+#define ENETC_SI_F_PPM BIT(4) /* pseudo MAC */
struct enetc_drvdata {
u32 pmac_offset; /* Only valid for PSI which supports 802.1Qbu */
@@ -362,6 +363,11 @@ static inline int enetc_pf_to_port(struct pci_dev *pf_pdev)
}
}
+static inline bool enetc_is_pseudo_mac(struct enetc_si *si)
+{
+ return si->hw_features & ENETC_SI_F_PPM;
+}
+
#define ENETC_MAX_NUM_TXQS 8
#define ENETC_INT_NAME_MAX (IFNAMSIZ + 8)
@@ -534,6 +540,8 @@ int enetc_hwtstamp_set(struct net_device *ndev,
extern const struct ethtool_ops enetc_pf_ethtool_ops;
extern const struct ethtool_ops enetc4_pf_ethtool_ops;
extern const struct ethtool_ops enetc_vf_ethtool_ops;
+extern const struct ethtool_ops enetc4_ppm_ethtool_ops;
+
void enetc_set_ethtool_ops(struct net_device *ndev);
void enetc_mm_link_state_update(struct enetc_ndev_priv *priv, bool link);
void enetc_mm_commit_preemptible_tcs(struct enetc_ndev_priv *priv);
diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_hw.h b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h
index 19bf0e89cdc2..7f1276edcff0 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc4_hw.h
+++ b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h
@@ -11,6 +11,7 @@
#define NXP_ENETC_VENDOR_ID 0x1131
#define NXP_ENETC_PF_DEV_ID 0xe101
+#define NXP_ENETC_PPM_DEV_ID 0xe110
/**********************Station interface registers************************/
/* Station interface LSO segmentation flag mask register 0/1 */
@@ -115,13 +116,17 @@
#define PMCAPR_HD BIT(8)
#define PMCAPR_FP GENMASK(10, 9)
+/* Port capability register */
+#define ENETC4_PCAPR 0x4000
+#define PCAPR_LINK_TYPE BIT(4)
+
/* Port configuration register */
#define ENETC4_PCR 0x4010
#define PCR_HDR_FMT BIT(0)
#define PCR_L2DOSE BIT(4)
#define PCR_TIMER_CS BIT(8)
#define PCR_PSPEED GENMASK(29, 16)
-#define PCR_PSPEED_VAL(speed) (((speed) / 10 - 1) << 16)
+#define PCR_PSPEED_VAL(speed) ((speed) / 10 - 1)
/* Port MAC address register 0/1 */
#define ENETC4_PMAR0 0x4020
@@ -193,4 +198,29 @@
#define SSP_1G 2
#define PM_IF_MODE_ENA BIT(15)
+/**********************ENETC Pseudo MAC port registers************************/
+/* Port pseudo MAC receive octets counter (64-bit) */
+#define ENETC4_PPMROCR 0x5080
+
+/* Port pseudo MAC receive unicast frame counter register (64-bit) */
+#define ENETC4_PPMRUFCR 0x5088
+
+/* Port pseudo MAC receive multicast frame counter register (64-bit) */
+#define ENETC4_PPMRMFCR 0x5090
+
+/* Port pseudo MAC receive broadcast frame counter register (64-bit) */
+#define ENETC4_PPMRBFCR 0x5098
+
+/* Port pseudo MAC transmit octets counter (64-bit) */
+#define ENETC4_PPMTOCR 0x50c0
+
+/* Port pseudo MAC transmit unicast frame counter register (64-bit) */
+#define ENETC4_PPMTUFCR 0x50c8
+
+/* Port pseudo MAC transmit multicast frame counter register (64-bit) */
+#define ENETC4_PPMTMFCR 0x50d0
+
+/* Port pseudo MAC transmit broadcast frame counter register (64-bit) */
+#define ENETC4_PPMTBFCR 0x50d8
+
#endif
diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
index 82c443b28b15..5de6b7b46c06 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
@@ -41,6 +41,16 @@ static void enetc4_get_port_caps(struct enetc_pf *pf)
pf->caps.mac_filter_num = val & PSIMAFCAPR_NUM_MAC_AFTE;
}
+static void enetc4_get_psi_hw_features(struct enetc_si *si)
+{
+ struct enetc_hw *hw = &si->hw;
+ u32 val;
+
+ val = enetc_port_rd(hw, ENETC4_PCAPR);
+ if (val & PCAPR_LINK_TYPE)
+ si->hw_features |= ENETC_SI_F_PPM;
+}
+
static void enetc4_pf_set_si_primary_mac(struct enetc_hw *hw, int si,
const u8 *addr)
{
@@ -277,6 +287,7 @@ static int enetc4_pf_struct_init(struct enetc_si *si)
pf->ops = &enetc4_pf_ops;
enetc4_get_port_caps(pf);
+ enetc4_get_psi_hw_features(si);
return 0;
}
@@ -589,6 +600,9 @@ static void enetc4_mac_config(struct enetc_pf *pf, unsigned int mode,
struct enetc_si *si = pf->si;
u32 val;
+ if (enetc_is_pseudo_mac(si))
+ return;
+
val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0));
val &= ~(PM_IF_MODE_IFMODE | PM_IF_MODE_ENA);
@@ -635,28 +649,10 @@ static void enetc4_pl_mac_config(struct phylink_config *config, unsigned int mod
static void enetc4_set_port_speed(struct enetc_ndev_priv *priv, int speed)
{
- u32 old_speed = priv->speed;
- u32 val;
-
- if (speed == old_speed)
- return;
-
- val = enetc_port_rd(&priv->si->hw, ENETC4_PCR);
- val &= ~PCR_PSPEED;
-
- switch (speed) {
- case SPEED_100:
- case SPEED_1000:
- case SPEED_2500:
- case SPEED_10000:
- val |= (PCR_PSPEED & PCR_PSPEED_VAL(speed));
- break;
- case SPEED_10:
- default:
- val |= (PCR_PSPEED & PCR_PSPEED_VAL(SPEED_10));
- }
+ u32 val = enetc_port_rd(&priv->si->hw, ENETC4_PCR);
priv->speed = speed;
+ val = u32_replace_bits(val, PCR_PSPEED_VAL(speed), PCR_PSPEED);
enetc_port_wr(&priv->si->hw, ENETC4_PCR, val);
}
@@ -1071,6 +1067,7 @@ static void enetc4_pf_remove(struct pci_dev *pdev)
static const struct pci_device_id enetc4_pf_id_table[] = {
{ PCI_DEVICE(NXP_ENETC_VENDOR_ID, NXP_ENETC_PF_DEV_ID) },
+ { PCI_DEVICE(NXP_ENETC_VENDOR_ID, NXP_ENETC_PPM_DEV_ID) },
{ 0, } /* End of table. */
};
MODULE_DEVICE_TABLE(pci, enetc4_pf_id_table);
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
index 71d052de669a..5ef2c5f3ff8f 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
@@ -435,6 +435,48 @@ static void enetc_get_eth_mac_stats(struct net_device *ndev,
}
}
+static void enetc_ppm_mac_stats(struct enetc_si *si,
+ struct ethtool_eth_mac_stats *s)
+{
+ struct enetc_hw *hw = &si->hw;
+ u64 rufcr, rmfcr, rbfcr;
+ u64 tufcr, tmfcr, tbfcr;
+
+ rufcr = enetc_port_rd64(hw, ENETC4_PPMRUFCR);
+ rmfcr = enetc_port_rd64(hw, ENETC4_PPMRMFCR);
+ rbfcr = enetc_port_rd64(hw, ENETC4_PPMRBFCR);
+
+ tufcr = enetc_port_rd64(hw, ENETC4_PPMTUFCR);
+ tmfcr = enetc_port_rd64(hw, ENETC4_PPMTMFCR);
+ tbfcr = enetc_port_rd64(hw, ENETC4_PPMTBFCR);
+
+ s->FramesTransmittedOK = tufcr + tmfcr + tbfcr;
+ s->FramesReceivedOK = rufcr + rmfcr + rbfcr;
+ s->OctetsTransmittedOK = enetc_port_rd64(hw, ENETC4_PPMTOCR);
+ s->OctetsReceivedOK = enetc_port_rd64(hw, ENETC4_PPMROCR);
+ s->MulticastFramesXmittedOK = tmfcr;
+ s->BroadcastFramesXmittedOK = tbfcr;
+ s->MulticastFramesReceivedOK = rmfcr;
+ s->BroadcastFramesReceivedOK = rbfcr;
+}
+
+static void enetc_ppm_get_eth_mac_stats(struct net_device *ndev,
+ struct ethtool_eth_mac_stats *mac_stats)
+{
+ struct enetc_ndev_priv *priv = netdev_priv(ndev);
+
+ switch (mac_stats->src) {
+ case ETHTOOL_MAC_STATS_SRC_EMAC:
+ enetc_ppm_mac_stats(priv->si, mac_stats);
+ break;
+ case ETHTOOL_MAC_STATS_SRC_PMAC:
+ break;
+ case ETHTOOL_MAC_STATS_SRC_AGGREGATE:
+ ethtool_aggregate_mac_stats(ndev, mac_stats);
+ break;
+ }
+}
+
static void enetc_get_eth_ctrl_stats(struct net_device *ndev,
struct ethtool_eth_ctrl_stats *ctrl_stats)
{
@@ -1313,6 +1355,25 @@ const struct ethtool_ops enetc_pf_ethtool_ops = {
.get_mm_stats = enetc_get_mm_stats,
};
+const struct ethtool_ops enetc4_ppm_ethtool_ops = {
+ .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
+ ETHTOOL_COALESCE_MAX_FRAMES |
+ ETHTOOL_COALESCE_USE_ADAPTIVE_RX,
+ .get_eth_mac_stats = enetc_ppm_get_eth_mac_stats,
+ .get_rxnfc = enetc4_get_rxnfc,
+ .get_rxfh_key_size = enetc_get_rxfh_key_size,
+ .get_rxfh_indir_size = enetc_get_rxfh_indir_size,
+ .get_rxfh = enetc_get_rxfh,
+ .set_rxfh = enetc_set_rxfh,
+ .get_rxfh_fields = enetc_get_rxfh_fields,
+ .get_ringparam = enetc_get_ringparam,
+ .get_coalesce = enetc_get_coalesce,
+ .set_coalesce = enetc_set_coalesce,
+ .get_link_ksettings = enetc_get_link_ksettings,
+ .set_link_ksettings = enetc_set_link_ksettings,
+ .get_link = ethtool_op_get_link,
+};
+
const struct ethtool_ops enetc_vf_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_MAX_FRAMES |
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
index 377c96325814..7b882b8921fe 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h
+++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
@@ -378,6 +378,7 @@ enum enetc_bdr_type {TX, RX};
#define EIPBRR0_REVISION GENMASK(15, 0)
#define ENETC_REV_1_0 0x0100
#define ENETC_REV_4_1 0X0401
+#define ENETC_REV_4_3 0x0403
#define ENETC_G_EIPBRR1 0x0bfc
#define ENETC_G_EPFBLPR(n) (0xd00 + 4 * (n))
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
index edf14a95cab7..9c634205e2a7 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
@@ -109,7 +109,7 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
- NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK |
+ NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_L4;
ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM |
@@ -133,6 +133,9 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
ndev->features |= NETIF_F_RXHASH;
}
+ if (!enetc_is_pseudo_mac(si))
+ ndev->hw_features |= NETIF_F_LOOPBACK;
+
/* TODO: currently, i.MX95 ENETC driver does not support advanced features */
if (!is_enetc_rev1(si))
goto end;
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net-next 7/8] net: enetc: add standalone ENETC support for i.MX94
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
` (5 preceding siblings ...)
2025-10-16 10:20 ` [PATCH net-next 6/8] net: enetc: add basic support for the ENETC with pseudo MAC " Wei Fang
@ 2025-10-16 10:20 ` Wei Fang
2025-10-16 10:20 ` [PATCH 8/8] arm64: dts: imx94: add basic NETC nodes and properties Wei Fang
` (2 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Wei Fang @ 2025-10-16 10:20 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, claudiu.manoil, vladimir.oltean,
xiaoning.wang, Frank.Li, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
The revision of i.MX94 ENETC is changed to v4.3, so add this revision to
enetc_info to support i.MX94 ENETC. And add PTP suspport for i.MX94.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
drivers/net/ethernet/freescale/enetc/enetc.c | 4 ++++
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index 88eeb0f51d41..15783f56dd39 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -3732,6 +3732,10 @@ static const struct enetc_platform_info enetc_info[] = {
.dev_id = NXP_ENETC_PPM_DEV_ID,
.data = &enetc4_ppm_data,
},
+ { .revision = ENETC_REV_4_3,
+ .dev_id = NXP_ENETC_PF_DEV_ID,
+ .data = &enetc4_pf_data,
+ },
};
int enetc_get_driver_data(struct enetc_si *si)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
index 5ef2c5f3ff8f..3e222321b937 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
@@ -936,6 +936,9 @@ static int enetc_get_phc_index_by_pdev(struct enetc_si *si)
case ENETC_REV_4_1:
devfn = PCI_DEVFN(24, 0);
break;
+ case ENETC_REV_4_3:
+ devfn = PCI_DEVFN(0, 1);
+ break;
default:
return -1;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 8/8] arm64: dts: imx94: add basic NETC nodes and properties
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
` (6 preceding siblings ...)
2025-10-16 10:20 ` [PATCH net-next 7/8] net: enetc: add standalone ENETC support " Wei Fang
@ 2025-10-16 10:20 ` Wei Fang
2025-10-16 12:11 ` [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Rob Herring (Arm)
2025-10-21 7:14 ` Paolo Abeni
9 siblings, 0 replies; 18+ messages in thread
From: Wei Fang @ 2025-10-16 10:20 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, claudiu.manoil, vladimir.oltean,
xiaoning.wang, Frank.Li, andrew+netdev, davem, edumazet, kuba,
pabeni, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
Add ENETC, EMDIO and Timer support.
Note that this patch is for reference only. It will be removed once the
related dt-bindings patches have been reviewed.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
arch/arm64/boot/dts/freescale/imx94.dtsi | 118 +++++++++++++++++++
arch/arm64/boot/dts/freescale/imx943-evk.dts | 100 ++++++++++++++++
2 files changed, 218 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx94.dtsi b/arch/arm64/boot/dts/freescale/imx94.dtsi
index d4a880496b0e..0527046601e5 100644
--- a/arch/arm64/boot/dts/freescale/imx94.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx94.dtsi
@@ -1190,5 +1190,123 @@ wdog3: watchdog@49220000 {
status = "disabled";
};
};
+
+ netc_blk_ctrl: system-controller@4ceb0000 {
+ compatible = "nxp,imx94-netc-blk-ctrl";
+ reg = <0x0 0x4ceb0000 0x0 0x10000>,
+ <0x0 0x4cec0000 0x0 0x10000>,
+ <0x0 0x4c810000 0x0 0x7C>;
+ reg-names = "ierb", "prb", "netcmix";
+ ranges;
+ #address-cells = <2>;
+ #size-cells = <2>;
+ power-domains = <&scmi_devpd IMX94_PD_NETC>;
+ status = "disabled";
+
+ netc_bus0: pcie@4ca00000 {
+ compatible = "pci-host-ecam-generic";
+ reg = <0x0 0x4ca00000 0x0 0x100000>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ device_type = "pci";
+ linux,pci-domain = <0>;
+ bus-range = <0x0 0x0>;
+ msi-map = <0x00 &its 0x68 0x1>, //ENETC3 PF
+ <0x01 &its 0x61 0x1>, //Timer0
+ <0x02 &its 0x64 0x1>, //Switch
+ <0x40 &its 0x69 0x1>, //ENETC3 VF0
+ <0x80 &its 0x6a 0x1>, //ENETC3 VF1
+ <0xC0 &its 0x6b 0x1>; //ENETC3 VF2
+ /* Switch BAR0 - non-prefetchable memory */
+ ranges = <0x02000000 0x0 0x4cc00000 0x0 0x4cc00000 0x0 0x80000
+ /* ENETC 3 and Timer 0 BAR0 - non-prefetchable memory */
+ 0x02000000 0x0 0x4cd40000 0x0 0x4cd40000 0x0 0x60000
+ /* Switch and Timer 0 BAR2 - prefetchable memory */
+ 0x42000000 0x0 0x4ce00000 0x0 0x4ce00000 0x0 0x20000
+ /* ENETC 3 VF0-2 BAR0 - non-prefetchable memory */
+ 0x02000000 0x0 0x4ce50000 0x0 0x4ce50000 0x0 0x30000
+ /* ENETC 3 VF0-2 BAR2 - prefetchable memory */
+ 0x42000000 0x0 0x4ce80000 0x0 0x4ce80000 0x0 0x30000>;
+
+ enetc3: ethernet@0,0 {
+ compatible = "pci1131,e110";
+ reg = <0x0 0 0 0 0>;
+ phy-mode = "internal";
+ status = "disabled";
+
+ fixed-link {
+ speed = <2680>;
+ full-duplex;
+ pause;
+ };
+ };
+
+ netc_timer0: ptp-timer@0,1 {
+ compatible = "pci1131,ee02";
+ reg = <0x100 0 0 0 0>;
+ status = "disabled";
+ };
+ };
+
+ netc_bus1: pcie@4cb00000 {
+ compatible = "pci-host-ecam-generic";
+ reg = <0x0 0x4cb00000 0x0 0x100000>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ device_type = "pci";
+ linux,pci-domain = <1>;
+ bus-range = <0x1 0x1>;
+ msi-map = <0x100 &its 0x65 0x1>, //ENETC0 PF
+ <0x101 &its 0x62 0x1>, //Timer1
+ <0x140 &its 0x66 0x1>, //ENETC1 PF
+ <0x180 &its 0x67 0x1>, //ENETC2 PF
+ <0x181 &its 0x63 0x1>, //Timer2
+ <0x1C0 &its 0x60 0x1>; //EMDIO
+ /* ENETC 0-2 BAR0 - non-prefetchable memory */
+ ranges = <0x02000000 0x0 0x4cC80000 0x0 0x4cc80000 0x0 0xc0000
+ /* Timer 1-2 and EMDIO BAR0 - non-prefetchable memory */
+ 0x02000000 0x0 0x4cda0000 0x0 0x4cda0000 0x0 0x60000
+ /* Timer 1-2 and EMDIO BAR2 - prefetchable memory */
+ 0x42000000 0x0 0x4ce20000 0x0 0x4ce20000 0x0 0x30000>;
+
+ enetc0: ethernet@0,0 {
+ compatible = "pci1131,e101";
+ reg = <0x10000 0 0 0 0>;
+ status = "disabled";
+ };
+
+ netc_timer1: ptp-timer@0,1 {
+ compatible = "pci1131,ee02";
+ reg = <0x10100 0 0 0 0>;
+ status = "disabled";
+ };
+
+ enetc1: ethernet@8,0 {
+ compatible = "pci1131,e101";
+ reg = <0x14000 0 0 0 0>;
+ status = "disabled";
+ };
+
+ enetc2: ethernet@10,0 {
+ compatible = "pci1131,e101";
+ reg = <0x18000 0 0 0 0>;
+ status = "disabled";
+ };
+
+ netc_timer2: ptp-timer@10,1 {
+ compatible = "pci1131,ee02";
+ reg = <0x18100 0 0 0 0>;
+ status = "disabled";
+ };
+
+ netc_emdio: mdio@18,0 {
+ compatible = "pci1131,ee00";
+ reg = <0x1c000 0 0 0 0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+ };
+ };
};
};
diff --git a/arch/arm64/boot/dts/freescale/imx943-evk.dts b/arch/arm64/boot/dts/freescale/imx943-evk.dts
index c8c3eff9df1a..91c579ef31fe 100644
--- a/arch/arm64/boot/dts/freescale/imx943-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx943-evk.dts
@@ -12,6 +12,9 @@ / {
model = "NXP i.MX943 EVK board";
aliases {
+ ethernet0 = &enetc3;
+ ethernet1 = &enetc1;
+ ethernet2 = &enetc2;
i2c2 = &lpi2c3;
i2c3 = &lpi2c4;
i2c5 = &lpi2c6;
@@ -127,6 +130,30 @@ memory@80000000 {
};
};
+&enetc1 {
+ clocks = <&scmi_clk IMX94_CLK_MAC4>;
+ clock-names = "ref";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_eth3>;
+ phy-handle = <ðphy3>;
+ phy-mode = "rgmii-id";
+ status = "okay";
+};
+
+&enetc2 {
+ clocks = <&scmi_clk IMX94_CLK_MAC5>;
+ clock-names = "ref";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_eth4>;
+ phy-handle = <ðphy4>;
+ phy-mode = "rgmii-id";
+ status = "okay";
+};
+
+&enetc3 {
+ status = "okay";
+};
+
&lpi2c3 {
clock-frequency = <400000>;
pinctrl-0 = <&pinctrl_lpi2c3>;
@@ -396,6 +423,39 @@ &micfil {
status = "okay";
};
+&netc_blk_ctrl {
+ assigned-clocks = <&scmi_clk IMX94_CLK_MAC4>,
+ <&scmi_clk IMX94_CLK_MAC5>;
+ assigned-clock-parents = <&scmi_clk IMX94_CLK_SYSPLL1_PFD0>,
+ <&scmi_clk IMX94_CLK_SYSPLL1_PFD0>;
+ assigned-clock-rates = <250000000>, <250000000>;
+ status = "okay";
+};
+
+&netc_emdio {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_emdio>;
+ status = "okay";
+
+ ethphy3: ethernet-phy@6 {
+ reg = <0x6>;
+ realtek,clkout-disable;
+ };
+
+ ethphy4: ethernet-phy@7 {
+ reg = <0x7>;
+ realtek,clkout-disable;
+ };
+};
+
+&netc_timer0 {
+ status = "okay";
+};
+
+&netc_timer1 {
+ status = "okay";
+};
+
&sai1 {
assigned-clocks = <&scmi_clk IMX94_CLK_AUDIOPLL1_VCO>,
<&scmi_clk IMX94_CLK_AUDIOPLL2_VCO>,
@@ -431,6 +491,46 @@ &sai3 {
};
&scmi_iomuxc {
+ pinctrl_emdio: emdiogrp{
+ fsl,pins = <
+ IMX94_PAD_ETH4_MDC_GPIO1__NETC_EMDC 0x57e
+ IMX94_PAD_ETH4_MDIO_GPIO2__NETC_EMDIO 0x97e
+ >;
+ };
+
+ pinctrl_eth3: eth3grp {
+ fsl,pins = <
+ IMX94_PAD_ETH3_TXD3__NETC_PINMUX_ETH3_TXD3 0x51e
+ IMX94_PAD_ETH3_TXD2__NETC_PINMUX_ETH3_TXD2 0x51e
+ IMX94_PAD_ETH3_TXD1__NETC_PINMUX_ETH3_TXD1 0x51e
+ IMX94_PAD_ETH3_TXD0__NETC_PINMUX_ETH3_TXD0 0x51e
+ IMX94_PAD_ETH3_TX_CTL__NETC_PINMUX_ETH3_TX_CTL 0x51e
+ IMX94_PAD_ETH3_TX_CLK__NETC_PINMUX_ETH3_TX_CLK 0x59e
+ IMX94_PAD_ETH3_RX_CTL__NETC_PINMUX_ETH3_RX_CTL 0x51e
+ IMX94_PAD_ETH3_RX_CLK__NETC_PINMUX_ETH3_RX_CLK 0x59e
+ IMX94_PAD_ETH3_RXD0__NETC_PINMUX_ETH3_RXD0 0x51e
+ IMX94_PAD_ETH3_RXD1__NETC_PINMUX_ETH3_RXD1 0x51e
+ IMX94_PAD_ETH3_RXD2__NETC_PINMUX_ETH3_RXD2 0x51e
+ IMX94_PAD_ETH3_RXD3__NETC_PINMUX_ETH3_RXD3 0x51e
+ >;
+ };
+
+ pinctrl_eth4: eth4grp {
+ fsl,pins = <
+ IMX94_PAD_ETH4_TXD3__NETC_PINMUX_ETH4_TXD3 0x51e
+ IMX94_PAD_ETH4_TXD2__NETC_PINMUX_ETH4_TXD2 0x51e
+ IMX94_PAD_ETH4_TXD1__NETC_PINMUX_ETH4_TXD1 0x51e
+ IMX94_PAD_ETH4_TXD0__NETC_PINMUX_ETH4_TXD0 0x51e
+ IMX94_PAD_ETH4_TX_CTL__NETC_PINMUX_ETH4_TX_CTL 0x51e
+ IMX94_PAD_ETH4_TX_CLK__NETC_PINMUX_ETH4_TX_CLK 0x59e
+ IMX94_PAD_ETH4_RX_CTL__NETC_PINMUX_ETH4_RX_CTL 0x51e
+ IMX94_PAD_ETH4_RX_CLK__NETC_PINMUX_ETH4_RX_CLK 0x59e
+ IMX94_PAD_ETH4_RXD0__NETC_PINMUX_ETH4_RXD0 0x51e
+ IMX94_PAD_ETH4_RXD1__NETC_PINMUX_ETH4_RXD1 0x51e
+ IMX94_PAD_ETH4_RXD2__NETC_PINMUX_ETH4_RXD2 0x51e
+ IMX94_PAD_ETH4_RXD3__NETC_PINMUX_ETH4_RXD3 0x51e
+ >;
+ };
pinctrl_ioexpander_int2: ioexpanderint2grp {
fsl,pins = <
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
` (7 preceding siblings ...)
2025-10-16 10:20 ` [PATCH 8/8] arm64: dts: imx94: add basic NETC nodes and properties Wei Fang
@ 2025-10-16 12:11 ` Rob Herring (Arm)
2025-10-21 7:14 ` Paolo Abeni
9 siblings, 0 replies; 18+ messages in thread
From: Rob Herring (Arm) @ 2025-10-16 12:11 UTC (permalink / raw)
To: Wei Fang
Cc: krzk+dt, davem, richardcochran, Frank.Li, vladimir.oltean,
andrew+netdev, kuba, linux-kernel, devicetree, imx,
claudiu.manoil, pabeni, edumazet, xiaoning.wang, netdev, conor+dt
On Thu, 16 Oct 2025 18:20:11 +0800, Wei Fang wrote:
> i.MX94 NETC has two kinds of ENETCs, one is the same as i.MX95, which
> can be used as a standalone network port. The other one is an internal
> ENETC, it connects to the CPU port of NETC switch through the pseudo
> MAC. Also, i.MX94 have multiple PTP Timers, which is different from
> i.MX95. Any PTP Timer can be bound to a specified standalone ENETC by
> the IERB ETBCR registers. Currently, this patch only add ENETC support
> and Timer support for i.MX94. The switch will be added by a separate
> patch set.
>
> ---
> Note that the DTS patch (patch 8/8) is just for referenece, it will be
> removed from this patch set when the dt-bindings patches have been
> reviewed. It will be sent for review by another thread in the future.
> ---
>
> Clark Wang (1):
> net: enetc: add ptp timer binding support for i.MX94
>
> Wei Fang (7):
> dt-bindings: net: netc-blk-ctrl: add compatible string for i.MX94
> platforms
> dt-bindings: net: enetc: add compatible string for ENETC with pseduo
> MAC
> dt-bindings: net: ethernet-controller: remove the enum values of speed
> net: enetc: add preliminary i.MX94 NETC blocks control support
> net: enetc: add basic support for the ENETC with pseudo MAC for i.MX94
> net: enetc: add standalone ENETC support for i.MX94
> arm64: dts: imx94: add basic NETC nodes and properties
>
> .../bindings/net/ethernet-controller.yaml | 1 -
> .../devicetree/bindings/net/fsl,enetc.yaml | 1 +
> .../bindings/net/nxp,netc-blk-ctrl.yaml | 1 +
> arch/arm64/boot/dts/freescale/imx94.dtsi | 118 ++++++++++
> arch/arm64/boot/dts/freescale/imx943-evk.dts | 100 +++++++++
> drivers/net/ethernet/freescale/enetc/enetc.c | 28 ++-
> drivers/net/ethernet/freescale/enetc/enetc.h | 8 +
> .../net/ethernet/freescale/enetc/enetc4_hw.h | 32 ++-
> .../net/ethernet/freescale/enetc/enetc4_pf.c | 37 ++--
> .../ethernet/freescale/enetc/enetc_ethtool.c | 64 ++++++
> .../net/ethernet/freescale/enetc/enetc_hw.h | 1 +
> .../freescale/enetc/enetc_pf_common.c | 5 +-
> .../ethernet/freescale/enetc/netc_blk_ctrl.c | 202 ++++++++++++++++++
> 13 files changed, 574 insertions(+), 24 deletions(-)
>
> --
> 2.34.1
>
>
>
My bot found new DTB warnings on the .dts files added or changed in this
series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings
are fixed by another series. Ultimately, it is up to the platform
maintainer whether these warnings are acceptable or not. No need to reply
unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then
make sure dt-schema is up to date:
pip3 install dtschema --upgrade
This patch series was applied (using b4) to base:
Base: attempting to guess base-commit...
Base: tags/next-20251015 (exact match)
Base: tags/next-20251015 (use --merge-base to override)
If this is not the correct base, please add 'base-commit' tag
(or use b4 which does this automatically)
New warnings running 'make CHECK_DTBS=y for arch/arm64/boot/dts/freescale/' for 20251016102020.3218579-1-wei.fang@nxp.com:
arch/arm64/boot/dts/freescale/imx943-evk.dtb: system-controller@4ceb0000 (nxp,imx94-netc-blk-ctrl): 'anyOf' conditional failed, one must be fixed:
'clocks' is a required property
'#clock-cells' is a required property
from schema $id: http://devicetree.org/schemas/clock/clock.yaml#
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
` (8 preceding siblings ...)
2025-10-16 12:11 ` [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Rob Herring (Arm)
@ 2025-10-21 7:14 ` Paolo Abeni
9 siblings, 0 replies; 18+ messages in thread
From: Paolo Abeni @ 2025-10-21 7:14 UTC (permalink / raw)
To: Wei Fang, robh, krzk+dt, conor+dt, claudiu.manoil,
vladimir.oltean, xiaoning.wang, Frank.Li, andrew+netdev, davem,
edumazet, kuba, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
On 10/16/25 12:20 PM, Wei Fang wrote:
> i.MX94 NETC has two kinds of ENETCs, one is the same as i.MX95, which
> can be used as a standalone network port. The other one is an internal
> ENETC, it connects to the CPU port of NETC switch through the pseudo
> MAC. Also, i.MX94 have multiple PTP Timers, which is different from
> i.MX95. Any PTP Timer can be bound to a specified standalone ENETC by
> the IERB ETBCR registers. Currently, this patch only add ENETC support
> and Timer support for i.MX94. The switch will be added by a separate
> patch set.
>
> ---
> Note that the DTS patch (patch 8/8) is just for referenece, it will be
> removed from this patch set when the dt-bindings patches have been
> reviewed. It will be sent for review by another thread in the future.
Note that such patch is (AFAICS) breaking Robert's tests. Including it
in this series will possibly/likely prevent (or at least slow down) acks
on the initial dst patches. I suggest omitting such patch in the next
iteration.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net-next 5/8] net: enetc: add ptp timer binding support for i.MX94
2025-10-16 10:20 ` [PATCH net-next 5/8] net: enetc: add ptp timer binding support for i.MX94 Wei Fang
@ 2025-10-21 7:21 ` Paolo Abeni
0 siblings, 0 replies; 18+ messages in thread
From: Paolo Abeni @ 2025-10-21 7:21 UTC (permalink / raw)
To: Wei Fang, robh, krzk+dt, conor+dt, claudiu.manoil,
vladimir.oltean, xiaoning.wang, Frank.Li, andrew+netdev, davem,
edumazet, kuba, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
On 10/16/25 12:20 PM, Wei Fang wrote:
> +static int imx94_ierb_init(struct platform_device *pdev)
> +{
> + struct netc_blk_ctrl *priv = platform_get_drvdata(pdev);
> + struct device_node *np = pdev->dev.of_node;
> + int err;
> +
> + for_each_child_of_node_scoped(np, child) {
> + for_each_child_of_node_scoped(child, gchild) {
> + if (of_device_is_compatible(gchild, "pci1131,e101")) {
> + err = imx94_enetc_update_tid(priv, gchild);
> + if (err)
> + return err;
Minor nit: the indentation level above is quite high; you could reduce
it a bit replacing:
if (of_device_is_compatible(gchild, "pci1131,e101")) {
with:
if (!of_device_is_compatible(gchild, "pci1131,e101"))
continue;
There is a similar occurrence in the previous patch.
/P
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net-next 6/8] net: enetc: add basic support for the ENETC with pseudo MAC for i.MX94
2025-10-16 10:20 ` [PATCH net-next 6/8] net: enetc: add basic support for the ENETC with pseudo MAC " Wei Fang
@ 2025-10-21 7:26 ` Paolo Abeni
2025-10-22 1:44 ` Wei Fang
0 siblings, 1 reply; 18+ messages in thread
From: Paolo Abeni @ 2025-10-21 7:26 UTC (permalink / raw)
To: Wei Fang, robh, krzk+dt, conor+dt, claudiu.manoil,
vladimir.oltean, xiaoning.wang, Frank.Li, andrew+netdev, davem,
edumazet, kuba, richardcochran
Cc: imx, netdev, linux-kernel, devicetree
On 10/16/25 12:20 PM, Wei Fang wrote:
> @@ -635,28 +649,10 @@ static void enetc4_pl_mac_config(struct phylink_config *config, unsigned int mod
>
> static void enetc4_set_port_speed(struct enetc_ndev_priv *priv, int speed)
> {
> - u32 old_speed = priv->speed;
> - u32 val;
> -
> - if (speed == old_speed)
> - return;
> -
> - val = enetc_port_rd(&priv->si->hw, ENETC4_PCR);
> - val &= ~PCR_PSPEED;
> -
> - switch (speed) {
> - case SPEED_100:
> - case SPEED_1000:
> - case SPEED_2500:
> - case SPEED_10000:
> - val |= (PCR_PSPEED & PCR_PSPEED_VAL(speed));
> - break;
> - case SPEED_10:
> - default:
> - val |= (PCR_PSPEED & PCR_PSPEED_VAL(SPEED_10));
> - }
> + u32 val = enetc_port_rd(&priv->si->hw, ENETC4_PCR);
>
> priv->speed = speed;
> + val = u32_replace_bits(val, PCR_PSPEED_VAL(speed), PCR_PSPEED);
> enetc_port_wr(&priv->si->hw, ENETC4_PCR, val);
> }
The above chunk looks unrelated from the rest of this patch. Perhaps
worth moving to a separate patch in this series? Or add some comments
explaining why it's needed.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net-next 1/8] dt-bindings: net: netc-blk-ctrl: add compatible string for i.MX94 platforms
2025-10-16 10:20 ` [PATCH net-next 1/8] dt-bindings: net: netc-blk-ctrl: add compatible string for i.MX94 platforms Wei Fang
@ 2025-10-21 20:38 ` Rob Herring (Arm)
0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring (Arm) @ 2025-10-21 20:38 UTC (permalink / raw)
To: Wei Fang
Cc: devicetree, davem, richardcochran, linux-kernel, kuba, Frank.Li,
netdev, vladimir.oltean, krzk+dt, andrew+netdev, claudiu.manoil,
imx, conor+dt, pabeni, edumazet, xiaoning.wang
On Thu, 16 Oct 2025 18:20:12 +0800, Wei Fang wrote:
> Add the compatible string "nxp,imx95-netc-blk-ctrl" for i.MX94 platforms.
>
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
> Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net-next 2/8] dt-bindings: net: enetc: add compatible string for ENETC with pseduo MAC
2025-10-16 10:20 ` [PATCH net-next 2/8] dt-bindings: net: enetc: add compatible string for ENETC with pseduo MAC Wei Fang
@ 2025-10-21 20:38 ` Rob Herring (Arm)
0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring (Arm) @ 2025-10-21 20:38 UTC (permalink / raw)
To: Wei Fang
Cc: pabeni, linux-kernel, kuba, krzk+dt, netdev, Frank.Li, imx,
devicetree, richardcochran, xiaoning.wang, andrew+netdev,
conor+dt, vladimir.oltean, davem, edumazet, claudiu.manoil
On Thu, 16 Oct 2025 18:20:13 +0800, Wei Fang wrote:
> The ENETC with pseudo MAC is used to connect to the CPU port of the NETC
> switch. This ENETC has a different PCI device ID, so add a standard PCI
> device compatible string to it.
>
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
> Documentation/devicetree/bindings/net/fsl,enetc.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net-next 3/8] dt-bindings: net: ethernet-controller: remove the enum values of speed
2025-10-16 10:20 ` [PATCH net-next 3/8] dt-bindings: net: ethernet-controller: remove the enum values of speed Wei Fang
@ 2025-10-21 20:50 ` Rob Herring
2025-10-22 1:51 ` Wei Fang
0 siblings, 1 reply; 18+ messages in thread
From: Rob Herring @ 2025-10-21 20:50 UTC (permalink / raw)
To: Wei Fang
Cc: krzk+dt, conor+dt, claudiu.manoil, vladimir.oltean, xiaoning.wang,
Frank.Li, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran, imx, netdev, linux-kernel, devicetree
On Thu, Oct 16, 2025 at 06:20:14PM +0800, Wei Fang wrote:
> Some fixed-link devices have uncommon link speeds. For example, the CPU
> port of NXP NETC switch is connected to an ENETC (Ethernet Controller),
> they are fully integrated into the NETC IP and connected through the
> 'pseudo link'. The link speed varies depending on the NETC version. For
> example, the speed of NETC v4.3 is 2680 Mbps, other versions may be 8
> Gbps or 12.5 Gbps or other speeds. There is no need and pointless to add
> these values to ethernet-controller.yaml. Therefore, remove these enum
> values so that when performing dtbs_check, no warnings are reported for
> the uncommon values.
Every binding that used this was relying on these constraints. So you've
got to move them into the individual bindings. I'd leave a minimum and
maximum here.
>
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
> Documentation/devicetree/bindings/net/ethernet-controller.yaml | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
> index 1bafd687dcb1..7fa02d58c208 100644
> --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
> +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
> @@ -177,7 +177,6 @@ properties:
> description:
> Link speed.
> $ref: /schemas/types.yaml#/definitions/uint32
> - enum: [10, 100, 1000, 2500, 5000, 10000]
>
> full-duplex:
> $ref: /schemas/types.yaml#/definitions/flag
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [PATCH net-next 6/8] net: enetc: add basic support for the ENETC with pseudo MAC for i.MX94
2025-10-21 7:26 ` Paolo Abeni
@ 2025-10-22 1:44 ` Wei Fang
0 siblings, 0 replies; 18+ messages in thread
From: Wei Fang @ 2025-10-22 1:44 UTC (permalink / raw)
To: Paolo Abeni
Cc: imx@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
Claudiu Manoil, Vladimir Oltean, Clark Wang, Frank Li,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, richardcochran@gmail.com
> On 10/16/25 12:20 PM, Wei Fang wrote:
> > @@ -635,28 +649,10 @@ static void enetc4_pl_mac_config(struct
> phylink_config *config, unsigned int mod
> >
> > static void enetc4_set_port_speed(struct enetc_ndev_priv *priv, int speed)
> > {
> > - u32 old_speed = priv->speed;
> > - u32 val;
> > -
> > - if (speed == old_speed)
> > - return;
> > -
> > - val = enetc_port_rd(&priv->si->hw, ENETC4_PCR);
> > - val &= ~PCR_PSPEED;
> > -
> > - switch (speed) {
> > - case SPEED_100:
> > - case SPEED_1000:
> > - case SPEED_2500:
> > - case SPEED_10000:
> > - val |= (PCR_PSPEED & PCR_PSPEED_VAL(speed));
> > - break;
> > - case SPEED_10:
> > - default:
> > - val |= (PCR_PSPEED & PCR_PSPEED_VAL(SPEED_10));
> > - }
> > + u32 val = enetc_port_rd(&priv->si->hw, ENETC4_PCR);
> >
> > priv->speed = speed;
> > + val = u32_replace_bits(val, PCR_PSPEED_VAL(speed), PCR_PSPEED);
> > enetc_port_wr(&priv->si->hw, ENETC4_PCR, val);
> > }
>
> The above chunk looks unrelated from the rest of this patch. Perhaps
> worth moving to a separate patch in this series? Or add some comments
> explaining why it's needed.
>
Because the internal link (The link between ENETC and the CPU port of
NETC switch) has a uncommon link speed and it is configurable. So I
removed the switch statement. But I realized that simply modifying the
fixed-link speed in DTS to support this uncommon link speed is not enough.
Although it will not affect the functionality, phylink will report a warning.
For i.MX94, I will set the speed to 2500Mbps in the fixed-link node. So I
will revert this change.
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [PATCH net-next 3/8] dt-bindings: net: ethernet-controller: remove the enum values of speed
2025-10-21 20:50 ` Rob Herring
@ 2025-10-22 1:51 ` Wei Fang
0 siblings, 0 replies; 18+ messages in thread
From: Wei Fang @ 2025-10-22 1:51 UTC (permalink / raw)
To: Rob Herring
Cc: krzk+dt@kernel.org, conor+dt@kernel.org, Claudiu Manoil,
Vladimir Oltean, Clark Wang, Frank Li, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, richardcochran@gmail.com, imx@lists.linux.dev,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
> On Thu, Oct 16, 2025 at 06:20:14PM +0800, Wei Fang wrote:
> > Some fixed-link devices have uncommon link speeds. For example, the CPU
> > port of NXP NETC switch is connected to an ENETC (Ethernet Controller),
> > they are fully integrated into the NETC IP and connected through the
> > 'pseudo link'. The link speed varies depending on the NETC version. For
> > example, the speed of NETC v4.3 is 2680 Mbps, other versions may be 8
> > Gbps or 12.5 Gbps or other speeds. There is no need and pointless to add
> > these values to ethernet-controller.yaml. Therefore, remove these enum
> > values so that when performing dtbs_check, no warnings are reported for
> > the uncommon values.
>
> Every binding that used this was relying on these constraints. So you've
> got to move them into the individual bindings. I'd leave a minimum and
> maximum here.
I realized that if we change to an uncommon speed, the phylink driver also
needs to be modified appropriately, otherwise the driver will report a warning,
although the warning does not affect usage. Modifying phylink driver is not the
purpose of this patch set, and I don't have a good idea at the moment, so I will
remove this patch. Thanks.
>
> >
> > Signed-off-by: Wei Fang <wei.fang@nxp.com>
> > ---
> > Documentation/devicetree/bindings/net/ethernet-controller.yaml | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
> b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
> > index 1bafd687dcb1..7fa02d58c208 100644
> > --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
> > +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
> > @@ -177,7 +177,6 @@ properties:
> > description:
> > Link speed.
> > $ref: /schemas/types.yaml#/definitions/uint32
> > - enum: [10, 100, 1000, 2500, 5000, 10000]
> >
> > full-duplex:
> > $ref: /schemas/types.yaml#/definitions/flag
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2025-10-22 1:51 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16 10:20 [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Wei Fang
2025-10-16 10:20 ` [PATCH net-next 1/8] dt-bindings: net: netc-blk-ctrl: add compatible string for i.MX94 platforms Wei Fang
2025-10-21 20:38 ` Rob Herring (Arm)
2025-10-16 10:20 ` [PATCH net-next 2/8] dt-bindings: net: enetc: add compatible string for ENETC with pseduo MAC Wei Fang
2025-10-21 20:38 ` Rob Herring (Arm)
2025-10-16 10:20 ` [PATCH net-next 3/8] dt-bindings: net: ethernet-controller: remove the enum values of speed Wei Fang
2025-10-21 20:50 ` Rob Herring
2025-10-22 1:51 ` Wei Fang
2025-10-16 10:20 ` [PATCH net-next 4/8] net: enetc: add preliminary i.MX94 NETC blocks control support Wei Fang
2025-10-16 10:20 ` [PATCH net-next 5/8] net: enetc: add ptp timer binding support for i.MX94 Wei Fang
2025-10-21 7:21 ` Paolo Abeni
2025-10-16 10:20 ` [PATCH net-next 6/8] net: enetc: add basic support for the ENETC with pseudo MAC " Wei Fang
2025-10-21 7:26 ` Paolo Abeni
2025-10-22 1:44 ` Wei Fang
2025-10-16 10:20 ` [PATCH net-next 7/8] net: enetc: add standalone ENETC support " Wei Fang
2025-10-16 10:20 ` [PATCH 8/8] arm64: dts: imx94: add basic NETC nodes and properties Wei Fang
2025-10-16 12:11 ` [PATCH net-next 0/8] net: enetc: Add i.MX94 ENETC support Rob Herring (Arm)
2025-10-21 7:14 ` Paolo Abeni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).