Skip to contentSkip to conversation

xilinx: tsn: Add TSN Endpoint Ethernet MAC driver support

RFC PATCH Superseded Srinivas Neeli 5 participants 28 messages Feb 19 – Mar 26

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover xilinx: tsn: Add TSN Endpoint Ethernet MAC driver support

Introduce a new network driver for the AMD LogiCORE 100M/1G TSN Subsystem IP, also known as the TSN Endpoint Ethernet MAC, which implements IEEE 802.1 Time-Sensitive Networking (TSN) features for deterministic and low-latency Ethernet communication in real-time and industrial automation use cases.

IP Core Overview:
The AMD LogiCORE 100M/1G TSN Subsystem IP solution (named as TSN Endpoint Ethernet MAC IP in the IP catalog) implements IEEE 802.1 Time Sensitive Networking (TSN) Standards and provides a low latency Bridged Endpoint or Endpoint only solutions. The bridged endpoint solution consists of a 3-port switch that connects to an endpoint including Linux software drivers. For Bridged Endpoint (Switch Endpoint), two ports connects to the network and one port connects to an internal Endpoint. It supports the use of GMII/RGMII interfaces connecting to a physical-side interface (PHY) chip with full duplex 100 Mb/s and 1 Gb/s operations.

Features:
- IP Customizable to generate TSN Endpoint or Bridged Endpoint solution
- Supports interface to network software stack
- Designed to comply with the following IEEE standards
- 802.1AS : Precision Time Protocol (PTP) synchronization
- 802.1Qav : Credit-Based Shaper for traffic shaping
- 802.1Qbv : Time-Aware Shaper for scheduled traffic
- 802.1Qbu : Frame Preemption for ultra-low latency
- 802.1CB : Frame Replication and Elimination for redundancy
- IP is customizable to enable various TSN feature-sets
- Supports three priority queues for scheduled, reserved (IEEE 802.1 Qav Credit Based Shaper) and best effort traffic classes
- Provides feature rich Ethernet Switch that caters to various network needs
* 3-port Switch (2-external, 1-internal)
* Programmable cut-through and store-forward operations
* 4-port Switch (2-external, 2-internal) extension through 'Endpoint Extension' and 'Endpoint Packet Switching' features
- Solution validated on ZCU102 & ZC702 AMD Evaluation boards.

Sample hardware architecture diagram for Bidge End Point like below:

             +------------------+
             |      MCDMA       |
             +---------+--------+
                    Q0---Q7
                       |
          +------------------------------------------------------------ +
          |            |	 TSN sub system(Bridge End Point)	|
          |            |                                                |
          |     +------+----+  Port 0   +-----------------------+       |
          |     |  EndPoint |<--------->|       TSN Switch      |       |
          |     |    (EP)   |           +----+-------------+----+       |
          |     +-----------+                |             |            |
          |                                  |             |            |
          |                              Port 1         Port 2          |
          |                                  |             |            |
          |                            +-----------+  +-----------+     |
          |                            |  MAC-1    |  |  MAC-2    |     |
          |                            |  (ETH1)   |  |  (ETH2)   |     |
          |                            +-----+-----+  +-----+-----+     |
	  |			             |		    |           |
          |				     |              |           |
          +-------------------------------------------------------------+
                                             |              |           
                                          RGMII           RGMII
                                             |              |
                                      +-----------+  +-----------+
                                      |  PHY1     |  |  PHY2     |
                                      | (Port 0)  |  | (Port 2)  |
                                      +-----------+  +-----------+

Software Driver Overivew:

This patch series targets for Bridge Endpoint design(Two EMAC's , one Endpoint and Switch block) with Multi channel DMA.

The TSN driver architecture mirrors the hardware structure by dividing functionality into multiple sub-blocks(Endpoint, EMACs, Switch, MDIO, DMA). Each sub-block includes its own init and exit routines, called from the core probe and remove flow, enabling flexible configurations and clean error unwind. Please check detailed explanation of each sub-block below.

Core Driver (xilinx_tsn.c):
- Acts as the central entry point for the driver, implementing platform probe and remove callbacks.
- Handles device tree parsing to discover configuration parameters such as DMA channel counts, queue priorities, and child hardware nodes.
- Manages clock acquisition, enablement, and disablement using the kernel bulk clock APIs.
- Maps the top-level register space for the TSN subsystem and prepares it for use by sub-blocks.
- Establishes initialization sequencing, ensuring that the endpoint is initialized first, followed by EMACs and MDIO, and finally the switch block.
- Provides a central driver context (struct tsn_priv), containing locks, statistics counters, configuration parameters, and references to instantiated functional components.

EndPoint(xilinx_tsn_ep.c):
- Implements the primary host-facing net_device interface (tsn_ep), which acts as the main application access point to the TSN subsystem.
- Manages multi-queue TX and RX descriptor rings using the dmaengine framework for high-performance packet transfer.
- Handles DMA submission and completion callbacks (tsn_dma_tx_cb / tsn_dma_rx_cb) to ensure efficient packet flow and completion tracking.
- Includes a VLAN PCP-to-queue mapping mechanism, enabling priority-based traffic classification and scheduling.
- Implements standard net_device operations including open, stop, start_xmit, set_mac_address, and select_queue for seamless integration with the Linux networking stack.

EMAC & MDIO (xilinx_tsn_emac.c and xilinx_tsn_mdio.c):
- Discovers and initializes individual Ethernet MAC instances by parsing child "ethernet-mac" nodes from the device tree.
- Allocates and registers a dedicated net_device for each MAC port, enabling independent interface management.
- Maps and configures register space for each MAC instance, including MAC address programming through UAW0/UAW1 registers.
- Establishes PHY connectivity using of_phy_connect() and manages link state changes.
- Updates MAC control registers dynamically based on PHY state transitions to ensure correct operational parameters.
- Optionally sets up an integrated MDIO bus if a "mdio" child node is present under the MAC node, enabling PHY access and management through the standard PHY framewor.

Switch (xilinx_tsn_switch.c):
- Handles initialization of the optional TSN switch block by mapping the "switch" child node from the device tree.
- Provides per-port state control (Disabled,Forwarding) via a hardware change-bit handshake mechanism with polling and timeout handling.
- Adds frame filter configuration support based on unicast source and destination MAC addresses.
- During driver initialization, all switch ports (Endpoint, MAC1, MAC2) are configured into the Forwarding state to enable data flow across the fabric.
- On driver removal, all ports are transitioned to the disabled state to ensure clean shutdown and traffic isolation.

xilinx_tsn_ptp_clock.c:
- Implements PTP Hardware Clock (PHC) support for the TSN subsystem's RTC/timer block.
- Provides ptp_clock_info operations (gettime64, settime64, adjtime, adjfine) for time synchronization.
- Handles RTC offset and increment register programming for clock adjustments.
- Implements PPS (Pulse Per Second) generation via timer interrupt handler, generating events at 128 pulses/second and delivering them to userspace.
- Registers PHC using ptp_clock_register() and exposes PHC index via ethtool for use by PTP daemons (ptp4l, phc2sys).
- Initialization is performed only for EMAC1 (MAC ID 1), as the PTP timer is shared globally across all MAC instances.
- Calculates RTC increment value based on fixed 125 MHz GTX clock frequency as specified in TSN IP core documentation.

xilinx_tsn_ptp_xmit.c:

- Implements dedicated PTP packet transmission and timestamping path using hardware PTP buffers.
- Manages 8 TX buffers and 16 RX buffers in hardware for PTP packet handling.
- Provides 32-bit aligned memory-mapped I/O helpers (memcpy_toio_32, memcpy_fromio_32) for efficient buffer access.
- Implements TX path (tsn_ptp_xmit) that copies PTP packets to hardware TX buffers and queues skbs for timestamp retrieval.
- Handles RX path using circular buffer mechanism with ptp_rx_hw_pointer (hardware write position) and ptp_rx_sw_pointer (software read position) for synchronized buffer access.
- Delivers hardware timestamps only for PTP event messages (Sync, Delay_Req, Pdelay_Req, Pdelay_Resp) by checking message type field.
- Uses interrupt-driven approach: RX ISR calls tsn_ptp_recv() directly, TX ISR schedules work queue (tsn_ptp_tx_tstamp) for timestamp delivery.
- Implements proper error handling including NULL checks for skb allocation, TX buffer overflow detection with netdev statistics updates, and cleanup paths for interrupt unregistration.

Future work:
- Plan to add hardware statistics support for EMACs.
- Plan to add support for PTP(1 step), QBV, preemption, FRER features.
- Adopting switch dev frame work for switch configurations.

Test information:
- Performed ping,iperf3 and 2 step ptp tests on the ZYNQMP platform.

NOTE:
- The changes depend on a few patches in the Xilinx DMA driver (xilinx_dma.c). Some of these patches are already posted, while others are still under review. The corresponding lore links are listed below, and links for the remaining patches will be added once they are submitted.

https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/

This RFC is the initial submission of the driver and aims to gather feedback on design, structure, and subsystem integration before further upstreamization work.

Srinivas Neeli (8):
dt-bindings: net: Add TSN Endpoint Ethernet MAC support
net: xilinx: tsn: Introduce TSN core driver skeleton
net: xilinx: tsn: Add TSN endpoint and MCDMA support
xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN
driver
net: xilinx: tsn: Add TSN switch support with port state and frame
filter control
dt-bindings: net: Add PTP interrupt support
net: xilinx: tsn: Add PTP hardware clock (PHC) and timer support
net: xilinx: tsn: Add PTP packet transmission support

 .../net/xlnx,tsn-endpoint-ethernet-mac.yaml   | 362 ++++++++
 drivers/net/ethernet/xilinx/Kconfig           |   1 +
 drivers/net/ethernet/xilinx/Makefile          |   1 +
 drivers/net/ethernet/xilinx/tsn/Kconfig       |  14 +
 drivers/net/ethernet/xilinx/tsn/Makefile      |   2 +
 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h  | 430 ++++++++++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_emac.c | 547 ++++++++++++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_ep.c   | 211 +++++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_main.c | 794 ++++++++++++++++++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c | 308 +++++++
 .../xilinx/tsn/xilinx_tsn_ptp_clock.c         | 386 +++++++++
 .../ethernet/xilinx/tsn/xilinx_tsn_ptp_xmit.c | 451 ++++++++++
 .../ethernet/xilinx/tsn/xilinx_tsn_switch.c   | 546 ++++++++++++
 13 files changed, 4053 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml
 create mode 100644 drivers/net/ethernet/xilinx/tsn/Kconfig
 create mode 100644 drivers/net/ethernet/xilinx/tsn/Makefile
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ep.c
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_main.c
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ptp_clock.c
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ptp_xmit.c
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_switch.c
Signature · 1 line
2.25.1
#1 lore raw

RFC PATCH 1/8 dt-bindings: net: Add TSN Endpoint Ethernet MAC support

TSN Endpoint Ethernet MAC implements IEEE 802.1 Time-Sensitive Networking (TSN) standards, providing deterministic, low-latency Ethernet communication. It can operate in two configurations, either as Endpoint-only or Bridged Endpoint mode. The Bridged Endpoint configuration integrates a three-port switch, with two ports connected to the external network and one port connected to an internal endpoint.

The IP supports GMII and RGMII interfaces for connection to external PHY devices, enabling full-duplex operation at 100 Mb/s and 1 Gb/s.

Add devicetree binding documentation for the TSN Endpoint Ethernet MAC IP, including support for multiple Ethernet MACs, a TSN switch, and an endpoint block.

---
NOTE:
The xlnx,tsn-endpoint-ethernet-mac-3.0 corresponds to the TSN Endpoint Ethernet MAC IP version. The IP Product Guide is currently under review and will be published on
the AMD/Xilinx documentation portal (similar to other IP TRMs).

---
 .../net/xlnx,tsn-endpoint-ethernet-mac.yaml   | 287 ++++++++++++++++++
 1 file changed, 287 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +287 -0
new file mode 100644
index 000000000000..0d61a911e1d1
@@ -0,0 +1,287 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/xlnx,tsn-endpoint-ethernet-mac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xilinx TSN Endpoint Ethernet MAC
+
+description:
+  TSN Endpoint Ethernet MAC IP implements IEEE 802.1 Time-Sensitive Networking (TSN)
+  standards and provides low-latency network connectivity in either Endpoint-only or
+  Bridged Endpoint configurations. In the Bridged Endpoint mode, the IP integrates a
+  three-port switch, with two ports connected to the external network and one port
+  connected to an internal endpoint.It also supports GMII/RGMII interfaces for
+  connection to an external PHY, enabling full-duplex operation at 100 Mb/s and
+  1 Gb/s speeds.
+
+maintainers:
+  - Neeli Srinivas <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - xlnx,tsn-endpoint-ethernet-mac-3.0
+  reg:
+    maxItems: 1
+
+  clocks:
+    minItems: 6
+
+  clock-names:
+    items:
+      - const: gtx
+      - const: gtx90
+      - const: host_rxfifo
+      - const: host_txfifo
+      - const: ref
+      - const: s_axi
+
+  dmas:
+    minItems: 2
+    maxItems: 32
+
+  dma-names:
+    items:
+      pattern: "^[tr]x_chan([0-9]|1[0-5])$"
+    description:
+      Should be "tx_chan0", "tx_chan1" ... "tx_chan15" for DMA Tx channel
+      Should be "rx_chan0", "rx_chan1" ... "rx_chan15" for DMA Rx channel
+    minItems: 2
+    maxItems: 32
+
+  ranges: true
+
+  xlnx,num-priorities:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 2
+    maximum: 8
+    description:
+      Number of traffic classes (priorities) configured in the IP.
+      This is an IP configuration parameter that determines the number of
+      priority queues available for QoS scheduling. Traffic classes map to
+      IEEE 802.1Q priority levels (0-7).
+
+  xlnx,tsn-tx-config:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Multiple TX Queue parameters. Phandle to a node that implements
+      the tx-queues-config.
+
+  tx-queues-config:
+    type: object
+    description:
+      TX queue configuration node that maps IP priority queues to
+      DMA TX channels. The TSN IP supports multiple priority queues for QoS
+      scheduling, and each queue can be connected to a specific DMA channel.
+      This mapping defines which DMA TX channel is used to transmit packets
+      for each priority queue. For example, queue0 with xlnx,dma-channel-num
+      set to 5 means priority queue 0 uses tx_chan5 for data transfer.
+
+    patternProperties:
+      "^queue[0-7]$":
+        description:
+          Each subnode represents a priority queue. The xlnx,dma-channel-num
+          property specifies which DMA TX channel (tx_chan0 to tx_chan15)
+          is connected to this queue for transmitting packets.
+        type: object
+        properties:
+          xlnx,dma-channel-num:
+            $ref: /schemas/types.yaml#/definitions/uint32
+            description:
+              DMA TX channel number connected to this priority queue.
+            minimum: 0
+            maximum: 15
+
+        additionalProperties: false
+    additionalProperties: false
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 1
+
+patternProperties:
+  "^ethernet-mac@":
+    type: object
+    $ref: /schemas/net/ethernet-controller.yaml#
+    required:
+      - reg
+      - phy-mode
+    properties:
+      reg:
+        maxItems: 1
+
+      phy-mode:
+        enum:
+          - gmii
+          - rgmii
+          - rgmii-id
+
+      phy-handle:
+        $ref: /schemas/types.yaml#/definitions/phandle
+
+      mdio:
+        type: object
+    additionalProperties: false
+
+  "^ep-mac@":
+    type: object
+    $ref: /schemas/net/ethernet-controller.yaml#
+    properties:
+      reg:
+        maxItems: 1
+
+    additionalProperties: false
+
+  "^switch@":
+    type: object
+    $ref: /schemas/net/ethernet-switch.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        maxItems: 1
+
+      ethernet-ports:
+        type: object
+        unevaluatedProperties: false
+
+        properties:
+          '#address-cells':
+            const: 1
+          '#size-cells':
+            const: 0
+
+        patternProperties:
+          "^port@[0-2]$":
+            type: object
+            $ref: ethernet-switch-port.yaml#
+            unevaluatedProperties: false
+
+            properties:
+              reg:
+                maximum: 2
+              ethernet:
+                description: Phandle to associated MAC or endpoint node
+                $ref: /schemas/types.yaml#/definitions/phandle
+            required:
+              - reg
+              - ethernet
+        required:
+          - "#address-cells"
+          - "#size-cells"
+    required:
+      - reg
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - dmas
+  - dma-names
+  - xlnx,num-priorities
+  - ranges
+
+examples:
+  - |
+    tsn_ip: tsn@80040000 {
+        compatible = "xlnx,tsn-endpoint-ethernet-mac-3.0";
+        reg = <0x80040000 0x40000>;
+        clocks = <&misc_clk_2>, <&misc_clk_2>, <&misc_clk_1>, <&misc_clk_1>, <&misc_clk_3>, <&misc_clk_0>;
+        clock-names = "gtx", "gtx90", "host_rxfifo", "host_txfifo", "ref", "s_axi";
+        dmas = <&axi_mcdma_0 0>, <&axi_mcdma_0 1>, <&axi_mcdma_0 2>, <&axi_mcdma_0 3>,
+               <&axi_mcdma_0 4>, <&axi_mcdma_0 5>, <&axi_mcdma_0 6>, <&axi_mcdma_0 7>,
+               <&axi_mcdma_0 16>, <&axi_mcdma_0 17>, <&axi_mcdma_0 18>, <&axi_mcdma_0 19>,
+               <&axi_mcdma_0 20>, <&axi_mcdma_0 21>, <&axi_mcdma_0 22>, <&axi_mcdma_0 23>;
+        dma-names = "tx_chan0","tx_chan1","tx_chan2","tx_chan3","tx_chan4","tx_chan5","tx_chan6",
+                    "tx_chan7","rx_chan0","rx_chan1","rx_chan2","rx_chan3","rx_chan4","rx_chan5",
+                    "rx_chan6","rx_chan7";
+        xlnx,num-priorities = <8>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges = <0x0 0x80040000 0x40000>;
+        xlnx,tsn-tx-config = <&tsn_tx_config>;
+        tsn_tx_config: tx-queues-config {
+            queue0 {
+                xlnx,dma-channel-num = <0x5>;
+            };
+            queue1 {
+                 xlnx,dma-channel-num = <0x4>;
+            };
+            queue2 {
+                 xlnx,dma-channel-num = <0x3>;
+            };
+            queue3 {
+                 xlnx,dma-channel-num = <0x2>;
+            };
+            queue4 {
+                 xlnx,dma-channel-num = <0x1>;
+            };
+            queue5 {
+                 xlnx,dma-channel-num = <0x0>;
+            };
+        };
+        // MAC 1 Node
+        mac1: ethernet-mac@0 {
+            reg = <0x0 0x14000>;
+            phy-mode = "rgmii-id";
+            phy-handle = <&phy0>;
+            mdio {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            phy0: ethernet-phy@0 {
+                device_type = "ethernet-phy";
+                reg = <0>;
+            };
+            };
+        };
+
+        // MAC 2 Node
+        mac2: ethernet-mac@20000 {
+            reg = <0x20000 0x14000>;
+            phy-mode = "rgmii-id";
+            phy-handle = <&phy1>;
+            mdio {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            phy1: ethernet-phy@1 {
+                device_type = "ethernet-phy";
+                reg = <1>;
+            };
+            };
+        };
+
+        // Endpoint Node
+        ep_mac: ep-mac@16000 {
+            reg = <0x16000 0xa000>;
+        };
+
+        // Switch Node
+        tsn_switch: switch@38000 {
+            reg = <0x38000 0x8000>;
+
+            ethernet-ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                port@0 {
+                    reg = <0>;
+                    ethernet = <&ep_mac>;
+                };
+
+                port@1 {
+                    reg = <1>;
+                    ethernet = <&mac1>;
+                };
+
+                port@2 {
+                    reg = <2>;
+                    ethernet = <&mac2>;
+                };
+            };
+        };
+    };
Signature · 1 line
2.25.1
#6 lore raw

RFC PATCH 2/8 net: xilinx: tsn: Introduce TSN core driver skeleton

In reply to Srinivas Neeli

Introduce the initial skeleton for the AMD/Xilinx Time Sensitive Networking (TSN) Ethernet IP driver. Adds the Kconfig entry (CONFIG_XILINX_TSN), updates the Xilinx Ethernet Makefile, and provides the base source file focused on device tree parsing and clock acquisition.

---
 drivers/net/ethernet/xilinx/Kconfig           |   1 +
 drivers/net/ethernet/xilinx/Makefile          |   1 +
 drivers/net/ethernet/xilinx/tsn/Kconfig       |  14 ++
 drivers/net/ethernet/xilinx/tsn/Makefile      |   2 +
 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h  |  60 +++++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_main.c | 218 ++++++++++++++++++
 6 files changed, 296 insertions(+)
 create mode 100644 drivers/net/ethernet/xilinx/tsn/Kconfig
 create mode 100644 drivers/net/ethernet/xilinx/tsn/Makefile
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_main.c
drivers/net/ethernet/xilinx/Kconfig +1 -0
index 7502214cc7d5..c6d704c8d3d4 100644
@@ -41,4 +41,5 @@ config XILINX_LL_TEMAC
 	  This driver supports the Xilinx 10/100/1000 LocalLink TEMAC
 	  core used in Xilinx Spartan and Virtex FPGAs
 
+source "drivers/net/ethernet/xilinx/tsn/Kconfig"
 endif # NET_VENDOR_XILINX
drivers/net/ethernet/xilinx/Makefile +1 -0
index 7d7dc1771423..66dab012650b 100644
@@ -8,3 +8,4 @@ obj-$(CONFIG_XILINX_LL_TEMAC) += ll_temac.o
 obj-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o
 xilinx_emac-objs := xilinx_axienet_main.o xilinx_axienet_mdio.o
 obj-$(CONFIG_XILINX_AXI_EMAC) += xilinx_emac.o
+obj-$(CONFIG_XILINX_TSN) += tsn/
drivers/net/ethernet/xilinx/tsn/Kconfig new file +14 -0
new file mode 100644
index 000000000000..53734842700b
@@ -0,0 +1,14 @@
+config XILINX_TSN
+	tristate "Xilinx TSN Ethernet driver"
+	depends on OF && HAS_IOMEM
+	select PHYLIB
+	select NET_DEVLINK
+	select NET_DEV_STATS
+	help
+	  This driver supports the Xilinx Time-Sensitive Networking (TSN)
+	  Ethernet IP, which includes multiple Ethernet MACs, a TSN switch,
+	  and an endpoint block. It provides support for scheduling,
+	  traffic shaping, and time synchronization to meet real-time
+	  requirements of industrial Ethernet applications.
+
+	  If unsure, say N.
drivers/net/ethernet/xilinx/tsn/Makefile new file +2 -0
new file mode 100644
index 000000000000..420497f2d402
@@ -0,0 +1,2 @@
+obj-$(CONFIG_XILINX_TSN) :=xilinx_tsn.o
+xilinx_tsn-objs := xilinx_tsn_main.o
drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h new file +60 -0

60 lines not on this page · raw message

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_main.c new file +218 -0

218 lines not on this page · raw message

Signature · 1 line
2.25.1
#8 lore raw

RFC PATCH 3/8 net: xilinx: tsn: Add TSN endpoint and MCDMA support

In reply to Srinivas Neeli

Add initial support for the TSN endpoint (EP) network interface, including basic DMA datapath integration and net_device registration.

Introduces a new driver component that registers an "ep" net_device with support for multiple TX/RX queues and ethtool statistics. It sets up DMA rings, manages TX/RX submission and completion callbacks, and provides helper APIs for accessing endpoint registers.

---
 drivers/net/ethernet/xilinx/tsn/Makefile      |   2 +-
 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h  | 113 ++++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_ep.c   | 211 +++++++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_main.c | 558 ++++++++++++++++++
 4 files changed, 883 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ep.c
drivers/net/ethernet/xilinx/tsn/Makefile +1 -1
index 420497f2d402..099526877948 100644
@@ -1,2 +1,2 @@
 obj-$(CONFIG_XILINX_TSN) :=xilinx_tsn.o
-xilinx_tsn-objs := xilinx_tsn_main.o
+xilinx_tsn-objs := xilinx_tsn_main.o xilinx_tsn_ep.o
drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h +113 -0

158 lines not on this page · raw message

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ep.c new file +211 -0

211 lines not on this page · raw message

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_main.c +558 -0

583 lines not on this page · raw message

Signature · 1 line
2.25.1
#10 lore raw

RFC PATCH 4/8 xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver

In reply to Srinivas Neeli

Introduce support for the Ethernet MAC (EMAC) and MDIO controller used by the TSN driver.

This patch adds:
- EMAC initialization, reset handling, and register access helpers
- MAC address configuration support
- MDIO read/write functions for PHY register access
- Basic PHY detection and link status handling
- Error handling and resource cleanup during initialization failures
- Build system updates to compile the new EMAC/MDIO support

---
 drivers/net/ethernet/xilinx/tsn/Makefile      |   2 +-
 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h  | 124 +++++++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_emac.c | 326 ++++++++++++++++++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_main.c |  19 +-
 .../net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c | 308 +++++++++++++++++
 5 files changed, 774 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c
drivers/net/ethernet/xilinx/tsn/Makefile +1 -1
index 099526877948..5eb6dde67061 100644
@@ -1,2 +1,2 @@
 obj-$(CONFIG_XILINX_TSN) :=xilinx_tsn.o
-xilinx_tsn-objs := xilinx_tsn_main.o xilinx_tsn_ep.o
+xilinx_tsn-objs := xilinx_tsn_main.o xilinx_tsn_ep.o xilinx_tsn_emac.o xilinx_tsn_mdio.o
drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h +124 -0

166 lines not on this page · raw message

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c new file +326 -0

326 lines not on this page · raw message

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_main.c +15 -4
index 9e674f99d83f..7cb07e330f57 100644
@@ -92,13 +92,14 @@ static void tsn_rx_submit_desc(struct tsn_dma_chan *xchan)
  * @tuser: TUSER metadata word from DMA descriptor
  *
  * Extract Input Port ID from TUSER bits[5:4] and return corresponding netdev.
- * Currently only EP is supported; MAC ports will return NULL until implemented.
+ * Supports EP (endpoint) and MAC1/MAC2 (EMAC) ports.
  *
  * Return: net_device pointer on success, NULL if port not available
  */
 static inline struct net_device *tsn_classify_rx_packet(struct tsn_priv *common, u32 tuser)
 {
 	u32 port_id;
+	int i;
 
 	/* Extract Input Port ID from TUSER bits[5:4] */
 	port_id = FIELD_GET(TSN_TUSER_PORT_ID_MASK, tuser);
@@ -112,9 +113,13 @@ static inline struct net_device *tsn_classify_rx_packet(struct tsn_priv *common,
 
 	case TSN_TUSER_PORT_MAC1:
 	case TSN_TUSER_PORT_MAC2:
-		/* MAC ports not yet implemented */
+		for (i = 0; i < common->num_emacs; i++) {
+			if (common->emacs[i] &&
+			    common->emacs[i]->emac_num == port_id)
+				return common->emacs[i]->ndev;
+		}
 		if (net_ratelimit())
-			dev_warn(common->dev, "RX from MAC port %u not yet supported\n", port_id);
+			dev_warn(common->dev, "RX from MAC port %u not found\n", port_id);
 		return NULL;
 
 	default:
@@ -726,13 +731,18 @@ static int tsn_ip_probe(struct platform_device *pdev)
 		goto free_clk;
 	}
 
-	/* Initialize EP - now safe to register because DMA is ready */
 	ret = tsn_ep_init(pdev);
 	if (ret)
 		goto exit_dma;
 
+	ret = tsn_emac_init(pdev);
+	if (ret)
+		goto exit_ep;
+
 	return 0;
 
+exit_ep:
+	tsn_ep_exit(pdev);
 exit_dma:
 	tsn_exit_dmaengine(pdev);
 free_clk:
@@ -748,6 +758,7 @@ static void tsn_ip_remove(struct platform_device *pdev)
 {
 	struct tsn_priv *common = platform_get_drvdata(pdev);
 
+	tsn_emac_exit(pdev);
 	/* Tear down DMA channels and endpoint */
 	if (common->ep)
 		tsn_ep_exit(pdev);
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c new file +308 -0

308 lines not on this page · raw message

Signature · 1 line
2.25.1
#17 lore raw

RFC PATCH 5/8 net: xilinx: tsn: Add TSN switch support with port state and frame filter control

In reply to Srinivas Neeli

Add support for the TSN hardware switch block, introducing port state management and frame filter configuration.

It provides initialization and cleanup routines, register access helpers, and APIs for port state and frame filter configuration.

Enables basic activation and controlled management of TSN switch ports, allowing traffic forwarding between endpoint and MAC interfaces through the switch.

---
 drivers/net/ethernet/xilinx/tsn/Makefile      |   2 +-
 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h  |  16 +
 .../net/ethernet/xilinx/tsn/xilinx_tsn_main.c |   7 +
 .../ethernet/xilinx/tsn/xilinx_tsn_switch.c   | 546 ++++++++++++++++++
 4 files changed, 570 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_switch.c
drivers/net/ethernet/xilinx/tsn/Makefile +1 -1
index 5eb6dde67061..fc1c0cda0843 100644
@@ -1,2 +1,2 @@
 obj-$(CONFIG_XILINX_TSN) :=xilinx_tsn.o
-xilinx_tsn-objs := xilinx_tsn_main.o xilinx_tsn_ep.o xilinx_tsn_emac.o xilinx_tsn_mdio.o
+xilinx_tsn-objs := xilinx_tsn_main.o xilinx_tsn_ep.o xilinx_tsn_emac.o xilinx_tsn_mdio.o xilinx_tsn_switch.o
drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h +16 -0
index c8435c09ed2c..91d01313aada 100644
@@ -138,6 +138,18 @@ struct tsn_emac {
 	int irq;
 };
 
+/*
+ * struct tsn_switch - TSN switch configuration structure
+ * @dev: Device pointer for this switch instance
+ * @regs: Virtual address mapping of switch register space
+ * @irq: Interrupt number for switch events
+ */
+struct tsn_switch {
+	struct device *dev;
+	void __iomem *regs;
+	int irq;
+};
+
 /*
  * struct skbuf_dma_descriptor - skb for each dma descriptor
  * @sgl: Pointer for sglist.
@@ -193,6 +205,7 @@ struct tsn_endpoint {
  * @regs: ioremap()'d base pointer
  * @ep: Pointer to TSN endpoint structure
  * @emacs: Array of EMAC instances (up to 2)
+ * @sw: Pointer to TSN switch structure
  * @clks: Bulk clock data for all required clocks
  * @tx_lock: Spinlock protecting TX rings and related TX state
  * @rx_lock: Spinlock protecting RX rings and related RX state
@@ -214,6 +227,7 @@ struct tsn_priv {
 	void __iomem *regs;
 	struct tsn_endpoint *ep;
 	struct tsn_emac *emacs[TSN_MAX_EMAC_NO];
+	struct tsn_switch *sw;
 	struct clk_bulk_data clks[TSN_NUM_CLOCKS];
 	spinlock_t tx_lock;	/* Protects TX ring buffers */
 	spinlock_t rx_lock;	/* Protects RX ring buffers */
@@ -294,4 +308,6 @@ int tsn_emac_init(struct platform_device *pdev);
 void tsn_emac_exit(struct platform_device *pdev);
 int tsn_mdio_setup(struct tsn_emac *emac, struct device_node *mac_np);
 void tsn_mdio_teardown(struct tsn_emac *emac);
+int tsn_switch_init(struct platform_device *pdev);
+void tsn_switch_exit(struct platform_device *pdev);
 #endif /* XILINX_TSN_H */
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_main.c +7 -0
index 7cb07e330f57..82c73fbcd83c 100644
@@ -739,8 +739,14 @@ static int tsn_ip_probe(struct platform_device *pdev)
 	if (ret)
 		goto exit_ep;
 
+	ret = tsn_switch_init(pdev);
+	if (ret)
+		goto exit_emac;
+
 	return 0;
 
+exit_emac:
+	tsn_emac_exit(pdev);
 exit_ep:
 	tsn_ep_exit(pdev);
 exit_dma:
@@ -758,6 +764,7 @@ static void tsn_ip_remove(struct platform_device *pdev)
 {
 	struct tsn_priv *common = platform_get_drvdata(pdev);
 
+	tsn_switch_exit(pdev);
 	tsn_emac_exit(pdev);
 	/* Tear down DMA channels and endpoint */
 	if (common->ep)
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_switch.c new file +546 -0

546 lines not on this page · raw message

Signature · 1 line
2.25.1
#18 lore raw

RFC PATCH 6/8 dt-bindings: net: Add PTP interrupt support

In reply to Srinivas Neeli

Add device tree bindings for PTP (Precision Time Protocol) interrupt configuration in Xilinx TSN Endpoint Ethernet MAC IP. The MAC instances within the TSN IP have asymmetric PTP capabilities based on their hardware configuration.

MAC 1 (xlnx,mac-id = 1) provides complete PTP hardware support including a dedicated PTP timer, requiring four interrupt lines:
- interrupt_ptp_rx: PTP receive packet interrupt
- interrupt_ptp_tx: PTP transmit packet interrupt
- mac_irq: General MAC interrupt
- interrupt_ptp_timer: PTP hardware timer interrupt

MAC 2 (xlnx,mac-id = 2) supports PTP packet processing but lacks the hardware timer block, requiring only three interrupt lines:
- interrupt_ptp_rx: PTP receive packet interrupt
- interrupt_ptp_tx: PTP transmit packet interrupt
- mac_irq: General MAC interrupt

---
 .../net/xlnx,tsn-endpoint-ethernet-mac.yaml   | 79 ++++++++++++++++++-
 1 file changed, 77 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml +77 -2
index 0d61a911e1d1..b1b0f4a03d11 100644
@@ -113,6 +113,34 @@ patternProperties:
       reg:
         maxItems: 1
 
+      xlnx,mac-id:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [1, 2]
+        description:
+          MAC instance identifier. MAC ID 1 supports PTP timer functionality,
+          while MAC ID 2 does not have PTP timer support.
+
+      interrupts:
+        minItems: 1
+        maxItems: 4
+        description:
+          Interrupt specifiers for MAC interrupts. MAC 1 (with PTP support)
+          requires 4 interrupts (ptp_rx, ptp_tx, mac_irq, ptp_timer).
+          MAC 2 (without PTP support) requires 3 interrupts (ptp_rx, ptp_tx, mac_irq).
+
+      interrupt-names:
+        minItems: 1
+        maxItems: 4
+        items:
+          enum:
+            - interrupt_ptp_rx
+            - interrupt_ptp_tx
+            - mac_irq
+            - interrupt_ptp_timer
+        description:
+          Names for the interrupts. MAC 1 includes "interrupt_ptp_timer" for
+          PTP hardware timer, which is not present in MAC 2.
+
       phy-mode:
         enum:
           - gmii
@@ -124,6 +152,44 @@ patternProperties:
 
       mdio:
         type: object
+
+    allOf:
+      - if:
+          properties:
+            xlnx,mac-id:
+              const: 1
+        then:
+          properties:
+            interrupts:
+              minItems: 4
+              maxItems: 4
+            interrupt-names:
+              items:
+                - const: interrupt_ptp_rx
+                - const: interrupt_ptp_tx
+                - const: mac_irq
+                - const: interrupt_ptp_timer
+          required:
+            - interrupts
+            - interrupt-names
+      - if:
+          properties:
+            xlnx,mac-id:
+              const: 2
+        then:
+          properties:
+            interrupts:
+              minItems: 3
+              maxItems: 3
+            interrupt-names:
+              items:
+                - const: interrupt_ptp_rx
+                - const: interrupt_ptp_tx
+                - const: mac_irq
+          required:
+            - interrupts
+            - interrupt-names
+
     additionalProperties: false
 
   "^ep-mac@":
@@ -225,9 +291,14 @@ examples:
                  xlnx,dma-channel-num = <0x0>;
             };
         };
-        // MAC 1 Node
+        // MAC 1 Node (with PTP timer support)
         mac1: ethernet-mac@0 {
             reg = <0x0 0x14000>;
+            xlnx,mac-id = <1>;
+            interrupt-parent = <&intc>;
+            interrupt-names = "interrupt_ptp_rx", "interrupt_ptp_tx",
+                              "mac_irq", "interrupt_ptp_timer";
+            interrupts = <0 2>, <2 2>, <4 2>, <6 2>;
             phy-mode = "rgmii-id";
             phy-handle = <&phy0>;
             mdio {
@@ -240,9 +311,13 @@ examples:
             };
         };
 
-        // MAC 2 Node
+        // MAC 2 Node (without PTP timer support)
         mac2: ethernet-mac@20000 {
             reg = <0x20000 0x14000>;
+            xlnx,mac-id = <2>;
+            interrupt-parent = <&intc>;
+            interrupt-names = "interrupt_ptp_rx", "interrupt_ptp_tx", "mac_irq";
+            interrupts = <1 2>, <3 2>, <5 2>;
             phy-mode = "rgmii-id";
             phy-handle = <&phy1>;
             mdio {
Signature · 1 line
2.25.1
#20 lore raw

RFC PATCH 7/8 net: xilinx: tsn: Add PTP hardware clock (PHC) and timer support

In reply to Srinivas Neeli

Added PTP Hardware Clock (PHC) support to the Xilinx TSN Ethernet driver by integrating the TSN IP's real-time clock (RTC) and PTP timer logic.

A new tsn_ptp_timer abstraction is introduced to manage the PTP timer registers, RTC offset/increment handling, timer interrupts, and PPS generation. The implementation provides full support for PTP clock operations including:
- gettime64 / settime64
- adjtime
- adjfine
- PPS enable/disable
- PHC registration via ptp_clock_register()

PTP timer interrupt handling is added to generate PPS output based on the TSN RTC pulse counter. The PTP timer is shared globally across the MAC instances and is initialized only for TEMAC1.

Support is also added to ethtool -T via get_ts_info to report hardware timestamping capabilities and the PHC index.

This enables Linux PTP services such as ptp4l and phc2sys to synchronize time using the TSN hardware clock.

---
 drivers/net/ethernet/xilinx/tsn/Makefile      |   2 +-
 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h  |  59 +++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_emac.c |  55 ++-
 .../xilinx/tsn/xilinx_tsn_ptp_clock.c         | 386 ++++++++++++++++++
 4 files changed, 500 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ptp_clock.c
drivers/net/ethernet/xilinx/tsn/Makefile +1 -1
index fc1c0cda0843..0faa5233221b 100644
@@ -1,2 +1,2 @@
 obj-$(CONFIG_XILINX_TSN) :=xilinx_tsn.o
-xilinx_tsn-objs := xilinx_tsn_main.o xilinx_tsn_ep.o xilinx_tsn_emac.o xilinx_tsn_mdio.o xilinx_tsn_switch.o
+xilinx_tsn-objs := xilinx_tsn_main.o xilinx_tsn_ep.o xilinx_tsn_emac.o xilinx_tsn_mdio.o xilinx_tsn_switch.o xilinx_tsn_ptp_clock.o
drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h +59 -0

99 lines not on this page · raw message

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c +54 -1

93 lines not on this page · raw message

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ptp_clock.c new file +386 -0

386 lines not on this page · raw message

Signature · 1 line
2.25.1
#21 lore raw

RFC PATCH 8/8 net: xilinx: tsn: Add PTP packet transmission support

In reply to Srinivas Neeli

Add support for PTP (Precision Time Protocol) packet transmission and timestamping for Xilinx TSN Ethernet MAC. This implementation provides hardware-assisted packet timestamping for IEEE 1588 PTP synchronization.

Key features added:
- PTP TX/RX buffer management with 8 TX and 16 RX buffers
- Hardware timestamp extraction for transmitted and received packets
- Dedicated PTP packet queue and transmission path
- Interrupt-driven timestamp retrieval via work queues
- Support for 2-step PTP mode (HWTSTAMP_TX_ON)
- PTP packet filtering based on ETH_P_1588 ethertype

---
 drivers/net/ethernet/xilinx/tsn/Makefile      |   2 +-
 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h  |  58 +++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_emac.c | 178 ++++++-
 .../ethernet/xilinx/tsn/xilinx_tsn_ptp_xmit.c | 451 ++++++++++++++++++
 4 files changed, 683 insertions(+), 6 deletions(-)
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ptp_xmit.c
drivers/net/ethernet/xilinx/tsn/Makefile +1 -1
index 0faa5233221b..a39cc7ca1533 100644
@@ -1,2 +1,2 @@
 obj-$(CONFIG_XILINX_TSN) :=xilinx_tsn.o
-xilinx_tsn-objs := xilinx_tsn_main.o xilinx_tsn_ep.o xilinx_tsn_emac.o xilinx_tsn_mdio.o xilinx_tsn_switch.o xilinx_tsn_ptp_clock.o
+xilinx_tsn-objs := xilinx_tsn_main.o xilinx_tsn_ep.o xilinx_tsn_emac.o xilinx_tsn_mdio.o xilinx_tsn_switch.o xilinx_tsn_ptp_clock.o xilinx_tsn_ptp_xmit.o
drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h +58 -0

80 lines not on this page · raw message

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c +173 -5

234 lines not on this page · raw message

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ptp_xmit.c new file +451 -0

451 lines not on this page · raw message

Signature · 1 line
2.25.1
#7 lore raw

Re: [RFC PATCH 2/8] net: xilinx: tsn: Introduce TSN core driver skeleton

In reply to Srinivas Neeli
Quoted 45 lines · Srinivas Neeli

Introduce the initial skeleton for the AMD/Xilinx Time Sensitive Networking (TSN) Ethernet IP driver. Adds the Kconfig entry (CONFIG_XILINX_TSN), updates the Xilinx Ethernet Makefile, and provides the base source file focused on device tree parsing and clock acquisition.

---
 drivers/net/ethernet/xilinx/Kconfig           |   1 +
 drivers/net/ethernet/xilinx/Makefile          |   1 +
 drivers/net/ethernet/xilinx/tsn/Kconfig       |  14 ++
 drivers/net/ethernet/xilinx/tsn/Makefile      |   2 +
 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h  |  60 +++++
 .../net/ethernet/xilinx/tsn/xilinx_tsn_main.c | 218 ++++++++++++++++++
 6 files changed, 296 insertions(+)
 create mode 100644 drivers/net/ethernet/xilinx/tsn/Kconfig
 create mode 100644 drivers/net/ethernet/xilinx/tsn/Makefile
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn.h
 create mode 100644 drivers/net/ethernet/xilinx/tsn/xilinx_tsn_main.c
drivers/net/ethernet/xilinx/Kconfig +1 -0
index 7502214cc7d5..c6d704c8d3d4 100644
@@ -41,4 +41,5 @@ config XILINX_LL_TEMAC
 	  This driver supports the Xilinx 10/100/1000 LocalLink TEMAC
 	  core used in Xilinx Spartan and Virtex FPGAs
 
+source "drivers/net/ethernet/xilinx/tsn/Kconfig"
 endif # NET_VENDOR_XILINX
drivers/net/ethernet/xilinx/Makefile +1 -0
index 7d7dc1771423..66dab012650b 100644
@@ -8,3 +8,4 @@ obj-$(CONFIG_XILINX_LL_TEMAC) += ll_temac.o
 obj-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o
 xilinx_emac-objs := xilinx_axienet_main.o xilinx_axienet_mdio.o
 obj-$(CONFIG_XILINX_AXI_EMAC) += xilinx_emac.o
+obj-$(CONFIG_XILINX_TSN) += tsn/
drivers/net/ethernet/xilinx/tsn/Kconfig new file +0 -0
new file mode 100644
index 000000000000..53734842700b

drivers/net/ethernet/xilinx/tsn/Kconfig line 3

Quoted 3 lines
drivers/net/ethernet/xilinx/tsn/Kconfig new file +3 -0
@@ -0,0 +1,14 @@
+config XILINX_TSN
+	tristate "Xilinx TSN Ethernet driver"
+	depends on OF && HAS_IOMEM

No ARCH_XILINX?

Quoted 10 lines
drivers/net/ethernet/xilinx/tsn/Kconfig new file +10 -0
+	select PHYLIB
+	select NET_DEVLINK
+	select NET_DEV_STATS
+	help
+	  This driver supports the Xilinx Time-Sensitive Networking (TSN)
+	  Ethernet IP, which includes multiple Ethernet MACs, a TSN switch,
+	  and an endpoint block. It provides support for scheduling,
+	  traffic shaping, and time synchronization to meet real-time
+	  requirements of industrial Ethernet applications.
+

...

Quoted 10 lines
drivers/net/ethernet/xilinx/tsn/Kconfig new file +10 -0
+
+/*
+ * Helper to parse TX queue config subnode referenced by
+ * xlnx,tsn-tx-config. This version enumerates child nodes in order and
+ * assigns DMA channels sequentially (queue0 == first child, etc.)
+ */
+static int tsn_parse_tx_queue_config(struct device *dev, struct tsn_priv *common,
+				     struct device_node *txcfg_np)
+{
+	struct device_node *qnode;

drivers/net/ethernet/xilinx/tsn/Kconfig

Quoted 10 lines
drivers/net/ethernet/xilinx/tsn/Kconfig new file +10 -0
+	unsigned int queue = 0;
+	int ret = 0;
+
+	for_each_available_child_of_node(txcfg_np, qnode) {
+		u32 chan;
+
+		if (queue >= common->num_tx_queues) {
+			dev_err(dev, "tx-config: extra child nodes beyond %u ignored\n",
+				common->num_tx_queues);
+			of_node_put(qnode);

Use scoped loop.

Quoted 103 lines
drivers/net/ethernet/xilinx/tsn/Kconfig new file +103 -0
+			return -EINVAL;
+		}
+
+		ret = of_property_read_u32(qnode, "xlnx,dma-channel-num", &chan);
+		if (ret) {
+			dev_err(dev, "tx-config: Q%u missing xlnx,dma-channel-num\n", queue);
+			of_node_put(qnode);
+			return ret;
+		}
+
+		if (chan > TSN_DMA_MAX_TX_CH) {
+			dev_err(dev, "tx-config: Q%u channel %u exceeds max %lu\n",
+				queue, chan, TSN_DMA_MAX_TX_CH);
+			of_node_put(qnode);
+			return -EINVAL;
+		}
+		common->tx_dma_chan_map[queue++] = chan;
+	}
+
+	if (queue != common->num_tx_queues) {
+		dev_err(dev, "tx-config: described %u queues but expected %u\n",
+			queue, common->num_tx_queues);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+/**
+ * tsn_parse_device_tree - Parse device tree configuration for TSN device
+ * @pdev: Platform device pointer
+ *
+ * Return: 0 on success, negative error code on failure
+ */
+static int tsn_parse_device_tree(struct platform_device *pdev)
+{
+	struct tsn_priv *common = platform_get_drvdata(pdev);
+	struct device_node *txcfg_np = NULL;
+	struct device *dev = &pdev->dev;
+	int i, ret;
+
+	/* Read number of priorities */
+	ret = of_property_read_u32(dev->of_node, "xlnx,num-priorities", &common->num_priorities);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to get xlnx,num-priorities\n");
+
+	if (common->num_priorities < TSN_MIN_PRIORITIES ||
+	    common->num_priorities > TSN_MAX_PRIORITIES)
+		return dev_err_probe(dev, -EINVAL, "Invalid xlnx,num-priorities (%u)\n",
+				     common->num_priorities);
+
+	/* Count TX and RX queues from dma-names property */
+	ret = of_property_count_strings(dev->of_node, "dma-names");
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "Failed to get dma-names\n");
+
+	common->num_tx_queues = 0;
+	common->num_rx_queues = 0;
+
+	for (i = 0; i < ret; i++) {
+		const char *dma_name;
+
+		if (of_property_read_string_index(dev->of_node, "dma-names", i, &dma_name))
+			continue;
+
+		if (strncmp(dma_name, "tx_chan", 7) == 0)
+			common->num_tx_queues++;
+		else if (strncmp(dma_name, "rx_chan", 7) == 0)
+			common->num_rx_queues++;
+	}
+
+	if (!common->num_tx_queues || common->num_tx_queues > TSN_MAX_TX_QUEUE)
+		return dev_err_probe(dev, -EINVAL,
+				     "Invalid TX queue count (%u, max %u)\n",
+				     common->num_tx_queues, TSN_MAX_TX_QUEUE);
+
+	if (!common->num_rx_queues)
+		return dev_err_probe(dev, -EINVAL, "No RX DMA channels found\n");
+
+	/* Setup clock IDs */
+	for (i = 0; i < TSN_NUM_CLOCKS; i++)
+		common->clks[i].id = tsn_clk_names[i];
+
+	/* Get all clocks */
+	ret = devm_clk_bulk_get(dev, TSN_NUM_CLOCKS, common->clks);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to get clocks\n");
+
+	/* Enable clocks */
+	ret = clk_bulk_prepare_enable(TSN_NUM_CLOCKS, common->clks);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to enable clocks\n");
+
+	for (i = 0; i < TSN_MAX_TX_QUEUE; i++)
+		common->tx_dma_chan_map[i] = TSN_DMA_CH_INVALID;
+
+	txcfg_np = of_parse_phandle(dev->of_node, "xlnx,tsn-tx-config", 0);
+	if (txcfg_np) {
+		ret = tsn_parse_tx_queue_config(dev, common, txcfg_np);
+		of_node_put(txcfg_np);
+		if (ret)
+			goto err_disable_clks;
+	}

drivers/net/ethernet/xilinx/tsn/Kconfig

Quoted 10 lines
drivers/net/ethernet/xilinx/tsn/Kconfig new file +10 -0
+
+	return 0;
+
+err_disable_clks:
+	clk_bulk_disable_unprepare(TSN_NUM_CLOCKS, common->clks);
+	return ret;
+}
+
+/**
+ * tsn_ip_probe - Probe TSN IP core device

Nooo...

Quoted 30 lines

+ * @pdev: Platform device pointer
+ *
+ * Return: 0 on success, negative error code on failure
+ */

drivers/net/ethernet/xilinx/tsn/Kconfig new file +26 -0
+static int tsn_ip_probe(struct platform_device *pdev)
+{
+	struct tsn_priv *common;
+	int ret;
+
+	common = devm_kzalloc(&pdev->dev, sizeof(*common), GFP_KERNEL);
+	if (!common)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, common);
+	common->pdev = pdev;
+	common->dev = &pdev->dev;
+
+	/* Initialize synchronization primitives */
+	spin_lock_init(&common->tx_lock);
+	spin_lock_init(&common->rx_lock);
+	mutex_init(&common->mdio_lock);
+
+	common->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!common->res)
+		return -ENODEV;
+	common->regs_start = common->res->start;
+	common->regs = devm_ioremap_resource(&pdev->dev, common->res);
+	if (IS_ERR(common->regs))
+		return PTR_ERR(common->regs);
+

drivers/net/ethernet/xilinx/tsn/Kconfig

Quoted 10 lines
drivers/net/ethernet/xilinx/tsn/Kconfig new file +10 -0
+	ret = tsn_parse_device_tree(pdev);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+/**
+ * tsn_ip_remove - Remove TSN IP core device
+ * @pdev: Platform device pointer

Pointless comment. Can it be anything else than what you wrote? Why are you adding comments to standard boilerplate calls?

Quoted 17 lines

+ */

drivers/net/ethernet/xilinx/tsn/Kconfig new file +16 -0
+static void tsn_ip_remove(struct platform_device *pdev)
+{
+	struct tsn_priv *common = platform_get_drvdata(pdev);
+
+	clk_bulk_disable_unprepare(TSN_NUM_CLOCKS, common->clks);
+}
+
+static const struct of_device_id tsn_of_match[] = {
+	{ .compatible = "xlnx,tsn-endpoint-ethernet-mac-3.0", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, tsn_of_match);
+
+static struct platform_driver tsn_driver = {
+	.probe = tsn_ip_probe,
+	.remove = tsn_ip_remove,

drivers/net/ethernet/xilinx/tsn/Kconfig

Quoted 10 lines
drivers/net/ethernet/xilinx/tsn/Kconfig new file +10 -0
+	.driver = {
+		.name = "xilinx-tsn",
+		.of_match_table = tsn_of_match,
+	},
+};
+module_platform_driver(tsn_driver);
+
+MODULE_AUTHOR("Neeli Srinivas <[email protected]>");
+MODULE_DESCRIPTION("Time Sensitive Networking (TSN) Ethernet MAC driver");
+MODULE_LICENSE("GPL");

Best regards,
Krzysztof

#22 lore raw
In reply to Srinivas Neeli
Quoted 8 lines · Srinivas Neeli

https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/

This RFC is the initial submission of the driver and aims to gather feedback on design, structure, and subsystem integration before further upstreamization work.

Isn't every patch initial submission aiming to gather feedback on design, structure and integration before further work?

I'll drop it from DT patchwork.

Anyway, remember about proper versioning so b4 diff work correctly. Usually people doing RFC get it wrong making the RFC completely pointless and counter productive :(

Best regards,
Krzysztof

#23 lore raw
In reply to Srinivas Neeli
Quoted 11 lines · Srinivas Neeli

Introduce a new network driver for the AMD LogiCORE 100M/1G TSN Subsystem IP, also known as the TSN Endpoint Ethernet MAC, which implements IEEE 802.1 Time-Sensitive Networking (TSN) features for deterministic and low-latency Ethernet communication in real-time and industrial automation use cases.

IP Core Overview:
The AMD LogiCORE 100M/1G TSN Subsystem IP solution (named as TSN Endpoint Ethernet MAC IP in the IP catalog) implements IEEE 802.1 Time Sensitive Networking (TSN) Standards and provides a low latency Bridged Endpoint or Endpoint only solutions.

So an Endpoint only solution is not connected to the switch? It outputs RGMII, can have a PHY connected to it, and so is a single netdev interface? You would typically use this in a client?

But you can also instantiate the same MAC multiple times, connected to an Ethernet switch? That would be the bridged endpoint?

Quoted 4 lines

The bridged endpoint solution consists of a 3-port
switch that connects to an endpoint including Linux software drivers. For Bridged Endpoint (Switch Endpoint), two ports connects to the network and one port connects to an internal Endpoint.

To the host, does the internal endpoint just look like a standard netdev?

What i'm trying to do is get an answer to: Is this a DSA switch, or a pure switchdev switch. If the host sees a netdev which is connected to a port of the switch, it is probably a DSA switch. If the host only sees the user ports, it is probably a pure switchdev switch.

Quoted 3 lines

It supports the use of
GMII/RGMII interfaces connecting to a physical-side interface (PHY) chip with full duplex 100 Mb/s and 1 Gb/s operations.

No 10Mbps support?

Quoted 6 lines

- Provides feature rich Ethernet Switch that caters to various network needs
* 3-port Switch (2-external, 1-internal)
* Programmable cut-through and store-forward operations
* 4-port Switch (2-external, 2-internal) extension through 'Endpoint Extension' and 'Endpoint Packet Switching' features

Why not N-ports? Is it really set to 3 or 4? It cannot be synthesised for 5, 8?

Quoted 23 lines

Sample hardware architecture diagram for Bidge End Point like below:

             +------------------+
             |      MCDMA       |
             +---------+--------+
                    Q0---Q7
                       |
          +------------------------------------------------------------ +
          |            |	 TSN sub system(Bridge End Point)	|
          |            |                                                |
          |     +------+----+  Port 0   +-----------------------+       |
          |     |  EndPoint |<--------->|       TSN Switch      |       |
          |     |    (EP)   |           +----+-------------+----+       |
          |     +-----------+                |             |            |
          |                                  |             |            |
          |                              Port 1         Port 2          |
          |                                  |             |            |
          |                            +-----------+  +-----------+     |
          |                            |  MAC-1    |  |  MAC-2    |     |
          |                            |  (ETH1)   |  |  (ETH2)   |     |
          |                            +-----+-----+  +-----+-----+     |
	  |			             |		    |           |
          |				     |              |           |
Quoted 9 lines
          +-------------------------------------------------------------+
                                             |              |           
                                          RGMII           RGMII
                                             |              |
                                      +-----------+  +-----------+
                                      |  PHY1     |  |  PHY2     |
                                      | (Port 0)  |  | (Port 2)  |
                                      +-----------+  +-----------+

So how does the host send a frame out Port 2? Is there an extra header on the frame sent by EndPoint, which the switch interprets?

FYI: Seems like PHY1 (port 0) is a typO.

Quoted 3 lines

- During driver initialization, all switch ports (Endpoint, MAC1, MAC2) are configured into the Forwarding state to enable data flow across the fabric.

Which is wrong. The Linux model is that switch ports are just netdevs. You configure them just like every other netdev in the system. Newly created netdevs are standalone. They only allow frames to pass between the wire and the host. If you want them to L2 forwards frames between ports you need to add them to a bridge.

Andrew

#2 lore raw

Re: [RFC PATCH 1/8] dt-bindings: net: Add TSN Endpoint Ethernet MAC support

In reply to Srinivas Neeli
Quoted 42 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +42 -0
+examples:
+  - |
+    tsn_ip: tsn@80040000 {
+        compatible = "xlnx,tsn-endpoint-ethernet-mac-3.0";
+        reg = <0x80040000 0x40000>;
+        clocks = <&misc_clk_2>, <&misc_clk_2>, <&misc_clk_1>, <&misc_clk_1>, <&misc_clk_3>, <&misc_clk_0>;
+        clock-names = "gtx", "gtx90", "host_rxfifo", "host_txfifo", "ref", "s_axi";
+        dmas = <&axi_mcdma_0 0>, <&axi_mcdma_0 1>, <&axi_mcdma_0 2>, <&axi_mcdma_0 3>,
+               <&axi_mcdma_0 4>, <&axi_mcdma_0 5>, <&axi_mcdma_0 6>, <&axi_mcdma_0 7>,
+               <&axi_mcdma_0 16>, <&axi_mcdma_0 17>, <&axi_mcdma_0 18>, <&axi_mcdma_0 19>,
+               <&axi_mcdma_0 20>, <&axi_mcdma_0 21>, <&axi_mcdma_0 22>, <&axi_mcdma_0 23>;
+        dma-names = "tx_chan0","tx_chan1","tx_chan2","tx_chan3","tx_chan4","tx_chan5","tx_chan6",
+                    "tx_chan7","rx_chan0","rx_chan1","rx_chan2","rx_chan3","rx_chan4","rx_chan5",
+                    "rx_chan6","rx_chan7";
+        xlnx,num-priorities = <8>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges = <0x0 0x80040000 0x40000>;
+        xlnx,tsn-tx-config = <&tsn_tx_config>;
+        tsn_tx_config: tx-queues-config {
+            queue0 {
+                xlnx,dma-channel-num = <0x5>;
+            };
+            queue1 {
+                 xlnx,dma-channel-num = <0x4>;
+            };
+            queue2 {
+                 xlnx,dma-channel-num = <0x3>;
+            };
+            queue3 {
+                 xlnx,dma-channel-num = <0x2>;
+            };
+            queue4 {
+                 xlnx,dma-channel-num = <0x1>;
+            };
+            queue5 {
+                 xlnx,dma-channel-num = <0x0>;
+            };
+        };
+        // MAC 1 Node
+        mac1: ethernet-mac@0 {
+            reg = <0x0 0x14000>;

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml line 240

Quoted 10 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +10 -0
+            phy-mode = "rgmii-id";
+            phy-handle = <&phy0>;
+            mdio {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            phy0: ethernet-phy@0 {
+                device_type = "ethernet-phy";
+                reg = <0>;
+            };
+            };

Two } at the same level means your indentation is broken.

So each MAC has an MDIO node?

Quoted 11 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +11 -0
+        };
+
+        // MAC 2 Node
+        mac2: ethernet-mac@20000 {
+            reg = <0x20000 0x14000>;
+            phy-mode = "rgmii-id";
+            phy-handle = <&phy1>;
+            mdio {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            phy1: ethernet-phy@1 {

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml line 261

Quoted 10 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +10 -0
+                device_type = "ethernet-phy";
+                reg = <1>;
+            };
+            };
+        };
+
+        // Endpoint Node
+        ep_mac: ep-mac@16000 {
+            reg = <0x16000 0xa000>;
+        };

Except the Endpoint MAC does not have MDIO? Or does it have an MDIO bus, and you have simply not listed it?

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml line 274

Quoted 13 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +13 -0
+
+        // Switch Node
+        tsn_switch: switch@38000 {
+            reg = <0x38000 0x8000>;
+
+            ethernet-ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                port@0 {
+                    reg = <0>;
+                    ethernet = <&ep_mac>;
+                };

So this looks like a DSA switch.

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml line 278

Quoted 4 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +4 -0
+
+                port@1 {
+                    reg = <1>;
+                    ethernet = <&mac1>;

If you look at Documentation/devicetree/bindings/net/dsa/dsa-port.yaml you see this node is derives from ethernet-switch-port.yaml, and that derives from ethernet-controller.yaml. All the MAC properties you have above actually belong here.

Andrew

#11 lore raw

Re: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver

In reply to Srinivas Neeli

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c line 93

Quoted 8 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c new file +8 -0
+static int tsn_mdio_read(struct mii_bus *bus, int phy_id, int reg)
+{
+	u32 rc;
+	int ret;
+	struct tsn_emac *emac = bus->priv;
+	struct tsn_priv *common = emac->common;
+
+	scoped_guard(mutex, &common->mdio_lock) {

What is this mutex protecting?

Review

Quoted 1 line
(quoted diff) +1 -0
+		tsn_mdio_mdc_enable(emac);

It is unusual to stop MDC. I suspect some PHYs will not like this. What is your reason for doing this.

Quoted 29 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c new file +29 -0
+/**
+ * tsn_mdio_setup - Setup MDIO bus for TSN EMAC
+ * @emac: Pointer to TSN EMAC structure
+ * @mac_np: Device tree node for MAC
+ *
+ * This function initializes the MDIO bus for the TSN EMAC interface.
+ * It allocates an MII bus structure, configures MDIO timing, finds
+ * the MDIO device tree node, and registers the MDIO bus with the kernel.
+ *
+ * Return: 0 on success, negative error code on failure
+ */
+int tsn_mdio_setup(struct tsn_emac *emac, struct device_node *mac_np)
+{
+	struct tsn_priv *common = emac->common;
+	struct device_node *mdio_node;
+	struct mii_bus *bus;
+	int ret;
+
+	bus = mdiobus_alloc();
+	if (!bus)
+		return -ENOMEM;
+
+	snprintf(bus->id, MII_BUS_ID_SIZE, "tsn-mac-%.8llx",
+		 (unsigned long long)emac->regs_start);
+
+	bus->priv = emac;
+	bus->name = "Xilinx TSN Ethernet MDIO";
+	bus->read = tsn_mdio_read;
+	bus->write = tsn_mdio_write;

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c line 272

Quoted 10 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c new file +10 -0
+	bus->parent = common->dev;
+	emac->mii_bus = bus;
+
+	mdio_node = of_get_child_by_name(mac_np, "mdio");
+	if (!mdio_node) {
+		dev_err(common->dev, "MAC%d: missing 'mdio' child node\n",
+			emac->emac_num);
+		ret = -ENODEV;
+		goto unregister;
+	}

I forget, does the binding have a required: for the MDIO node?

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c line 276

Quoted 4 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c new file +4 -0
+	ret = tsn_mdio_enable(emac);
+	if (ret < 0)
+		goto unregister;
+	ret = of_mdiobus_register(bus, mdio_node);

Having a node in DT is generally optional. You can pass NULL to of_mdiobus_register() and it will do the right thing.

Andrew

#9 lore raw

Re: [RFC PATCH 3/8] net: xilinx: tsn: Add TSN endpoint and MCDMA support

In reply to Srinivas Neeli
kernel test robot noticed the following build warnings:

Hi Srinivas,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on net-next/main net/main linus/master v6.19 next-20260219] [cannot apply to xilinx-xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Srinivas-Neeli/dt-bindings-net-Add-TSN-Endpoint-Ethernet-MAC-support/20260219-135600
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20260219054911.2017362-4-srinivas.neeli%40amd.com
patch subject: [RFC PATCH 3/8] net: xilinx: tsn: Add TSN endpoint and MCDMA support
config: sh-allyesconfig (https://download.01.org/0day-ci/archive/20260220/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260220/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> Warning: drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ep.c:63 expecting prototype for tsn_ep_start_xmit_dmaengine(). Prototype was for tsn_ep_start_xmit() instead
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#24 lore raw
In reply to Andrew Lunn

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Andrew,

Quoted 27 lines

-----Original Message-----
From: Andrew Lunn <[email protected]>
Sent: Thursday, February 19, 2026 10:13 PM
To: Neeli, Srinivas <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; git (AMD-Xilinx) <[email protected]>
Subject: Re: [RFC PATCH 0/8] xilinx: tsn: Add TSN Endpoint Ethernet MAC driver support

Quoted 8 lines · Srinivas Neeli

Introduce a new network driver for the AMD LogiCORE 100M/1G TSN Subsystem IP, also known as the TSN Endpoint Ethernet MAC, which implements IEEE 802.1 Time-Sensitive Networking (TSN) features for deterministic and low-latency Ethernet communication in real-time and industrial automation use cases.

IP Core Overview:
The AMD LogiCORE 100M/1G TSN Subsystem IP solution (named as TSN

Endpoint

Quoted 3 lines

Ethernet MAC IP in the IP catalog) implements IEEE 802.1 Time Sensitive Networking (TSN) Standards and provides a low latency Bridged Endpoint or Endpoint only solutions.

Quoted 7 lines

So an Endpoint only solution is not connected to the switch? It outputs RGMII, can have a PHY connected to it, and so is a single netdev interface? You would typically use this in a client?

But you can also instantiate the same MAC multiple times, connected to an Ethernet switch? That would be the bridged endpoint?

Yes, that understanding is correct.
In Endpoint only configuration, the TSN Endpoint is connected Ethernet MAC and operates as a standalone MAC, connected via GMII/RGMII to a PHY, and is exposed to Linux as a single netdev, similar to a conventional Ethernet controller.
In Bridged Endpoint (Switch Endpoint), two ports connects to the network and one port connects to an internal Endpoint. The internal endpoint connects to the CPU and external ports connect to PHYs.

Quoted 7 lines
Quoted 4 lines

The bridged endpoint solution consists of a 3-port
switch that connects to an endpoint including Linux software drivers. For Bridged Endpoint (Switch Endpoint), two ports connects to the network and one port connects to an internal Endpoint.

To the host, does the internal endpoint just look like a standard netdev?

Yes. From the host’s perspective, the internal endpoint is exposed as a standard Linux netdev.

Quoted 6 lines

What i'm trying to do is get an answer to: Is this a DSA switch, or a pure switchdev switch. If the host sees a netdev which is connected to a port of the switch, it is probably a DSA switch. If the host only sees the user ports, it is probably a pure switchdev switch.

We are planning to implement a pure switchdev framework for the switch, as PTP packets are sent directly from the netdev interfaces that represent the external network ports.
Please let me know your thoughts or suggestions if you feel a different approach would be more appropriate.

Quoted 5 lines
Quoted 3 lines

It supports the use of
GMII/RGMII interfaces connecting to a physical-side interface (PHY) chip with full duplex 100 Mb/s and 1 Gb/s operations.

No 10Mbps support?

Yes, that is correct. The current TSN Endpoint Ethernet MAC supports 100 Mb/s and 1 Gb/s full‑duplex modes only. 10 Mb/s operation is not supported by the underlying hardware IP.

Quoted 11 lines
Quoted 7 lines

- Provides feature rich Ethernet Switch that caters to various network needs
* 3-port Switch (2-external, 1-internal)
* Programmable cut-through and store-forward operations
* 4-port Switch (2-external, 2-internal) extension through 'Endpoint Extension' and 'Endpoint Packet Switching' features

Why not N-ports? Is it really set to 3 or 4? It cannot be synthesised for 5, 8?

The number of ports is fixed by the IP configuration. The standard TSN Subsystem IP supports 3 port operation (2 external + 1 internal), with an optional extension to 4 ports using endpoint extension features.
Arbitrary N‑port synthesis (for example 5 or 8 ports) is not supported.

Quoted 33 lines
Quoted 23 lines

Sample hardware architecture diagram for Bidge End Point like below:

             +------------------+
             |      MCDMA       |
             +---------+--------+
                    Q0---Q7
                       |
          +------------------------------------------------------------ +
          |            |     TSN sub system(Bridge End Point)       |
          |            |                                                |
          |     +------+----+  Port 0   +-----------------------+       |
          |     |  EndPoint |<--------->|       TSN Switch      |       |
          |     |    (EP)   |           +----+-------------+----+       |
          |     +-----------+                |             |            |
          |                                  |             |            |
          |                              Port 1         Port 2          |
          |                                  |             |            |
          |                            +-----------+  +-----------+     |
          |                            |  MAC-1    |  |  MAC-2    |     |
          |                            |  (ETH1)   |  |  (ETH2)   |     |
          |                            +-----+-----+  +-----+-----+     |
      |                                  |              |           |
          |                              |              |           |
Quoted 9 lines
          +-------------------------------------------------------------+
                                             |              |
                                          RGMII           RGMII
                                             |              |
                                      +-----------+  +-----------+
                                      |  PHY1     |  |  PHY2     |
                                      | (Port 0)  |  | (Port 2)  |
                                      +-----------+  +-----------+
Quoted 3 lines

So how does the host send a frame out Port 2? Is there an extra header on the frame sent by EndPoint, which the switch interprets?

In this RFC, I configured all switch ports in forward mode. As a result, when a frame is sent from the internal endpoint, it is flooded to both external ports.
To forward packets to a specific port instead of flooding, either static switch CAM entries need to be configured or address learning should be enabled so the switch can learn CAM entries dynamically.

Quoted 2 lines

FYI: Seems like PHY1 (port 0) is a typO.

Here, PHY1 (port 0) and PHY2 (port 2) represent the external daughter card ports that I connected to the IP for testing. I realize this representation may be confusing, so I will remove these port references to avoid any confusion.

Quoted 11 lines
Quoted 3 lines

- During driver initialization, all switch ports (Endpoint, MAC1, MAC2) are configured into the Forwarding state to enable data flow across the fabric.

Which is wrong. The Linux model is that switch ports are just netdevs. You configure them just like every other netdev in the system. Newly created netdevs are standalone. They only allow frames to pass between the wire and the host. If you want them to L2 forwards frames between ports you need to add them to a bridge.

Andrew

Currently, I have validated the behavior using forward mode. Based on the feedback, I will implement the required switch configuration changes in the next patch series.

Thanks
Neeli Srinivas

#3 lore raw

RE: [RFC PATCH 1/8] dt-bindings: net: Add TSN Endpoint Ethernet MAC support

In reply to Andrew Lunn

[AMD Official Use Only - AMD Internal Distribution Only]

Hi,

Quoted 75 lines

-----Original Message-----
From: Andrew Lunn <[email protected]>
Sent: Thursday, February 19, 2026 10:24 PM
To: Neeli, Srinivas <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; git (AMD-Xilinx) <[email protected]>
Subject: Re: [RFC PATCH 1/8] dt-bindings: net: Add TSN Endpoint Ethernet MAC support

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml

Quoted 6 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +6 -0
+examples:
+  - |
+    tsn_ip: tsn@80040000 {
+        compatible = "xlnx,tsn-endpoint-ethernet-mac-3.0";
+        reg = <0x80040000 0x40000>;
+        clocks = <&misc_clk_2>, <&misc_clk_2>, <&misc_clk_1>,

<&misc_clk_1>, <&misc_clk_3>, <&misc_clk_0>;

Review

Quoted 2 lines
(quoted diff) +2 -0
+        clock-names = "gtx", "gtx90", "host_rxfifo", "host_txfifo", "ref", "s_axi";
+        dmas = <&axi_mcdma_0 0>, <&axi_mcdma_0 1>, <&axi_mcdma_0 2>,

<&axi_mcdma_0 3>,

Quoted 1 line

+ <&axi_mcdma_0 4>, <&axi_mcdma_0 5>, <&axi_mcdma_0 6>,

<&axi_mcdma_0 7>,

Quoted 1 line

+ <&axi_mcdma_0 16>, <&axi_mcdma_0 17>, <&axi_mcdma_0 18>,

<&axi_mcdma_0 19>,

Quoted 1 line

+ <&axi_mcdma_0 20>, <&axi_mcdma_0 21>, <&axi_mcdma_0 22>,

<&axi_mcdma_0 23>;

Quoted 1 line

+ dma-names =

"tx_chan0","tx_chan1","tx_chan2","tx_chan3","tx_chan4","tx_chan5","tx_ch an6",

Quoted 1 line

+

"tx_chan7","rx_chan0","rx_chan1","rx_chan2","rx_chan3","rx_chan4","rx_ch an5",

Quoted 29 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +29 -0
+                    "rx_chan6","rx_chan7";
+        xlnx,num-priorities = <8>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges = <0x0 0x80040000 0x40000>;
+        xlnx,tsn-tx-config = <&tsn_tx_config>;
+        tsn_tx_config: tx-queues-config {
+            queue0 {
+                xlnx,dma-channel-num = <0x5>;
+            };
+            queue1 {
+                 xlnx,dma-channel-num = <0x4>;
+            };
+            queue2 {
+                 xlnx,dma-channel-num = <0x3>;
+            };
+            queue3 {
+                 xlnx,dma-channel-num = <0x2>;
+            };
+            queue4 {
+                 xlnx,dma-channel-num = <0x1>;
+            };
+            queue5 {
+                 xlnx,dma-channel-num = <0x0>;
+            };
+        };
+        // MAC 1 Node
+        mac1: ethernet-mac@0 {
+            reg = <0x0 0x14000>;

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml line 240

Quoted 10 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +10 -0
+            phy-mode = "rgmii-id";
+            phy-handle = <&phy0>;
+            mdio {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            phy0: ethernet-phy@0 {
+                device_type = "ethernet-phy";
+                reg = <0>;
+            };
+            };
Quoted 2 lines

Two } at the same level means your indentation is broken.

I will address in next series.

Quoted 2 lines

So each MAC has an MDIO node?

Yes, in this hardware configuration each external Ethernet MAC instance owns its own MDIO bus used to manage its directly connected PHY.

Quoted 16 lines
Quoted 16 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +16 -0
+        };
+
+        // MAC 2 Node
+        mac2: ethernet-mac@20000 {
+            reg = <0x20000 0x14000>;
+            phy-mode = "rgmii-id";
+            phy-handle = <&phy1>;
+            mdio {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            phy1: ethernet-phy@1 {
+                device_type = "ethernet-phy";
+                reg = <1>;
+            };
+            };
+        };
Quoted 8 lines

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml line 261

Quoted 5 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +5 -0
+
+        // Endpoint Node
+        ep_mac: ep-mac@16000 {
+            reg = <0x16000 0xa000>;
+        };

Except the Endpoint MAC does not have MDIO? Or does it have an MDIO bus, and you have simply not listed it?

The endpoint MAC does not connect to an external PHY and therefore does not expose an MDIO bus. It is an internal endpoint, so no MDIO node is required.

Quoted 22 lines
Quoted 4 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +3 -0
+
+        // Switch Node
+        tsn_switch: switch@38000 {

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml line 274

Quoted 10 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +10 -0
+            reg = <0x38000 0x8000>;
+
+            ethernet-ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                port@0 {
+                    reg = <0>;
+                    ethernet = <&ep_mac>;
+                };

So this looks like a DSA switch.

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml line 278

Quoted 4 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +4 -0
+
+                port@1 {
+                    reg = <1>;
+                    ethernet = <&mac1>;
Quoted 6 lines

If you look at Documentation/devicetree/bindings/net/dsa/dsa-port.yaml you see this node is derives from ethernet-switch-port.yaml, and that derives from ethernet-controller.yaml. All the MAC properties you have above actually belong here.

Andrew

We referred to ethernet-switch-port.yaml while implementing the switch node. Our intention is to implement the switch using a pure switchdev framework in a future patch series. Please let us know your suggestions.

Thanks
Neeli Srinivas

#12 lore raw

RE: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver

In reply to Andrew Lunn

[AMD Official Use Only - AMD Internal Distribution Only]

Hi,

Quoted 13 lines

-----Original Message-----
From: Andrew Lunn <[email protected]>
Sent: Thursday, February 19, 2026 10:36 PM
To: Neeli, Srinivas <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; git (AMD-Xilinx) <[email protected]>
Subject: Re: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver

Quoted 10 lines

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c line 93

Quoted 7 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c new file +7 -0
+static int tsn_mdio_read(struct mii_bus *bus, int phy_id, int reg) {
+   u32 rc;
+   int ret;
+   struct tsn_emac *emac = bus->priv;
+   struct tsn_priv *common = emac->common;
+
+   scoped_guard(mutex, &common->mdio_lock) {

What is this mutex protecting?

The mutex serializes access to the MDIO controller register block. The MDIO core already serializes bus accesses via bus->mdio_lock, so the additional driver level mutex is redundant.
I will remove the extra mutex from the driver and rely on the MDIO core locking instead.

Quoted 5 lines
Quoted 1 line

+ tsn_mdio_mdc_enable(emac);

It is unusual to stop MDC. I suspect some PHYs will not like this. What is your reason for doing this.

The intention is to reduce power consumption by gating the clock when it is not required.

Quoted 34 lines
Quoted 23 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c new file +23 -0
+/**
+ * tsn_mdio_setup - Setup MDIO bus for TSN EMAC
+ * @emac: Pointer to TSN EMAC structure
+ * @mac_np: Device tree node for MAC
+ *
+ * This function initializes the MDIO bus for the TSN EMAC interface.
+ * It allocates an MII bus structure, configures MDIO timing, finds
+ * the MDIO device tree node, and registers the MDIO bus with the kernel.
+ *
+ * Return: 0 on success, negative error code on failure  */ int
+tsn_mdio_setup(struct tsn_emac *emac, struct device_node *mac_np) {
+   struct tsn_priv *common = emac->common;
+   struct device_node *mdio_node;
+   struct mii_bus *bus;
+   int ret;
+
+   bus = mdiobus_alloc();
+   if (!bus)
+           return -ENOMEM;
+
+   snprintf(bus->id, MII_BUS_ID_SIZE, "tsn-mac-%.8llx",
+            (unsigned long long)emac->regs_start);
+

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c

Quoted 10 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c new file +10 -0
+   bus->priv = emac;
+   bus->name = "Xilinx TSN Ethernet MDIO";
+   bus->read = tsn_mdio_read;
+   bus->write = tsn_mdio_write;
+   bus->parent = common->dev;
+   emac->mii_bus = bus;
+
+   mdio_node = of_get_child_by_name(mac_np, "mdio");
+   if (!mdio_node) {
+           dev_err(common->dev, "MAC%d: missing 'mdio' child

node\n",

Quoted 7 lines

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c line 272

Quoted 4 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c new file +4 -0
+                   emac->emac_num);
+           ret = -ENODEV;
+           goto unregister;
+   }

I forget, does the binding have a required: for the MDIO node?

MDIO node is not mandatory in binding. I will update the driver to treat the mdio chaild node as optional.

Quoted 9 lines

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c line 276

Quoted 4 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_mdio.c new file +4 -0
+   ret = tsn_mdio_enable(emac);
+   if (ret < 0)
+           goto unregister;
+   ret = of_mdiobus_register(bus, mdio_node);

Having a node in DT is generally optional. You can pass NULL to of_mdiobus_register() and it will do the right thing.

Andrew

Yes, agreed. I will update the implementation to pass NULL to of_mdiobus_register() when the MDIO DT node is absent, instead of failing probe.

Thanks
Neeli Srinivas

#25 lore raw
In reply to Neeli, Srinivas
Quoted 1 line · Srinivas

[AMD Official Use Only - AMD Internal Distribution Only]

Sorry, i'm not part of AMD...

Quoted 11 lines
Quoted 3 lines

So how does the host send a frame out Port 2? Is there an extra header on the frame sent by EndPoint, which the switch interprets?

In this RFC, I configured all switch ports in forward mode. As a result, when a frame is sent from the internal endpoint, it is flooded to both external ports. To forward packets to a specific port instead of flooding, either static switch CAM entries need to be configured or address learning should be enabled so the switch can learn CAM entries dynamically.

Despite not being part of AMD, this part is important.

I don't care about how the RFC works, i want to know how the hardware works, to ensure you have the correct choice of DSA vs pure switchdev.

Take the example of running Spanning Tree Protocol. The bridge needs to send the BPDU out a specific port. What mechanism is used to do that? It also needs to know which port a BPDU ingressed.

Andrew

#4 lore raw

Re: [RFC PATCH 1/8] dt-bindings: net: Add TSN Endpoint Ethernet MAC support

In reply to Neeli, Srinivas
Quoted 9 lines
Quoted 7 lines

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml line 261

Quoted 4 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +4 -0
+        // Endpoint Node
+        ep_mac: ep-mac@16000 {
+            reg = <0x16000 0xa000>;
+        };

Except the Endpoint MAC does not have MDIO? Or does it have an MDIO bus, and you have simply not listed it?

The endpoint MAC does not connect to an external PHY and therefore does not expose an MDIO bus. It is an internal endpoint, so no MDIO node is required.

It does not really matter if it is required. Does it physically exist? Can MDC and MDIO be routed to pins? Could i hang an external switch off it?

DT describes hardware. If the hardware exists, describe it.

Andrew

#13 lore raw

Re: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver

In reply to Neeli, Srinivas
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

+ tsn_mdio_mdc_enable(emac);

It is unusual to stop MDC. I suspect some PHYs will not like this. What is your reason for doing this.

The intention is to reduce power consumption by gating the clock when it is not required.

There is only one other MDIO bus driver that i know of which disables the clock between transactions. And it does it because the board has ageing problems, and if the clock it left ticking all the time, the magic smoke eventually escapes.

How many different PHYs have you tested this with? How good a feeling do you have this is not going to cause problems? How much power do you actually save?

Andrew

#15 lore raw

Re: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver

In reply to Srinivas Neeli
Quoted 1 line

+#define TSN_EMMC_LINKSPEED_10 0x0 /* 10 Mbit */

If the MAC cannot do 10Mbps, why have this?

Quoted 5 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c new file +5 -0
+static int emac_open(struct net_device *ndev)
+{
+	struct tsn_emac *emac = netdev_priv(ndev);
+	struct phy_device *phydev = NULL;
+

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c line 74

Quoted 10 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c new file +10 -0
+	if (emac->phy_node) {
+		phydev = of_phy_connect(emac->ndev, emac->phy_node,
+					tsn_adjust_link_tsn,
+					emac->phy_flags,
+					emac->phy_mode);
+		if (!phydev)
+			dev_err(emac->common->dev, "of_phy_connect() failed\n");
+		else
+			phy_start(phydev);
+	}

Somewhere around here, i would expect you to tell phylib the MAC cannot do 10Mbps. You don't want the PHY offering those speeds for autoneg, otherwise it might actually negotiate 10Mbps.

I also think you should be using phylink, not phylib. But we first need to finish the discussion about DSA vs pure switchdev. If this ends up being a DSA driver, you will be using phylink anywhere. If it is a pure switchdev driver, i would still recommend using phylink, you are less likely to get things wrong, because the API is better designed.

Andrew

#19 lore raw

Re: [RFC PATCH 6/8] dt-bindings: net: Add PTP interrupt support

In reply to Srinivas Neeli

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml patternProperties: · line 129

Quoted 7 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml +7 -0
+      interrupts:
+        minItems: 1
+        maxItems: 4
+        description:
+          Interrupt specifiers for MAC interrupts. MAC 1 (with PTP support)
+          requires 4 interrupts (ptp_rx, ptp_tx, mac_irq, ptp_timer).
+          MAC 2 (without PTP support) requires 3 interrupts (ptp_rx, ptp_tx, mac_irq).

You say 3 or 4 are required, yet have minItems: 1? 3 seems more appropriate.

You have restraints later, so i don't know if these are even needed here? I will let the DT Maintainers comment about that.

Andrew

#5 lore raw

RE: [RFC PATCH 1/8] dt-bindings: net: Add TSN Endpoint Ethernet MAC support

In reply to Andrew Lunn

[Public]

Hi,

Quoted 22 lines

-----Original Message-----
From: Andrew Lunn <[email protected]>
Sent: Friday, February 20, 2026 7:09 PM
To: Neeli, Srinivas <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; git (AMD-Xilinx) <[email protected]>
Subject: Re: [RFC PATCH 1/8] dt-bindings: net: Add TSN Endpoint Ethernet MAC support

Quoted 8 lines
Quoted 7 lines

Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml line 261

Quoted 4 lines
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml new file +4 -0
+        // Endpoint Node
+        ep_mac: ep-mac@16000 {
+            reg = <0x16000 0xa000>;
+        };

Except the Endpoint MAC does not have MDIO? Or does it have an MDIO bus, and you have simply not listed it?

The endpoint MAC does not connect to an external PHY and therefore does

not expose an MDIO bus.

Quoted 8 lines
Quoted 1 line

It is an internal endpoint, so no MDIO node is required.

It does not really matter if it is required. Does it physically exist? Can MDC and MDIO be routed to pins? Could i hang an external switch off it?

DT describes hardware. If the hardware exists, describe it.

Andrew

The endpoint does not have an MDIO controller in hardware, and such functionality does not physically exist. As a result, attaching any external PHY or switch is not possible.
The Endpoint connected to the CPU through the AXI bus.

Thanks
Neeli Srinivas

#14 lore raw

RE: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver

In reply to Andrew Lunn

[Public]

Hi,

Quoted 26 lines

-----Original Message-----
From: Andrew Lunn <[email protected]>
Sent: Friday, February 20, 2026 8:33 PM
To: Neeli, Srinivas <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; git (AMD-Xilinx) <[email protected]>
Subject: Re: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

+ tsn_mdio_mdc_enable(emac);

It is unusual to stop MDC. I suspect some PHYs will not like this. What is your reason for doing this.

The intention is to reduce power consumption by gating the clock when it is

not required.

There is only one other MDIO bus driver that i know of which disables the clock between transactions. And it does it because the board has ageing problems, and if the clock it left ticking all the time, the magic smoke eventually escapes.

Quoted 6 lines

How many different PHYs have you tested this with? How good a feeling do you have this is not going to cause problems? How much power do you actually save?

Andrew

This change was expected to provide some power savings when the clock is disabled.
Since I have not validated this through practical measurements and have tested it with only one PHY, I have decided to drop the change. Thanks for the guidance.

Thanks
Neeli Srinivas

#16 lore raw

RE: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver

In reply to Andrew Lunn

[Public]

Hi,

Quoted 37 lines

-----Original Message-----
From: Andrew Lunn <[email protected]>
Sent: Friday, February 20, 2026 8:43 PM
To: Neeli, Srinivas <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; git (AMD-Xilinx) <[email protected]>
Subject: Re: [RFC PATCH 4/8] xilinx: tsn: Add Ethernet MAC (EMAC) and MDIO support to the TSN driver

Quoted 1 line

+#define TSN_EMMC_LINKSPEED_10 0x0 /* 10 Mbit */

If the MAC cannot do 10Mbps, why have this?

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c

Quoted 11 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c new file +11 -0
+static int emac_open(struct net_device *ndev) {
+   struct tsn_emac *emac = netdev_priv(ndev);
+   struct phy_device *phydev = NULL;
+
+   if (emac->phy_node) {
+           phydev = of_phy_connect(emac->ndev, emac->phy_node,
+                                   tsn_adjust_link_tsn,
+                                   emac->phy_flags,
+                                   emac->phy_mode);
+           if (!phydev)
+                   dev_err(emac->common->dev, "of_phy_connect()

failed\n");

drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c line 74

Quoted 3 lines
drivers/net/ethernet/xilinx/tsn/xilinx_tsn_emac.c new file +3 -0
+           else
+                   phy_start(phydev);
+   }

Somewhere around here, i would expect you to tell phylib the MAC cannot do 10Mbps. You don't want the PHY offering those speeds for autoneg, otherwise it might actually negotiate 10Mbps.

Quoted 7 lines

I also think you should be using phylink, not phylib. But we first need to finish the discussion about DSA vs pure switchdev. If this ends up being a DSA driver, you will be using phylink anywhere. If it is a pure switchdev driver, i would still recommend using phylink, you are less likely to get things wrong, because the API is better designed.

Andrew

Thank you for the detailed feedback.

I agree with your comments. I plan to rework this driver to use the phylink framework instead of phylib, as it is a better fit and avoids getting these details wrong.

In the next revision, I will also address the 10 Mbps handling and ensure that unsupported link modes are properly constrained, so they are not advertised or negotiated. Thanks for the guidance.

Thanks
Neeli Srinivas

#26 lore raw
In reply to Andrew Lunn

Hi Andrew,

Quoted 15 lines · Andrew Lunn
Quoted 1 line · Srinivas

[AMD Official Use Only - AMD Internal Distribution Only]

Sorry, i'm not part of AMD...

Quoted 9 lines
Quoted 3 lines

So how does the host send a frame out Port 2? Is there an extra header on the frame sent by EndPoint, which the switch interprets?

In this RFC, I configured all switch ports in forward mode. As a result, when a frame is sent from the internal endpoint, it is flooded to both external ports. To forward packets to a specific port instead of flooding, either static switch CAM entries need to be configured or address learning should be enabled so the switch can learn CAM entries dynamically.

Despite not being part of AMD, this part is important.

Quoted 8 lines

I don't care about how the RFC works, i want to know how the hardware works, to ensure you have the correct choice of DSA vs pure switchdev.

Take the example of running Spanning Tree Protocol. The bridge needs to send the BPDU out a specific port. What mechanism is used to do that? It also needs to know which port a BPDU ingressed.

Andrew

Hi Andrew,

I would like to briefly share an overview of our TSN switch capabilities and seek your guidance on the most appropriate Linux framework for the driver implementation specifically whether switchdev or DSA would be the better fit.

TSN Switch Capabilities
-----------------------
Our TSN subsystem supports the following IEEE TSN clauses:

IEEE 802.1Qbv – Time-Aware Shaper (scheduled traffic using gate control)
IEEE 802.1Qbu / IEEE 802.3br – Frame preemption
IEEE 802.1Qci – Per-Stream Filtering and Policing (PSFP), including: SDU-based filtering and Meter-based policing IEEE 802.1CB – Frame Replication and Elimination for Reliability (FRER)
IEEE 802.1AS / IEEE 1588 – Time synchronization (PTP / gPTP)

Hardware Architecture Overview
------------------------------
The switch consists of three ports:

Port 0: Connected to the CPU (control/endpoint port) Port 1: Connected to MAC1
Port 2: Connected to MAC2

MAC1 and MAC2 are capable of transmitting and receiving PTP packets, with received packets stored in internal BRAM. They will not be forwarded by switch to the internal endpoint (EP) and MAC network drivers xmit's and receives the PTP frames. The switch forwards frames based on VLAN port membership and the CAM entries and switch supports TSN features such as CBS, Qci (PSFP) and 802.1CB (FRER) through hardware configuration.
The CPU is intended to operate purely in the control plane and is not part of the forwarding data path.

Thank you very much for your time and guidance. Please let us know if any additional details would be helpful.

Best regards,
Neeli Srinivas

#27 lore raw
Quoted 54 lines · Srinivas

Hi Andrew,

Quoted 15 lines · Andrew Lunn
Quoted 1 line · Srinivas

[AMD Official Use Only - AMD Internal Distribution Only]

Sorry, i'm not part of AMD...

Quoted 9 lines
Quoted 3 lines

So how does the host send a frame out Port 2? Is there an extra header on the frame sent by EndPoint, which the switch interprets?

In this RFC, I configured all switch ports in forward mode. As a result, when a frame is sent from the internal endpoint, it is flooded to both external ports.  To forward packets to a specific port instead of flooding, either static switch CAM entries need to be configured or address learning should be enabled so the switch can learn CAM entries dynamically.

Despite not being part of AMD, this part is important.

Quoted 8 lines

I don't care about how the RFC works, i want to know how the hardware works, to ensure you have the correct choice of DSA vs pure switchdev.

Take the example of running Spanning Tree Protocol. The bridge needs to send the BPDU out a specific port. What mechanism is used to do that? It also needs to know which port a BPDU ingressed.

    Andrew

Hi Andrew,

I would like to briefly share an overview of our TSN switch capabilities and seek your guidance on the most appropriate Linux framework for the driver implementation specifically whether switchdev or DSA would be the better fit.

TSN Switch Capabilities
-----------------------
Our TSN subsystem supports the following IEEE TSN clauses:

IEEE 802.1Qbv – Time-Aware Shaper (scheduled traffic using gate control)
IEEE 802.1Qbu / IEEE 802.3br – Frame preemption
IEEE 802.1Qci – Per-Stream Filtering and Policing (PSFP), including: SDU-based filtering and Meter-based policing IEEE 802.1CB – Frame Replication and Elimination for Reliability (FRER)
IEEE 802.1AS / IEEE 1588 – Time synchronization (PTP / gPTP)

Hardware Architecture Overview
------------------------------
The switch consists of three ports:

Port 0: Connected to the CPU (control/endpoint port) Port 1: Connected to MAC1
Port 2: Connected to MAC2

MAC1 and MAC2 are capable of transmitting and receiving PTP packets, with received packets stored in internal BRAM. They will not be forwarded by switch to the internal endpoint (EP) and MAC network drivers xmit's and receives the PTP frames. The switch forwards frames based on VLAN port membership and the CAM entries and switch supports TSN features such as CBS, Qci (PSFP) and 802.1CB (FRER) through hardware configuration.
The CPU is intended to operate purely in the control plane and is not part of the forwarding data path.

Quoted 6 lines

Thank you very much for your time and guidance. Please let us know if any additional details would be helpful.

Best regards,
Neeli Srinivas

Hi Andrew,

Based on the feedback so far, I am planning to proceed with a switchdev based implementation for the next RFC series, as this appears to be a better fit with the Linux networking model. Please let me know if you have any concerns with this approach. If this direction is acceptable, I will share the next version of the RFC series accordingly. Thank you for your guidance.

Best regards,
Neeli Srinivas