| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/09 20:15 | flow | patch-triage |
2mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "The patch series adds support for the onsemi S2500 10BASE-T1S MAC-PHY Ethernet controller over SPI, adds PTP hardware timestamping support to the OPEN Alliance TC6 (OA TC6) MAC-PHY framework, and updates the NCN26000 and DP83867 PHY drivers along with adding a genphy_loopback_no_speed helper in phylib. All modified executable code belongs to physical SPI MAC-PHY controllers or physical MDIO PHY transceivers that cannot be instantiated or emulated in standard QEMU/GCE virtualized environments, making the changes structurally unreachable for syzkaller fuzzing.",
"WorthFuzzing": false
} |
| 1/1 | 2026/10/09 20:15 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 356357d5e391c245337760eb72e4160b5016eba2\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Fri Oct 9 20:15:56 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/Documentation/devicetree/bindings/net/onnn,s2500.yaml b/Documentation/devicetree/bindings/net/onnn,s2500.yaml\nnew file mode 100644\nindex 0000000000000..fadd656629f10\n--- /dev/null\n+++ b/Documentation/devicetree/bindings/net/onnn,s2500.yaml\n@@ -0,0 +1,71 @@\n+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)\n+%YAML 1.2\n+---\n+$id: http://devicetree.org/schemas/net/onnn,s2500.yaml#\n+$schema: http://devicetree.org/meta-schemas/core.yaml#\n+\n+title: onsemi S2500 10BASE-T1S MACPHY Ethernet Controllers\n+\n+maintainers:\n+ - Selva Rajagopal \u003cSelvamani.Rajagopal@onsemi.com\u003e\n+\n+description:\n+ The S2500 combines a Media Access Controller (MAC) and an\n+ Ethernet PHY to enable 10BASE‑T1S networks. The Ethernet Media Access\n+ Controller (MAC) module implements a 10 Mbps half duplex Ethernet MAC,\n+ compatible with the IEEE 802.3 standard and a 10BASE-T1S physical layer\n+ transceiver integrated into the S2500. The communication between\n+ the host and the MAC-PHY is specified in the OPEN Alliance 10BASE-T1x\n+ MACPHY Serial Interface (TC6).\n+\n+allOf:\n+ - $ref: /schemas/net/ethernet-controller.yaml#\n+ - $ref: /schemas/spi/spi-peripheral-props.yaml#\n+\n+properties:\n+ compatible:\n+ const: onnn,s2500\n+\n+ reg:\n+ maxItems: 1\n+\n+ interrupts:\n+ description:\n+ Interrupt from MAC-PHY asserted in the event of Receive Chunks\n+ Available, Transmit Chunk Credits Available and Extended Status\n+ Event.\n+ maxItems: 1\n+\n+ reset-gpios:\n+ description:\n+ GPIO connected to the active-low RST_N pin of the MAC-PHY.\n+ maxItems: 1\n+\n+ spi-max-frequency:\n+ maximum: 25000000\n+\n+required:\n+ - compatible\n+ - reg\n+ - interrupts\n+ - spi-max-frequency\n+\n+unevaluatedProperties: false\n+\n+examples:\n+ - |\n+ #include \u003cdt-bindings/interrupt-controller/irq.h\u003e\n+ spi {\n+ #address-cells = \u003c1\u003e;\n+ #size-cells = \u003c0\u003e;\n+\n+ ethernet@0 {\n+ compatible = \"onnn,s2500\";\n+ reg = \u003c0\u003e;\n+ pinctrl-names = \"default\";\n+ pinctrl-0 = \u003c\u0026eth0_pins\u003e;\n+ interrupt-parent = \u003c\u0026gpio\u003e;\n+ interrupts = \u003c25 IRQ_TYPE_LEVEL_LOW\u003e;\n+ spi-max-frequency = \u003c15000000\u003e;\n+ };\n+ };\ndiff --git a/Documentation/networking/oa-tc6-framework.rst b/Documentation/networking/oa-tc6-framework.rst\nindex 2545ef694016f..3cfe8cb7cf75f 100644\n--- a/Documentation/networking/oa-tc6-framework.rst\n+++ b/Documentation/networking/oa-tc6-framework.rst\n@@ -153,6 +153,10 @@ OPEN Alliance TC6 Framework\n - Forwards the received Ethernet frame from 10Base-T1x MAC-PHY to n/w\n subsystem.\n \n+- If supported by the hardware and enabled, updates hardware timestamp\n+ in skb, when indicated by one of the three timestamp capture registers\n+ through TSC fields of the header.\n+\n Data Transaction\n ~~~~~~~~~~~~~~~~\n \n@@ -496,3 +500,58 @@ the MAC-PHY.\n Zero align receive frame feature can be enabled to align all receive ethernet\n frames data to start at the beginning of any receive data chunk payload with a\n start word offset (SWO) of zero.\n+\n+.. c:function:: int oa_tc6_ptp_register(struct oa_tc6 *tc6, \\\n+ struct ptp_clock_info *info);\n+\n+Registers the PTP hardware clock related functions with the kernel.\n+This API simply registers. Initialization of the fields in the\n+ptp_clock_info structure are left to the vendor as programming hardware\n+timer is expected to be vendor dependent. The fields max_adj, owner,\n+and all the functions for the clock operations, like adjfine, gettimex64,\n+settime64, adjtime are expected to be initialized in the structure before\n+calling the registering the hardware clock.\n+\n+.. c:function:: void oa_tc6_ptp_unregister(struct oa_tc6 *tc6);\n+\n+Unregisters the PTP hardware clock related callbacks.\n+\n+.. c:function:: int oa_tc6_get_ts_info(struct oa_tc6 *tc6, \\\n+ struct kernel_ethtool_ts_info *info);\n+\n+Provides timestamp related settings that are supported to ethtool.\n+\n+.. c:function:: void oa_tc6_hwtstamp_get(struct oa_tc6 *tc6, \\\n+ struct kernel_hwtstamp_config *cfg);\n+\n+Returns hardware timestamp configuration. Part of net_device_ops callbacks.\n+\n+.. c:function:: void oa_tc6_get_ts_stats(struct oa_tc6 *tc6, \\\n+ struct ethtool_ts_stats *ts_stats);\n+\n+Provides hardware timestamp related traffic statistics for ethtool.\n+\n+.. c:function:: int oa_tc6_hwtstamp_set(struct oa_tc6 *tc6, \\\n+ struct kernel_hwtstamp_config *cfg);\n+\n+Helper to set hardware timestamp configuration. Part of net_device_ops\n+callbacks.\n+\n+.. c:function:: void oa_tc6_set_vend1_mms(struct oa_tc6 *tc6, int mms);\n+\n+Helper to map MDIO_MMD_VEND1 command to vendor specific Memory Map Select\n+(MMS) value. This function offers flexibility for vendors that may have\n+used any MMS value between 10 and 15 as allowed by the specification.\n+MDIO_MMD_VEND2 is already mapped to MMS4 in the OA TC6 frame work code.\n+\n+.. c:function:: int oa_tc6_write_register_mms(struct oa_tc6 *tc6, \\\n+ u8 mms, u16 address, \\\n+ u32 value);\n+\n+Write a single register addressed by @mms and @address in the MAC-PHY.\n+\n+.. c:function:: int oa_tc6_read_register_mms(struct oa_tc6 *tc6, \\\n+ u8 mms, u16 address, \\\n+ u32 *value);\n+\n+Read a single register addressed by @mms and @address in the MAC-PHY.\ndiff --git a/MAINTAINERS b/MAINTAINERS\nindex 509b35b5a0e7a..c114be8516070 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -20435,11 +20435,19 @@ F:\tarch/mips/boot/dts/ralink/omega2p.dts\n \n ONSEMI ETHERNET PHY DRIVERS\n M:\tPiergiorgio Beruto \u003cpiergiorgio.beruto@gmail.com\u003e\n+M:\tSelva Rajagopal \u003cselvamani.rajagopal@onsemi.com\u003e\n L:\tnetdev@vger.kernel.org\n S:\tSupported\n W:\thttp://www.onsemi.com\n F:\tdrivers/net/phy/ncn*\n \n+ONSEMI S2500 10BASE-T1S MACPHY ETHERNET DRIVER\n+M:\tSelva Rajagopal \u003cselvamani.rajagopal@onsemi.com\u003e\n+L:\tnetdev@vger.kernel.org\n+S:\tSupported\n+F:\tDocumentation/devicetree/bindings/net/onnn,s2500.yaml\n+F:\tdrivers/net/ethernet/onsemi/s2500/*\n+\n OP-TEE DRIVER\n M:\tJens Wiklander \u003cjenswi@kernel.org\u003e\n L:\top-tee@lists.trustedfirmware.org (moderated for non-subscribers)\n@@ -20461,10 +20469,11 @@ F:\tdrivers/rtc/rtc-optee.c\n \n OPEN ALLIANCE 10BASE-T1S MACPHY SERIAL INTERFACE FRAMEWORK\n M:\tParthiban Veerasooran \u003cparthiban.veerasooran@microchip.com\u003e\n+M:\tSelva Rajagopal \u003cselvamani.rajagopal@onsemi.com\u003e (timestamp support)\n L:\tnetdev@vger.kernel.org\n S:\tMaintained\n F:\tDocumentation/networking/oa-tc6-framework.rst\n-F:\tdrivers/net/ethernet/oa_tc6.c\n+F:\tdrivers/net/ethernet/oa_tc6/*\n F:\tinclude/linux/oa_tc6.h\n \n OPEN FIRMWARE AND FLATTENED DEVICE TREE\ndiff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig\nindex c2b0161d0beca..c160bf9913453 100644\n--- a/drivers/net/ethernet/Kconfig\n+++ b/drivers/net/ethernet/Kconfig\n@@ -135,7 +135,9 @@ source \"drivers/net/ethernet/netronome/Kconfig\"\n source \"drivers/net/ethernet/8390/Kconfig\"\n source \"drivers/net/ethernet/nvidia/Kconfig\"\n source \"drivers/net/ethernet/nxp/Kconfig\"\n+source \"drivers/net/ethernet/oa_tc6/Kconfig\"\n source \"drivers/net/ethernet/oki-semi/Kconfig\"\n+source \"drivers/net/ethernet/onsemi/Kconfig\"\n \n config ETHOC\n \ttristate \"OpenCores 10/100 Mbps Ethernet MAC support\"\n@@ -147,17 +149,6 @@ config ETHOC\n \thelp\n \t Say Y here if you want to use the OpenCores 10/100 Mbps Ethernet MAC.\n \n-config OA_TC6\n-\ttristate \"OPEN Alliance TC6 10BASE-T1x MAC-PHY support\" if COMPILE_TEST\n-\tdepends on SPI\n-\tselect PHYLIB\n-\thelp\n-\t This library implements OPEN Alliance TC6 10BASE-T1x MAC-PHY\n-\t Serial Interface protocol for supporting 10BASE-T1x MAC-PHYs.\n-\n-\t To know the implementation details, refer documentation in\n-\t \u003cfile:Documentation/networking/oa-tc6-framework.rst\u003e.\n-\n source \"drivers/net/ethernet/pasemi/Kconfig\"\n source \"drivers/net/ethernet/pensando/Kconfig\"\n source \"drivers/net/ethernet/qlogic/Kconfig\"\ndiff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile\nindex a306dae23bcb8..e4bad64bf95c2 100644\n--- a/drivers/net/ethernet/Makefile\n+++ b/drivers/net/ethernet/Makefile\n@@ -72,7 +72,9 @@ obj-$(CONFIG_NET_VENDOR_NETRONOME) += netronome/\n obj-$(CONFIG_NET_VENDOR_NI) += ni/\n obj-$(CONFIG_NET_VENDOR_NVIDIA) += nvidia/\n obj-$(CONFIG_LPC_ENET) += nxp/\n+obj-$(CONFIG_OA_TC6) += oa_tc6/\n obj-$(CONFIG_NET_VENDOR_OKI) += oki-semi/\n+obj-$(CONFIG_NET_VENDOR_ONSEMI) += onsemi/\n obj-$(CONFIG_ETHOC) += ethoc.o\n obj-$(CONFIG_NET_VENDOR_PASEMI) += pasemi/\n obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/\n@@ -105,5 +107,4 @@ obj-$(CONFIG_NET_VENDOR_XILINX) += xilinx/\n obj-$(CONFIG_NET_VENDOR_XIRCOM) += xircom/\n obj-$(CONFIG_NET_VENDOR_SYNOPSYS) += synopsys/\n obj-$(CONFIG_NET_VENDOR_PENSANDO) += pensando/\n-obj-$(CONFIG_OA_TC6) += oa_tc6.o\n obj-$(CONFIG_NET_VENDOR_ZTE) += zte/\ndiff --git a/drivers/net/ethernet/adi/Kconfig b/drivers/net/ethernet/adi/Kconfig\nindex bdb8ff7d15da6..120a52e6b2834 100644\n--- a/drivers/net/ethernet/adi/Kconfig\n+++ b/drivers/net/ethernet/adi/Kconfig\n@@ -29,6 +29,7 @@ config ADIN1110\n config ADIN1140\n \ttristate \"Analog Devices ADIN1140 MAC-PHY\"\n \tdepends on SPI\n+\tdepends on PTP_1588_CLOCK_OPTIONAL\n \tselect ADIN1140_PHY\n \tselect OA_TC6\n \thelp\ndiff --git a/drivers/net/ethernet/microchip/lan865x/Kconfig b/drivers/net/ethernet/microchip/lan865x/Kconfig\nindex 7f2a4e7e1915f..342172cb8837d 100644\n--- a/drivers/net/ethernet/microchip/lan865x/Kconfig\n+++ b/drivers/net/ethernet/microchip/lan865x/Kconfig\n@@ -8,6 +8,7 @@ if NET_VENDOR_MICROCHIP\n config LAN865X\n \ttristate \"LAN865x support\"\n \tdepends on SPI\n+\tdepends on PTP_1588_CLOCK_OPTIONAL\n \tselect OA_TC6\n \thelp\n \t Support for the Microchip LAN8650/1 Rev.B0/B1 MACPHY Ethernet chip. It\ndiff --git a/drivers/net/ethernet/oa_tc6/Kconfig b/drivers/net/ethernet/oa_tc6/Kconfig\nnew file mode 100644\nindex 0000000000000..2c8c881d5b992\n--- /dev/null\n+++ b/drivers/net/ethernet/oa_tc6/Kconfig\n@@ -0,0 +1,17 @@\n+# SPDX-License-Identifier: GPL-2.0-only\n+#\n+# OA TC6 10BASE-T1x MAC-PHY configuration\n+#\n+\n+config OA_TC6\n+\ttristate \"OPEN Alliance TC6 10BASE-T1x MAC-PHY support\" if COMPILE_TEST\n+\tdepends on SPI\n+\tdepends on PTP_1588_CLOCK_OPTIONAL\n+\tselect PHYLIB\n+\thelp\n+\t This library implements OPEN Alliance TC6 10BASE-T1x MAC-PHY\n+\t Serial Interface protocol for supporting 10BASE-T1x MAC-PHYs.\n+\n+\t To know the implementation details, refer documentation in\n+\t \u003cfile:Documentation/networking/oa-tc6-framework.rst\u003e.\n+\ndiff --git a/drivers/net/ethernet/oa_tc6/Makefile b/drivers/net/ethernet/oa_tc6/Makefile\nnew file mode 100644\nindex 0000000000000..964f668efc2d3\n--- /dev/null\n+++ b/drivers/net/ethernet/oa_tc6/Makefile\n@@ -0,0 +1,7 @@\n+# SPDX-License-Identifier: GPL-2.0-only\n+#\n+# Makefile for OA TC6 10BASE-T1x MAC-PHY\n+#\n+\n+obj-$(CONFIG_OA_TC6) := oa_tc6_mod.o\n+oa_tc6_mod-objs := oa_tc6.o oa_tc6_ptp.o oa_tc6_tstamp.o\ndiff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6/oa_tc6.c\nsimilarity index 82%\nrename from drivers/net/ethernet/oa_tc6.c\nrename to drivers/net/ethernet/oa_tc6/oa_tc6.c\nindex 364027c39fa4a..0c4f7d3f978fd 100644\n--- a/drivers/net/ethernet/oa_tc6.c\n+++ b/drivers/net/ethernet/oa_tc6/oa_tc6.c\n@@ -8,114 +8,23 @@\n #include \u003clinux/bitfield.h\u003e\n #include \u003clinux/delay.h\u003e\n #include \u003clinux/gpio/consumer.h\u003e\n+#include \u003clinux/bitops.h\u003e\n #include \u003clinux/iopoll.h\u003e\n #include \u003clinux/interrupt.h\u003e\n #include \u003clinux/mdio.h\u003e\n #include \u003clinux/phy.h\u003e\n #include \u003clinux/oa_tc6.h\u003e\n \n-/* Control command header */\n-#define OA_TC6_CTRL_HEADER_DATA_NOT_CTRL\tBIT(31)\n-#define OA_TC6_CTRL_HEADER_WRITE_NOT_READ\tBIT(29)\n-#define OA_TC6_CTRL_HEADER_MEM_MAP_SELECTOR\tGENMASK(27, 24)\n-#define OA_TC6_CTRL_HEADER_ADDR\t\t\tGENMASK(23, 8)\n-#define OA_TC6_CTRL_HEADER_LENGTH\t\tGENMASK(7, 1)\n-#define OA_TC6_CTRL_HEADER_PARITY\t\tBIT(0)\n-\n-/* Data header */\n-#define OA_TC6_DATA_HEADER_DATA_NOT_CTRL\tBIT(31)\n-#define OA_TC6_DATA_HEADER_DATA_VALID\t\tBIT(21)\n-#define OA_TC6_DATA_HEADER_START_VALID\t\tBIT(20)\n-#define OA_TC6_DATA_HEADER_START_WORD_OFFSET\tGENMASK(19, 16)\n-#define OA_TC6_DATA_HEADER_END_VALID\t\tBIT(14)\n-#define OA_TC6_DATA_HEADER_END_BYTE_OFFSET\tGENMASK(13, 8)\n-#define OA_TC6_DATA_HEADER_PARITY\t\tBIT(0)\n-\n-/* Data footer */\n-#define OA_TC6_DATA_FOOTER_EXTENDED_STS\t\tBIT(31)\n-#define OA_TC6_DATA_FOOTER_RXD_HEADER_BAD\tBIT(30)\n-#define OA_TC6_DATA_FOOTER_CONFIG_SYNC\t\tBIT(29)\n-#define OA_TC6_DATA_FOOTER_RX_CHUNKS\t\tGENMASK(28, 24)\n-#define OA_TC6_DATA_FOOTER_DATA_VALID\t\tBIT(21)\n-#define OA_TC6_DATA_FOOTER_START_VALID\t\tBIT(20)\n-#define OA_TC6_DATA_FOOTER_START_WORD_OFFSET\tGENMASK(19, 16)\n-#define OA_TC6_DATA_FOOTER_END_VALID\t\tBIT(14)\n-#define OA_TC6_DATA_FOOTER_END_BYTE_OFFSET\tGENMASK(13, 8)\n-#define OA_TC6_DATA_FOOTER_TX_CREDITS\t\tGENMASK(5, 1)\n-\n-#define OA_TC6_CTRL_PROT_REPLY_SIZE\t\t4\n-#define OA_TC6_CTRL_HEADER_SIZE\t\t\t4\n-#define OA_TC6_CTRL_REG_VALUE_SIZE\t\t4\n-#define OA_TC6_CTRL_IGNORED_SIZE\t\t4\n-#define OA_TC6_CTRL_MAX_REGISTERS\t\t128\n-#define OA_TC6_CTRL_SPI_BUF_SIZE\t(OA_TC6_CTRL_HEADER_SIZE +\\\n-\t\t\t\t\t(OA_TC6_CTRL_MAX_REGISTERS *\\\n-\t\t\t\t\t(OA_TC6_CTRL_REG_VALUE_SIZE +\\\n-\t\t\t\t\tOA_TC6_CTRL_PROT_REPLY_SIZE)) +\\\n-\t\t\t\t\tOA_TC6_CTRL_IGNORED_SIZE)\n-\n-#define OA_TC6_CHUNK_PAYLOAD_SIZE\t\t64\n-#define OA_TC6_DATA_HEADER_SIZE\t\t\t4\n-#define OA_TC6_CHUNK_SIZE\t\t\t(OA_TC6_DATA_HEADER_SIZE +\\\n-\t\t\t\t\t\tOA_TC6_CHUNK_PAYLOAD_SIZE)\n-#define OA_TC6_MAX_TX_CHUNKS\t\t\t48\n-#define OA_TC6_SPI_DATA_BUF_SIZE\t\t(OA_TC6_MAX_TX_CHUNKS *\\\n-\t\t\t\t\t\tOA_TC6_CHUNK_SIZE)\n-#define STATUS0_RESETC_POLL_DELAY\t\t1000\n-#define STATUS0_RESETC_POLL_TIMEOUT\t\t1000000\n-\n-#define OA_TC6_REG_MMS_MASK\t\tGENMASK(19, 16)\n-\n-/* Internal structure for MAC-PHY drivers */\n-struct oa_tc6 {\n-\tstruct net_device *netdev;\n-\tstruct phy_device *phydev;\n-\tstruct mii_bus *mdiobus;\n-\tstruct spi_device *spi;\n-\tstruct mutex spi_ctrl_lock; /* Protects spi control transfer */\n-\tspinlock_t tx_skb_lock; /* Protects tx skb handling */\n-\tvoid *spi_ctrl_tx_buf;\n-\tvoid *spi_ctrl_rx_buf;\n-\tvoid *spi_data_tx_buf;\n-\tvoid *spi_data_rx_buf;\n-\tstruct sk_buff *ongoing_tx_skb;\n-\tstruct sk_buff *waiting_tx_skb;\n-\tstruct sk_buff *rx_skb;\n-\tu16 tx_skb_offset;\n-\tu16 spi_data_tx_buf_offset;\n-\tu16 tx_credits;\n-\tu8 rx_chunks_available;\n-\tbool wait_until_start_valid;\n-\tbool int_flag;\n-\tbool disable_traffic;\n-\tbool prot_ctrl;\n-\tenum oa_tc6_quirk_flag quirk_flags;\n-\tstruct gpio_desc *reset_gpio;\n-};\n-\n-enum oa_tc6_header_type {\n-\tOA_TC6_CTRL_HEADER,\n-\tOA_TC6_DATA_HEADER,\n-};\n-\n-enum oa_tc6_register_op {\n-\tOA_TC6_CTRL_REG_READ = 0,\n-\tOA_TC6_CTRL_REG_WRITE = 1,\n-};\n-\n-enum oa_tc6_data_valid_info {\n-\tOA_TC6_DATA_INVALID,\n-\tOA_TC6_DATA_VALID,\n-};\n+#include \"oa_tc6_std_def.h\"\n \n-enum oa_tc6_data_start_valid_info {\n-\tOA_TC6_DATA_START_INVALID,\n-\tOA_TC6_DATA_START_VALID,\n+struct oa_tc6_ts_info_rx {\n+\tbool rtsa;\n+\tbool rtsp;\n };\n \n-enum oa_tc6_data_end_valid_info {\n-\tOA_TC6_DATA_END_INVALID,\n-\tOA_TC6_DATA_END_VALID,\n+struct oa_tc6_ts_info_tx {\n+\tktime_t hwtstamp;\n+\tu8 tsc;\n };\n \n static int oa_tc6_spi_transfer(struct oa_tc6 *tc6,\n@@ -152,6 +61,205 @@ static int oa_tc6_get_parity(u32 p)\n \treturn !((p \u003e\u003e 28) \u0026 1);\n }\n \n+static struct oa_tc6_ts_info_tx *oa_tc6_tsinfo_tx(struct sk_buff *skb)\n+{\n+\treturn (struct oa_tc6_ts_info_tx *)(skb-\u003ecb);\n+}\n+\n+static struct oa_tc6_ts_info_rx *oa_tc6_tsinfo_rx(struct sk_buff *skb)\n+{\n+\treturn (struct oa_tc6_ts_info_rx *)(skb-\u003ecb);\n+}\n+\n+static u8 oa_tc6_next_tsc(u8 tsc)\n+{\n+\treturn tsc \u003c OA_TC6_TTSCC_REG_ID ? tsc + 1 : OA_TC6_TTSCA_REG_ID;\n+}\n+\n+static bool oa_tc6_req_tx_hwtstamp(struct oa_tc6 *tc6, struct sk_buff *skb)\n+{\n+\tu8 tsc;\n+\tu8 i;\n+\n+\tlockdep_assert_held(\u0026tc6-\u003etx_skb_lock);\n+\n+\tif (!skb || !(skb_shinfo(skb)-\u003etx_flags \u0026 SKBTX_HW_TSTAMP))\n+\t\treturn false;\n+\n+\tif (!tc6-\u003ehw_tstamp_enabled)\n+\t\treturn false;\n+\n+\tif (tc6-\u003ets_config.tx_type != HWTSTAMP_TX_ON) {\n+\t\ttc6-\u003etx_hwtstamp_lost++;\n+\t\treturn false;\n+\t}\n+\n+\ttsc = tc6-\u003ettsc_current_id;\n+\tfor (i = 0; i \u003c OA_TC6_TTSCC_REG_ID; i++) {\n+\t\tif (!(tc6-\u003ets_ttsc_pending \u0026\n+\t\t BIT(tsc - OA_TC6_TTSCA_REG_ID)))\n+\t\t\tgoto slot_found;\n+\t\ttsc = oa_tc6_next_tsc(tsc);\n+\t}\n+\n+\t/* All the three slots are waiting for its event. This skb\n+\t * can't request timestamp. Marking it to be dropped.\n+\t */\n+\ttc6-\u003etx_hwtstamp_lost++;\n+\treturn true;\n+\n+slot_found:\n+\ttc6-\u003ets_ttsc_pending |= BIT(tsc - OA_TC6_TTSCA_REG_ID);\n+\ttc6-\u003ettsc_current_id = oa_tc6_next_tsc(tsc);\n+\toa_tc6_tsinfo_tx(skb)-\u003etsc = tsc;\n+\tskb_shinfo(skb)-\u003etx_flags |= SKBTX_IN_PROGRESS;\n+\treturn false;\n+}\n+\n+static void oa_tc6_events_handle(struct oa_tc6 *tc6, u32 val, const u32 *ts)\n+{\n+\tstruct skb_shared_hwtstamps tstamp;\n+\tstruct oa_tc6_ts_info_tx *ski;\n+\tstruct sk_buff *skb, *tmp;\n+\tLIST_HEAD(deliver);\n+\tLIST_HEAD(drop);\n+\tu8 tsc, bit_num;\n+\tu32 handled = 0;\n+\tu32 event;\n+\n+\tspin_lock_bh(\u0026tc6-\u003etx_skb_lock);\n+\tlist_for_each_entry_safe(skb, tmp, \u0026tc6-\u003etx_ts_skb_q, list) {\n+\t\tski = oa_tc6_tsinfo_tx(skb);\n+\t\ttsc = ski-\u003etsc;\n+\t\tbit_num = tsc - OA_TC6_TTSCA_REG_ID;\n+\t\tevent = OA_TC6_STATUS0_TTSCAA \u003c\u003c bit_num;\n+\t\tif (!(val \u0026 event))\n+\t\t\tcontinue;\n+\t\tif (handled \u0026 event) {\n+\t\t\tdev_warn_ratelimited(\u0026tc6-\u003espi-\u003edev,\n+\t\t\t\t\t \"Multiple skbs\\n\");\n+\t\t\ttc6-\u003etx_hwtstamp_err++;\n+\t\t\tlist_move_tail(\u0026skb-\u003elist, \u0026drop);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\thandled |= event;\n+\t\ttc6-\u003ets_ttsc_pending \u0026= ~BIT(bit_num);\n+\n+\t\tski-\u003ehwtstamp = ktime_set(ts[2 * bit_num],\n+\t\t\t\t\t ts[2 * bit_num + 1]);\n+\t\ttc6-\u003etx_hwtstamp_pkts++;\n+\t\tlist_move_tail(\u0026skb-\u003elist, \u0026deliver);\n+\t}\n+\tspin_unlock_bh(\u0026tc6-\u003etx_skb_lock);\n+\n+\t/* skb_tstamp_tx() clones the skb and wakes the owning socket, so keep\n+\t * it out of the lock that oa_tc6_start_xmit() takes.\n+\t */\n+\tlist_for_each_entry_safe(skb, tmp, \u0026deliver, list) {\n+\t\tlist_del(\u0026skb-\u003elist);\n+\t\tmemset(\u0026tstamp, 0, sizeof(tstamp));\n+\t\ttstamp.hwtstamp = oa_tc6_tsinfo_tx(skb)-\u003ehwtstamp;\n+\t\tskb_tstamp_tx(skb, \u0026tstamp);\n+\t\tdev_kfree_skb(skb);\n+\t}\n+\n+\tlist_for_each_entry_safe(skb, tmp, \u0026drop, list) {\n+\t\tlist_del(\u0026skb-\u003elist);\n+\t\tdev_kfree_skb(skb);\n+\t}\n+\n+\tif (val \u0026 ~handled) {\n+\t\ttc6-\u003etx_hwtstamp_err += hweight32(val \u0026 ~handled);\n+\t\tdev_warn_ratelimited(\u0026tc6-\u003espi-\u003edev,\n+\t\t\t\t \"Unexpected event: 0x%x\\n\",\n+\t\t\t\t val \u0026 ~handled);\n+\t}\n+}\n+\n+void oa_tc6_cleanup_tx_tstamp_skbs(struct oa_tc6 *tc6)\n+{\n+\tstruct sk_buff *skb, *tmp;\n+\n+\tspin_lock_bh(\u0026tc6-\u003etx_skb_lock);\n+\tlist_for_each_entry_safe(skb, tmp, \u0026tc6-\u003etx_ts_skb_q, list) {\n+\t\tlist_del(\u0026skb-\u003elist);\n+\t\ttc6-\u003ets_ttsc_pending \u0026= ~BIT(oa_tc6_tsinfo_tx(skb)-\u003etsc -\n+\t\t\t\t\t OA_TC6_TTSCA_REG_ID);\n+\t\tdev_kfree_skb(skb);\n+\n+\t\t/* The frame was transmitted, only its timestamp is lost. */\n+\t\ttc6-\u003etx_hwtstamp_lost++;\n+\t}\n+\tspin_unlock_bh(\u0026tc6-\u003etx_skb_lock);\n+}\n+\n+static int oa_tc6_update_ts_in_rx_skb(struct oa_tc6 *tc6)\n+{\n+\tunsigned int expected_len = ETH_HLEN;\n+\tstruct sk_buff *skb = tc6-\u003erx_skb;\n+\tstruct oa_tc6_ts_info_rx *ski;\n+\t__be32 ts_val[2];\n+\tu32 ts[2];\n+\n+\tski = oa_tc6_tsinfo_rx(skb);\n+\tif (ski-\u003ertsa)\n+\t\texpected_len += OA_TC6_TSTAMP_SZ;\n+\n+\tif (skb-\u003elen \u003c expected_len) {\n+\t\ttc6-\u003enetdev-\u003estats.rx_length_errors++;\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (!ski-\u003ertsa)\n+\t\treturn 0;\n+\n+\tmemcpy(\u0026ts_val[0], skb-\u003edata, 4);\n+\tmemcpy(\u0026ts_val[1], (u32 *)skb-\u003edata + 1, 4);\n+\n+\tts[0] = be32_to_cpu(ts_val[0]);\n+\tts[1] = be32_to_cpu(ts_val[1]);\n+\n+\t/* Check parity */\n+\tif ((oa_tc6_get_parity(ts[0]) ^ oa_tc6_get_parity(ts[1])) ==\n+\t !ski-\u003ertsp) {\n+\t\tstruct skb_shared_hwtstamps *hw_ts;\n+\n+\t\t/* Report timestamp to the upper layers */\n+\t\thw_ts = skb_hwtstamps(skb);\n+\t\tmemset(hw_ts, 0, sizeof(*hw_ts));\n+\t\thw_ts-\u003ehwtstamp = ktime_set(ts[0], ts[1]);\n+\t}\n+\tskb_pull(skb, sizeof(ts));\n+\n+\treturn 0;\n+}\n+\n+static int oa_tc6_update_standard_capability(struct oa_tc6 *tc6)\n+{\n+\tu32 regval = 0;\n+\tint ret;\n+\n+\tret = oa_tc6_read_register(tc6, OA_TC6_REG_STDCAP, \u0026regval);\n+\tif (ret)\n+\t\treturn ret;\n+\tif (regval \u0026 OA_TC6_STDCAP_TIMESTAMP_CAPABILITY)\n+\t\ttc6-\u003ehw_tstamp_supported = true;\n+\treturn 0;\n+}\n+\n+/**\n+ * oa_tc6_set_vend1_mms - Add vendor specific MDIO_MMD to OA TC6 MMS\n+ * mapper value.\n+ * @tc6: oa_tc6 struct.\n+ * @mms: vendor defined MMS value for VEND1 mdio device.\n+ */\n+void oa_tc6_set_vend1_mms(struct oa_tc6 *tc6, int mms)\n+{\n+\ttc6-\u003evend1_mms = mms;\n+}\n+EXPORT_SYMBOL_GPL(oa_tc6_set_vend1_mms);\n+\n static __be32 oa_tc6_prepare_ctrl_header(u32 addr, u8 length,\n \t\t\t\t\t enum oa_tc6_register_op reg_op)\n {\n@@ -479,7 +587,7 @@ static int oa_tc6_mdiobus_write(struct mii_bus *bus, int addr, int regnum,\n \t\t\t\t val);\n }\n \n-static int oa_tc6_get_phy_c45_mms(int devnum)\n+static int oa_tc6_get_phy_c45_mms(struct oa_tc6 *tc6, int devnum)\n {\n \tswitch (devnum) {\n \tcase MDIO_MMD_PCS:\n@@ -492,6 +600,8 @@ static int oa_tc6_get_phy_c45_mms(int devnum)\n \t\treturn OA_TC6_PHY_C45_AUTO_NEG_MMS5;\n \tcase MDIO_MMD_POWER_UNIT:\n \t\treturn OA_TC6_PHY_C45_POWER_UNIT_MMS6;\n+\tcase MDIO_MMD_VEND1:\n+\t\treturn tc6-\u003evend1_mms;\n \tdefault:\n \t\treturn -EOPNOTSUPP;\n \t}\n@@ -505,7 +615,7 @@ int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int devnum,\n \tint mms;\n \tint ret;\n \n-\tmms = oa_tc6_get_phy_c45_mms(devnum);\n+\tmms = oa_tc6_get_phy_c45_mms(tc6, devnum);\n \tif (mms \u003c 0)\n \t\treturn mms;\n \n@@ -523,7 +633,7 @@ int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int devnum,\n \tstruct oa_tc6 *tc6 = bus-\u003epriv;\n \tint mms;\n \n-\tmms = oa_tc6_get_phy_c45_mms(devnum);\n+\tmms = oa_tc6_get_phy_c45_mms(tc6, devnum);\n \tif (mms \u003c 0)\n \t\treturn mms;\n \n@@ -727,6 +837,16 @@ static void oa_tc6_cleanup_ongoing_rx_skb(struct oa_tc6 *tc6)\n \n static void oa_tc6_cleanup_ongoing_tx_skb(struct oa_tc6 *tc6)\n {\n+\tif (tc6-\u003eongoing_tx_skb \u0026\u0026\n+\t oa_tc6_tsinfo_tx(tc6-\u003eongoing_tx_skb)-\u003etsc) {\n+\t\tu8 tsc = oa_tc6_tsinfo_tx(tc6-\u003eongoing_tx_skb)-\u003etsc;\n+\n+\t\tspin_lock_bh(\u0026tc6-\u003etx_skb_lock);\n+\t\ttc6-\u003ets_ttsc_pending \u0026= ~BIT(tsc - OA_TC6_TTSCA_REG_ID);\n+\t\tspin_unlock_bh(\u0026tc6-\u003etx_skb_lock);\n+\t}\n+\n+\ttc6-\u003etx_skb_offset = 0;\n \toa_tc6_drop_tx_skb(tc6, tc6-\u003eongoing_tx_skb);\n \ttc6-\u003eongoing_tx_skb = NULL;\n }\n@@ -752,6 +872,7 @@ static void oa_tc6_free_pending_skbs(struct oa_tc6 *tc6)\n {\n \toa_tc6_free_ongoing_skbs(tc6);\n \toa_tc6_cleanup_waiting_tx_skb(tc6);\n+\toa_tc6_cleanup_tx_tstamp_skbs(tc6);\n }\n \n static void oa_tc6_look_for_new_frame(struct oa_tc6 *tc6)\n@@ -780,6 +901,8 @@ static void oa_tc6_disable_traffic(struct oa_tc6 *tc6)\n \tnetif_tx_disable(tc6-\u003enetdev);\n \toa_tc6_drop_tx_skb(tc6, skb);\n \toa_tc6_free_ongoing_skbs(tc6);\n+\toa_tc6_cleanup_tx_tstamp_skbs(tc6);\n+\n \toa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, regval);\n \toa_tc6_read_register(tc6, OA_TC6_REG_STATUS0, \u0026regval);\n \toa_tc6_write_register(tc6, OA_TC6_REG_STATUS0, regval);\n@@ -788,15 +911,28 @@ static void oa_tc6_disable_traffic(struct oa_tc6 *tc6)\n \n static int oa_tc6_process_extended_status(struct oa_tc6 *tc6)\n {\n+\tu32 regs[OA_TC6_STATUS0_TTSC_REG_COUNT];\n+\tbool ts_valid = !!tc6-\u003eptp_clock;\n \tu32 value;\n \tint ret;\n \n-\tret = oa_tc6_read_register(tc6, OA_TC6_REG_STATUS0, \u0026value);\n+\t/* When timestamp is disabled, there is no behavior change\n+\t * as it reads only STATUS0 register. When enabled,\n+\t * TTSCA_HIGH..TTSCC_LOW are fetched together with STATUS0\n+\t * to avoid having to make second SPI transaction. Reading few\n+\t * extra registers, even it may not be needed every time this\n+\t * function is called, it is more efficient than making second\n+\t * SPI transaction, when needed.\n+\t */\n+\tret = oa_tc6_read_registers(tc6, OA_TC6_REG_STATUS0, regs,\n+\t\t\t\t ts_valid ?\n+\t\t\t\t OA_TC6_STATUS0_TTSC_REG_COUNT : 1);\n \tif (ret) {\n \t\tnetdev_err(tc6-\u003enetdev, \"STATUS0 register read failed: %d\\n\",\n \t\t\t ret);\n \t\treturn ret;\n \t}\n+\tvalue = regs[0];\n \n \t/* This function is called for each chunk received in a given SPI\n \t * transaction. In case, extended status bit is set in more than\n@@ -805,6 +941,11 @@ static int oa_tc6_process_extended_status(struct oa_tc6 *tc6)\n \tif (!value)\n \t\treturn 0;\n \n+\tif ((value \u0026 OA_TC6_STATUS0_TTSCA_MASK) != 0)\n+\t\toa_tc6_events_handle(tc6, value \u0026\n+\t\t\t\t OA_TC6_STATUS0_TTSCA_MASK,\n+\t\t\t\t \u0026regs[OA_TC6_TTSC_REG_OFFSET]);\n+\n \t/* Clear the error interrupts status */\n \tret = oa_tc6_write_register(tc6, OA_TC6_REG_STATUS0, value);\n \tif (ret) {\n@@ -890,6 +1031,13 @@ static void oa_tc6_submit_rx_skb(struct oa_tc6 *tc6)\n \t tc6-\u003erx_skb-\u003elen \u003e ETH_FCS_LEN)\n \t\tskb_trim(tc6-\u003erx_skb, tc6-\u003erx_skb-\u003elen - ETH_FCS_LEN);\n \n+\tif (oa_tc6_update_ts_in_rx_skb(tc6)) {\n+\t\ttc6-\u003enetdev-\u003estats.rx_dropped++;\n+\t\tdev_kfree_skb_any(tc6-\u003erx_skb);\n+\t\ttc6-\u003erx_skb = NULL;\n+\t\treturn;\n+\t}\n+\n \ttc6-\u003erx_skb-\u003eprotocol = eth_type_trans(tc6-\u003erx_skb, tc6-\u003enetdev);\n \ttc6-\u003enetdev-\u003estats.rx_packets++;\n \ttc6-\u003enetdev-\u003estats.rx_bytes += tc6-\u003erx_skb-\u003elen;\n@@ -925,25 +1073,32 @@ static int oa_tc6_update_rx_skb(struct oa_tc6 *tc6, u8 *payload, u8 length)\n * buffer pointer. We should release, if a valid pointer is found before\n * allocating a new one.\n */\n-static int oa_tc6_allocate_rx_skb(struct oa_tc6 *tc6)\n+static int oa_tc6_allocate_rx_skb(struct oa_tc6 *tc6, u32 footer)\n {\n+\tstruct oa_tc6_ts_info_rx *ski;\n+\n \toa_tc6_cleanup_ongoing_rx_skb(tc6);\n-\ttc6-\u003erx_skb = netdev_alloc_skb_ip_align(tc6-\u003enetdev, tc6-\u003enetdev-\u003emtu +\n-\t\t\t\t\t\tETH_HLEN + ETH_FCS_LEN);\n+\ttc6-\u003erx_skb = netdev_alloc_skb_ip_align(tc6-\u003enetdev,\n+\t\t\t\t\t\ttc6-\u003enetdev-\u003emtu +\n+\t\t\t\t\t\tETH_HLEN + ETH_FCS_LEN +\n+\t\t\t\t\t\tOA_TC6_TSTAMP_SZ);\n \tif (!tc6-\u003erx_skb) {\n \t\ttc6-\u003enetdev-\u003estats.rx_dropped++;\n \t\treturn -ENOMEM;\n \t}\n \n+\tski = oa_tc6_tsinfo_rx(tc6-\u003erx_skb);\n+\tski-\u003ertsa = FIELD_GET(OA_TC6_DATA_FOOTER_RTSA_VALID, footer);\n+\tski-\u003ertsp = FIELD_GET(OA_TC6_DATA_FOOTER_RTSP_VALID, footer);\n \treturn 0;\n }\n \n static int oa_tc6_prcs_complete_rx_frame(struct oa_tc6 *tc6, u8 *payload,\n-\t\t\t\t\t u16 size)\n+\t\t\t\t\t u16 size, u32 footer)\n {\n \tint ret;\n \n-\tret = oa_tc6_allocate_rx_skb(tc6);\n+\tret = oa_tc6_allocate_rx_skb(tc6, footer);\n \tif (ret)\n \t\treturn ret;\n \n@@ -956,11 +1111,11 @@ static int oa_tc6_prcs_complete_rx_frame(struct oa_tc6 *tc6, u8 *payload,\n \treturn 0;\n }\n \n-static int oa_tc6_prcs_rx_frame_start(struct oa_tc6 *tc6, u8 *payload, u16 size)\n+static int oa_tc6_prcs_rx_frame_start(struct oa_tc6 *tc6, u8 *payload, u16 size, u32 footer)\n {\n \tint ret;\n \n-\tret = oa_tc6_allocate_rx_skb(tc6);\n+\tret = oa_tc6_allocate_rx_skb(tc6, footer);\n \tif (ret)\n \t\treturn ret;\n \n@@ -1007,7 +1162,7 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *tc6, u8 *data,\n \t\tsize = end_byte_offset + 1 - start_byte_offset;\n \t\treturn oa_tc6_prcs_complete_rx_frame(tc6,\n \t\t\t\t\t\t \u0026data[start_byte_offset],\n-\t\t\t\t\t\t size);\n+\t\t\t\t\t\t size, footer);\n \t}\n \n \t/* Process the chunk with only rx frame start */\n@@ -1015,7 +1170,7 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *tc6, u8 *data,\n \t\tsize = OA_TC6_CHUNK_PAYLOAD_SIZE - start_byte_offset;\n \t\treturn oa_tc6_prcs_rx_frame_start(tc6,\n \t\t\t\t\t\t \u0026data[start_byte_offset],\n-\t\t\t\t\t\t size);\n+\t\t\t\t\t\t size, footer);\n \t}\n \n \t/* Process the chunk with only rx frame end */\n@@ -1048,7 +1203,7 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *tc6, u8 *data,\n \t\tsize = OA_TC6_CHUNK_PAYLOAD_SIZE - start_byte_offset;\n \t\treturn oa_tc6_prcs_rx_frame_start(tc6,\n \t\t\t\t\t\t \u0026data[start_byte_offset],\n-\t\t\t\t\t\t size);\n+\t\t\t\t\t\t size, footer);\n \t}\n \n \t/* Process the chunk with ongoing rx frame data */\n@@ -1127,13 +1282,15 @@ static int oa_tc6_process_spi_data_rx_buf(struct oa_tc6 *tc6, u16 length)\n }\n \n static __be32 oa_tc6_prepare_data_header(bool data_valid, bool start_valid,\n-\t\t\t\t\t bool end_valid, u8 end_byte_offset)\n+\t\t\t\t\t bool end_valid, u8 end_byte_offset,\n+\t\t\t\t\t u8 tsc)\n {\n \tu32 header = FIELD_PREP(OA_TC6_DATA_HEADER_DATA_NOT_CTRL,\n \t\t\t\tOA_TC6_DATA_HEADER) |\n \t\t FIELD_PREP(OA_TC6_DATA_HEADER_DATA_VALID, data_valid) |\n \t\t FIELD_PREP(OA_TC6_DATA_HEADER_START_VALID, start_valid) |\n \t\t FIELD_PREP(OA_TC6_DATA_HEADER_END_VALID, end_valid) |\n+\t\t FIELD_PREP(OA_TC6_DATA_HEADER_TSC_OFFSET, tsc) |\n \t\t FIELD_PREP(OA_TC6_DATA_HEADER_END_BYTE_OFFSET,\n \t\t\t\tend_byte_offset);\n \n@@ -1152,6 +1309,7 @@ static void oa_tc6_add_tx_skb_to_spi_buf(struct oa_tc6 *tc6)\n \tenum oa_tc6_data_start_valid_info start_valid;\n \tu8 end_byte_offset = 0;\n \tu16 length_to_copy;\n+\tu8 tsc = 0;\n \n \t/* Initial value is assigned here to avoid more than 80 characters in\n \t * the declaration place.\n@@ -1161,8 +1319,10 @@ static void oa_tc6_add_tx_skb_to_spi_buf(struct oa_tc6 *tc6)\n \t/* Set start valid if the current tx chunk contains the start of the tx\n \t * ethernet frame.\n \t */\n-\tif (!tc6-\u003etx_skb_offset)\n+\tif (!tc6-\u003etx_skb_offset) {\n \t\tstart_valid = OA_TC6_DATA_START_VALID;\n+\t\ttsc = oa_tc6_tsinfo_tx(tc6-\u003eongoing_tx_skb)-\u003etsc;\n+\t}\n \n \t/* If the remaining tx skb length is more than the chunk payload size of\n \t * 64 bytes then copy only 64 bytes and leave the ongoing tx skb for\n@@ -1183,17 +1343,29 @@ static void oa_tc6_add_tx_skb_to_spi_buf(struct oa_tc6 *tc6)\n \t\ttc6-\u003etx_skb_offset = 0;\n \t\ttc6-\u003enetdev-\u003estats.tx_bytes += tc6-\u003eongoing_tx_skb-\u003elen;\n \t\ttc6-\u003enetdev-\u003estats.tx_packets++;\n-\t\tkfree_skb(tc6-\u003eongoing_tx_skb);\n+\n+\t\t/* Free the ones that are not saved for later processing,\n+\t\t * like timestamping.\n+\t\t */\n+\t\tif (!oa_tc6_tsinfo_tx(tc6-\u003eongoing_tx_skb)-\u003etsc) {\n+\t\t\tkfree_skb(tc6-\u003eongoing_tx_skb);\n+\t\t} else {\n+\t\t\tspin_lock_bh(\u0026tc6-\u003etx_skb_lock);\n+\t\t\tlist_add_tail(\u0026tc6-\u003eongoing_tx_skb-\u003elist,\n+\t\t\t\t \u0026tc6-\u003etx_ts_skb_q);\n+\t\t\tspin_unlock_bh(\u0026tc6-\u003etx_skb_lock);\n+\t\t}\n \t\ttc6-\u003eongoing_tx_skb = NULL;\n \t}\n \n \t*tx_buf = oa_tc6_prepare_data_header(OA_TC6_DATA_VALID, start_valid,\n-\t\t\t\t\t end_valid, end_byte_offset);\n+\t\t\t\t\t end_valid, end_byte_offset, tsc);\n \ttc6-\u003espi_data_tx_buf_offset += OA_TC6_CHUNK_SIZE;\n }\n \n static u16 oa_tc6_prepare_spi_tx_buf_for_tx_skbs(struct oa_tc6 *tc6)\n {\n+\tstruct sk_buff *drop_skb;\n \tu16 used_tx_credits;\n \n \t/* Get tx skbs and convert them into tx chunks based on the tx credits\n@@ -1202,10 +1374,21 @@ static u16 oa_tc6_prepare_spi_tx_buf_for_tx_skbs(struct oa_tc6 *tc6)\n \tfor (used_tx_credits = 0; used_tx_credits \u003c tc6-\u003etx_credits;\n \t used_tx_credits++) {\n \t\tif (!tc6-\u003eongoing_tx_skb) {\n+\t\t\tdrop_skb = NULL;\n \t\t\tspin_lock_bh(\u0026tc6-\u003etx_skb_lock);\n \t\t\ttc6-\u003eongoing_tx_skb = tc6-\u003ewaiting_tx_skb;\n \t\t\ttc6-\u003ewaiting_tx_skb = NULL;\n+\t\t\tif (oa_tc6_req_tx_hwtstamp(tc6,\n+\t\t\t\t\t\t tc6-\u003eongoing_tx_skb)) {\n+\t\t\t\tdrop_skb = tc6-\u003eongoing_tx_skb;\n+\t\t\t\ttc6-\u003eongoing_tx_skb = NULL;\n+\t\t\t\tif (!tc6-\u003edisable_traffic \u0026\u0026\n+\t\t\t\t netif_running(tc6-\u003enetdev) \u0026\u0026\n+\t\t\t\t netif_queue_stopped(tc6-\u003enetdev))\n+\t\t\t\t\tnetif_wake_queue(tc6-\u003enetdev);\n+\t\t\t}\n \t\t\tspin_unlock_bh(\u0026tc6-\u003etx_skb_lock);\n+\t\t\toa_tc6_drop_tx_skb(tc6, drop_skb);\n \t\t}\n \t\tif (!tc6-\u003eongoing_tx_skb)\n \t\t\tbreak;\n@@ -1222,7 +1405,7 @@ static void oa_tc6_add_empty_chunks_to_spi_buf(struct oa_tc6 *tc6,\n \n \theader = oa_tc6_prepare_data_header(OA_TC6_DATA_INVALID,\n \t\t\t\t\t OA_TC6_DATA_START_INVALID,\n-\t\t\t\t\t OA_TC6_DATA_END_INVALID, 0);\n+\t\t\t\t\t OA_TC6_DATA_END_INVALID, 0, 0);\n \n \twhile (needed_empty_chunks--) {\n \t\t__be32 *tx_buf = tc6-\u003espi_data_tx_buf +\n@@ -1414,6 +1597,7 @@ netdev_tx_t oa_tc6_start_xmit(struct oa_tc6 *tc6, struct sk_buff *skb)\n \t\treturn NETDEV_TX_OK;\n \t}\n \n+\toa_tc6_tsinfo_tx(skb)-\u003etsc = 0;\n \tspin_lock_bh(\u0026tc6-\u003etx_skb_lock);\n \tif (tc6-\u003ewaiting_tx_skb) {\n \t\tnetif_stop_queue(tc6-\u003enetdev);\n@@ -1473,6 +1657,9 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,\n \tSET_NETDEV_DEV(netdev, \u0026spi-\u003edev);\n \tmutex_init(\u0026tc6-\u003espi_ctrl_lock);\n \tspin_lock_init(\u0026tc6-\u003etx_skb_lock);\n+\ttc6-\u003evend1_mms = -EOPNOTSUPP;\n+\ttc6-\u003ettsc_current_id = OA_TC6_TTSCA_REG_ID;\n+\tINIT_LIST_HEAD(\u0026tc6-\u003etx_ts_skb_q);\n \n \tif (quirks)\n \t\ttc6-\u003equirk_flags = quirks-\u003equirk_flags;\n@@ -1566,6 +1753,12 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,\n \t\tgoto phy_exit;\n \t}\n \n+\tret = oa_tc6_update_standard_capability(tc6);\n+\tif (ret) {\n+\t\tdev_err(\u0026tc6-\u003espi-\u003edev, \"Failed to read capability\\n\");\n+\t\tgoto phy_exit;\n+\t}\n+\n \tret = devm_request_threaded_irq(\u0026tc6-\u003espi-\u003edev, tc6-\u003espi-\u003eirq,\n \t\t\t\t\toa_tc6_macphy_isr,\n \t\t\t\t\toa_tc6_macphy_threaded_irq,\ndiff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_ptp.c b/drivers/net/ethernet/oa_tc6/oa_tc6_ptp.c\nnew file mode 100644\nindex 0000000000000..1b515615819b1\n--- /dev/null\n+++ b/drivers/net/ethernet/oa_tc6/oa_tc6_ptp.c\n@@ -0,0 +1,65 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * Support for hardware timestamping feature for OPEN Alliance\n+ * 10BASE‑T1x MAC‑PHY Serial Interface framework\n+ *\n+ * Author: Selva Rajagopal \u003cselvamani.rajagopal@onsemi.com\u003e\n+ */\n+\n+#include \u003clinux/kernel.h\u003e\n+#include \u003clinux/spi/spi.h\u003e\n+#include \u003clinux/ptp_clock_kernel.h\u003e\n+#include \u003clinux/ethtool.h\u003e\n+#include \u003clinux/phy.h\u003e\n+#include \u003clinux/oa_tc6.h\u003e\n+\n+#include \"oa_tc6_std_def.h\"\n+\n+/**\n+ * oa_tc6_ptp_register - Registers clock related callbacks\n+ * @tc6: oa_tc6 struct.\n+ * @info: Describes a PTP hardware clock\n+ *\n+ * Description: Vendors are expected to set the hardware timestamp\n+ * related callbacks before calling this function.\n+ *\n+ * Return: 0 on success otherwise failed.\n+ *\n+ */\n+int oa_tc6_ptp_register(struct oa_tc6 *tc6, struct ptp_clock_info *info)\n+{\n+\tint ret = 0;\n+\n+\t/* Not supporting hardware timestamp isn't an error */\n+\tif (!tc6-\u003ehw_tstamp_supported)\n+\t\treturn ret;\n+\n+\tsnprintf(info-\u003ename, sizeof(info-\u003ename), \"OA TC6 PTP %s\",\n+\t\t dev_name(\u0026tc6-\u003espi-\u003edev));\n+\ttc6-\u003eptp_clock = ptp_clock_register(info, \u0026tc6-\u003espi-\u003edev);\n+\tif (IS_ERR(tc6-\u003eptp_clock)) {\n+\t\tret = PTR_ERR(tc6-\u003eptp_clock);\n+\t\ttc6-\u003eptp_clock = NULL;\n+\t\tdev_err(\u0026tc6-\u003espi-\u003edev, \"Registration of %s failed\\n\",\n+\t\t\tinfo-\u003ename);\n+\t}\n+\n+\tif (tc6-\u003eptp_clock)\n+\t\tdev_info(\u0026tc6-\u003espi-\u003edev, \"%s registered. index %d\\n\",\n+\t\t\t info-\u003ename, ptp_clock_index(tc6-\u003eptp_clock));\n+\treturn ret;\n+}\n+EXPORT_SYMBOL_GPL(oa_tc6_ptp_register);\n+\n+/**\n+ * oa_tc6_ptp_unregister - Unregisters clock related callbacks\n+ * @tc6: oa_tc6 struct.\n+ */\n+void oa_tc6_ptp_unregister(struct oa_tc6 *tc6)\n+{\n+\tif (tc6-\u003eptp_clock) {\n+\t\tptp_clock_unregister(tc6-\u003eptp_clock);\n+\t\ttc6-\u003eptp_clock = NULL;\n+\t}\n+}\n+EXPORT_SYMBOL_GPL(oa_tc6_ptp_unregister);\ndiff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_std_def.h b/drivers/net/ethernet/oa_tc6/oa_tc6_std_def.h\nnew file mode 100644\nindex 0000000000000..cd62071d7f609\n--- /dev/null\n+++ b/drivers/net/ethernet/oa_tc6/oa_tc6_std_def.h\n@@ -0,0 +1,172 @@\n+/* SPDX-License-Identifier: GPL-2.0+ */\n+/*\n+ * Register and driver related definitions to support\n+ * OPEN Alliance 10BASE‑T1x MAC‑PHY Serial Interface framework.\n+ *\n+ * Author: Selva Rajagopal \u003cselvamani.rajagopal@onsemi.com\u003e\n+ */\n+\n+#ifndef OA_TC6_STD_DEF_H\n+#define OA_TC6_STD_DEF_H\n+\n+#include \u003clinux/ptp_clock_kernel.h\u003e\n+#include \u003clinux/net_tstamp.h\u003e\n+#include \u003clinux/netdevice.h\u003e\n+#include \u003clinux/spi/spi.h\u003e\n+#include \u003clinux/skbuff.h\u003e\n+#include \u003clinux/sched.h\u003e\n+#include \u003clinux/wait.h\u003e\n+#include \u003clinux/phy.h\u003e\n+\n+/* Tx timestamp capture register A (high) */\n+#define OA_TC6_REG_TTSCA_HIGH\t\t\t(0x10)\n+\n+/* Control command header */\n+#define OA_TC6_CTRL_HEADER_DATA_NOT_CTRL\tBIT(31)\n+#define OA_TC6_CTRL_HEADER_WRITE_NOT_READ\tBIT(29)\n+#define OA_TC6_CTRL_HEADER_MEM_MAP_SELECTOR\tGENMASK(27, 24)\n+#define OA_TC6_CTRL_HEADER_ADDR\t\t\tGENMASK(23, 8)\n+#define OA_TC6_CTRL_HEADER_LENGTH\t\tGENMASK(7, 1)\n+#define OA_TC6_CTRL_HEADER_PARITY\t\tBIT(0)\n+\n+/* Data header */\n+#define OA_TC6_DATA_HEADER_DATA_NOT_CTRL\tBIT(31)\n+#define OA_TC6_DATA_HEADER_DATA_VALID\t\tBIT(21)\n+#define OA_TC6_DATA_HEADER_START_VALID\t\tBIT(20)\n+#define OA_TC6_DATA_HEADER_START_WORD_OFFSET\tGENMASK(19, 16)\n+#define OA_TC6_DATA_HEADER_END_VALID\t\tBIT(14)\n+#define OA_TC6_DATA_HEADER_END_BYTE_OFFSET\tGENMASK(13, 8)\n+#define OA_TC6_DATA_HEADER_TSC_OFFSET\t\tGENMASK(7, 6)\n+#define OA_TC6_DATA_HEADER_PARITY\t\tBIT(0)\n+\n+/* Data footer */\n+#define OA_TC6_DATA_FOOTER_EXTENDED_STS\t\tBIT(31)\n+#define OA_TC6_DATA_FOOTER_RXD_HEADER_BAD\tBIT(30)\n+#define OA_TC6_DATA_FOOTER_CONFIG_SYNC\t\tBIT(29)\n+#define OA_TC6_DATA_FOOTER_RX_CHUNKS\t\tGENMASK(28, 24)\n+#define OA_TC6_DATA_FOOTER_DATA_VALID\t\tBIT(21)\n+#define OA_TC6_DATA_FOOTER_START_VALID\t\tBIT(20)\n+#define OA_TC6_DATA_FOOTER_START_WORD_OFFSET\tGENMASK(19, 16)\n+#define OA_TC6_DATA_FOOTER_END_VALID\t\tBIT(14)\n+#define OA_TC6_DATA_FOOTER_RTSA_VALID\t\tBIT(7)\n+#define OA_TC6_DATA_FOOTER_RTSP_VALID\t\tBIT(6)\n+#define OA_TC6_DATA_FOOTER_END_BYTE_OFFSET\tGENMASK(13, 8)\n+#define OA_TC6_DATA_FOOTER_TX_CREDITS\t\tGENMASK(5, 1)\n+\n+#define OA_TC6_CTRL_PROT_REPLY_SIZE\t\t4\n+#define OA_TC6_CTRL_HEADER_SIZE\t\t\t4\n+#define OA_TC6_CTRL_REG_VALUE_SIZE\t\t4\n+#define OA_TC6_CTRL_IGNORED_SIZE\t\t4\n+#define OA_TC6_CTRL_MAX_REGISTERS\t\t128\n+#define OA_TC6_CTRL_SPI_BUF_SIZE\t(OA_TC6_CTRL_HEADER_SIZE +\\\n+\t\t\t\t\t(OA_TC6_CTRL_MAX_REGISTERS *\\\n+\t\t\t\t\t(OA_TC6_CTRL_REG_VALUE_SIZE +\\\n+\t\t\t\t\tOA_TC6_CTRL_PROT_REPLY_SIZE)) +\\\n+\t\t\t\t\tOA_TC6_CTRL_IGNORED_SIZE)\n+\n+#define OA_TC6_CHUNK_PAYLOAD_SIZE\t\t64\n+#define OA_TC6_DATA_HEADER_SIZE\t\t\t4\n+#define OA_TC6_CHUNK_SIZE\t\t\t(OA_TC6_DATA_HEADER_SIZE +\\\n+\t\t\t\t\t\tOA_TC6_CHUNK_PAYLOAD_SIZE)\n+#define OA_TC6_MAX_TX_CHUNKS\t\t\t48\n+#define OA_TC6_SPI_DATA_BUF_SIZE\t\t(OA_TC6_MAX_TX_CHUNKS *\\\n+\t\t\t\t\t\tOA_TC6_CHUNK_SIZE)\n+#define STATUS0_RESETC_POLL_DELAY\t\t1000\n+#define STATUS0_RESETC_POLL_TIMEOUT\t\t1000000\n+\n+#define OA_TC6_REG_MMS_MASK\t\tGENMASK(19, 16)\n+\n+#define OA_TC6_TSTAMP_SZ\t\t\t8\n+\n+#define OA_TC6_TTSCA_REG_ID\t\t\t1\n+#define OA_TC6_TTSCB_REG_ID\t\t\t2\n+#define OA_TC6_TTSCC_REG_ID\t\t\t3\n+\n+/* STATUS0 and the TTSCA/B/C capture registers are contiguous in MMS 0, so\n+ * they are fetched with a single control transaction while timestamping is\n+ * available.\n+ */\n+#define OA_TC6_TTSC_REG_OFFSET\t\t(OA_TC6_REG_TTSCA_HIGH - \\\n+\t\t\t\t\t OA_TC6_REG_STATUS0)\n+#define OA_TC6_TTSC_REG_COUNT\t\t(2 * OA_TC6_TTSCC_REG_ID)\n+#define OA_TC6_STATUS0_TTSC_REG_COUNT\t(OA_TC6_TTSC_REG_OFFSET + \\\n+\t\t\t\t\t OA_TC6_TTSC_REG_COUNT)\n+\n+/* Useful for reading all the registers between CONFIG0 and INT_MASK0\n+ * in a single SPI transaction\n+ */\n+#define CFG0_TO_IMASK0_REG_COUNT\t(OA_TC6_REG_INT_MASK0 - \\\n+\t\t\t\t\t OA_TC6_REG_CONFIG0 + 1)\n+#define CFG0_VAL_OFFSET\t\t\t(0)\n+#define STATUS0_VAL_OFFSET\t\t(OA_TC6_REG_STATUS0 - \\\n+\t\t\t\t\t OA_TC6_REG_CONFIG0)\n+#define IRQM_VAL_OFFSET\t\t\t(OA_TC6_REG_INT_MASK0 - \\\n+\t\t\t\t\t OA_TC6_REG_CONFIG0)\n+\n+/* Internal structure for MAC-PHY drivers */\n+struct oa_tc6 {\n+\tstruct net_device *netdev;\n+\tstruct phy_device *phydev;\n+\tstruct mii_bus *mdiobus;\n+\tstruct spi_device *spi;\n+\tstruct mutex spi_ctrl_lock; /* Protects spi control transfer */\n+\tspinlock_t tx_skb_lock; /* Protects tx skb handling */\n+\tvoid *spi_ctrl_tx_buf;\n+\tvoid *spi_ctrl_rx_buf;\n+\tvoid *spi_data_tx_buf;\n+\tvoid *spi_data_rx_buf;\n+\tstruct sk_buff *ongoing_tx_skb;\n+\tstruct sk_buff *waiting_tx_skb;\n+\tstruct sk_buff *rx_skb;\n+\tu16 tx_skb_offset;\n+\tu16 spi_data_tx_buf_offset;\n+\tu16 tx_credits;\n+\tu8 rx_chunks_available;\n+\tbool wait_until_start_valid;\n+\tbool int_flag;\n+\tbool disable_traffic;\n+\tbool prot_ctrl;\n+\tenum oa_tc6_quirk_flag quirk_flags;\n+\tstruct gpio_desc *reset_gpio;\n+\tstruct hwtstamp_config ts_config;\n+\tstruct list_head tx_ts_skb_q;\n+\tstruct ptp_clock *ptp_clock;\n+\tbool hw_tstamp_supported;\n+\tbool hw_tstamp_enabled;\n+\tu64 tx_hwtstamp_pkts;\n+\tu64 tx_hwtstamp_lost;\n+\tu64 tx_hwtstamp_err;\n+\tu8 ts_ttsc_pending;\n+\tu8 ttsc_current_id;\n+\tint vend1_mms;\n+};\n+\n+enum oa_tc6_header_type {\n+\tOA_TC6_CTRL_HEADER,\n+\tOA_TC6_DATA_HEADER,\n+};\n+\n+enum oa_tc6_register_op {\n+\tOA_TC6_CTRL_REG_READ = 0,\n+\tOA_TC6_CTRL_REG_WRITE = 1,\n+};\n+\n+enum oa_tc6_data_valid_info {\n+\tOA_TC6_DATA_INVALID,\n+\tOA_TC6_DATA_VALID,\n+};\n+\n+enum oa_tc6_data_start_valid_info {\n+\tOA_TC6_DATA_START_INVALID,\n+\tOA_TC6_DATA_START_VALID,\n+};\n+\n+enum oa_tc6_data_end_valid_info {\n+\tOA_TC6_DATA_END_INVALID,\n+\tOA_TC6_DATA_END_VALID,\n+};\n+\n+void oa_tc6_cleanup_tx_tstamp_skbs(struct oa_tc6 *tc6);\n+\n+#endif /* OA_TC6_STD_DEF_H */\n+\ndiff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_tstamp.c b/drivers/net/ethernet/oa_tc6/oa_tc6_tstamp.c\nnew file mode 100644\nindex 0000000000000..539cbd36a1d04\n--- /dev/null\n+++ b/drivers/net/ethernet/oa_tc6/oa_tc6_tstamp.c\n@@ -0,0 +1,224 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * OPEN Alliance 10BASE‑T1x MAC‑PHY Serial Interface framework\n+ *\n+ * Author: Selva Rajagopal \u003cselvamani.rajagopal@onsemi.com\u003e\n+ */\n+\n+#include \u003clinux/bitfield.h\u003e\n+#include \u003clinux/iopoll.h\u003e\n+#include \u003clinux/mdio.h\u003e\n+#include \u003clinux/phy.h\u003e\n+#include \u003clinux/oa_tc6.h\u003e\n+\n+#include \"oa_tc6_std_def.h\"\n+\n+static int oa_tc6_set_hwtstamp_settings(struct oa_tc6 *tc6,\n+\t\t\t\t\tconst struct hwtstamp_config *ts_cfg)\n+{\n+\tu32 regs[CFG0_TO_IMASK0_REG_COUNT];\n+\tu32 cfg0, irqm, status0;\n+\tbool disabled;\n+\tint ret;\n+\n+\tif (tc6-\u003ets_config.flags == ts_cfg-\u003eflags \u0026\u0026\n+\t tc6-\u003ets_config.tx_type == ts_cfg-\u003etx_type \u0026\u0026\n+\t tc6-\u003ets_config.rx_filter == ts_cfg-\u003erx_filter)\n+\t\treturn 0;\n+\n+\tspin_lock_bh(\u0026tc6-\u003etx_skb_lock);\n+\tdisabled = tc6-\u003edisable_traffic;\n+\tspin_unlock_bh(\u0026tc6-\u003etx_skb_lock);\n+\tif (disabled)\n+\t\treturn -EIO;\n+\n+\t/* CONFIG0, STATUS0 and INT_MASK0 span one register block, so a\n+\t * single control transaction covers all three.\n+\t */\n+\tret = oa_tc6_read_registers(tc6, OA_TC6_REG_CONFIG0, regs,\n+\t\t\t\t ARRAY_SIZE(regs));\n+\tif (ret) {\n+\t\tdev_err(\u0026tc6-\u003espi-\u003edev, \"Failed to read CFG0 block\\n\");\n+\t\tgoto out;\n+\t}\n+\n+\tcfg0 = regs[CFG0_VAL_OFFSET];\n+\tstatus0 = regs[STATUS0_VAL_OFFSET];\n+\tirqm = regs[IRQM_VAL_OFFSET];\n+\n+\t/* Hardware timestamp feature supports 64-bit timestamp only */\n+\tif (ts_cfg-\u003etx_type == HWTSTAMP_TX_ON ||\n+\t ts_cfg-\u003erx_filter == HWTSTAMP_FILTER_ALL)\n+\t\tcfg0 |= (OA_TC6_CONFIG0_FTSE_ENABLE |\n+\t\t\t OA_TC6_CONFIG0_FTSS_64BIT_TSTAMP);\n+\telse\n+\t\tcfg0 \u0026= ~OA_TC6_CONFIG0_FTSE_ENABLE;\n+\n+\tif (ts_cfg-\u003etx_type == HWTSTAMP_TX_ON)\n+\t\tirqm \u0026= ~OA_TC6_INT_MASK0_TTSCA_MASK;\n+\telse\n+\t\tirqm |= OA_TC6_INT_MASK0_TTSCA_MASK;\n+\n+\t/* STATUS0 is write-one-to-clear, so this acknowledges a capture\n+\t * without delivering its timestamp. Skip it while TX timestamping\n+\t * stays enabled, where a capture may still be outstanding.\n+\t */\n+\tstatus0 \u0026= OA_TC6_STATUS0_TTSCA_MASK;\n+\tif (status0 \u0026\u0026 (tc6-\u003ets_config.tx_type != HWTSTAMP_TX_ON ||\n+\t\t\tts_cfg-\u003etx_type != HWTSTAMP_TX_ON)) {\n+\t\tret = oa_tc6_write_register(tc6, OA_TC6_REG_STATUS0,\n+\t\t\t\t\t status0);\n+\t\tif (ret) {\n+\t\t\tdev_err(\u0026tc6-\u003espi-\u003edev,\n+\t\t\t\t\"failed to write STATUS0 register\\n\");\n+\t\t\tgoto out;\n+\t\t}\n+\t}\n+\n+\tret = oa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, irqm);\n+\tif (ret) {\n+\t\tdev_err(\u0026tc6-\u003espi-\u003edev, \"failed to write IRQM register\\n\");\n+\t\tgoto out;\n+\t}\n+\n+\tret = oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, cfg0);\n+\tif (ret) {\n+\t\tdev_err(\u0026tc6-\u003espi-\u003edev, \"failed to write CFG0 register\\n\");\n+\t\tgoto out;\n+\t}\n+\tspin_lock_bh(\u0026tc6-\u003etx_skb_lock);\n+\ttc6-\u003ets_config = *ts_cfg;\n+\tif (cfg0 \u0026 OA_TC6_CONFIG0_FTSE_ENABLE)\n+\t\ttc6-\u003ehw_tstamp_enabled = true;\n+\telse\n+\t\ttc6-\u003ehw_tstamp_enabled = false;\n+\tspin_unlock_bh(\u0026tc6-\u003etx_skb_lock);\n+\n+\t/* The TX timestamp completion interrupt is masked now. Time\n+\t * to release the queued skbs.\n+\t */\n+\tif (ts_cfg-\u003etx_type != HWTSTAMP_TX_ON)\n+\t\toa_tc6_cleanup_tx_tstamp_skbs(tc6);\n+out:\n+\treturn ret;\n+}\n+\n+/**\n+ * oa_tc6_hwtstamp_get - gets hardware timestamp config\n+ * @tc6: oa_tc6 struct.\n+ * @cfg: kernel copy of hardware timestamp config\n+ */\n+void oa_tc6_hwtstamp_get(struct oa_tc6 *tc6,\n+\t\t\t struct kernel_hwtstamp_config *cfg)\n+{\n+\thwtstamp_config_to_kernel(cfg, \u0026tc6-\u003ets_config);\n+}\n+EXPORT_SYMBOL_GPL(oa_tc6_hwtstamp_get);\n+\n+/**\n+ * oa_tc6_hwtstamp_set - sets hardware timestamp config\n+ * @tc6: oa_tc6 struct.\n+ * @cfg: kernel copy of hardware timestamp config\n+ *\n+ * Return: 0 on success otherwise failed.\n+ */\n+int oa_tc6_hwtstamp_set(struct oa_tc6 *tc6,\n+\t\t\tstruct kernel_hwtstamp_config *cfg)\n+{\n+\tstruct hwtstamp_config ts_cfg;\n+\tint ret;\n+\n+\tif (!netif_running(tc6-\u003enetdev))\n+\t\treturn -EIO;\n+\n+\t/* Set only when STDCAP advertised the capability and the PHC\n+\t * registered, which is what ethtool -T reports.\n+\t */\n+\tif (!tc6-\u003eptp_clock)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tswitch (cfg-\u003etx_type) {\n+\tcase HWTSTAMP_TX_OFF:\n+\tcase HWTSTAMP_TX_ON:\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -ERANGE;\n+\t}\n+\n+\tswitch (cfg-\u003erx_filter) {\n+\tcase HWTSTAMP_FILTER_NONE:\n+\tcase HWTSTAMP_FILTER_ALL:\n+\tcase HWTSTAMP_FILTER_SOME:\n+\tcase HWTSTAMP_FILTER_PTP_V1_L4_EVENT:\n+\tcase HWTSTAMP_FILTER_PTP_V1_L4_SYNC:\n+\tcase HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:\n+\tcase HWTSTAMP_FILTER_PTP_V2_L4_EVENT:\n+\tcase HWTSTAMP_FILTER_PTP_V2_L4_SYNC:\n+\tcase HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:\n+\tcase HWTSTAMP_FILTER_PTP_V2_L2_EVENT:\n+\tcase HWTSTAMP_FILTER_PTP_V2_L2_SYNC:\n+\tcase HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:\n+\tcase HWTSTAMP_FILTER_PTP_V2_EVENT:\n+\tcase HWTSTAMP_FILTER_PTP_V2_SYNC:\n+\tcase HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:\n+\tcase HWTSTAMP_FILTER_NTP_ALL:\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -ERANGE;\n+\t}\n+\n+\thwtstamp_config_from_kernel(\u0026ts_cfg, cfg);\n+\n+\t/* Supports timestamping all traffic */\n+\tif (cfg-\u003erx_filter != HWTSTAMP_FILTER_NONE ||\n+\t cfg-\u003etx_type == HWTSTAMP_TX_ON)\n+\t\tts_cfg.rx_filter = HWTSTAMP_FILTER_ALL;\n+\n+\tret = oa_tc6_set_hwtstamp_settings(tc6, \u0026ts_cfg);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Report what was programmed, not asked. */\n+\tcfg-\u003erx_filter = ts_cfg.rx_filter;\n+\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(oa_tc6_hwtstamp_set);\n+\n+/**\n+ * oa_tc6_get_ts_stats - Provides timestamping stats\n+ * @tc6: oa_tc6 struct.\n+ * @stats: ethtool data structure to fill in\n+ */\n+void oa_tc6_get_ts_stats(struct oa_tc6 *tc6,\n+\t\t\t struct ethtool_ts_stats *stats)\n+{\n+\tstats-\u003epkts = tc6-\u003etx_hwtstamp_pkts;\n+\tstats-\u003eerr = tc6-\u003etx_hwtstamp_err;\n+\tstats-\u003elost = tc6-\u003etx_hwtstamp_lost;\n+}\n+EXPORT_SYMBOL_GPL(oa_tc6_get_ts_stats);\n+\n+/**\n+ * oa_tc6_get_ts_info - Provides timestamp info for ethtool\n+ * @tc6: oa_tc6 struct.\n+ * @info: ethtool timestamping info structure\n+ *\n+ * Return: 0 on success otherwise failed.\n+ */\n+int oa_tc6_get_ts_info(struct oa_tc6 *tc6,\n+\t\t struct kernel_ethtool_ts_info *info)\n+{\n+\tif (!tc6-\u003eptp_clock)\n+\t\treturn ethtool_op_get_ts_info(tc6-\u003enetdev, info);\n+\n+\tinfo-\u003eso_timestamping = SOF_TIMESTAMPING_RAW_HARDWARE |\n+\t\t\t\tSOF_TIMESTAMPING_TX_HARDWARE |\n+\t\t\t\tSOF_TIMESTAMPING_RX_HARDWARE;\n+\tinfo-\u003ephc_index = ptp_clock_index(tc6-\u003eptp_clock);\n+\tinfo-\u003etx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON);\n+\tinfo-\u003erx_filters = BIT(HWTSTAMP_FILTER_NONE) |\n+\t\t\t BIT(HWTSTAMP_FILTER_ALL);\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(oa_tc6_get_ts_info);\ndiff --git a/drivers/net/ethernet/onsemi/Kconfig b/drivers/net/ethernet/onsemi/Kconfig\nnew file mode 100644\nindex 0000000000000..484de609462a7\n--- /dev/null\n+++ b/drivers/net/ethernet/onsemi/Kconfig\n@@ -0,0 +1,22 @@\n+# SPDX-License-Identifier: GPL-2.0-only\n+#\n+# onsemi network device configuration\n+#\n+\n+config NET_VENDOR_ONSEMI\n+\tbool \"onsemi network devices\"\n+\tdefault y\n+\thelp\n+\t If you have a network card belonging to this class, say Y.\n+\n+\t Note that the answer to this question doesn't directly affect the\n+\t kernel: saying N will just cause the configurator to skip all\n+\t the questions about onsemi ethernet devices. If you say Y, you\n+\t will be asked for your specific card in the following questions.\n+\n+if NET_VENDOR_ONSEMI\n+\n+source \"drivers/net/ethernet/onsemi/s2500/Kconfig\"\n+\n+endif # NET_VENDOR_ONSEMI\n+\ndiff --git a/drivers/net/ethernet/onsemi/Makefile b/drivers/net/ethernet/onsemi/Makefile\nnew file mode 100644\nindex 0000000000000..f3d4eb154313c\n--- /dev/null\n+++ b/drivers/net/ethernet/onsemi/Makefile\n@@ -0,0 +1,7 @@\n+# SPDX-License-Identifier: GPL-2.0-only\n+#\n+# Makefile for the onsemi network device drivers.\n+#\n+\n+obj-$(CONFIG_S2500_MACPHY) += s2500/\n+\ndiff --git a/drivers/net/ethernet/onsemi/s2500/Kconfig b/drivers/net/ethernet/onsemi/s2500/Kconfig\nnew file mode 100644\nindex 0000000000000..abd967448af07\n--- /dev/null\n+++ b/drivers/net/ethernet/onsemi/s2500/Kconfig\n@@ -0,0 +1,21 @@\n+# SPDX-License-Identifier: GPL-2.0-only\n+#\n+# onsemi S2500 Driver Support\n+#\n+\n+config S2500_MACPHY\n+\ttristate \"S2500 support\"\n+\tdepends on SPI\n+\tdepends on PTP_1588_CLOCK_OPTIONAL\n+\timply NET_SELFTESTS\n+\tselect BITREVERSE\n+\tselect NCN26000_PHY\n+\tselect OA_TC6\n+\thelp\n+\t Support for the onsemi S2500 MACPHY Ethernet chip.\n+\t It works under the framework that conform to OPEN Alliance\n+\t 10BASE-T1x Serial Interface specification.\n+\n+\t To compile this driver as a module, choose M here. The module will be\n+\t called s2500.\n+\ndiff --git a/drivers/net/ethernet/onsemi/s2500/Makefile b/drivers/net/ethernet/onsemi/s2500/Makefile\nnew file mode 100644\nindex 0000000000000..61ec705cdf9f1\n--- /dev/null\n+++ b/drivers/net/ethernet/onsemi/s2500/Makefile\n@@ -0,0 +1,7 @@\n+# SPDX-License-Identifier: GPL-2.0-only\n+#\n+# Makefile for the onsemi network device drivers.\n+#\n+obj-$(CONFIG_S2500_MACPHY) := s2500.o\n+s2500-objs := s2500_main.o s2500_ethtool.o s2500_ptp.o\n+\ndiff --git a/drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c b/drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c\nnew file mode 100644\nindex 0000000000000..12e59e8d44a62\n--- /dev/null\n+++ b/drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c\n@@ -0,0 +1,383 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright 2026 Semiconductor Components Industries, LLC (\"onsemi\").\n+ * onsemi's S2500 10BASE-T1S MAC-PHY driver\n+ */\n+\n+#include \u003clinux/ethtool.h\u003e\n+#include \u003cnet/selftests.h\u003e\n+#include \u003clinux/phy.h\u003e\n+\n+#include \"s2500_hw_def.h\"\n+\n+#define S2500_NUM_REGS\t\t\t38\n+#define S2500_REGDUMP_LEN\t\t(sizeof(u32) * (S2500_NUM_REGS * 2))\n+\n+#define S2500_NUM_MAC_STATS\t\t1\n+#define S2500_NUM_RMON_STATS\t\t12\n+\n+struct s2500_reg_map {\n+\tu16 reg;\n+\tu8 mms;\n+};\n+\n+static const struct s2500_reg_map s2500_reg_map[S2500_NUM_REGS] = {\n+\t{ S2500_REG_VS_ONIPVER, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_TWEAKS1, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_PLCAEXT, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_PMATUNE0, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_PMATUNE1, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_T1SWUPTUNE, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_HDD, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_DCQ_TOID, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_DCQ_SQI, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_DCQ_SQI_PLUS, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_HDD_TUNE1, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_HDD_TUNE2, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_HDD_TUNE3, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_WS_STATUS_0, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_WS_CTRL_0, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_WS_STATUS_1, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_WS_CTRL_1, OA_TC6_PHY_C45_VS_PLCA_MMS4 },\n+\t{ S2500_REG_VS_MIIMIRQE, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_MIIMIRQS, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_DIOCFG0, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_CHIPID, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_TWEAKS2, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_MACID0, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_MACID1, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_NVM_HEALTH, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_PTP_SEC, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_PTPNSEC, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_PTP_SETSEC, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_SETNSEC, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_PTP_ADJ, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_CMPCTL, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_CMPSEC, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_CMPNSEC, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_CMPPER, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_CAPCTL, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_CAPSEC, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_CAPNSEC, OA_TC6_PHY_C45_VS_MMS12 },\n+\t{ S2500_REG_VS_BCNCNT, OA_TC6_PHY_C45_VS_MMS12 },\n+};\n+\n+enum s2500_stat_idx {\n+\tS2500_MSTOCTECTSTX_IDX = 0,\n+\tS2500_MSTFRAMESTXOK_IDX,\n+\tS2500_MSTBCASTTXOK_IDX,\n+\tS2500_MSTMCASTTXOK_IDX,\n+\tS2500_MSTFRAMESTX64_IDX,\n+\tS2500_MSTFRAMESTX65_IDX,\n+\tS2500_MSTFRAMESTX128_IDX,\n+\tS2500_MSTFRAMESTX256_IDX,\n+\tS2500_MSTFRAMESTX512_IDX,\n+\tS2500_MSTFRAMESTX1024_IDX,\n+\tS2500_MSTTXUNDEFLOW_IDX,\n+\tS2500_MSTSINGLECOL_IDX,\n+\tS2500_MSTMULTICOL_IDX,\n+\tS2500_MSTEXCESSCOL_IDX,\n+\tS2500_MSTDEFERREDTX_IDX,\n+\tS2500_MSTCRSERR_IDX,\n+\tS2500_MSTOCTECTSRX_IDX,\n+\tS2500_MSTFRAMESRXOK_IDX,\n+\tS2500_MSTBCASTRXOK_IDX,\n+\tS2500_MSTMCASTRXOK_IDX,\n+\tS2500_MSTFRAMESRX64_IDX,\n+\tS2500_MSTFRAMESRX65_IDX,\n+\tS2500_MSTFRAMESRX128_IDX,\n+\tS2500_MSTFRAMESRX256_IDX,\n+\tS2500_MSTFRAMESRX512_IDX,\n+\tS2500_MSTFRAMESRX1024_IDX,\n+\tS2500_MSTRUNTSERR_IDX,\n+\tS2500_MSTRXTOOLONG_IDX,\n+\tS2500_MSTFCSERRS_IDX,\n+\tS2500_MSTSYMBOLERRS_IDX,\n+\tS2500_MSTALIGNERRS_IDX,\n+\tS2500_MSTRXOVERFLOW_IDX,\n+\tS2500_MSTRXDROPPED_IDX,\n+};\n+\n+static const char s2500_mac_stat_strings[][ETH_GSTRING_LEN] = {\n+\t\"rx_mismatch_drops\",\n+};\n+\n+static const u8 s2500_mac_stat_map[S2500_NUM_MAC_STATS] = {\n+\tS2500_MSTRXDROPPED_IDX,\n+};\n+\n+static const u8 s2500_rmon_stat_map[S2500_NUM_RMON_STATS] = {\n+\tS2500_MSTFRAMESTX64_IDX,\n+\tS2500_MSTFRAMESTX65_IDX,\n+\tS2500_MSTFRAMESTX128_IDX,\n+\tS2500_MSTFRAMESTX256_IDX,\n+\tS2500_MSTFRAMESTX512_IDX,\n+\tS2500_MSTFRAMESTX1024_IDX,\n+\tS2500_MSTFRAMESRX64_IDX,\n+\tS2500_MSTFRAMESRX65_IDX,\n+\tS2500_MSTFRAMESRX128_IDX,\n+\tS2500_MSTFRAMESRX256_IDX,\n+\tS2500_MSTFRAMESRX512_IDX,\n+\tS2500_MSTFRAMESRX1024_IDX,\n+};\n+\n+static const struct ethtool_rmon_hist_range s2500_rmon_hist_ranges[] = {\n+\t{ 64, 64 },\n+\t{ 65, 127 },\n+\t{ 128, 255 },\n+\t{ 256, 511 },\n+\t{ 512, 1023 },\n+\t{ 1024, 2000 },\n+\t{ },\n+};\n+\n+#define S2500_MAC_STATS_LEN ARRAY_SIZE(s2500_mac_stat_strings)\n+static_assert(S2500_MAC_STATS_LEN == S2500_NUM_MAC_STATS);\n+static_assert(ARRAY_SIZE(s2500_mac_stat_map) == S2500_NUM_MAC_STATS);\n+static_assert(ARRAY_SIZE(s2500_rmon_stat_map) == S2500_NUM_RMON_STATS);\n+\n+#define STAT_REG_OFFSET(x) ((S2500_REG_MAC_ST##x) - \\\n+\t\t\t S2500_REG_MAC_FIRST_STAT)\n+\n+static void s2500_update_stats(struct s2500_info *priv)\n+{\n+\tu64 *data = priv-\u003estats_data;\n+\tu32 *regs, *rptr, addr;\n+\tint ret;\n+\n+\tif (time_is_after_jiffies(priv-\u003estats_read_at +\n+\t\t\t\t S2500_STATS_CACHE_PERIOD))\n+\t\treturn;\n+\n+\tregs = kmalloc_array(S2500_NUM_STAT_REGS, sizeof(u32), GFP_KERNEL);\n+\tif (!regs)\n+\t\treturn;\n+\n+\taddr = FIELD_PREP(S2500_REG_MMS_MASK, OA_TC6_MAC_MMS1) |\n+\t\t\t S2500_REG_MAC_STOCTECTSTXL;\n+\tret = oa_tc6_read_registers(priv-\u003etc6, addr, regs,\n+\t\t\t\t S2500_NUM_STAT_REGS);\n+\tif (ret)\n+\t\tgoto out;\n+\n+\tpriv-\u003estats_read_at = jiffies;\n+\trptr = regs;\n+\n+\t/* TX bytes is a 64-bit value that is stored in two regs.\n+\t * When lower 32 bits are read from OCTETS-L register,\n+\t * upper bits are sampled and stored in OCTETS-H register.\n+\t * Request to read multiple registers reads OCTETS-L first.\n+\t * This way, counter value is read in an atomic manner.\n+\t */\n+\t*(data++) += ((u64)*rptr) | (((u64)*(rptr + 1)) \u003c\u003c 32);\n+\n+\t/* Rest are 32-bit values until RX bytes register. */\n+\tfor (rptr += 2; (rptr - regs) \u003c STAT_REG_OFFSET(OCTECTSRXL); ++rptr)\n+\t\t*(data++) += *rptr;\n+\n+\t/* RX bytes is a 64-bit value that is stored in two regs.\n+\t * Like TX bytes counter, value is read atomically from\n+\t * registers.\n+\t */\n+\t*(data++) += ((u64)*rptr) | (((u64)*(rptr + 1)) \u003c\u003c 32);\n+\n+\tfor (rptr += 2; (rptr - regs) \u003c S2500_NUM_STAT_REGS; ++rptr)\n+\t\t*(data++) += *rptr;\n+out:\n+\tkfree(regs);\n+}\n+\n+static void s2500_get_drvinfo(struct net_device *ndev,\n+\t\t\t struct ethtool_drvinfo *info)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\n+\tstrscpy(info-\u003edriver, DRV_NAME, sizeof(info-\u003edriver));\n+\tstrscpy(info-\u003ebus_info, dev_name(\u0026priv-\u003espi-\u003edev),\n+\t\tsizeof(info-\u003ebus_info));\n+}\n+\n+static int s2500_get_sset_count(struct net_device *ndev, int sset)\n+{\n+\tswitch (sset) {\n+\tcase ETH_SS_STATS:\n+\t\treturn S2500_MAC_STATS_LEN;\n+\tcase ETH_SS_TEST:\n+\t\treturn net_selftest_get_count();\n+\tdefault:\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+}\n+\n+static void s2500_get_strings(struct net_device *ndev, u32 stringset,\n+\t\t\t u8 *buf)\n+{\n+\tswitch (stringset) {\n+\tcase ETH_SS_STATS:\n+\t\tmemcpy(buf, s2500_mac_stat_strings,\n+\t\t S2500_MAC_STATS_LEN * ETH_GSTRING_LEN);\n+\t\tbreak;\n+\tcase ETH_SS_TEST:\n+\t\tnet_selftest_get_strings(buf);\n+\t\tbreak;\n+\t}\n+}\n+\n+static void s2500_get_ethtool_stats(struct net_device *ndev,\n+\t\t\t\t struct ethtool_stats *stats, u64 *data)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\tint i;\n+\n+\ts2500_update_stats(priv);\n+\tfor (i = 0; i \u003c S2500_NUM_MAC_STATS; i++)\n+\t\tdata[i] = priv-\u003estats_data[s2500_mac_stat_map[i]];\n+}\n+\n+static void s2500_get_eth_mac_stats(struct net_device *ndev,\n+\t\t\t\t struct ethtool_eth_mac_stats *mac_stats)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\tconst u64 *st;\n+\n+\tif (mac_stats-\u003esrc != ETHTOOL_MAC_STATS_SRC_AGGREGATE)\n+\t\treturn;\n+\n+\ts2500_update_stats(priv);\n+\tst = priv-\u003estats_data;\n+\n+\tmac_stats-\u003eOctetsTransmittedOK = st[S2500_MSTOCTECTSTX_IDX];\n+\tmac_stats-\u003eFramesTransmittedOK = st[S2500_MSTFRAMESTXOK_IDX];\n+\tmac_stats-\u003eBroadcastFramesXmittedOK = st[S2500_MSTBCASTTXOK_IDX];\n+\tmac_stats-\u003eMulticastFramesXmittedOK = st[S2500_MSTMCASTTXOK_IDX];\n+\tmac_stats-\u003eSingleCollisionFrames = st[S2500_MSTSINGLECOL_IDX];\n+\tmac_stats-\u003eMultipleCollisionFrames = st[S2500_MSTMULTICOL_IDX];\n+\tmac_stats-\u003eFramesAbortedDueToXSColls = st[S2500_MSTEXCESSCOL_IDX];\n+\tmac_stats-\u003eFramesWithDeferredXmissions = st[S2500_MSTDEFERREDTX_IDX];\n+\tmac_stats-\u003eCarrierSenseErrors = st[S2500_MSTCRSERR_IDX];\n+\tmac_stats-\u003eFramesLostDueToIntMACXmitError =\n+\t\tst[S2500_MSTTXUNDEFLOW_IDX];\n+\tmac_stats-\u003eOctetsReceivedOK = st[S2500_MSTOCTECTSRX_IDX];\n+\tmac_stats-\u003eFramesReceivedOK = st[S2500_MSTFRAMESRXOK_IDX];\n+\tmac_stats-\u003eBroadcastFramesReceivedOK = st[S2500_MSTBCASTRXOK_IDX];\n+\tmac_stats-\u003eMulticastFramesReceivedOK = st[S2500_MSTMCASTRXOK_IDX];\n+\tmac_stats-\u003eFrameTooLongErrors = st[S2500_MSTRXTOOLONG_IDX];\n+\tmac_stats-\u003eFrameCheckSequenceErrors = st[S2500_MSTFCSERRS_IDX];\n+\tmac_stats-\u003eAlignmentErrors = st[S2500_MSTALIGNERRS_IDX];\n+\tmac_stats-\u003eFramesLostDueToIntMACRcvError =\n+\t\tst[S2500_MSTRXOVERFLOW_IDX];\n+}\n+\n+static void s2500_get_eth_phy_stats(struct net_device *ndev,\n+\t\t\t\t struct ethtool_eth_phy_stats *phy_stats)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\n+\tif (phy_stats-\u003esrc != ETHTOOL_MAC_STATS_SRC_AGGREGATE)\n+\t\treturn;\n+\n+\ts2500_update_stats(priv);\n+\tphy_stats-\u003eSymbolErrorDuringCarrier =\n+\t\tpriv-\u003estats_data[S2500_MSTSYMBOLERRS_IDX];\n+}\n+\n+static void s2500_rmon_stats(struct net_device *ndev,\n+\t\t\t struct ethtool_rmon_stats *rmon_stats,\n+\t\t\t const struct ethtool_rmon_hist_range **ranges)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\tu8 offset;\n+\tint i;\n+\n+\tif (rmon_stats-\u003esrc != ETHTOOL_MAC_STATS_SRC_AGGREGATE)\n+\t\treturn;\n+\n+\ts2500_update_stats(priv);\n+\n+\trmon_stats-\u003eundersize_pkts = priv-\u003estats_data[S2500_MSTRUNTSERR_IDX];\n+\trmon_stats-\u003eoversize_pkts = priv-\u003estats_data[S2500_MSTRXTOOLONG_IDX];\n+\n+\tfor (i = 0; i \u003c 6; i++) {\n+\t\toffset = s2500_rmon_stat_map[i];\n+\t\trmon_stats-\u003ehist_tx[i] = priv-\u003estats_data[offset];\n+\t}\n+\n+\tfor (i = 0; i \u003c 6; i++) {\n+\t\toffset = s2500_rmon_stat_map[i + 6];\n+\t\trmon_stats-\u003ehist[i] = priv-\u003estats_data[offset];\n+\t}\n+\n+\t*ranges = s2500_rmon_hist_ranges;\n+}\n+\n+static int s2500_get_ts_info(struct net_device *ndev,\n+\t\t\t struct kernel_ethtool_ts_info *ts_info)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\n+\treturn oa_tc6_get_ts_info(priv-\u003etc6, ts_info);\n+}\n+\n+static int s2500_get_regs_len(struct net_device *dev)\n+{\n+\treturn S2500_REGDUMP_LEN;\n+}\n+\n+static void s2500_get_regs(struct net_device *ndev,\n+\t\t\t struct ethtool_regs *regs, void *p)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\t__be32 *pbuff = p;\n+\tint ret = 0;\n+\tu32 val;\n+\tu16 reg;\n+\tu8 mms;\n+\tint i;\n+\n+\tregs-\u003eversion = 0;\n+\tmemset(p, 0, S2500_REGDUMP_LEN);\n+\n+\tif (!netif_running(ndev))\n+\t\treturn;\n+\n+\tfor (i = 0; i \u003c S2500_NUM_REGS; i++) {\n+\t\tval = 0;\n+\t\treg = s2500_reg_map[i].reg;\n+\t\tmms = s2500_reg_map[i].mms;\n+\t\tret = oa_tc6_read_register_mms(priv-\u003etc6, mms, reg,\n+\t\t\t\t\t \u0026val);\n+\n+\t\t/* Write a pattern to indicate failure */\n+\t\tif (ret)\n+\t\t\tval = 0xDEADC0DE;\n+\t\t*pbuff++ = cpu_to_be32(((u32)mms \u003c\u003c 16) | reg);\n+\t\t*pbuff++ = cpu_to_be32(val);\n+\t}\n+}\n+\n+static void s2500_get_ts_stats(struct net_device *ndev,\n+\t\t\t struct ethtool_ts_stats *ts_stats)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\n+\toa_tc6_get_ts_stats(priv-\u003etc6, ts_stats);\n+}\n+\n+const struct ethtool_ops s2500_ethtool_ops = {\n+\t.get_drvinfo = s2500_get_drvinfo,\n+\t.get_link = ethtool_op_get_link,\n+\t.get_link_ksettings = phy_ethtool_get_link_ksettings,\n+\t.set_link_ksettings = phy_ethtool_set_link_ksettings,\n+\t.get_ts_stats = s2500_get_ts_stats,\n+\t.get_sset_count = s2500_get_sset_count,\n+\t.get_strings = s2500_get_strings,\n+\t.get_ethtool_stats = s2500_get_ethtool_stats,\n+\t.get_eth_mac_stats = s2500_get_eth_mac_stats,\n+\t.get_eth_phy_stats = s2500_get_eth_phy_stats,\n+\t.get_rmon_stats = s2500_rmon_stats,\n+\t.get_ts_info = s2500_get_ts_info,\n+\t.get_regs_len = s2500_get_regs_len,\n+\t.get_regs = s2500_get_regs,\n+\t.self_test = net_selftest,\n+};\n+\ndiff --git a/drivers/net/ethernet/onsemi/s2500/s2500_hw_def.h b/drivers/net/ethernet/onsemi/s2500/s2500_hw_def.h\nnew file mode 100644\nindex 0000000000000..0d0b335a397a9\n--- /dev/null\n+++ b/drivers/net/ethernet/onsemi/s2500/s2500_hw_def.h\n@@ -0,0 +1,160 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright 2026 Semiconductor Components Industries, LLC (\"onsemi\").\n+ * onsemi's S2500 10BASE-T1S MAC-PHY driver\n+ */\n+\n+#ifndef S2500_HW_DEF_H\n+#define S2500_HW_DEF_H\n+\n+#include \u003clinux/kernel.h\u003e\n+#include \u003clinux/netdevice.h\u003e\n+#include \u003clinux/spi/spi.h\u003e\n+#include \u003clinux/phylink.h\u003e\n+#include \u003clinux/net_tstamp.h\u003e\n+#include \u003clinux/ptp_clock_kernel.h\u003e\n+#include \u003clinux/delay.h\u003e\n+#include \u003clinux/mutex.h\u003e\n+#include \u003clinux/ktime.h\u003e\n+#include \u003clinux/errno.h\u003e\n+#include \u003clinux/oa_tc6.h\u003e\n+\n+#define DRV_NAME\t\t\t\"s2500\"\n+\n+#define S2500_N_MCAST_FILTERS\t\t3\n+\n+#define S2500_REG_MMS_MASK\t\tGENMASK(19, 16)\n+\n+/* SPI OID and model register */\n+#define S2500_REG_PHYID\t\t\t0x1\n+\n+#define S2500_PHYID_OUI_SHIFT\t\t10\n+#define S2500_PHYID_OUI_MASK\t\tGENMASK(31, S2500_PHYID_OUI_SHIFT)\n+#define S2500_PHYID_OUI_MASK0\t\tGENMASK(21, 16)\n+#define S2500_PHYID_OUI_MASK1\t\tGENMASK(15, 8)\n+#define S2500_PHYID_OUI_MASK2\t\tGENMASK(7, 0)\n+\n+#define S2500_CONFIG0_TXCTHRESH_SHIFT\t10\n+#define S2500_CONFIG0_RXCTE\t\tBIT(8)\n+#define S2500_CONFIG0_CPS_SHIFT\t\t0\n+#define S2500_CONFIG0_TXCTHRESH_8\t0x2\n+#define S2500_CONFIG0_CPS_64\t\t0x6\n+\n+/* Read only bit in STATUS0 register */\n+#define S2500_STATUS0_PHY_INT\t\tBIT(7)\n+\n+#define S2500_REG_MAC_CTRL\t\t0x0\n+\n+#define S2500_MAC_CTRL_MCSF\t\tBIT(18)\n+#define S2500_MAC_CTRL_ADRF\t\tBIT(16)\n+#define S2500_MAC_CTRL_FCSA\t\tBIT(8)\n+#define S2500_MAC_CTRL_TXEN\t\tBIT(1)\n+#define S2500_MAC_CTRL_RXEN\t\tBIT(0)\n+\n+/* MAC address filter registers */\n+#define S2500_REG_MAC_ADDRFILTL(n)\t(16 + 2 * (n))\n+#define S2500_REG_MAC_ADDRFILTH(n)\t(17 + 2 * (n))\n+#define S2500_REG_MAC_ADDRMASKL(n)\t(32 + 2 * (n))\n+#define S2500_REG_MAC_ADDRMASKH(n)\t(33 + 2 * (n))\n+\n+#define S2500_MAC_ADDRFILT_ENABLE\tBIT(31)\n+\n+/* MAC statistic registers */\n+#define S2500_REG_MAC_STOCTECTSTXL\t48\n+#define S2500_REG_MAC_STOCTECTSTXH\t49\n+#define S2500_REG_MAC_STOCTECTSRXL\t65\n+#define S2500_REG_MAC_STOCTECTSRXH\t66\n+#define S2500_REG_MAC_STRXDROPPED\t82\n+\n+/* First/last statistic register for sequential access */\n+#define S2500_REG_MAC_FIRST_STAT\tS2500_REG_MAC_STOCTECTSTXL\n+#define S2500_REG_MAC_LAST_STAT\t\tS2500_REG_MAC_STRXDROPPED\n+\n+#define S2500_NUM_STAT_REGS \\\n+\t(S2500_REG_MAC_LAST_STAT - S2500_REG_MAC_FIRST_STAT + 1)\n+#define S2500_NUM_STAT_VARS\t\t(S2500_NUM_STAT_REGS - 2)\n+#define S2500_STATS_CACHE_PERIOD\tmsecs_to_jiffies(100)\n+\n+/* Vendor specific MMS4 registers */\n+#define S2500_REG_VS_ONIPVER\t\t0x8000\n+#define S2500_REG_VS_TWEAKS1\t\t0x8001\n+#define S2500_REG_VS_PLCAEXT\t\t0x8002\n+#define S2500_REG_VS_PMATUNE0\t\t0x8003\n+#define S2500_REG_VS_PMATUNE1\t\t0x8004\n+#define S2500_REG_VS_T1SWUPTUNE\t\t0x8007\n+#define S2500_REG_VS_HDD\t\t0xCC01\n+#define S2500_REG_VS_DCQ_TOID\t\t0xCC02\n+#define S2500_REG_VS_DCQ_SQI\t\t0xCC03\n+#define S2500_REG_VS_DCQ_SQI_PLUS\t0xCC04\n+#define S2500_REG_VS_HDD_TUNE1\t\t0xCD00\n+#define S2500_REG_VS_HDD_TUNE2\t\t0xCD01\n+#define S2500_REG_VS_HDD_TUNE3\t\t0xCD02\n+#define S2500_REG_VS_WS_STATUS_0\t0xD000\n+#define S2500_REG_VS_WS_CTRL_0\t\t0xD001\n+#define S2500_REG_VS_WS_STATUS_1\t0xD100\n+#define S2500_REG_VS_WS_CTRL_1\t\t0xD101\n+\n+/* Vendor specific MMS12 registers */\n+#define S2500_REG_VS_MIIMIRQE\t\t0x10\n+\n+/* MIIM IRQ status register */\n+#define S2500_REG_VS_MIIMIRQS\t\t0x11\n+\n+#define S2500_REG_VS_DIOCFG0\t\t0x12\n+\n+#define S2500_REG_VS_CHIPID\t\t0x1000\n+#define S2500_REG_VS_TWEAKS2\t\t0x1001\n+\n+/* Permanent MAC address register */\n+#define S2500_REG_VS_MACID0\t\t0x1002\n+#define S2500_VS_MACID0_BYTE4_MASK\tGENMASK(15, 8)\n+#define S2500_VS_MACID0_BYTE5_MASK\tGENMASK(7, 0)\n+\n+#define S2500_REG_VS_MACID1\t\t0x1003\n+#define S2500_VS_MACID1_BYTE3_MASK\tGENMASK(7, 0)\n+#define S2500_REG_VS_NVM_HEALTH\t\t0x1005\n+\n+/* PTP registers */\n+#define S2500_REG_VS_PTP_SEC\t\t0x1010\n+#define S2500_REG_VS_PTP_SETSEC\t\t0x1012\n+#define S2500_REG_VS_PTP_ADJ\t\t0x1014\n+\n+/* Frequency adjust magnitude, 1 LSB = 0.000125 ppm = 1/8 ppb */\n+#define S2500_PTP_ADJ_MAX\t\tGENMASK(27, 0)\n+#define S2500_PTP_MAX_ADJ_PPB\t\t(S2500_PTP_ADJ_MAX / 8)\n+#define S2500_REG_VS_PTPNSEC\t\t0x1011\n+#define S2500_REG_VS_SETNSEC\t\t0x1013\n+#define S2500_REG_VS_CMPCTL\t\t0x1015\n+#define S2500_REG_VS_CMPSEC\t\t0x1016\n+#define S2500_REG_VS_CMPNSEC\t\t0x1017\n+#define S2500_REG_VS_CMPPER\t\t0x1018\n+#define S2500_REG_VS_CAPCTL\t\t0x1019\n+#define S2500_REG_VS_CAPSEC\t\t0x101A\n+#define S2500_REG_VS_CAPNSEC\t\t0x101B\n+#define S2500_REG_VS_BCNCNT\t\t0x101C\n+\n+/* prototypes / forward declarations */\n+extern const struct ethtool_ops s2500_ethtool_ops;\n+\n+struct s2500_info {\n+\tstruct device *dev;\n+\tstruct net_device *ndev;\n+\n+\t/* To have atomic operation for PTP time registers */\n+\tstruct mutex ptp_adj_lock;\n+\n+\tstruct spi_device *spi;\n+\n+\t/* statistic counters variables */\n+\tu64 stats_data[S2500_NUM_STAT_VARS];\n+\tunsigned long stats_read_at;\n+\n+\t/* PTP related variables */\n+\tstruct ptp_clock_info ptp_clock_info;\n+\tstruct oa_tc6 *tc6;\n+};\n+\n+int s2500_ptp_register(struct s2500_info *priv);\n+\n+#endif /* S2500_HW_DEF_H */\n+\ndiff --git a/drivers/net/ethernet/onsemi/s2500/s2500_main.c b/drivers/net/ethernet/onsemi/s2500/s2500_main.c\nnew file mode 100644\nindex 0000000000000..4cd0f5d106665\n--- /dev/null\n+++ b/drivers/net/ethernet/onsemi/s2500/s2500_main.c\n@@ -0,0 +1,523 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright 2026 Semiconductor Components Industries, LLC (\"onsemi\").\n+ * onsemi's S2500 10BASE-T1S MAC-PHY driver\n+ */\n+\n+#include \u003clinux/etherdevice.h\u003e\n+#include \u003clinux/if_ether.h\u003e\n+#include \u003clinux/irqchip.h\u003e\n+#include \u003clinux/module.h\u003e\n+#include \u003clinux/platform_device.h\u003e\n+#include \u003clinux/bitrev.h\u003e\n+#include \u003clinux/phy.h\u003e\n+\n+#include \"s2500_hw_def.h\"\n+\n+/* Initializes the net device MAC address by reading the UID stored\n+ * into the device internal non-volatile memory.\n+ */\n+static int s2500_read_mac_from_nvmem(struct s2500_info *priv)\n+{\n+\tu8 mms = OA_TC6_PHY_C45_VS_MMS12;\n+\tu8 addr[ETH_ALEN];\n+\tu32 mac1 = 0;\n+\tu32 mac0 = 0;\n+\tu32 val;\n+\tint ret;\n+\n+\tret = oa_tc6_read_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t S2500_REG_VS_MACID1, \u0026mac1);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = oa_tc6_read_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t S2500_REG_VS_MACID0, \u0026mac0);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Pre-production parts may have 0 */\n+\tif (mac0 == 0 \u0026\u0026 mac1 == 0)\n+\t\treturn -ENXIO;\n+\n+\tret = oa_tc6_read_register(priv-\u003etc6, S2500_REG_PHYID, \u0026val);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tval = (val \u0026 S2500_PHYID_OUI_MASK) \u003e\u003e S2500_PHYID_OUI_SHIFT;\n+\n+\t/* Mapping for bits from PHY ID register to OUI as give below.\n+\t * - PHY-ID[10:17] provides OUI[16:23]\n+\t * - PHY-ID[18:25] provides OUI[8:15]\n+\t * - PHY-ID[26:31] provides OUI[2:7]\n+\t *\n+\t * Hardware presents OUI such a way that this requires not just\n+\t * byte level swap, bit level swap is needed as well.\n+\t */\n+\taddr[0] = bitrev8(FIELD_GET(S2500_PHYID_OUI_MASK0, val));\n+\taddr[1] = bitrev8(FIELD_GET(S2500_PHYID_OUI_MASK1, val));\n+\taddr[2] = bitrev8(FIELD_GET(S2500_PHYID_OUI_MASK2, val));\n+\n+\taddr[3] = FIELD_GET(S2500_VS_MACID1_BYTE3_MASK, mac1);\n+\taddr[4] = FIELD_GET(S2500_VS_MACID0_BYTE4_MASK, mac0);\n+\taddr[5] = FIELD_GET(S2500_VS_MACID0_BYTE5_MASK, mac0);\n+\n+\t__dev_addr_set(priv-\u003endev, addr, ETH_ALEN);\n+\tpriv-\u003endev-\u003eaddr_assign_type = NET_ADDR_PERM;\n+\treturn ret;\n+}\n+\n+/* Writes MAC address to macphy registers */\n+static int s2500_set_mac_filter(struct net_device *ndev, const u8 *mac)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\tu8 mms = OA_TC6_MAC_MMS1;\n+\tu32 val;\n+\tint ret;\n+\n+\t/* Set unicast address filter */\n+\tret = oa_tc6_write_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t\tS2500_REG_MAC_ADDRMASKL(0),\n+\t\t\t\t\t0xffffffff);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = oa_tc6_write_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t\tS2500_REG_MAC_ADDRMASKH(0),\n+\t\t\t\t\t0xffff);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tval = get_unaligned_be32(\u0026mac[2]);\n+\n+\tret = oa_tc6_write_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t\tS2500_REG_MAC_ADDRFILTL(0),\n+\t\t\t\t\tval);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tval = S2500_MAC_ADDRFILT_ENABLE | get_unaligned_be16(mac);\n+\n+\treturn oa_tc6_write_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t\t S2500_REG_MAC_ADDRFILTH(0),\n+\t\t\t\t\t val);\n+}\n+\n+static int s2500_mac_ctrl_modify_bits(struct s2500_info *priv,\n+\t\t\t\t u32 in_bits, bool clr)\n+{\n+\tu32 reg = S2500_REG_MAC_CTRL;\n+\tu8 mms = OA_TC6_MAC_MMS1;\n+\tu32 rval = 0;\n+\tu32 wval = 0;\n+\tint ret;\n+\n+\tret = oa_tc6_read_register_mms(priv-\u003etc6, mms, reg, \u0026rval);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (clr)\n+\t\twval = rval \u0026 ~in_bits;\n+\telse\n+\t\twval = rval | in_bits;\n+\tif (rval != wval)\n+\t\tret = oa_tc6_write_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t\t\treg, wval);\n+\treturn ret;\n+}\n+\n+static int s2500_init(struct s2500_info *priv)\n+{\n+\tu32 val;\n+\tint ret;\n+\n+\t/* Configure MAC-PHY's behavior */\n+\tval = OA_TC6_CONFIG0_SYNC | S2500_CONFIG0_RXCTE |\n+\t (S2500_CONFIG0_TXCTHRESH_8 \u003c\u003c\n+\t S2500_CONFIG0_TXCTHRESH_SHIFT) |\n+\t (S2500_CONFIG0_CPS_64 \u003c\u003c S2500_CONFIG0_CPS_SHIFT) |\n+\t OA_TC6_CONFIG0_FTSS_64BIT_TSTAMP;\n+\n+\tret = oa_tc6_write_register(priv-\u003etc6, OA_TC6_REG_CONFIG0,\n+\t\t\t\t val);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Program the source MAC address into the device */\n+\tret = s2500_set_mac_filter(priv-\u003endev, priv-\u003endev-\u003edev_addr);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tval = S2500_MAC_CTRL_ADRF | S2500_MAC_CTRL_FCSA;\n+\n+\treturn s2500_mac_ctrl_modify_bits(priv, val, false);\n+}\n+\n+static void s2500_shutdown(struct s2500_info *priv)\n+{\n+\tu32 val = S2500_MAC_CTRL_TXEN | S2500_MAC_CTRL_RXEN;\n+\tstruct net_device *ndev = priv-\u003endev;\n+\n+\tnetif_stop_queue(ndev);\n+\tphy_stop(ndev-\u003ephydev);\n+\n+\ts2500_mac_ctrl_modify_bits(priv, val, true);\n+}\n+\n+static int s2500_set_promiscuous_mode(struct s2500_info *priv,\n+\t\t\t\t unsigned int rx_flags)\n+{\n+\tu32 val = S2500_MAC_CTRL_ADRF;\n+\tbool clr = false;\n+\n+\tif (rx_flags \u0026 IFF_PROMISC)\n+\t\tclr = true;\n+\treturn s2500_mac_ctrl_modify_bits(priv, val, clr);\n+}\n+\n+static int s2500_set_multicast_mode(struct s2500_info *priv,\n+\t\t\t\t unsigned int rx_flags,\n+\t\t\t\t struct netdev_hw_addr_list *mc)\n+{\n+\tstruct netdev_hw_addr *ha;\n+\tu8 mms = OA_TC6_MAC_MMS1;\n+\tint i, ret = 0;\n+\tint mc_count;\n+\tu16 addr;\n+\tu32 val;\n+\n+\tmc_count = netdev_hw_addr_list_count(mc);\n+\n+\tif ((rx_flags \u0026 IFF_ALLMULTI) ||\n+\t mc_count \u003e S2500_N_MCAST_FILTERS) {\n+\t\t/* Disable multicast filter */\n+\t\tret = s2500_mac_ctrl_modify_bits(priv,\n+\t\t\t\t\t\t S2500_MAC_CTRL_MCSF,\n+\t\t\t\t\t\t true);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\t/* Accept all multicasts */\n+\t\taddr = S2500_REG_MAC_ADDRMASKL(1);\n+\t\tret = oa_tc6_write_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t\t\taddr, 0);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\taddr = S2500_REG_MAC_ADDRMASKH(1);\n+\t\tret = oa_tc6_write_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t\t\taddr, 0x100);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\taddr = S2500_REG_MAC_ADDRFILTL(1);\n+\t\tret = oa_tc6_write_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t\t\taddr, 0);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\tval = S2500_MAC_ADDRFILT_ENABLE | 0x00000100;\n+\t\taddr = S2500_REG_MAC_ADDRFILTH(1);\n+\t\tret = oa_tc6_write_register_mms(priv-\u003etc6, mms,\n+\t\t\t\t\t\taddr, val);\n+\t} else if (mc_count == 0) {\n+\t\t/* Enable multicast filter */\n+\t\tret = s2500_mac_ctrl_modify_bits(priv,\n+\t\t\t\t\t\t S2500_MAC_CTRL_MCSF,\n+\t\t\t\t\t\t false);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\t/* Disable filters */\n+\t\tfor (i = 1; i \u003c= S2500_N_MCAST_FILTERS; i++) {\n+\t\t\taddr = S2500_REG_MAC_ADDRFILTH(i);\n+\t\t\tret = oa_tc6_write_register_mms(priv-\u003etc6,\n+\t\t\t\t\t\t\tmms, addr, 0);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t}\n+\t} else {\n+\t\tu32 addrh, addrl;\n+\n+\t\t/* Disable multicast filter */\n+\t\tret = s2500_mac_ctrl_modify_bits(priv,\n+\t\t\t\t\t\t S2500_MAC_CTRL_MCSF,\n+\t\t\t\t\t\t true);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\t/* Disable filters */\n+\t\tfor (i = 1; i \u003c= S2500_N_MCAST_FILTERS; i++) {\n+\t\t\taddr = S2500_REG_MAC_ADDRFILTH(i);\n+\t\t\tret = oa_tc6_write_register_mms(priv-\u003etc6,\n+\t\t\t\t\t\t\tmms, addr, 0);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t}\n+\n+\t\t/* Slot 0 holds the unicast MAC, multicast starts at 1 */\n+\t\ti = 1;\n+\t\tnetdev_hw_addr_list_for_each(ha, mc) {\n+\t\t\tconst u8 *mac = ha-\u003eaddr;\n+\t\t\tint slot = i++;\n+\n+\t\t\taddrh = S2500_MAC_ADDRFILT_ENABLE |\n+\t\t\t\tget_unaligned_be16(mac);\n+\t\t\taddrl = get_unaligned_be32(\u0026mac[2]);\n+\n+\t\t\taddr = S2500_REG_MAC_ADDRFILTH(slot);\n+\t\t\tret = oa_tc6_write_register_mms(priv-\u003etc6,\n+\t\t\t\t\t\t\tmms, addr,\n+\t\t\t\t\t\t\taddrh);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\n+\t\t\taddr = S2500_REG_MAC_ADDRFILTL(slot);\n+\t\t\tret = oa_tc6_write_register_mms(priv-\u003etc6,\n+\t\t\t\t\t\t\tmms, addr,\n+\t\t\t\t\t\t\taddrl);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\n+\t\t\taddr = S2500_REG_MAC_ADDRMASKL(slot);\n+\t\t\tret = oa_tc6_write_register_mms(priv-\u003etc6,\n+\t\t\t\t\t\t\tmms, addr,\n+\t\t\t\t\t\t\t0xffffffff);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\n+\t\t\taddr = S2500_REG_MAC_ADDRMASKH(slot);\n+\t\t\tret = oa_tc6_write_register_mms(priv-\u003etc6,\n+\t\t\t\t\t\t\tmms, addr,\n+\t\t\t\t\t\t\t0xffff);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t}\n+\t}\n+\treturn ret;\n+}\n+\n+static int s2500_set_rx_mode(struct net_device *ndev,\n+\t\t\t struct netdev_hw_addr_list *uc,\n+\t\t\t struct netdev_hw_addr_list *mc)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\tint ret;\n+\n+\tret = s2500_set_promiscuous_mode(priv, ndev-\u003eflags);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn s2500_set_multicast_mode(priv, ndev-\u003eflags, mc);\n+}\n+\n+static int s2500_set_mac_address(struct net_device *ndev, void *p)\n+{\n+\tstruct sockaddr *addr = p;\n+\tint ret;\n+\n+\tif (!is_valid_ether_addr(addr-\u003esa_data))\n+\t\treturn -EADDRNOTAVAIL;\n+\n+\tret = s2500_set_mac_filter(ndev, addr-\u003esa_data);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\teth_hw_addr_set(ndev, addr-\u003esa_data);\n+\treturn ret;\n+}\n+\n+static netdev_tx_t s2500_start_xmit(struct sk_buff *skb,\n+\t\t\t\t struct net_device *ndev)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\n+\treturn oa_tc6_start_xmit(priv-\u003etc6, skb);\n+}\n+\n+static int s2500_open(struct net_device *ndev)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\tu32 val;\n+\tint ret;\n+\n+\tdev_dbg(\u0026ndev-\u003edev, \"%s\", \"s2500_open\\n\");\n+\tphy_start(priv-\u003endev-\u003ephydev);\n+\n+\tval = S2500_MAC_CTRL_TXEN | S2500_MAC_CTRL_RXEN;\n+\tret = s2500_mac_ctrl_modify_bits(priv, val, false);\n+\tif (!ret)\n+\t\tnetif_start_queue(priv-\u003endev);\n+\telse\n+\t\tphy_stop(priv-\u003endev-\u003ephydev);\n+\treturn ret;\n+}\n+\n+static int s2500_stop(struct net_device *ndev)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\n+\tdev_dbg(\u0026ndev-\u003edev, \"%s\", \"s2500_stop\\n\");\n+\n+\ts2500_shutdown(priv);\n+\treturn 0;\n+}\n+\n+static int s2500_hwtstamp_get(struct net_device *ndev,\n+\t\t\t struct kernel_hwtstamp_config *k_cfg)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\n+\toa_tc6_hwtstamp_get(priv-\u003etc6, k_cfg);\n+\treturn 0;\n+}\n+\n+static int s2500_hwtstamp_set(struct net_device *ndev,\n+\t\t\t struct kernel_hwtstamp_config *cfg,\n+\t\t\t struct netlink_ext_ack *extack)\n+{\n+\tstruct s2500_info *priv = netdev_priv(ndev);\n+\n+\treturn oa_tc6_hwtstamp_set(priv-\u003etc6, cfg);\n+}\n+\n+static const struct net_device_ops s2500_netdev_ops = {\n+\t.ndo_open = s2500_open,\n+\t.ndo_stop = s2500_stop,\n+\t.ndo_start_xmit = s2500_start_xmit,\n+\t.ndo_set_mac_address = s2500_set_mac_address,\n+\t.ndo_set_rx_mode_async = s2500_set_rx_mode,\n+\t.ndo_eth_ioctl = phy_do_ioctl_running,\n+\t.ndo_hwtstamp_get = s2500_hwtstamp_get,\n+\t.ndo_hwtstamp_set = s2500_hwtstamp_set,\n+};\n+\n+static int s2500_probe(struct spi_device *spi)\n+{\n+\tstruct device *dev = \u0026spi-\u003edev;\n+\tstruct net_device *ndev;\n+\tstruct s2500_info *priv;\n+\tu32 val;\n+\tint ret;\n+\n+\tif (spi-\u003eirq \u003c 0)\n+\t\treturn -ENODEV;\n+\n+\tndev = devm_alloc_etherdev(dev, sizeof(struct s2500_info));\n+\tif (!ndev)\n+\t\treturn -ENOMEM;\n+\n+\tpriv = netdev_priv(ndev);\n+\tpriv-\u003endev = ndev;\n+\tpriv-\u003espi = spi;\n+\tpriv-\u003edev = dev;\n+\n+\tSET_NETDEV_DEV(ndev, dev);\n+\n+\tmutex_init(\u0026priv-\u003eptp_adj_lock);\n+\tndev-\u003eirq = spi-\u003eirq;\n+\n+\t/* Ensures that the first read is not from the cache. */\n+\tpriv-\u003estats_read_at = jiffies - S2500_STATS_CACHE_PERIOD;\n+\n+\tspi_set_drvdata(spi, priv);\n+\n+\tndev-\u003enetdev_ops = \u0026s2500_netdev_ops;\n+\tndev-\u003eethtool_ops = \u0026s2500_ethtool_ops;\n+\tndev-\u003eif_port = IF_PORT_10BASET;\n+\n+\tpriv-\u003etc6 = oa_tc6_init(spi, ndev, NULL);\n+\tif (IS_ERR(priv-\u003etc6)) {\n+\t\tret = PTR_ERR(priv-\u003etc6);\n+\t\tdev_err(\u0026spi-\u003edev, \"OA TC6 init failed\\n\");\n+\t\treturn ret;\n+\t}\n+\toa_tc6_set_vend1_mms(priv-\u003etc6, OA_TC6_PHY_C45_VS_MMS12);\n+\n+\t/* All read-only bits. Some are self clear. No need to write */\n+\tret = oa_tc6_read_register_mms(priv-\u003etc6, OA_TC6_PHY_C45_VS_MMS12,\n+\t\t\t\t S2500_REG_VS_MIIMIRQS, \u0026val);\n+\tif (ret) {\n+\t\tdev_err(\u0026spi-\u003edev, \"Failed to read MIIM IRQ status\\n\");\n+\t\tgoto err_reg_read;\n+\t}\n+\n+\t/* Acknowledge all IRQ status bits */\n+\tret = oa_tc6_read_register(priv-\u003etc6,\n+\t\t\t\t OA_TC6_REG_STATUS0, \u0026val);\n+\tif (!ret) {\n+\t\t/* Clear read only bit */\n+\t\tval \u0026= ~S2500_STATUS0_PHY_INT;\n+\t\toa_tc6_write_register(priv-\u003etc6,\n+\t\t\t\t OA_TC6_REG_STATUS0, val);\n+\t}\n+\n+\tret = device_get_ethdev_address(priv-\u003edev, ndev);\n+\tif (ret)\n+\t\tret = s2500_read_mac_from_nvmem(priv);\n+\n+\tif (ret) {\n+\t\teth_hw_addr_random(ndev);\n+\t\tdev_warn(\u0026spi-\u003edev, \"Using random MAC address %pM\\n\",\n+\t\t\t ndev-\u003edev_addr);\n+\t}\n+\n+\tret = s2500_init(priv);\n+\tif (ret) {\n+\t\tdev_err(\u0026spi-\u003edev, \"Failure seen in s2500_init\\n\");\n+\t\tgoto err_reg_read;\n+\t}\n+\n+\t/* Configure PTP as S2500 supports it */\n+\tret = s2500_ptp_register(priv);\n+\tif (ret)\n+\t\tgoto err_reg_read;\n+\n+\tret = register_netdev(ndev);\n+\tif (!ret)\n+\t\treturn ret;\n+\tdev_err(\u0026spi-\u003edev, \"Failed to register netdev\\n\");\n+\toa_tc6_ptp_unregister(priv-\u003etc6);\n+err_reg_read:\n+\toa_tc6_exit(priv-\u003etc6);\n+\treturn ret;\n+}\n+\n+static void s2500_remove(struct spi_device *spi)\n+{\n+\tstruct s2500_info *priv = spi_get_drvdata(spi);\n+\n+\tdev_dbg(\u0026priv-\u003endev-\u003edev, \"%s\", \"s2500_remove\\n\");\n+\n+\tunregister_netdev(priv-\u003endev);\n+\toa_tc6_ptp_unregister(priv-\u003etc6);\n+\toa_tc6_exit(priv-\u003etc6);\n+}\n+\n+static const struct of_device_id s2500_of_match[] = {\n+\t{ .compatible = \"onnn,s2500\" },\n+\t{ }\n+};\n+MODULE_DEVICE_TABLE(of, s2500_of_match);\n+\n+static const struct spi_device_id s2500_ids[] = {\n+\t{ \"s2500\" },\n+\t{ }\n+};\n+MODULE_DEVICE_TABLE(spi, s2500_ids);\n+\n+static struct spi_driver s2500_driver = {\n+\t.driver = {\n+\t\t.name = DRV_NAME,\n+\t\t.of_match_table = s2500_of_match,\n+\t},\n+\t.probe = s2500_probe,\n+\t.remove = s2500_remove,\n+\t.id_table = s2500_ids,\n+};\n+module_spi_driver(s2500_driver);\n+\n+MODULE_AUTHOR(\"Selva Rajagopal \u003cselvamani.rajagopal@onsemi.com\u003e\");\n+MODULE_AUTHOR(\"Piergiorgio Beruto\");\n+MODULE_DESCRIPTION(\"onsemi MACPHY ethernet driver\");\n+MODULE_LICENSE(\"GPL\");\ndiff --git a/drivers/net/ethernet/onsemi/s2500/s2500_ptp.c b/drivers/net/ethernet/onsemi/s2500/s2500_ptp.c\nnew file mode 100644\nindex 0000000000000..2bcf69c0d6a2e\n--- /dev/null\n+++ b/drivers/net/ethernet/onsemi/s2500/s2500_ptp.c\n@@ -0,0 +1,174 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright 2026 Semiconductor Components Industries, LLC (\"onsemi\").\n+ * onsemi's S2500 10BASE-T1S MAC-PHY driver\n+ */\n+\n+#include \"s2500_hw_def.h\"\n+\n+static int s2500_ptp_get_time64(struct ptp_clock_info *ptp,\n+\t\t\t\tstruct timespec64 *ts,\n+\t\t\t\tstruct ptp_system_timestamp *ptp_sts)\n+{\n+\tstruct s2500_info *priv = container_of(ptp, struct s2500_info,\n+\t\t\t\t\t ptp_clock_info);\n+\tu32 data[2];\n+\tu32 addr;\n+\tint ret;\n+\n+\tptp_read_system_prets(ptp_sts);\n+\taddr = FIELD_PREP(S2500_REG_MMS_MASK,\n+\t\t\t OA_TC6_PHY_C45_VS_MMS12) |\n+\t\t\t S2500_REG_VS_PTP_SEC;\n+\tret = oa_tc6_read_registers(priv-\u003etc6, addr, \u0026data[0], 2);\n+\tptp_read_system_postts(ptp_sts);\n+\n+\tif (!ret) {\n+\t\tts-\u003etv_sec = data[0];\n+\t\tts-\u003etv_nsec = data[1];\n+\t}\n+\n+\treturn ret;\n+}\n+\n+static int s2500_ptp_write_time(struct s2500_info *priv,\n+\t\t\t\tconst struct timespec64 *ts)\n+{\n+\tu32 data[2];\n+\tu32 addr;\n+\n+\tlockdep_assert_held(\u0026priv-\u003eptp_adj_lock);\n+\n+\tif (ts-\u003etv_sec \u003e= (1ULL \u003c\u003c 32))\n+\t\treturn -ERANGE;\n+\n+\tdata[0] = (u32)ts-\u003etv_sec;\n+\t/* bit 31 = execute set command */\n+\tdata[1] = ts-\u003etv_nsec | BIT(31);\n+\taddr = FIELD_PREP(S2500_REG_MMS_MASK,\n+\t\t\t OA_TC6_PHY_C45_VS_MMS12) |\n+\t\t\t S2500_REG_VS_PTP_SETSEC;\n+\n+\treturn oa_tc6_write_registers(priv-\u003etc6, addr, \u0026data[0], 2);\n+}\n+\n+static int s2500_ptp_set_time64(struct ptp_clock_info *ptp,\n+\t\t\t\tconst struct timespec64 *ts)\n+{\n+\tstruct s2500_info *priv = container_of(ptp, struct s2500_info,\n+\t\t\t\t\t ptp_clock_info);\n+\tint ret;\n+\n+\tmutex_lock(\u0026priv-\u003eptp_adj_lock);\n+\tret = s2500_ptp_write_time(priv, ts);\n+\tmutex_unlock(\u0026priv-\u003eptp_adj_lock);\n+\n+\treturn ret;\n+}\n+\n+static int s2500_ptp_set_freq(struct s2500_info *priv, long scaled_ppm)\n+{\n+\tu32 sign_bit = 0;\n+\tlong adj;\n+\tu32 val;\n+\tu64 ppm;\n+\n+\tif (scaled_ppm \u003c 0) {\n+\t\t/* split sign / mod */\n+\t\tsign_bit = 1U \u003c\u003c 31;\n+\t\tscaled_ppm = ~scaled_ppm + 1;\n+\t}\n+\n+\t/*\n+\t * Convert unsigned scaled_ppm to atto-seconds per clock cycles.\n+\t * The scaled_ppm format is Qx.16 --\u003e 1 lsb = 1/65536 ppm.\n+\t * The clock period of the S2500 is 8ns (125 MHz), so 1 lsb of\n+\t * adj register LSB is 1 atto-sec / 8ns = 0.000125 ppm.\n+\t * Represented in Qx.16 format, this is 0.000125 * 2^16 = 8(.192)\n+\t * To convert scaled_ppm into a register value we need to divide\n+\t * it by the LSB value, hence adj = (scaled_ppm * 1000) / 8192 to\n+\t * minimize the precision loss due to the integer arithmetic.\n+\t * That further reduces to (scaled_ppm * 125) / 1024.\n+\t */\n+\tppm = (u64)scaled_ppm * 125;\n+\tdo_div(ppm, 1024);\n+\tadj = (long)ppm;\n+\n+\t/* check overflow */\n+\tif (adj \u003e S2500_PTP_ADJ_MAX)\n+\t\treturn -ERANGE;\n+\n+\tval = (u32)adj | sign_bit;\n+\treturn oa_tc6_write_register_mms(priv-\u003etc6, OA_TC6_PHY_C45_VS_MMS12,\n+\t\t\t\t\t S2500_REG_VS_PTP_ADJ, val);\n+}\n+\n+static int s2500_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)\n+{\n+\tstruct s2500_info *priv = container_of(ptp, struct s2500_info,\n+\t\t\t\t\t ptp_clock_info);\n+\n+\treturn s2500_ptp_set_freq(priv, scaled_ppm);\n+}\n+\n+static int s2500_ptp_step_time(struct s2500_info *priv, s64 delta)\n+{\n+\tstruct timespec64 target, now, delta_ts;\n+\tstruct ptp_system_timestamp sts;\n+\tint ret;\n+\n+\tmemset(\u0026sts, 0, sizeof(sts));\n+\tret = s2500_ptp_get_time64(\u0026priv-\u003eptp_clock_info, \u0026now, \u0026sts);\n+\tif (ret)\n+\t\treturn ret;\n+\tif (delta \u003e= 0) {\n+\t\tdelta_ts = ns_to_timespec64(delta);\n+\t\ttarget = timespec64_add(now, delta_ts);\n+\t} else {\n+\t\tdelta_ts = ns_to_timespec64(-delta);\n+\t\ttarget = timespec64_sub(now, delta_ts);\n+\t}\n+\t/* The subtraction above can take the target below the epoch */\n+\tif (target.tv_sec \u003c 0)\n+\t\treturn -ERANGE;\n+\treturn s2500_ptp_write_time(priv, \u0026target);\n+}\n+\n+static int s2500_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)\n+{\n+\tstruct s2500_info *priv = container_of(ptp, struct s2500_info,\n+\t\t\t\t\t ptp_clock_info);\n+\tint ret;\n+\n+\t/* Nothing to do */\n+\tif (delta == 0)\n+\t\treturn 0;\n+\n+\t/* The device has no add-delta register, so the offset is applied as\n+\t * a read-modify-write of the time registers.\n+\t */\n+\tmutex_lock(\u0026priv-\u003eptp_adj_lock);\n+\tret = s2500_ptp_step_time(priv, delta);\n+\tmutex_unlock(\u0026priv-\u003eptp_adj_lock);\n+\n+\treturn ret;\n+}\n+\n+int s2500_ptp_register(struct s2500_info *priv)\n+{\n+\tstruct ptp_clock_info *info = \u0026priv-\u003eptp_clock_info;\n+\tint ret;\n+\n+\tinfo-\u003emax_adj = S2500_PTP_MAX_ADJ_PPB;\n+\tinfo-\u003eowner = THIS_MODULE;\n+\tinfo-\u003eadjfine = s2500_ptp_adjfine;\n+\tinfo-\u003egettimex64 = s2500_ptp_get_time64;\n+\tinfo-\u003esettime64 = s2500_ptp_set_time64;\n+\tinfo-\u003eadjtime = s2500_ptp_adjtime;\n+\n+\tret = oa_tc6_ptp_register(priv-\u003etc6, info);\n+\tif (ret)\n+\t\tdev_err(\u0026priv-\u003espi-\u003edev, \"PTP registration failed\\n\");\n+\treturn ret;\n+}\n+\ndiff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c\nindex a3cd5cb11ea0a..a626676064225 100644\n--- a/drivers/net/phy/dp83867.c\n+++ b/drivers/net/phy/dp83867.c\n@@ -1058,15 +1058,6 @@ static void dp83867_link_change_notify(struct phy_device *phydev)\n \t}\n }\n \n-static int dp83867_loopback(struct phy_device *phydev, bool enable, int speed)\n-{\n-\tif (enable \u0026\u0026 speed)\n-\t\treturn -EOPNOTSUPP;\n-\n-\treturn phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,\n-\t\t\t enable ? BMCR_LOOPBACK : 0);\n-}\n-\n static int\n dp83867_led_brightness_set(struct phy_device *phydev,\n \t\t\t u8 index, enum led_brightness brightness)\n@@ -1292,7 +1283,7 @@ static struct phy_driver dp83867_driver[] = {\n \t\t.resume\t\t= dp83867_resume,\n \n \t\t.link_change_notify = dp83867_link_change_notify,\n-\t\t.set_loopback\t= dp83867_loopback,\n+\t\t.set_loopback\t= genphy_loopback_no_speed,\n \n \t\t.led_brightness_set = dp83867_led_brightness_set,\n \t\t.led_hw_is_supported = dp83867_led_hw_is_supported,\ndiff --git a/drivers/net/phy/ncn26000.c b/drivers/net/phy/ncn26000.c\nindex cabdd83c614f0..de0fafda38761 100644\n--- a/drivers/net/phy/ncn26000.c\n+++ b/drivers/net/phy/ncn26000.c\n@@ -2,7 +2,7 @@\n /*\n * Driver for the onsemi 10BASE-T1S NCN26000 PHYs family.\n *\n- * Copyright 2022 onsemi\n+ * Copyright 2026 onsemi\n */\n #include \u003clinux/kernel.h\u003e\n #include \u003clinux/bitfield.h\u003e\n@@ -14,6 +14,7 @@\n \n #include \"mdio-open-alliance.h\"\n \n+#define PHY_ID_S2500\t\t\t0x180FF411\n #define PHY_ID_NCN26000\t\t\t0x180FF5A1\n \n #define NCN26000_REG_IRQ_CTL 16\n@@ -35,15 +36,24 @@\n \n #define TO_TMR_DEFAULT\t\t\t32\n \n+#define NCN26000_REG_PHYCFG1\t\t0x8001\n+#define NCN26000_PHYCFG1_ENI\t\tBIT(7)\n+#define NCN26000_PHYCFG1_ENI_MASK\tBIT(7)\n+\n static int ncn26000_config_init(struct phy_device *phydev)\n {\n+\tint ret = 0;\n+\n \t/* HW bug workaround: the default value of the PLCA TO_TIMER should be\n \t * 32, where the current version of NCN26000 reports 24. This will be\n \t * fixed in future PHY versions. For the time being, we force the\n \t * correct default here.\n \t */\n-\treturn phy_write_mmd(phydev, MDIO_MMD_VEND2, MDIO_OATC14_PLCA_TOTMR,\n-\t\t\t TO_TMR_DEFAULT);\n+\tif (phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_NCN26000))\n+\t\tret = phy_write_mmd(phydev, MDIO_MMD_VEND2,\n+\t\t\t\t MDIO_OATC14_PLCA_TOTMR,\n+\t\t\t\t TO_TMR_DEFAULT);\n+\treturn ret;\n }\n \n static int ncn26000_config_aneg(struct phy_device *phydev)\n@@ -100,6 +110,24 @@ static int ncn26000_read_status(struct phy_device *phydev)\n \treturn 0;\n }\n \n+/* Intercept PLCA enable/disable request to\n+ * set the proprietary, ENI mode accordingly\n+ */\n+static int ncn26000_c45_plca_set_cfg(struct phy_device *phydev,\n+\t\t\t\t const struct phy_plca_cfg *plca_cfg)\n+{\n+\tint ret = genphy_c45_plca_set_cfg(phydev, plca_cfg);\n+\tu16 eni_cfg = 0;\n+\n+\tif (ret || plca_cfg-\u003eenabled \u003c 0)\n+\t\treturn ret;\n+\n+\teni_cfg = (plca_cfg-\u003eenabled) ? NCN26000_PHYCFG1_ENI : 0;\n+\treturn phy_modify_mmd(phydev, MDIO_MMD_VEND2,\n+\t\t\t NCN26000_REG_PHYCFG1,\n+\t\t\t NCN26000_PHYCFG1_ENI_MASK, eni_cfg);\n+}\n+\n static irqreturn_t ncn26000_handle_interrupt(struct phy_device *phydev)\n {\n \tint ret;\n@@ -117,8 +145,8 @@ static irqreturn_t ncn26000_handle_interrupt(struct phy_device *phydev)\n \n static int ncn26000_config_intr(struct phy_device *phydev)\n {\n-\tint ret;\n \tu16 irqe;\n+\tint ret;\n \n \tif (phydev-\u003einterrupts == PHY_INTERRUPT_ENABLED) {\n \t\t// acknowledge IRQs\n@@ -141,6 +169,27 @@ static int ncn26000_config_intr(struct phy_device *phydev)\n }\n \n static struct phy_driver ncn26000_driver[] = {\n+\t{\n+\t\tPHY_ID_MATCH_MODEL(PHY_ID_S2500),\n+\t\t.name = \"S2500\",\n+\t\t.features = PHY_BASIC_T1S_P2MP_FEATURES,\n+\t\t.config_init = ncn26000_config_init,\n+\t\t.config_intr = ncn26000_config_intr,\n+\t\t.config_aneg = ncn26000_config_aneg,\n+\t\t.read_status = ncn26000_read_status,\n+\t\t.handle_interrupt = ncn26000_handle_interrupt,\n+\t\t.set_loopback = genphy_loopback_no_speed,\n+\t\t.set_plca_cfg = ncn26000_c45_plca_set_cfg,\n+\t\t.get_plca_cfg = genphy_c45_plca_get_cfg,\n+\t\t.get_plca_status = genphy_c45_plca_get_status,\n+\t\t.soft_reset = genphy_soft_reset,\n+\t\t.get_sqi = genphy_c45_oatc14_get_sqi,\n+\t\t.get_sqi_max = genphy_c45_oatc14_get_sqi_max,\n+\t\t.read_mmd = genphy_read_mmd_c45,\n+\t\t.write_mmd = genphy_write_mmd_c45,\n+\t\t.cable_test_get_status = genphy_c45_oatc14_cable_test_get_status,\n+\t\t.cable_test_start = genphy_c45_oatc14_cable_test_start,\n+\t},\n \t{\n \t\tPHY_ID_MATCH_MODEL(PHY_ID_NCN26000),\n \t\t.name\t\t\t= \"NCN26000\",\n@@ -151,7 +200,7 @@ static struct phy_driver ncn26000_driver[] = {\n \t\t.read_status\t\t= ncn26000_read_status,\n \t\t.handle_interrupt = ncn26000_handle_interrupt,\n \t\t.get_plca_cfg\t\t= genphy_c45_plca_get_cfg,\n-\t\t.set_plca_cfg\t\t= genphy_c45_plca_set_cfg,\n+\t\t.set_plca_cfg\t\t= ncn26000_c45_plca_set_cfg,\n \t\t.get_plca_status\t= genphy_c45_plca_get_status,\n \t\t.soft_reset = genphy_soft_reset,\n \t},\n@@ -161,11 +210,13 @@ module_phy_driver(ncn26000_driver);\n \n static const struct mdio_device_id __maybe_unused ncn26000_tbl[] = {\n \t{ PHY_ID_MATCH_MODEL(PHY_ID_NCN26000) },\n+\t{ PHY_ID_MATCH_MODEL(PHY_ID_S2500) },\n \t{ }\n };\n \n MODULE_DEVICE_TABLE(mdio, ncn26000_tbl);\n \n+MODULE_AUTHOR(\"Selva Rajagopal \u003cselvamani.rajagopal@onsemi.com\u003e\");\n MODULE_AUTHOR(\"Piergiorgio Beruto\");\n MODULE_DESCRIPTION(\"onsemi 10BASE-T1S PHY driver\");\n MODULE_LICENSE(\"Dual BSD/GPL\");\ndiff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c\nindex bfce8b893644f..03419f6455875 100644\n--- a/drivers/net/phy/phy_device.c\n+++ b/drivers/net/phy/phy_device.c\n@@ -2791,6 +2791,28 @@ int genphy_resume(struct phy_device *phydev)\n }\n EXPORT_SYMBOL(genphy_resume);\n \n+/**\n+ * genphy_loopback_no_speed - Helper to modify the PHY loopback mode\n+ * without setting speed. Some PHYs, like 10Base-T1S, don't support\n+ * auto-negotiation and therefore setting the speed isn't supported.\n+ *\n+ * @phydev: The phy_device struct\n+ * @enable: Flag to enable or disable the PHY level loopback.\n+ * @speed: Speed setting. Not expected to be set. Error if it is set.\n+ *\n+ * Returns: 0 if successful, negative error code on failure.\n+ */\n+int genphy_loopback_no_speed(struct phy_device *phydev, bool enable,\n+\t\t\t int speed)\n+{\n+\tif (enable \u0026\u0026 speed)\n+\t\treturn -EOPNOTSUPP;\n+\n+\treturn phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,\n+\t\t\t enable ? BMCR_LOOPBACK : 0);\n+}\n+EXPORT_SYMBOL(genphy_loopback_no_speed);\n+\n int genphy_loopback(struct phy_device *phydev, bool enable, int speed)\n {\n \tif (enable) {\ndiff --git a/include/linux/oa_tc6.h b/include/linux/oa_tc6.h\nindex 27f652d4920b2..86075ee113feb 100644\n--- a/include/linux/oa_tc6.h\n+++ b/include/linux/oa_tc6.h\n@@ -7,13 +7,18 @@\n * Author: Parthiban Veerasooran \u003cparthiban.veerasooran@microchip.com\u003e\n */\n \n+#ifndef _LINUX_OA_TC6_H\n+#define _LINUX_OA_TC6_H\n+\n #include \u003clinux/etherdevice.h\u003e\n #include \u003clinux/spi/spi.h\u003e\n+#include \u003clinux/ptp_clock_kernel.h\u003e\n \n /* OPEN Alliance TC6 registers */\n /* Standard Capabilities Register */\n #define OA_TC6_REG_STDCAP\t\t\t0x0002\n #define OA_TC6_STDCAP_DIRECT_PHY_REG_ACCESS\tBIT(8)\n+#define OA_TC6_STDCAP_TIMESTAMP_CAPABILITY\tBIT(6)\n \n /* Reset Control and Status Register */\n #define OA_TC6_REG_RESET\t\t\t0x0003\n@@ -23,6 +28,8 @@\n #define OA_TC6_REG_CONFIG0\t\t\t0x0004\n #define OA_TC6_CONFIG0_SYNC\t\t\tBIT(15)\n #define OA_TC6_CONFIG0_ZARFE_ENABLE\t\tBIT(12)\n+#define OA_TC6_CONFIG0_FTSE_ENABLE\t\tBIT(7)\n+#define OA_TC6_CONFIG0_FTSS_64BIT_TSTAMP\tBIT(6)\n #define OA_TC6_CONFIG0_PROTE\t\t\tBIT(5)\n \n /* Configuration Register #2 */\n@@ -30,6 +37,10 @@\n \n /* Status Register #0 */\n #define OA_TC6_REG_STATUS0\t\t\t0x0008\n+#define OA_TC6_STATUS0_TTSCAC\t\t\tBIT(10)\n+#define OA_TC6_STATUS0_TTSCAB\t\t\tBIT(9)\n+#define OA_TC6_STATUS0_TTSCAA\t\t\tBIT(8)\n+#define OA_TC6_STATUS0_TTSCA_MASK\t\tGENMASK(10, 8)\n #define OA_TC6_STATUS0_RESETC\t\t\tBIT(6)\t/* Reset Complete */\n #define OA_TC6_STATUS0_HEADER_ERROR\t\tBIT(5)\n #define OA_TC6_STATUS0_LOSS_OF_FRAME_ERROR\tBIT(4)\n@@ -43,6 +54,7 @@\n \n /* Interrupt Mask Register #0 */\n #define OA_TC6_REG_INT_MASK0\t\t\t\t0x000C\n+#define OA_TC6_INT_MASK0_TTSCA_MASK\t\t\tGENMASK(10, 8)\n #define OA_TC6_INT_MASK0_HEADER_ERR_MASK\t\tBIT(5)\n #define OA_TC6_INT_MASK0_LOSS_OF_FRAME_ERR_MASK\t\tBIT(4)\n #define OA_TC6_INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK\tBIT(3)\n@@ -63,6 +75,7 @@\n #define OA_TC6_PHY_C45_VS_PLCA_MMS4\t\t4\t/* MMD 31 */\n #define OA_TC6_PHY_C45_AUTO_NEG_MMS5\t\t5\t/* MMD 7 */\n #define OA_TC6_PHY_C45_POWER_UNIT_MMS6\t\t6\t/* MMD 13 */\n+#define OA_TC6_PHY_C45_VS_MMS12\t\t\t12\t/* for vendors */\n \n struct oa_tc6;\n \n@@ -93,3 +106,15 @@ int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int devnum,\n \t\t\t int regnum);\n int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int devnum,\n \t\t\t int regnum, u16 val);\n+int oa_tc6_ptp_register(struct oa_tc6 *tc6, struct ptp_clock_info *info);\n+int oa_tc6_get_ts_info(struct oa_tc6 *tc6,\n+\t\t struct kernel_ethtool_ts_info *info);\n+void oa_tc6_hwtstamp_get(struct oa_tc6 *tc6,\n+\t\t\t struct kernel_hwtstamp_config *cfg);\n+void oa_tc6_get_ts_stats(struct oa_tc6 *tc6,\n+\t\t\t struct ethtool_ts_stats *stats);\n+int oa_tc6_hwtstamp_set(struct oa_tc6 *tc6,\n+\t\t\tstruct kernel_hwtstamp_config *cfg);\n+void oa_tc6_set_vend1_mms(struct oa_tc6 *tc6, int mms);\n+void oa_tc6_ptp_unregister(struct oa_tc6 *tc6);\n+#endif /* _LINUX_OA_TC6_H */\ndiff --git a/include/linux/phy.h b/include/linux/phy.h\nindex 7c5098a0dd6cd..ea3505e49316f 100644\n--- a/include/linux/phy.h\n+++ b/include/linux/phy.h\n@@ -2307,6 +2307,8 @@ int genphy_read_status(struct phy_device *phydev);\n int genphy_read_master_slave(struct phy_device *phydev);\n int genphy_suspend(struct phy_device *phydev);\n int genphy_resume(struct phy_device *phydev);\n+int genphy_loopback_no_speed(struct phy_device *phydev, bool enable,\n+\t\t\t int speed);\n int genphy_loopback(struct phy_device *phydev, bool enable, int speed);\n int genphy_soft_reset(struct phy_device *phydev);\n irqreturn_t genphy_handle_interrupt_no_ack(struct phy_device *phydev);\n"
} |
| 2/1 | 2026/10/09 20:15 | agent | patch-evaluator |
2mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series adds support for the onsemi S2500 10BASE-T1S MAC-PHY Ethernet controller over SPI, adds PTP hardware timestamping support to the OPEN Alliance TC6 (OA TC6) MAC-PHY framework, and updates the NCN26000 and DP83867 PHY drivers along with adding a genphy_loopback_no_speed helper in phylib. All modified executable code belongs to physical SPI MAC-PHY controllers or physical MDIO PHY transceivers that cannot be instantiated or emulated in standard QEMU/GCE virtualized environments, making the changes structurally unreachable for syzkaller fuzzing.",
"WorthFuzzing": false
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 356357d5e391c245337760eb72e4160b5016eba2
Author: syz-cluster <triage@syzkaller.com>
Date: Fri Oct 9 20:15:56 2026 +0000
syz-cluster: applied patch under review
diff --git a/Documentation/devicetree/bindings/net/onnn,s2500.yaml b/Documentation/devicetree/bindings/net/onnn,s2500.yaml
new file mode 100644
index 0000000000000..fadd656629f10
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/onnn,s2500.yaml
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/onnn,s2500.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: onsemi S2500 10BASE-T1S MACPHY Ethernet Controllers
+
+maintainers:
+ - Selva Rajagopal <Selvamani.Rajagopal@onsemi.com>
+
+description:
+ The S2500 combines a Media Access Controller (MAC) and an
+ Ethernet PHY to enable 10BASE‑T1S networks. The Ethernet Media Access
+ Controller (MAC) module implements a 10 Mbps half duplex Ethernet MAC,
+ compatible with the IEEE 802.3 standard and a 10BASE-T1S physical layer
+ transceiver integrated into the S2500. The communication between
+ the host and the MAC-PHY is specified in the OPEN Alliance 10BASE-T1x
+ MACPHY Serial Interface (TC6).
+
+allOf:
+ - $ref: /schemas/net/ethernet-controller.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+ compatible:
+ const: onnn,s2500
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ description:
+ Interrupt from MAC-PHY asserted in the event of Receive Chunks
+ Available, Transmit Chunk Credits Available and Extended Status
+ Event.
+ maxItems: 1
+
+ reset-gpios:
+ description:
+ GPIO connected to the active-low RST_N pin of the MAC-PHY.
+ maxItems: 1
+
+ spi-max-frequency:
+ maximum: 25000000
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - spi-max-frequency
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethernet@0 {
+ compatible = "onnn,s2500";
+ reg = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <ð0_pins>;
+ interrupt-parent = <&gpio>;
+ interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
+ spi-max-frequency = <15000000>;
+ };
+ };
diff --git a/Documentation/networking/oa-tc6-framework.rst b/Documentation/networking/oa-tc6-framework.rst
index 2545ef694016f..3cfe8cb7cf75f 100644
--- a/Documentation/networking/oa-tc6-framework.rst
+++ b/Documentation/networking/oa-tc6-framework.rst
@@ -153,6 +153,10 @@ OPEN Alliance TC6 Framework
- Forwards the received Ethernet frame from 10Base-T1x MAC-PHY to n/w
subsystem.
+- If supported by the hardware and enabled, updates hardware timestamp
+ in skb, when indicated by one of the three timestamp capture registers
+ through TSC fields of the header.
+
Data Transaction
~~~~~~~~~~~~~~~~
@@ -496,3 +500,58 @@ the MAC-PHY.
Zero align receive frame feature can be enabled to align all receive ethernet
frames data to start at the beginning of any receive data chunk payload with a
start word offset (SWO) of zero.
+
+.. c:function:: int oa_tc6_ptp_register(struct oa_tc6 *tc6, \
+ struct ptp_clock_info *info);
+
+Registers the PTP hardware clock related functions with the kernel.
+This API simply registers. Initialization of the fields in the
+ptp_clock_info structure are left to the vendor as programming hardware
+timer is expected to be vendor dependent. The fields max_adj, owner,
+and all the functions for the clock operations, like adjfine, gettimex64,
+settime64, adjtime are expected to be initialized in the structure before
+calling the registering the hardware clock.
+
+.. c:function:: void oa_tc6_ptp_unregister(struct oa_tc6 *tc6);
+
+Unregisters the PTP hardware clock related callbacks.
+
+.. c:function:: int oa_tc6_get_ts_info(struct oa_tc6 *tc6, \
+ struct kernel_ethtool_ts_info *info);
+
+Provides timestamp related settings that are supported to ethtool.
+
+.. c:function:: void oa_tc6_hwtstamp_get(struct oa_tc6 *tc6, \
+ struct kernel_hwtstamp_config *cfg);
+
+Returns hardware timestamp configuration. Part of net_device_ops callbacks.
+
+.. c:function:: void oa_tc6_get_ts_stats(struct oa_tc6 *tc6, \
+ struct ethtool_ts_stats *ts_stats);
+
+Provides hardware timestamp related traffic statistics for ethtool.
+
+.. c:function:: int oa_tc6_hwtstamp_set(struct oa_tc6 *tc6, \
+ struct kernel_hwtstamp_config *cfg);
+
+Helper to set hardware timestamp configuration. Part of net_device_ops
+callbacks.
+
+.. c:function:: void oa_tc6_set_vend1_mms(struct oa_tc6 *tc6, int mms);
+
+Helper to map MDIO_MMD_VEND1 command to vendor specific Memory Map Select
+(MMS) value. This function offers flexibility for vendors that may have
+used any MMS value between 10 and 15 as allowed by the specification.
+MDIO_MMD_VEND2 is already mapped to MMS4 in the OA TC6 frame work code.
+
+.. c:function:: int oa_tc6_write_register_mms(struct oa_tc6 *tc6, \
+ u8 mms, u16 address, \
+ u32 value);
+
+Write a single register addressed by @mms and @address in the MAC-PHY.
+
+.. c:function:: int oa_tc6_read_register_mms(struct oa_tc6 *tc6, \
+ u8 mms, u16 address, \
+ u32 *value);
+
+Read a single register addressed by @mms and @address in the MAC-PHY.
diff --git a/MAINTAINERS b/MAINTAINERS
index 509b35b5a0e7a..c114be8516070 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20435,11 +20435,19 @@ F: arch/mips/boot/dts/ralink/omega2p.dts
ONSEMI ETHERNET PHY DRIVERS
M: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
+M: Selva Rajagopal <selvamani.rajagopal@onsemi.com>
L: netdev@vger.kernel.org
S: Supported
W: http://www.onsemi.com
F: drivers/net/phy/ncn*
+ONSEMI S2500 10BASE-T1S MACPHY ETHERNET DRIVER
+M: Selva Rajagopal <selvamani.rajagopal@onsemi.com>
+L: netdev@vger.kernel.org
+S: Supported
+F: Documentation/devicetree/bindings/net/onnn,s2500.yaml
+F: drivers/net/ethernet/onsemi/s2500/*
+
OP-TEE DRIVER
M: Jens Wiklander <jenswi@kernel.org>
L: op-tee@lists.trustedfirmware.org (moderated for non-subscribers)
@@ -20461,10 +20469,11 @@ F: drivers/rtc/rtc-optee.c
OPEN ALLIANCE 10BASE-T1S MACPHY SERIAL INTERFACE FRAMEWORK
M: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
+M: Selva Rajagopal <selvamani.rajagopal@onsemi.com> (timestamp support)
L: netdev@vger.kernel.org
S: Maintained
F: Documentation/networking/oa-tc6-framework.rst
-F: drivers/net/ethernet/oa_tc6.c
+F: drivers/net/ethernet/oa_tc6/*
F: include/linux/oa_tc6.h
OPEN FIRMWARE AND FLATTENED DEVICE TREE
diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
index c2b0161d0beca..c160bf9913453 100644
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -135,7 +135,9 @@ source "drivers/net/ethernet/netronome/Kconfig"
source "drivers/net/ethernet/8390/Kconfig"
source "drivers/net/ethernet/nvidia/Kconfig"
source "drivers/net/ethernet/nxp/Kconfig"
+source "drivers/net/ethernet/oa_tc6/Kconfig"
source "drivers/net/ethernet/oki-semi/Kconfig"
+source "drivers/net/ethernet/onsemi/Kconfig"
config ETHOC
tristate "OpenCores 10/100 Mbps Ethernet MAC support"
@@ -147,17 +149,6 @@ config ETHOC
help
Say Y here if you want to use the OpenCores 10/100 Mbps Ethernet MAC.
-config OA_TC6
- tristate "OPEN Alliance TC6 10BASE-T1x MAC-PHY support" if COMPILE_TEST
- depends on SPI
- select PHYLIB
- help
- This library implements OPEN Alliance TC6 10BASE-T1x MAC-PHY
- Serial Interface protocol for supporting 10BASE-T1x MAC-PHYs.
-
- To know the implementation details, refer documentation in
- <file:Documentation/networking/oa-tc6-framework.rst>.
-
source "drivers/net/ethernet/pasemi/Kconfig"
source "drivers/net/ethernet/pensando/Kconfig"
source "drivers/net/ethernet/qlogic/Kconfig"
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
index a306dae23bcb8..e4bad64bf95c2 100644
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -72,7 +72,9 @@ obj-$(CONFIG_NET_VENDOR_NETRONOME) += netronome/
obj-$(CONFIG_NET_VENDOR_NI) += ni/
obj-$(CONFIG_NET_VENDOR_NVIDIA) += nvidia/
obj-$(CONFIG_LPC_ENET) += nxp/
+obj-$(CONFIG_OA_TC6) += oa_tc6/
obj-$(CONFIG_NET_VENDOR_OKI) += oki-semi/
+obj-$(CONFIG_NET_VENDOR_ONSEMI) += onsemi/
obj-$(CONFIG_ETHOC) += ethoc.o
obj-$(CONFIG_NET_VENDOR_PASEMI) += pasemi/
obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/
@@ -105,5 +107,4 @@ obj-$(CONFIG_NET_VENDOR_XILINX) += xilinx/
obj-$(CONFIG_NET_VENDOR_XIRCOM) += xircom/
obj-$(CONFIG_NET_VENDOR_SYNOPSYS) += synopsys/
obj-$(CONFIG_NET_VENDOR_PENSANDO) += pensando/
-obj-$(CONFIG_OA_TC6) += oa_tc6.o
obj-$(CONFIG_NET_VENDOR_ZTE) += zte/
diff --git a/drivers/net/ethernet/adi/Kconfig b/drivers/net/ethernet/adi/Kconfig
index bdb8ff7d15da6..120a52e6b2834 100644
--- a/drivers/net/ethernet/adi/Kconfig
+++ b/drivers/net/ethernet/adi/Kconfig
@@ -29,6 +29,7 @@ config ADIN1110
config ADIN1140
tristate "Analog Devices ADIN1140 MAC-PHY"
depends on SPI
+ depends on PTP_1588_CLOCK_OPTIONAL
select ADIN1140_PHY
select OA_TC6
help
diff --git a/drivers/net/ethernet/microchip/lan865x/Kconfig b/drivers/net/ethernet/microchip/lan865x/Kconfig
index 7f2a4e7e1915f..342172cb8837d 100644
--- a/drivers/net/ethernet/microchip/lan865x/Kconfig
+++ b/drivers/net/ethernet/microchip/lan865x/Kconfig
@@ -8,6 +8,7 @@ if NET_VENDOR_MICROCHIP
config LAN865X
tristate "LAN865x support"
depends on SPI
+ depends on PTP_1588_CLOCK_OPTIONAL
select OA_TC6
help
Support for the Microchip LAN8650/1 Rev.B0/B1 MACPHY Ethernet chip. It
diff --git a/drivers/net/ethernet/oa_tc6/Kconfig b/drivers/net/ethernet/oa_tc6/Kconfig
new file mode 100644
index 0000000000000..2c8c881d5b992
--- /dev/null
+++ b/drivers/net/ethernet/oa_tc6/Kconfig
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# OA TC6 10BASE-T1x MAC-PHY configuration
+#
+
+config OA_TC6
+ tristate "OPEN Alliance TC6 10BASE-T1x MAC-PHY support" if COMPILE_TEST
+ depends on SPI
+ depends on PTP_1588_CLOCK_OPTIONAL
+ select PHYLIB
+ help
+ This library implements OPEN Alliance TC6 10BASE-T1x MAC-PHY
+ Serial Interface protocol for supporting 10BASE-T1x MAC-PHYs.
+
+ To know the implementation details, refer documentation in
+ <file:Documentation/networking/oa-tc6-framework.rst>.
+
diff --git a/drivers/net/ethernet/oa_tc6/Makefile b/drivers/net/ethernet/oa_tc6/Makefile
new file mode 100644
index 0000000000000..964f668efc2d3
--- /dev/null
+++ b/drivers/net/ethernet/oa_tc6/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Makefile for OA TC6 10BASE-T1x MAC-PHY
+#
+
+obj-$(CONFIG_OA_TC6) := oa_tc6_mod.o
+oa_tc6_mod-objs := oa_tc6.o oa_tc6_ptp.o oa_tc6_tstamp.o
diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6/oa_tc6.c
similarity index 82%
rename from drivers/net/ethernet/oa_tc6.c
rename to drivers/net/ethernet/oa_tc6/oa_tc6.c
index 364027c39fa4a..0c4f7d3f978fd 100644
--- a/drivers/net/ethernet/oa_tc6.c
+++ b/drivers/net/ethernet/oa_tc6/oa_tc6.c
@@ -8,114 +8,23 @@
#include <linux/bitfield.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
+#include <linux/bitops.h>
#include <linux/iopoll.h>
#include <linux/interrupt.h>
#include <linux/mdio.h>
#include <linux/phy.h>
#include <linux/oa_tc6.h>
-/* Control command header */
-#define OA_TC6_CTRL_HEADER_DATA_NOT_CTRL BIT(31)
-#define OA_TC6_CTRL_HEADER_WRITE_NOT_READ BIT(29)
-#define OA_TC6_CTRL_HEADER_MEM_MAP_SELECTOR GENMASK(27, 24)
-#define OA_TC6_CTRL_HEADER_ADDR GENMASK(23, 8)
-#define OA_TC6_CTRL_HEADER_LENGTH GENMASK(7, 1)
-#define OA_TC6_CTRL_HEADER_PARITY BIT(0)
-
-/* Data header */
-#define OA_TC6_DATA_HEADER_DATA_NOT_CTRL BIT(31)
-#define OA_TC6_DATA_HEADER_DATA_VALID BIT(21)
-#define OA_TC6_DATA_HEADER_START_VALID BIT(20)
-#define OA_TC6_DATA_HEADER_START_WORD_OFFSET GENMASK(19, 16)
-#define OA_TC6_DATA_HEADER_END_VALID BIT(14)
-#define OA_TC6_DATA_HEADER_END_BYTE_OFFSET GENMASK(13, 8)
-#define OA_TC6_DATA_HEADER_PARITY BIT(0)
-
-/* Data footer */
-#define OA_TC6_DATA_FOOTER_EXTENDED_STS BIT(31)
-#define OA_TC6_DATA_FOOTER_RXD_HEADER_BAD BIT(30)
-#define OA_TC6_DATA_FOOTER_CONFIG_SYNC BIT(29)
-#define OA_TC6_DATA_FOOTER_RX_CHUNKS GENMASK(28, 24)
-#define OA_TC6_DATA_FOOTER_DATA_VALID BIT(21)
-#define OA_TC6_DATA_FOOTER_START_VALID BIT(20)
-#define OA_TC6_DATA_FOOTER_START_WORD_OFFSET GENMASK(19, 16)
-#define OA_TC6_DATA_FOOTER_END_VALID BIT(14)
-#define OA_TC6_DATA_FOOTER_END_BYTE_OFFSET GENMASK(13, 8)
-#define OA_TC6_DATA_FOOTER_TX_CREDITS GENMASK(5, 1)
-
-#define OA_TC6_CTRL_PROT_REPLY_SIZE 4
-#define OA_TC6_CTRL_HEADER_SIZE 4
-#define OA_TC6_CTRL_REG_VALUE_SIZE 4
-#define OA_TC6_CTRL_IGNORED_SIZE 4
-#define OA_TC6_CTRL_MAX_REGISTERS 128
-#define OA_TC6_CTRL_SPI_BUF_SIZE (OA_TC6_CTRL_HEADER_SIZE +\
- (OA_TC6_CTRL_MAX_REGISTERS *\
- (OA_TC6_CTRL_REG_VALUE_SIZE +\
- OA_TC6_CTRL_PROT_REPLY_SIZE)) +\
- OA_TC6_CTRL_IGNORED_SIZE)
-
-#define OA_TC6_CHUNK_PAYLOAD_SIZE 64
-#define OA_TC6_DATA_HEADER_SIZE 4
-#define OA_TC6_CHUNK_SIZE (OA_TC6_DATA_HEADER_SIZE +\
- OA_TC6_CHUNK_PAYLOAD_SIZE)
-#define OA_TC6_MAX_TX_CHUNKS 48
-#define OA_TC6_SPI_DATA_BUF_SIZE (OA_TC6_MAX_TX_CHUNKS *\
- OA_TC6_CHUNK_SIZE)
-#define STATUS0_RESETC_POLL_DELAY 1000
-#define STATUS0_RESETC_POLL_TIMEOUT 1000000
-
-#define OA_TC6_REG_MMS_MASK GENMASK(19, 16)
-
-/* Internal structure for MAC-PHY drivers */
-struct oa_tc6 {
- struct net_device *netdev;
- struct phy_device *phydev;
- struct mii_bus *mdiobus;
- struct spi_device *spi;
- struct mutex spi_ctrl_lock; /* Protects spi control transfer */
- spinlock_t tx_skb_lock; /* Protects tx skb handling */
- void *spi_ctrl_tx_buf;
- void *spi_ctrl_rx_buf;
- void *spi_data_tx_buf;
- void *spi_data_rx_buf;
- struct sk_buff *ongoing_tx_skb;
- struct sk_buff *waiting_tx_skb;
- struct sk_buff *rx_skb;
- u16 tx_skb_offset;
- u16 spi_data_tx_buf_offset;
- u16 tx_credits;
- u8 rx_chunks_available;
- bool wait_until_start_valid;
- bool int_flag;
- bool disable_traffic;
- bool prot_ctrl;
- enum oa_tc6_quirk_flag quirk_flags;
- struct gpio_desc *reset_gpio;
-};
-
-enum oa_tc6_header_type {
- OA_TC6_CTRL_HEADER,
- OA_TC6_DATA_HEADER,
-};
-
-enum oa_tc6_register_op {
- OA_TC6_CTRL_REG_READ = 0,
- OA_TC6_CTRL_REG_WRITE = 1,
-};
-
-enum oa_tc6_data_valid_info {
- OA_TC6_DATA_INVALID,
- OA_TC6_DATA_VALID,
-};
+#include "oa_tc6_std_def.h"
-enum oa_tc6_data_start_valid_info {
- OA_TC6_DATA_START_INVALID,
- OA_TC6_DATA_START_VALID,
+struct oa_tc6_ts_info_rx {
+ bool rtsa;
+ bool rtsp;
};
-enum oa_tc6_data_end_valid_info {
- OA_TC6_DATA_END_INVALID,
- OA_TC6_DATA_END_VALID,
+struct oa_tc6_ts_info_tx {
+ ktime_t hwtstamp;
+ u8 tsc;
};
static int oa_tc6_spi_transfer(struct oa_tc6 *tc6,
@@ -152,6 +61,205 @@ static int oa_tc6_get_parity(u32 p)
return !((p >> 28) & 1);
}
+static struct oa_tc6_ts_info_tx *oa_tc6_tsinfo_tx(struct sk_buff *skb)
+{
+ return (struct oa_tc6_ts_info_tx *)(skb->cb);
+}
+
+static struct oa_tc6_ts_info_rx *oa_tc6_tsinfo_rx(struct sk_buff *skb)
+{
+ return (struct oa_tc6_ts_info_rx *)(skb->cb);
+}
+
+static u8 oa_tc6_next_tsc(u8 tsc)
+{
+ return tsc < OA_TC6_TTSCC_REG_ID ? tsc + 1 : OA_TC6_TTSCA_REG_ID;
+}
+
+static bool oa_tc6_req_tx_hwtstamp(struct oa_tc6 *tc6, struct sk_buff *skb)
+{
+ u8 tsc;
+ u8 i;
+
+ lockdep_assert_held(&tc6->tx_skb_lock);
+
+ if (!skb || !(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
+ return false;
+
+ if (!tc6->hw_tstamp_enabled)
+ return false;
+
+ if (tc6->ts_config.tx_type != HWTSTAMP_TX_ON) {
+ tc6->tx_hwtstamp_lost++;
+ return false;
+ }
+
+ tsc = tc6->ttsc_current_id;
+ for (i = 0; i < OA_TC6_TTSCC_REG_ID; i++) {
+ if (!(tc6->ts_ttsc_pending &
+ BIT(tsc - OA_TC6_TTSCA_REG_ID)))
+ goto slot_found;
+ tsc = oa_tc6_next_tsc(tsc);
+ }
+
+ /* All the three slots are waiting for its event. This skb
+ * can't request timestamp. Marking it to be dropped.
+ */
+ tc6->tx_hwtstamp_lost++;
+ return true;
+
+slot_found:
+ tc6->ts_ttsc_pending |= BIT(tsc - OA_TC6_TTSCA_REG_ID);
+ tc6->ttsc_current_id = oa_tc6_next_tsc(tsc);
+ oa_tc6_tsinfo_tx(skb)->tsc = tsc;
+ skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
+ return false;
+}
+
+static void oa_tc6_events_handle(struct oa_tc6 *tc6, u32 val, const u32 *ts)
+{
+ struct skb_shared_hwtstamps tstamp;
+ struct oa_tc6_ts_info_tx *ski;
+ struct sk_buff *skb, *tmp;
+ LIST_HEAD(deliver);
+ LIST_HEAD(drop);
+ u8 tsc, bit_num;
+ u32 handled = 0;
+ u32 event;
+
+ spin_lock_bh(&tc6->tx_skb_lock);
+ list_for_each_entry_safe(skb, tmp, &tc6->tx_ts_skb_q, list) {
+ ski = oa_tc6_tsinfo_tx(skb);
+ tsc = ski->tsc;
+ bit_num = tsc - OA_TC6_TTSCA_REG_ID;
+ event = OA_TC6_STATUS0_TTSCAA << bit_num;
+ if (!(val & event))
+ continue;
+ if (handled & event) {
+ dev_warn_ratelimited(&tc6->spi->dev,
+ "Multiple skbs\n");
+ tc6->tx_hwtstamp_err++;
+ list_move_tail(&skb->list, &drop);
+ continue;
+ }
+
+ handled |= event;
+ tc6->ts_ttsc_pending &= ~BIT(bit_num);
+
+ ski->hwtstamp = ktime_set(ts[2 * bit_num],
+ ts[2 * bit_num + 1]);
+ tc6->tx_hwtstamp_pkts++;
+ list_move_tail(&skb->list, &deliver);
+ }
+ spin_unlock_bh(&tc6->tx_skb_lock);
+
+ /* skb_tstamp_tx() clones the skb and wakes the owning socket, so keep
+ * it out of the lock that oa_tc6_start_xmit() takes.
+ */
+ list_for_each_entry_safe(skb, tmp, &deliver, list) {
+ list_del(&skb->list);
+ memset(&tstamp, 0, sizeof(tstamp));
+ tstamp.hwtstamp = oa_tc6_tsinfo_tx(skb)->hwtstamp;
+ skb_tstamp_tx(skb, &tstamp);
+ dev_kfree_skb(skb);
+ }
+
+ list_for_each_entry_safe(skb, tmp, &drop, list) {
+ list_del(&skb->list);
+ dev_kfree_skb(skb);
+ }
+
+ if (val & ~handled) {
+ tc6->tx_hwtstamp_err += hweight32(val & ~handled);
+ dev_warn_ratelimited(&tc6->spi->dev,
+ "Unexpected event: 0x%x\n",
+ val & ~handled);
+ }
+}
+
+void oa_tc6_cleanup_tx_tstamp_skbs(struct oa_tc6 *tc6)
+{
+ struct sk_buff *skb, *tmp;
+
+ spin_lock_bh(&tc6->tx_skb_lock);
+ list_for_each_entry_safe(skb, tmp, &tc6->tx_ts_skb_q, list) {
+ list_del(&skb->list);
+ tc6->ts_ttsc_pending &= ~BIT(oa_tc6_tsinfo_tx(skb)->tsc -
+ OA_TC6_TTSCA_REG_ID);
+ dev_kfree_skb(skb);
+
+ /* The frame was transmitted, only its timestamp is lost. */
+ tc6->tx_hwtstamp_lost++;
+ }
+ spin_unlock_bh(&tc6->tx_skb_lock);
+}
+
+static int oa_tc6_update_ts_in_rx_skb(struct oa_tc6 *tc6)
+{
+ unsigned int expected_len = ETH_HLEN;
+ struct sk_buff *skb = tc6->rx_skb;
+ struct oa_tc6_ts_info_rx *ski;
+ __be32 ts_val[2];
+ u32 ts[2];
+
+ ski = oa_tc6_tsinfo_rx(skb);
+ if (ski->rtsa)
+ expected_len += OA_TC6_TSTAMP_SZ;
+
+ if (skb->len < expected_len) {
+ tc6->netdev->stats.rx_length_errors++;
+ return -EINVAL;
+ }
+
+ if (!ski->rtsa)
+ return 0;
+
+ memcpy(&ts_val[0], skb->data, 4);
+ memcpy(&ts_val[1], (u32 *)skb->data + 1, 4);
+
+ ts[0] = be32_to_cpu(ts_val[0]);
+ ts[1] = be32_to_cpu(ts_val[1]);
+
+ /* Check parity */
+ if ((oa_tc6_get_parity(ts[0]) ^ oa_tc6_get_parity(ts[1])) ==
+ !ski->rtsp) {
+ struct skb_shared_hwtstamps *hw_ts;
+
+ /* Report timestamp to the upper layers */
+ hw_ts = skb_hwtstamps(skb);
+ memset(hw_ts, 0, sizeof(*hw_ts));
+ hw_ts->hwtstamp = ktime_set(ts[0], ts[1]);
+ }
+ skb_pull(skb, sizeof(ts));
+
+ return 0;
+}
+
+static int oa_tc6_update_standard_capability(struct oa_tc6 *tc6)
+{
+ u32 regval = 0;
+ int ret;
+
+ ret = oa_tc6_read_register(tc6, OA_TC6_REG_STDCAP, ®val);
+ if (ret)
+ return ret;
+ if (regval & OA_TC6_STDCAP_TIMESTAMP_CAPABILITY)
+ tc6->hw_tstamp_supported = true;
+ return 0;
+}
+
+/**
+ * oa_tc6_set_vend1_mms - Add vendor specific MDIO_MMD to OA TC6 MMS
+ * mapper value.
+ * @tc6: oa_tc6 struct.
+ * @mms: vendor defined MMS value for VEND1 mdio device.
+ */
+void oa_tc6_set_vend1_mms(struct oa_tc6 *tc6, int mms)
+{
+ tc6->vend1_mms = mms;
+}
+EXPORT_SYMBOL_GPL(oa_tc6_set_vend1_mms);
+
static __be32 oa_tc6_prepare_ctrl_header(u32 addr, u8 length,
enum oa_tc6_register_op reg_op)
{
@@ -479,7 +587,7 @@ static int oa_tc6_mdiobus_write(struct mii_bus *bus, int addr, int regnum,
val);
}
-static int oa_tc6_get_phy_c45_mms(int devnum)
+static int oa_tc6_get_phy_c45_mms(struct oa_tc6 *tc6, int devnum)
{
switch (devnum) {
case MDIO_MMD_PCS:
@@ -492,6 +600,8 @@ static int oa_tc6_get_phy_c45_mms(int devnum)
return OA_TC6_PHY_C45_AUTO_NEG_MMS5;
case MDIO_MMD_POWER_UNIT:
return OA_TC6_PHY_C45_POWER_UNIT_MMS6;
+ case MDIO_MMD_VEND1:
+ return tc6->vend1_mms;
default:
return -EOPNOTSUPP;
}
@@ -505,7 +615,7 @@ int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int devnum,
int mms;
int ret;
- mms = oa_tc6_get_phy_c45_mms(devnum);
+ mms = oa_tc6_get_phy_c45_mms(tc6, devnum);
if (mms < 0)
return mms;
@@ -523,7 +633,7 @@ int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int devnum,
struct oa_tc6 *tc6 = bus->priv;
int mms;
- mms = oa_tc6_get_phy_c45_mms(devnum);
+ mms = oa_tc6_get_phy_c45_mms(tc6, devnum);
if (mms < 0)
return mms;
@@ -727,6 +837,16 @@ static void oa_tc6_cleanup_ongoing_rx_skb(struct oa_tc6 *tc6)
static void oa_tc6_cleanup_ongoing_tx_skb(struct oa_tc6 *tc6)
{
+ if (tc6->ongoing_tx_skb &&
+ oa_tc6_tsinfo_tx(tc6->ongoing_tx_skb)->tsc) {
+ u8 tsc = oa_tc6_tsinfo_tx(tc6->ongoing_tx_skb)->tsc;
+
+ spin_lock_bh(&tc6->tx_skb_lock);
+ tc6->ts_ttsc_pending &= ~BIT(tsc - OA_TC6_TTSCA_REG_ID);
+ spin_unlock_bh(&tc6->tx_skb_lock);
+ }
+
+ tc6->tx_skb_offset = 0;
oa_tc6_drop_tx_skb(tc6, tc6->ongoing_tx_skb);
tc6->ongoing_tx_skb = NULL;
}
@@ -752,6 +872,7 @@ static void oa_tc6_free_pending_skbs(struct oa_tc6 *tc6)
{
oa_tc6_free_ongoing_skbs(tc6);
oa_tc6_cleanup_waiting_tx_skb(tc6);
+ oa_tc6_cleanup_tx_tstamp_skbs(tc6);
}
static void oa_tc6_look_for_new_frame(struct oa_tc6 *tc6)
@@ -780,6 +901,8 @@ static void oa_tc6_disable_traffic(struct oa_tc6 *tc6)
netif_tx_disable(tc6->netdev);
oa_tc6_drop_tx_skb(tc6, skb);
oa_tc6_free_ongoing_skbs(tc6);
+ oa_tc6_cleanup_tx_tstamp_skbs(tc6);
+
oa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, regval);
oa_tc6_read_register(tc6, OA_TC6_REG_STATUS0, ®val);
oa_tc6_write_register(tc6, OA_TC6_REG_STATUS0, regval);
@@ -788,15 +911,28 @@ static void oa_tc6_disable_traffic(struct oa_tc6 *tc6)
static int oa_tc6_process_extended_status(struct oa_tc6 *tc6)
{
+ u32 regs[OA_TC6_STATUS0_TTSC_REG_COUNT];
+ bool ts_valid = !!tc6->ptp_clock;
u32 value;
int ret;
- ret = oa_tc6_read_register(tc6, OA_TC6_REG_STATUS0, &value);
+ /* When timestamp is disabled, there is no behavior change
+ * as it reads only STATUS0 register. When enabled,
+ * TTSCA_HIGH..TTSCC_LOW are fetched together with STATUS0
+ * to avoid having to make second SPI transaction. Reading few
+ * extra registers, even it may not be needed every time this
+ * function is called, it is more efficient than making second
+ * SPI transaction, when needed.
+ */
+ ret = oa_tc6_read_registers(tc6, OA_TC6_REG_STATUS0, regs,
+ ts_valid ?
+ OA_TC6_STATUS0_TTSC_REG_COUNT : 1);
if (ret) {
netdev_err(tc6->netdev, "STATUS0 register read failed: %d\n",
ret);
return ret;
}
+ value = regs[0];
/* This function is called for each chunk received in a given SPI
* transaction. In case, extended status bit is set in more than
@@ -805,6 +941,11 @@ static int oa_tc6_process_extended_status(struct oa_tc6 *tc6)
if (!value)
return 0;
+ if ((value & OA_TC6_STATUS0_TTSCA_MASK) != 0)
+ oa_tc6_events_handle(tc6, value &
+ OA_TC6_STATUS0_TTSCA_MASK,
+ ®s[OA_TC6_TTSC_REG_OFFSET]);
+
/* Clear the error interrupts status */
ret = oa_tc6_write_register(tc6, OA_TC6_REG_STATUS0, value);
if (ret) {
@@ -890,6 +1031,13 @@ static void oa_tc6_submit_rx_skb(struct oa_tc6 *tc6)
tc6->rx_skb->len > ETH_FCS_LEN)
skb_trim(tc6->rx_skb, tc6->rx_skb->len - ETH_FCS_LEN);
+ if (oa_tc6_update_ts_in_rx_skb(tc6)) {
+ tc6->netdev->stats.rx_dropped++;
+ dev_kfree_skb_any(tc6->rx_skb);
+ tc6->rx_skb = NULL;
+ return;
+ }
+
tc6->rx_skb->protocol = eth_type_trans(tc6->rx_skb, tc6->netdev);
tc6->netdev->stats.rx_packets++;
tc6->netdev->stats.rx_bytes += tc6->rx_skb->len;
@@ -925,25 +1073,32 @@ static int oa_tc6_update_rx_skb(struct oa_tc6 *tc6, u8 *payload, u8 length)
* buffer pointer. We should release, if a valid pointer is found before
* allocating a new one.
*/
-static int oa_tc6_allocate_rx_skb(struct oa_tc6 *tc6)
+static int oa_tc6_allocate_rx_skb(struct oa_tc6 *tc6, u32 footer)
{
+ struct oa_tc6_ts_info_rx *ski;
+
oa_tc6_cleanup_ongoing_rx_skb(tc6);
- tc6->rx_skb = netdev_alloc_skb_ip_align(tc6->netdev, tc6->netdev->mtu +
- ETH_HLEN + ETH_FCS_LEN);
+ tc6->rx_skb = netdev_alloc_skb_ip_align(tc6->netdev,
+ tc6->netdev->mtu +
+ ETH_HLEN + ETH_FCS_LEN +
+ OA_TC6_TSTAMP_SZ);
if (!tc6->rx_skb) {
tc6->netdev->stats.rx_dropped++;
return -ENOMEM;
}
+ ski = oa_tc6_tsinfo_rx(tc6->rx_skb);
+ ski->rtsa = FIELD_GET(OA_TC6_DATA_FOOTER_RTSA_VALID, footer);
+ ski->rtsp = FIELD_GET(OA_TC6_DATA_FOOTER_RTSP_VALID, footer);
return 0;
}
static int oa_tc6_prcs_complete_rx_frame(struct oa_tc6 *tc6, u8 *payload,
- u16 size)
+ u16 size, u32 footer)
{
int ret;
- ret = oa_tc6_allocate_rx_skb(tc6);
+ ret = oa_tc6_allocate_rx_skb(tc6, footer);
if (ret)
return ret;
@@ -956,11 +1111,11 @@ static int oa_tc6_prcs_complete_rx_frame(struct oa_tc6 *tc6, u8 *payload,
return 0;
}
-static int oa_tc6_prcs_rx_frame_start(struct oa_tc6 *tc6, u8 *payload, u16 size)
+static int oa_tc6_prcs_rx_frame_start(struct oa_tc6 *tc6, u8 *payload, u16 size, u32 footer)
{
int ret;
- ret = oa_tc6_allocate_rx_skb(tc6);
+ ret = oa_tc6_allocate_rx_skb(tc6, footer);
if (ret)
return ret;
@@ -1007,7 +1162,7 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *tc6, u8 *data,
size = end_byte_offset + 1 - start_byte_offset;
return oa_tc6_prcs_complete_rx_frame(tc6,
&data[start_byte_offset],
- size);
+ size, footer);
}
/* Process the chunk with only rx frame start */
@@ -1015,7 +1170,7 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *tc6, u8 *data,
size = OA_TC6_CHUNK_PAYLOAD_SIZE - start_byte_offset;
return oa_tc6_prcs_rx_frame_start(tc6,
&data[start_byte_offset],
- size);
+ size, footer);
}
/* Process the chunk with only rx frame end */
@@ -1048,7 +1203,7 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *tc6, u8 *data,
size = OA_TC6_CHUNK_PAYLOAD_SIZE - start_byte_offset;
return oa_tc6_prcs_rx_frame_start(tc6,
&data[start_byte_offset],
- size);
+ size, footer);
}
/* Process the chunk with ongoing rx frame data */
@@ -1127,13 +1282,15 @@ static int oa_tc6_process_spi_data_rx_buf(struct oa_tc6 *tc6, u16 length)
}
static __be32 oa_tc6_prepare_data_header(bool data_valid, bool start_valid,
- bool end_valid, u8 end_byte_offset)
+ bool end_valid, u8 end_byte_offset,
+ u8 tsc)
{
u32 header = FIELD_PREP(OA_TC6_DATA_HEADER_DATA_NOT_CTRL,
OA_TC6_DATA_HEADER) |
FIELD_PREP(OA_TC6_DATA_HEADER_DATA_VALID, data_valid) |
FIELD_PREP(OA_TC6_DATA_HEADER_START_VALID, start_valid) |
FIELD_PREP(OA_TC6_DATA_HEADER_END_VALID, end_valid) |
+ FIELD_PREP(OA_TC6_DATA_HEADER_TSC_OFFSET, tsc) |
FIELD_PREP(OA_TC6_DATA_HEADER_END_BYTE_OFFSET,
end_byte_offset);
@@ -1152,6 +1309,7 @@ static void oa_tc6_add_tx_skb_to_spi_buf(struct oa_tc6 *tc6)
enum oa_tc6_data_start_valid_info start_valid;
u8 end_byte_offset = 0;
u16 length_to_copy;
+ u8 tsc = 0;
/* Initial value is assigned here to avoid more than 80 characters in
* the declaration place.
@@ -1161,8 +1319,10 @@ static void oa_tc6_add_tx_skb_to_spi_buf(struct oa_tc6 *tc6)
/* Set start valid if the current tx chunk contains the start of the tx
* ethernet frame.
*/
- if (!tc6->tx_skb_offset)
+ if (!tc6->tx_skb_offset) {
start_valid = OA_TC6_DATA_START_VALID;
+ tsc = oa_tc6_tsinfo_tx(tc6->ongoing_tx_skb)->tsc;
+ }
/* If the remaining tx skb length is more than the chunk payload size of
* 64 bytes then copy only 64 bytes and leave the ongoing tx skb for
@@ -1183,17 +1343,29 @@ static void oa_tc6_add_tx_skb_to_spi_buf(struct oa_tc6 *tc6)
tc6->tx_skb_offset = 0;
tc6->netdev->stats.tx_bytes += tc6->ongoing_tx_skb->len;
tc6->netdev->stats.tx_packets++;
- kfree_skb(tc6->ongoing_tx_skb);
+
+ /* Free the ones that are not saved for later processing,
+ * like timestamping.
+ */
+ if (!oa_tc6_tsinfo_tx(tc6->ongoing_tx_skb)->tsc) {
+ kfree_skb(tc6->ongoing_tx_skb);
+ } else {
+ spin_lock_bh(&tc6->tx_skb_lock);
+ list_add_tail(&tc6->ongoing_tx_skb->list,
+ &tc6->tx_ts_skb_q);
+ spin_unlock_bh(&tc6->tx_skb_lock);
+ }
tc6->ongoing_tx_skb = NULL;
}
*tx_buf = oa_tc6_prepare_data_header(OA_TC6_DATA_VALID, start_valid,
- end_valid, end_byte_offset);
+ end_valid, end_byte_offset, tsc);
tc6->spi_data_tx_buf_offset += OA_TC6_CHUNK_SIZE;
}
static u16 oa_tc6_prepare_spi_tx_buf_for_tx_skbs(struct oa_tc6 *tc6)
{
+ struct sk_buff *drop_skb;
u16 used_tx_credits;
/* Get tx skbs and convert them into tx chunks based on the tx credits
@@ -1202,10 +1374,21 @@ static u16 oa_tc6_prepare_spi_tx_buf_for_tx_skbs(struct oa_tc6 *tc6)
for (used_tx_credits = 0; used_tx_credits < tc6->tx_credits;
used_tx_credits++) {
if (!tc6->ongoing_tx_skb) {
+ drop_skb = NULL;
spin_lock_bh(&tc6->tx_skb_lock);
tc6->ongoing_tx_skb = tc6->waiting_tx_skb;
tc6->waiting_tx_skb = NULL;
+ if (oa_tc6_req_tx_hwtstamp(tc6,
+ tc6->ongoing_tx_skb)) {
+ drop_skb = tc6->ongoing_tx_skb;
+ tc6->ongoing_tx_skb = NULL;
+ if (!tc6->disable_traffic &&
+ netif_running(tc6->netdev) &&
+ netif_queue_stopped(tc6->netdev))
+ netif_wake_queue(tc6->netdev);
+ }
spin_unlock_bh(&tc6->tx_skb_lock);
+ oa_tc6_drop_tx_skb(tc6, drop_skb);
}
if (!tc6->ongoing_tx_skb)
break;
@@ -1222,7 +1405,7 @@ static void oa_tc6_add_empty_chunks_to_spi_buf(struct oa_tc6 *tc6,
header = oa_tc6_prepare_data_header(OA_TC6_DATA_INVALID,
OA_TC6_DATA_START_INVALID,
- OA_TC6_DATA_END_INVALID, 0);
+ OA_TC6_DATA_END_INVALID, 0, 0);
while (needed_empty_chunks--) {
__be32 *tx_buf = tc6->spi_data_tx_buf +
@@ -1414,6 +1597,7 @@ netdev_tx_t oa_tc6_start_xmit(struct oa_tc6 *tc6, struct sk_buff *skb)
return NETDEV_TX_OK;
}
+ oa_tc6_tsinfo_tx(skb)->tsc = 0;
spin_lock_bh(&tc6->tx_skb_lock);
if (tc6->waiting_tx_skb) {
netif_stop_queue(tc6->netdev);
@@ -1473,6 +1657,9 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
SET_NETDEV_DEV(netdev, &spi->dev);
mutex_init(&tc6->spi_ctrl_lock);
spin_lock_init(&tc6->tx_skb_lock);
+ tc6->vend1_mms = -EOPNOTSUPP;
+ tc6->ttsc_current_id = OA_TC6_TTSCA_REG_ID;
+ INIT_LIST_HEAD(&tc6->tx_ts_skb_q);
if (quirks)
tc6->quirk_flags = quirks->quirk_flags;
@@ -1566,6 +1753,12 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
goto phy_exit;
}
+ ret = oa_tc6_update_standard_capability(tc6);
+ if (ret) {
+ dev_err(&tc6->spi->dev, "Failed to read capability\n");
+ goto phy_exit;
+ }
+
ret = devm_request_threaded_irq(&tc6->spi->dev, tc6->spi->irq,
oa_tc6_macphy_isr,
oa_tc6_macphy_threaded_irq,
diff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_ptp.c b/drivers/net/ethernet/oa_tc6/oa_tc6_ptp.c
new file mode 100644
index 0000000000000..1b515615819b1
--- /dev/null
+++ b/drivers/net/ethernet/oa_tc6/oa_tc6_ptp.c
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Support for hardware timestamping feature for OPEN Alliance
+ * 10BASE‑T1x MAC‑PHY Serial Interface framework
+ *
+ * Author: Selva Rajagopal <selvamani.rajagopal@onsemi.com>
+ */
+
+#include <linux/kernel.h>
+#include <linux/spi/spi.h>
+#include <linux/ptp_clock_kernel.h>
+#include <linux/ethtool.h>
+#include <linux/phy.h>
+#include <linux/oa_tc6.h>
+
+#include "oa_tc6_std_def.h"
+
+/**
+ * oa_tc6_ptp_register - Registers clock related callbacks
+ * @tc6: oa_tc6 struct.
+ * @info: Describes a PTP hardware clock
+ *
+ * Description: Vendors are expected to set the hardware timestamp
+ * related callbacks before calling this function.
+ *
+ * Return: 0 on success otherwise failed.
+ *
+ */
+int oa_tc6_ptp_register(struct oa_tc6 *tc6, struct ptp_clock_info *info)
+{
+ int ret = 0;
+
+ /* Not supporting hardware timestamp isn't an error */
+ if (!tc6->hw_tstamp_supported)
+ return ret;
+
+ snprintf(info->name, sizeof(info->name), "OA TC6 PTP %s",
+ dev_name(&tc6->spi->dev));
+ tc6->ptp_clock = ptp_clock_register(info, &tc6->spi->dev);
+ if (IS_ERR(tc6->ptp_clock)) {
+ ret = PTR_ERR(tc6->ptp_clock);
+ tc6->ptp_clock = NULL;
+ dev_err(&tc6->spi->dev, "Registration of %s failed\n",
+ info->name);
+ }
+
+ if (tc6->ptp_clock)
+ dev_info(&tc6->spi->dev, "%s registered. index %d\n",
+ info->name, ptp_clock_index(tc6->ptp_clock));
+ return ret;
+}
+EXPORT_SYMBOL_GPL(oa_tc6_ptp_register);
+
+/**
+ * oa_tc6_ptp_unregister - Unregisters clock related callbacks
+ * @tc6: oa_tc6 struct.
+ */
+void oa_tc6_ptp_unregister(struct oa_tc6 *tc6)
+{
+ if (tc6->ptp_clock) {
+ ptp_clock_unregister(tc6->ptp_clock);
+ tc6->ptp_clock = NULL;
+ }
+}
+EXPORT_SYMBOL_GPL(oa_tc6_ptp_unregister);
diff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_std_def.h b/drivers/net/ethernet/oa_tc6/oa_tc6_std_def.h
new file mode 100644
index 0000000000000..cd62071d7f609
--- /dev/null
+++ b/drivers/net/ethernet/oa_tc6/oa_tc6_std_def.h
@@ -0,0 +1,172 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Register and driver related definitions to support
+ * OPEN Alliance 10BASE‑T1x MAC‑PHY Serial Interface framework.
+ *
+ * Author: Selva Rajagopal <selvamani.rajagopal@onsemi.com>
+ */
+
+#ifndef OA_TC6_STD_DEF_H
+#define OA_TC6_STD_DEF_H
+
+#include <linux/ptp_clock_kernel.h>
+#include <linux/net_tstamp.h>
+#include <linux/netdevice.h>
+#include <linux/spi/spi.h>
+#include <linux/skbuff.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+#include <linux/phy.h>
+
+/* Tx timestamp capture register A (high) */
+#define OA_TC6_REG_TTSCA_HIGH (0x10)
+
+/* Control command header */
+#define OA_TC6_CTRL_HEADER_DATA_NOT_CTRL BIT(31)
+#define OA_TC6_CTRL_HEADER_WRITE_NOT_READ BIT(29)
+#define OA_TC6_CTRL_HEADER_MEM_MAP_SELECTOR GENMASK(27, 24)
+#define OA_TC6_CTRL_HEADER_ADDR GENMASK(23, 8)
+#define OA_TC6_CTRL_HEADER_LENGTH GENMASK(7, 1)
+#define OA_TC6_CTRL_HEADER_PARITY BIT(0)
+
+/* Data header */
+#define OA_TC6_DATA_HEADER_DATA_NOT_CTRL BIT(31)
+#define OA_TC6_DATA_HEADER_DATA_VALID BIT(21)
+#define OA_TC6_DATA_HEADER_START_VALID BIT(20)
+#define OA_TC6_DATA_HEADER_START_WORD_OFFSET GENMASK(19, 16)
+#define OA_TC6_DATA_HEADER_END_VALID BIT(14)
+#define OA_TC6_DATA_HEADER_END_BYTE_OFFSET GENMASK(13, 8)
+#define OA_TC6_DATA_HEADER_TSC_OFFSET GENMASK(7, 6)
+#define OA_TC6_DATA_HEADER_PARITY BIT(0)
+
+/* Data footer */
+#define OA_TC6_DATA_FOOTER_EXTENDED_STS BIT(31)
+#define OA_TC6_DATA_FOOTER_RXD_HEADER_BAD BIT(30)
+#define OA_TC6_DATA_FOOTER_CONFIG_SYNC BIT(29)
+#define OA_TC6_DATA_FOOTER_RX_CHUNKS GENMASK(28, 24)
+#define OA_TC6_DATA_FOOTER_DATA_VALID BIT(21)
+#define OA_TC6_DATA_FOOTER_START_VALID BIT(20)
+#define OA_TC6_DATA_FOOTER_START_WORD_OFFSET GENMASK(19, 16)
+#define OA_TC6_DATA_FOOTER_END_VALID BIT(14)
+#define OA_TC6_DATA_FOOTER_RTSA_VALID BIT(7)
+#define OA_TC6_DATA_FOOTER_RTSP_VALID BIT(6)
+#define OA_TC6_DATA_FOOTER_END_BYTE_OFFSET GENMASK(13, 8)
+#define OA_TC6_DATA_FOOTER_TX_CREDITS GENMASK(5, 1)
+
+#define OA_TC6_CTRL_PROT_REPLY_SIZE 4
+#define OA_TC6_CTRL_HEADER_SIZE 4
+#define OA_TC6_CTRL_REG_VALUE_SIZE 4
+#define OA_TC6_CTRL_IGNORED_SIZE 4
+#define OA_TC6_CTRL_MAX_REGISTERS 128
+#define OA_TC6_CTRL_SPI_BUF_SIZE (OA_TC6_CTRL_HEADER_SIZE +\
+ (OA_TC6_CTRL_MAX_REGISTERS *\
+ (OA_TC6_CTRL_REG_VALUE_SIZE +\
+ OA_TC6_CTRL_PROT_REPLY_SIZE)) +\
+ OA_TC6_CTRL_IGNORED_SIZE)
+
+#define OA_TC6_CHUNK_PAYLOAD_SIZE 64
+#define OA_TC6_DATA_HEADER_SIZE 4
+#define OA_TC6_CHUNK_SIZE (OA_TC6_DATA_HEADER_SIZE +\
+ OA_TC6_CHUNK_PAYLOAD_SIZE)
+#define OA_TC6_MAX_TX_CHUNKS 48
+#define OA_TC6_SPI_DATA_BUF_SIZE (OA_TC6_MAX_TX_CHUNKS *\
+ OA_TC6_CHUNK_SIZE)
+#define STATUS0_RESETC_POLL_DELAY 1000
+#define STATUS0_RESETC_POLL_TIMEOUT 1000000
+
+#define OA_TC6_REG_MMS_MASK GENMASK(19, 16)
+
+#define OA_TC6_TSTAMP_SZ 8
+
+#define OA_TC6_TTSCA_REG_ID 1
+#define OA_TC6_TTSCB_REG_ID 2
+#define OA_TC6_TTSCC_REG_ID 3
+
+/* STATUS0 and the TTSCA/B/C capture registers are contiguous in MMS 0, so
+ * they are fetched with a single control transaction while timestamping is
+ * available.
+ */
+#define OA_TC6_TTSC_REG_OFFSET (OA_TC6_REG_TTSCA_HIGH - \
+ OA_TC6_REG_STATUS0)
+#define OA_TC6_TTSC_REG_COUNT (2 * OA_TC6_TTSCC_REG_ID)
+#define OA_TC6_STATUS0_TTSC_REG_COUNT (OA_TC6_TTSC_REG_OFFSET + \
+ OA_TC6_TTSC_REG_COUNT)
+
+/* Useful for reading all the registers between CONFIG0 and INT_MASK0
+ * in a single SPI transaction
+ */
+#define CFG0_TO_IMASK0_REG_COUNT (OA_TC6_REG_INT_MASK0 - \
+ OA_TC6_REG_CONFIG0 + 1)
+#define CFG0_VAL_OFFSET (0)
+#define STATUS0_VAL_OFFSET (OA_TC6_REG_STATUS0 - \
+ OA_TC6_REG_CONFIG0)
+#define IRQM_VAL_OFFSET (OA_TC6_REG_INT_MASK0 - \
+ OA_TC6_REG_CONFIG0)
+
+/* Internal structure for MAC-PHY drivers */
+struct oa_tc6 {
+ struct net_device *netdev;
+ struct phy_device *phydev;
+ struct mii_bus *mdiobus;
+ struct spi_device *spi;
+ struct mutex spi_ctrl_lock; /* Protects spi control transfer */
+ spinlock_t tx_skb_lock; /* Protects tx skb handling */
+ void *spi_ctrl_tx_buf;
+ void *spi_ctrl_rx_buf;
+ void *spi_data_tx_buf;
+ void *spi_data_rx_buf;
+ struct sk_buff *ongoing_tx_skb;
+ struct sk_buff *waiting_tx_skb;
+ struct sk_buff *rx_skb;
+ u16 tx_skb_offset;
+ u16 spi_data_tx_buf_offset;
+ u16 tx_credits;
+ u8 rx_chunks_available;
+ bool wait_until_start_valid;
+ bool int_flag;
+ bool disable_traffic;
+ bool prot_ctrl;
+ enum oa_tc6_quirk_flag quirk_flags;
+ struct gpio_desc *reset_gpio;
+ struct hwtstamp_config ts_config;
+ struct list_head tx_ts_skb_q;
+ struct ptp_clock *ptp_clock;
+ bool hw_tstamp_supported;
+ bool hw_tstamp_enabled;
+ u64 tx_hwtstamp_pkts;
+ u64 tx_hwtstamp_lost;
+ u64 tx_hwtstamp_err;
+ u8 ts_ttsc_pending;
+ u8 ttsc_current_id;
+ int vend1_mms;
+};
+
+enum oa_tc6_header_type {
+ OA_TC6_CTRL_HEADER,
+ OA_TC6_DATA_HEADER,
+};
+
+enum oa_tc6_register_op {
+ OA_TC6_CTRL_REG_READ = 0,
+ OA_TC6_CTRL_REG_WRITE = 1,
+};
+
+enum oa_tc6_data_valid_info {
+ OA_TC6_DATA_INVALID,
+ OA_TC6_DATA_VALID,
+};
+
+enum oa_tc6_data_start_valid_info {
+ OA_TC6_DATA_START_INVALID,
+ OA_TC6_DATA_START_VALID,
+};
+
+enum oa_tc6_data_end_valid_info {
+ OA_TC6_DATA_END_INVALID,
+ OA_TC6_DATA_END_VALID,
+};
+
+void oa_tc6_cleanup_tx_tstamp_skbs(struct oa_tc6 *tc6);
+
+#endif /* OA_TC6_STD_DEF_H */
+
diff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_tstamp.c b/drivers/net/ethernet/oa_tc6/oa_tc6_tstamp.c
new file mode 100644
index 0000000000000..539cbd36a1d04
--- /dev/null
+++ b/drivers/net/ethernet/oa_tc6/oa_tc6_tstamp.c
@@ -0,0 +1,224 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * OPEN Alliance 10BASE‑T1x MAC‑PHY Serial Interface framework
+ *
+ * Author: Selva Rajagopal <selvamani.rajagopal@onsemi.com>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/iopoll.h>
+#include <linux/mdio.h>
+#include <linux/phy.h>
+#include <linux/oa_tc6.h>
+
+#include "oa_tc6_std_def.h"
+
+static int oa_tc6_set_hwtstamp_settings(struct oa_tc6 *tc6,
+ const struct hwtstamp_config *ts_cfg)
+{
+ u32 regs[CFG0_TO_IMASK0_REG_COUNT];
+ u32 cfg0, irqm, status0;
+ bool disabled;
+ int ret;
+
+ if (tc6->ts_config.flags == ts_cfg->flags &&
+ tc6->ts_config.tx_type == ts_cfg->tx_type &&
+ tc6->ts_config.rx_filter == ts_cfg->rx_filter)
+ return 0;
+
+ spin_lock_bh(&tc6->tx_skb_lock);
+ disabled = tc6->disable_traffic;
+ spin_unlock_bh(&tc6->tx_skb_lock);
+ if (disabled)
+ return -EIO;
+
+ /* CONFIG0, STATUS0 and INT_MASK0 span one register block, so a
+ * single control transaction covers all three.
+ */
+ ret = oa_tc6_read_registers(tc6, OA_TC6_REG_CONFIG0, regs,
+ ARRAY_SIZE(regs));
+ if (ret) {
+ dev_err(&tc6->spi->dev, "Failed to read CFG0 block\n");
+ goto out;
+ }
+
+ cfg0 = regs[CFG0_VAL_OFFSET];
+ status0 = regs[STATUS0_VAL_OFFSET];
+ irqm = regs[IRQM_VAL_OFFSET];
+
+ /* Hardware timestamp feature supports 64-bit timestamp only */
+ if (ts_cfg->tx_type == HWTSTAMP_TX_ON ||
+ ts_cfg->rx_filter == HWTSTAMP_FILTER_ALL)
+ cfg0 |= (OA_TC6_CONFIG0_FTSE_ENABLE |
+ OA_TC6_CONFIG0_FTSS_64BIT_TSTAMP);
+ else
+ cfg0 &= ~OA_TC6_CONFIG0_FTSE_ENABLE;
+
+ if (ts_cfg->tx_type == HWTSTAMP_TX_ON)
+ irqm &= ~OA_TC6_INT_MASK0_TTSCA_MASK;
+ else
+ irqm |= OA_TC6_INT_MASK0_TTSCA_MASK;
+
+ /* STATUS0 is write-one-to-clear, so this acknowledges a capture
+ * without delivering its timestamp. Skip it while TX timestamping
+ * stays enabled, where a capture may still be outstanding.
+ */
+ status0 &= OA_TC6_STATUS0_TTSCA_MASK;
+ if (status0 && (tc6->ts_config.tx_type != HWTSTAMP_TX_ON ||
+ ts_cfg->tx_type != HWTSTAMP_TX_ON)) {
+ ret = oa_tc6_write_register(tc6, OA_TC6_REG_STATUS0,
+ status0);
+ if (ret) {
+ dev_err(&tc6->spi->dev,
+ "failed to write STATUS0 register\n");
+ goto out;
+ }
+ }
+
+ ret = oa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, irqm);
+ if (ret) {
+ dev_err(&tc6->spi->dev, "failed to write IRQM register\n");
+ goto out;
+ }
+
+ ret = oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, cfg0);
+ if (ret) {
+ dev_err(&tc6->spi->dev, "failed to write CFG0 register\n");
+ goto out;
+ }
+ spin_lock_bh(&tc6->tx_skb_lock);
+ tc6->ts_config = *ts_cfg;
+ if (cfg0 & OA_TC6_CONFIG0_FTSE_ENABLE)
+ tc6->hw_tstamp_enabled = true;
+ else
+ tc6->hw_tstamp_enabled = false;
+ spin_unlock_bh(&tc6->tx_skb_lock);
+
+ /* The TX timestamp completion interrupt is masked now. Time
+ * to release the queued skbs.
+ */
+ if (ts_cfg->tx_type != HWTSTAMP_TX_ON)
+ oa_tc6_cleanup_tx_tstamp_skbs(tc6);
+out:
+ return ret;
+}
+
+/**
+ * oa_tc6_hwtstamp_get - gets hardware timestamp config
+ * @tc6: oa_tc6 struct.
+ * @cfg: kernel copy of hardware timestamp config
+ */
+void oa_tc6_hwtstamp_get(struct oa_tc6 *tc6,
+ struct kernel_hwtstamp_config *cfg)
+{
+ hwtstamp_config_to_kernel(cfg, &tc6->ts_config);
+}
+EXPORT_SYMBOL_GPL(oa_tc6_hwtstamp_get);
+
+/**
+ * oa_tc6_hwtstamp_set - sets hardware timestamp config
+ * @tc6: oa_tc6 struct.
+ * @cfg: kernel copy of hardware timestamp config
+ *
+ * Return: 0 on success otherwise failed.
+ */
+int oa_tc6_hwtstamp_set(struct oa_tc6 *tc6,
+ struct kernel_hwtstamp_config *cfg)
+{
+ struct hwtstamp_config ts_cfg;
+ int ret;
+
+ if (!netif_running(tc6->netdev))
+ return -EIO;
+
+ /* Set only when STDCAP advertised the capability and the PHC
+ * registered, which is what ethtool -T reports.
+ */
+ if (!tc6->ptp_clock)
+ return -EOPNOTSUPP;
+
+ switch (cfg->tx_type) {
+ case HWTSTAMP_TX_OFF:
+ case HWTSTAMP_TX_ON:
+ break;
+ default:
+ return -ERANGE;
+ }
+
+ switch (cfg->rx_filter) {
+ case HWTSTAMP_FILTER_NONE:
+ case HWTSTAMP_FILTER_ALL:
+ case HWTSTAMP_FILTER_SOME:
+ case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
+ case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
+ case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
+ case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
+ case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
+ case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
+ case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
+ case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
+ case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
+ case HWTSTAMP_FILTER_PTP_V2_EVENT:
+ case HWTSTAMP_FILTER_PTP_V2_SYNC:
+ case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+ case HWTSTAMP_FILTER_NTP_ALL:
+ break;
+ default:
+ return -ERANGE;
+ }
+
+ hwtstamp_config_from_kernel(&ts_cfg, cfg);
+
+ /* Supports timestamping all traffic */
+ if (cfg->rx_filter != HWTSTAMP_FILTER_NONE ||
+ cfg->tx_type == HWTSTAMP_TX_ON)
+ ts_cfg.rx_filter = HWTSTAMP_FILTER_ALL;
+
+ ret = oa_tc6_set_hwtstamp_settings(tc6, &ts_cfg);
+ if (ret)
+ return ret;
+
+ /* Report what was programmed, not asked. */
+ cfg->rx_filter = ts_cfg.rx_filter;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(oa_tc6_hwtstamp_set);
+
+/**
+ * oa_tc6_get_ts_stats - Provides timestamping stats
+ * @tc6: oa_tc6 struct.
+ * @stats: ethtool data structure to fill in
+ */
+void oa_tc6_get_ts_stats(struct oa_tc6 *tc6,
+ struct ethtool_ts_stats *stats)
+{
+ stats->pkts = tc6->tx_hwtstamp_pkts;
+ stats->err = tc6->tx_hwtstamp_err;
+ stats->lost = tc6->tx_hwtstamp_lost;
+}
+EXPORT_SYMBOL_GPL(oa_tc6_get_ts_stats);
+
+/**
+ * oa_tc6_get_ts_info - Provides timestamp info for ethtool
+ * @tc6: oa_tc6 struct.
+ * @info: ethtool timestamping info structure
+ *
+ * Return: 0 on success otherwise failed.
+ */
+int oa_tc6_get_ts_info(struct oa_tc6 *tc6,
+ struct kernel_ethtool_ts_info *info)
+{
+ if (!tc6->ptp_clock)
+ return ethtool_op_get_ts_info(tc6->netdev, info);
+
+ info->so_timestamping = SOF_TIMESTAMPING_RAW_HARDWARE |
+ SOF_TIMESTAMPING_TX_HARDWARE |
+ SOF_TIMESTAMPING_RX_HARDWARE;
+ info->phc_index = ptp_clock_index(tc6->ptp_clock);
+ info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON);
+ info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) |
+ BIT(HWTSTAMP_FILTER_ALL);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(oa_tc6_get_ts_info);
diff --git a/drivers/net/ethernet/onsemi/Kconfig b/drivers/net/ethernet/onsemi/Kconfig
new file mode 100644
index 0000000000000..484de609462a7
--- /dev/null
+++ b/drivers/net/ethernet/onsemi/Kconfig
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# onsemi network device configuration
+#
+
+config NET_VENDOR_ONSEMI
+ bool "onsemi network devices"
+ default y
+ help
+ If you have a network card belonging to this class, say Y.
+
+ Note that the answer to this question doesn't directly affect the
+ kernel: saying N will just cause the configurator to skip all
+ the questions about onsemi ethernet devices. If you say Y, you
+ will be asked for your specific card in the following questions.
+
+if NET_VENDOR_ONSEMI
+
+source "drivers/net/ethernet/onsemi/s2500/Kconfig"
+
+endif # NET_VENDOR_ONSEMI
+
diff --git a/drivers/net/ethernet/onsemi/Makefile b/drivers/net/ethernet/onsemi/Makefile
new file mode 100644
index 0000000000000..f3d4eb154313c
--- /dev/null
+++ b/drivers/net/ethernet/onsemi/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Makefile for the onsemi network device drivers.
+#
+
+obj-$(CONFIG_S2500_MACPHY) += s2500/
+
diff --git a/drivers/net/ethernet/onsemi/s2500/Kconfig b/drivers/net/ethernet/onsemi/s2500/Kconfig
new file mode 100644
index 0000000000000..abd967448af07
--- /dev/null
+++ b/drivers/net/ethernet/onsemi/s2500/Kconfig
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# onsemi S2500 Driver Support
+#
+
+config S2500_MACPHY
+ tristate "S2500 support"
+ depends on SPI
+ depends on PTP_1588_CLOCK_OPTIONAL
+ imply NET_SELFTESTS
+ select BITREVERSE
+ select NCN26000_PHY
+ select OA_TC6
+ help
+ Support for the onsemi S2500 MACPHY Ethernet chip.
+ It works under the framework that conform to OPEN Alliance
+ 10BASE-T1x Serial Interface specification.
+
+ To compile this driver as a module, choose M here. The module will be
+ called s2500.
+
diff --git a/drivers/net/ethernet/onsemi/s2500/Makefile b/drivers/net/ethernet/onsemi/s2500/Makefile
new file mode 100644
index 0000000000000..61ec705cdf9f1
--- /dev/null
+++ b/drivers/net/ethernet/onsemi/s2500/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Makefile for the onsemi network device drivers.
+#
+obj-$(CONFIG_S2500_MACPHY) := s2500.o
+s2500-objs := s2500_main.o s2500_ethtool.o s2500_ptp.o
+
diff --git a/drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c b/drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c
new file mode 100644
index 0000000000000..12e59e8d44a62
--- /dev/null
+++ b/drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c
@@ -0,0 +1,383 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2026 Semiconductor Components Industries, LLC ("onsemi").
+ * onsemi's S2500 10BASE-T1S MAC-PHY driver
+ */
+
+#include <linux/ethtool.h>
+#include <net/selftests.h>
+#include <linux/phy.h>
+
+#include "s2500_hw_def.h"
+
+#define S2500_NUM_REGS 38
+#define S2500_REGDUMP_LEN (sizeof(u32) * (S2500_NUM_REGS * 2))
+
+#define S2500_NUM_MAC_STATS 1
+#define S2500_NUM_RMON_STATS 12
+
+struct s2500_reg_map {
+ u16 reg;
+ u8 mms;
+};
+
+static const struct s2500_reg_map s2500_reg_map[S2500_NUM_REGS] = {
+ { S2500_REG_VS_ONIPVER, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_TWEAKS1, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_PLCAEXT, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_PMATUNE0, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_PMATUNE1, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_T1SWUPTUNE, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_HDD, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_DCQ_TOID, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_DCQ_SQI, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_DCQ_SQI_PLUS, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_HDD_TUNE1, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_HDD_TUNE2, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_HDD_TUNE3, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_WS_STATUS_0, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_WS_CTRL_0, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_WS_STATUS_1, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_WS_CTRL_1, OA_TC6_PHY_C45_VS_PLCA_MMS4 },
+ { S2500_REG_VS_MIIMIRQE, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_MIIMIRQS, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_DIOCFG0, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_CHIPID, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_TWEAKS2, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_MACID0, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_MACID1, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_NVM_HEALTH, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_PTP_SEC, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_PTPNSEC, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_PTP_SETSEC, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_SETNSEC, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_PTP_ADJ, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_CMPCTL, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_CMPSEC, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_CMPNSEC, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_CMPPER, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_CAPCTL, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_CAPSEC, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_CAPNSEC, OA_TC6_PHY_C45_VS_MMS12 },
+ { S2500_REG_VS_BCNCNT, OA_TC6_PHY_C45_VS_MMS12 },
+};
+
+enum s2500_stat_idx {
+ S2500_MSTOCTECTSTX_IDX = 0,
+ S2500_MSTFRAMESTXOK_IDX,
+ S2500_MSTBCASTTXOK_IDX,
+ S2500_MSTMCASTTXOK_IDX,
+ S2500_MSTFRAMESTX64_IDX,
+ S2500_MSTFRAMESTX65_IDX,
+ S2500_MSTFRAMESTX128_IDX,
+ S2500_MSTFRAMESTX256_IDX,
+ S2500_MSTFRAMESTX512_IDX,
+ S2500_MSTFRAMESTX1024_IDX,
+ S2500_MSTTXUNDEFLOW_IDX,
+ S2500_MSTSINGLECOL_IDX,
+ S2500_MSTMULTICOL_IDX,
+ S2500_MSTEXCESSCOL_IDX,
+ S2500_MSTDEFERREDTX_IDX,
+ S2500_MSTCRSERR_IDX,
+ S2500_MSTOCTECTSRX_IDX,
+ S2500_MSTFRAMESRXOK_IDX,
+ S2500_MSTBCASTRXOK_IDX,
+ S2500_MSTMCASTRXOK_IDX,
+ S2500_MSTFRAMESRX64_IDX,
+ S2500_MSTFRAMESRX65_IDX,
+ S2500_MSTFRAMESRX128_IDX,
+ S2500_MSTFRAMESRX256_IDX,
+ S2500_MSTFRAMESRX512_IDX,
+ S2500_MSTFRAMESRX1024_IDX,
+ S2500_MSTRUNTSERR_IDX,
+ S2500_MSTRXTOOLONG_IDX,
+ S2500_MSTFCSERRS_IDX,
+ S2500_MSTSYMBOLERRS_IDX,
+ S2500_MSTALIGNERRS_IDX,
+ S2500_MSTRXOVERFLOW_IDX,
+ S2500_MSTRXDROPPED_IDX,
+};
+
+static const char s2500_mac_stat_strings[][ETH_GSTRING_LEN] = {
+ "rx_mismatch_drops",
+};
+
+static const u8 s2500_mac_stat_map[S2500_NUM_MAC_STATS] = {
+ S2500_MSTRXDROPPED_IDX,
+};
+
+static const u8 s2500_rmon_stat_map[S2500_NUM_RMON_STATS] = {
+ S2500_MSTFRAMESTX64_IDX,
+ S2500_MSTFRAMESTX65_IDX,
+ S2500_MSTFRAMESTX128_IDX,
+ S2500_MSTFRAMESTX256_IDX,
+ S2500_MSTFRAMESTX512_IDX,
+ S2500_MSTFRAMESTX1024_IDX,
+ S2500_MSTFRAMESRX64_IDX,
+ S2500_MSTFRAMESRX65_IDX,
+ S2500_MSTFRAMESRX128_IDX,
+ S2500_MSTFRAMESRX256_IDX,
+ S2500_MSTFRAMESRX512_IDX,
+ S2500_MSTFRAMESRX1024_IDX,
+};
+
+static const struct ethtool_rmon_hist_range s2500_rmon_hist_ranges[] = {
+ { 64, 64 },
+ { 65, 127 },
+ { 128, 255 },
+ { 256, 511 },
+ { 512, 1023 },
+ { 1024, 2000 },
+ { },
+};
+
+#define S2500_MAC_STATS_LEN ARRAY_SIZE(s2500_mac_stat_strings)
+static_assert(S2500_MAC_STATS_LEN == S2500_NUM_MAC_STATS);
+static_assert(ARRAY_SIZE(s2500_mac_stat_map) == S2500_NUM_MAC_STATS);
+static_assert(ARRAY_SIZE(s2500_rmon_stat_map) == S2500_NUM_RMON_STATS);
+
+#define STAT_REG_OFFSET(x) ((S2500_REG_MAC_ST##x) - \
+ S2500_REG_MAC_FIRST_STAT)
+
+static void s2500_update_stats(struct s2500_info *priv)
+{
+ u64 *data = priv->stats_data;
+ u32 *regs, *rptr, addr;
+ int ret;
+
+ if (time_is_after_jiffies(priv->stats_read_at +
+ S2500_STATS_CACHE_PERIOD))
+ return;
+
+ regs = kmalloc_array(S2500_NUM_STAT_REGS, sizeof(u32), GFP_KERNEL);
+ if (!regs)
+ return;
+
+ addr = FIELD_PREP(S2500_REG_MMS_MASK, OA_TC6_MAC_MMS1) |
+ S2500_REG_MAC_STOCTECTSTXL;
+ ret = oa_tc6_read_registers(priv->tc6, addr, regs,
+ S2500_NUM_STAT_REGS);
+ if (ret)
+ goto out;
+
+ priv->stats_read_at = jiffies;
+ rptr = regs;
+
+ /* TX bytes is a 64-bit value that is stored in two regs.
+ * When lower 32 bits are read from OCTETS-L register,
+ * upper bits are sampled and stored in OCTETS-H register.
+ * Request to read multiple registers reads OCTETS-L first.
+ * This way, counter value is read in an atomic manner.
+ */
+ *(data++) += ((u64)*rptr) | (((u64)*(rptr + 1)) << 32);
+
+ /* Rest are 32-bit values until RX bytes register. */
+ for (rptr += 2; (rptr - regs) < STAT_REG_OFFSET(OCTECTSRXL); ++rptr)
+ *(data++) += *rptr;
+
+ /* RX bytes is a 64-bit value that is stored in two regs.
+ * Like TX bytes counter, value is read atomically from
+ * registers.
+ */
+ *(data++) += ((u64)*rptr) | (((u64)*(rptr + 1)) << 32);
+
+ for (rptr += 2; (rptr - regs) < S2500_NUM_STAT_REGS; ++rptr)
+ *(data++) += *rptr;
+out:
+ kfree(regs);
+}
+
+static void s2500_get_drvinfo(struct net_device *ndev,
+ struct ethtool_drvinfo *info)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+
+ strscpy(info->driver, DRV_NAME, sizeof(info->driver));
+ strscpy(info->bus_info, dev_name(&priv->spi->dev),
+ sizeof(info->bus_info));
+}
+
+static int s2500_get_sset_count(struct net_device *ndev, int sset)
+{
+ switch (sset) {
+ case ETH_SS_STATS:
+ return S2500_MAC_STATS_LEN;
+ case ETH_SS_TEST:
+ return net_selftest_get_count();
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
+static void s2500_get_strings(struct net_device *ndev, u32 stringset,
+ u8 *buf)
+{
+ switch (stringset) {
+ case ETH_SS_STATS:
+ memcpy(buf, s2500_mac_stat_strings,
+ S2500_MAC_STATS_LEN * ETH_GSTRING_LEN);
+ break;
+ case ETH_SS_TEST:
+ net_selftest_get_strings(buf);
+ break;
+ }
+}
+
+static void s2500_get_ethtool_stats(struct net_device *ndev,
+ struct ethtool_stats *stats, u64 *data)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+ int i;
+
+ s2500_update_stats(priv);
+ for (i = 0; i < S2500_NUM_MAC_STATS; i++)
+ data[i] = priv->stats_data[s2500_mac_stat_map[i]];
+}
+
+static void s2500_get_eth_mac_stats(struct net_device *ndev,
+ struct ethtool_eth_mac_stats *mac_stats)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+ const u64 *st;
+
+ if (mac_stats->src != ETHTOOL_MAC_STATS_SRC_AGGREGATE)
+ return;
+
+ s2500_update_stats(priv);
+ st = priv->stats_data;
+
+ mac_stats->OctetsTransmittedOK = st[S2500_MSTOCTECTSTX_IDX];
+ mac_stats->FramesTransmittedOK = st[S2500_MSTFRAMESTXOK_IDX];
+ mac_stats->BroadcastFramesXmittedOK = st[S2500_MSTBCASTTXOK_IDX];
+ mac_stats->MulticastFramesXmittedOK = st[S2500_MSTMCASTTXOK_IDX];
+ mac_stats->SingleCollisionFrames = st[S2500_MSTSINGLECOL_IDX];
+ mac_stats->MultipleCollisionFrames = st[S2500_MSTMULTICOL_IDX];
+ mac_stats->FramesAbortedDueToXSColls = st[S2500_MSTEXCESSCOL_IDX];
+ mac_stats->FramesWithDeferredXmissions = st[S2500_MSTDEFERREDTX_IDX];
+ mac_stats->CarrierSenseErrors = st[S2500_MSTCRSERR_IDX];
+ mac_stats->FramesLostDueToIntMACXmitError =
+ st[S2500_MSTTXUNDEFLOW_IDX];
+ mac_stats->OctetsReceivedOK = st[S2500_MSTOCTECTSRX_IDX];
+ mac_stats->FramesReceivedOK = st[S2500_MSTFRAMESRXOK_IDX];
+ mac_stats->BroadcastFramesReceivedOK = st[S2500_MSTBCASTRXOK_IDX];
+ mac_stats->MulticastFramesReceivedOK = st[S2500_MSTMCASTRXOK_IDX];
+ mac_stats->FrameTooLongErrors = st[S2500_MSTRXTOOLONG_IDX];
+ mac_stats->FrameCheckSequenceErrors = st[S2500_MSTFCSERRS_IDX];
+ mac_stats->AlignmentErrors = st[S2500_MSTALIGNERRS_IDX];
+ mac_stats->FramesLostDueToIntMACRcvError =
+ st[S2500_MSTRXOVERFLOW_IDX];
+}
+
+static void s2500_get_eth_phy_stats(struct net_device *ndev,
+ struct ethtool_eth_phy_stats *phy_stats)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+
+ if (phy_stats->src != ETHTOOL_MAC_STATS_SRC_AGGREGATE)
+ return;
+
+ s2500_update_stats(priv);
+ phy_stats->SymbolErrorDuringCarrier =
+ priv->stats_data[S2500_MSTSYMBOLERRS_IDX];
+}
+
+static void s2500_rmon_stats(struct net_device *ndev,
+ struct ethtool_rmon_stats *rmon_stats,
+ const struct ethtool_rmon_hist_range **ranges)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+ u8 offset;
+ int i;
+
+ if (rmon_stats->src != ETHTOOL_MAC_STATS_SRC_AGGREGATE)
+ return;
+
+ s2500_update_stats(priv);
+
+ rmon_stats->undersize_pkts = priv->stats_data[S2500_MSTRUNTSERR_IDX];
+ rmon_stats->oversize_pkts = priv->stats_data[S2500_MSTRXTOOLONG_IDX];
+
+ for (i = 0; i < 6; i++) {
+ offset = s2500_rmon_stat_map[i];
+ rmon_stats->hist_tx[i] = priv->stats_data[offset];
+ }
+
+ for (i = 0; i < 6; i++) {
+ offset = s2500_rmon_stat_map[i + 6];
+ rmon_stats->hist[i] = priv->stats_data[offset];
+ }
+
+ *ranges = s2500_rmon_hist_ranges;
+}
+
+static int s2500_get_ts_info(struct net_device *ndev,
+ struct kernel_ethtool_ts_info *ts_info)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+
+ return oa_tc6_get_ts_info(priv->tc6, ts_info);
+}
+
+static int s2500_get_regs_len(struct net_device *dev)
+{
+ return S2500_REGDUMP_LEN;
+}
+
+static void s2500_get_regs(struct net_device *ndev,
+ struct ethtool_regs *regs, void *p)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+ __be32 *pbuff = p;
+ int ret = 0;
+ u32 val;
+ u16 reg;
+ u8 mms;
+ int i;
+
+ regs->version = 0;
+ memset(p, 0, S2500_REGDUMP_LEN);
+
+ if (!netif_running(ndev))
+ return;
+
+ for (i = 0; i < S2500_NUM_REGS; i++) {
+ val = 0;
+ reg = s2500_reg_map[i].reg;
+ mms = s2500_reg_map[i].mms;
+ ret = oa_tc6_read_register_mms(priv->tc6, mms, reg,
+ &val);
+
+ /* Write a pattern to indicate failure */
+ if (ret)
+ val = 0xDEADC0DE;
+ *pbuff++ = cpu_to_be32(((u32)mms << 16) | reg);
+ *pbuff++ = cpu_to_be32(val);
+ }
+}
+
+static void s2500_get_ts_stats(struct net_device *ndev,
+ struct ethtool_ts_stats *ts_stats)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+
+ oa_tc6_get_ts_stats(priv->tc6, ts_stats);
+}
+
+const struct ethtool_ops s2500_ethtool_ops = {
+ .get_drvinfo = s2500_get_drvinfo,
+ .get_link = ethtool_op_get_link,
+ .get_link_ksettings = phy_ethtool_get_link_ksettings,
+ .set_link_ksettings = phy_ethtool_set_link_ksettings,
+ .get_ts_stats = s2500_get_ts_stats,
+ .get_sset_count = s2500_get_sset_count,
+ .get_strings = s2500_get_strings,
+ .get_ethtool_stats = s2500_get_ethtool_stats,
+ .get_eth_mac_stats = s2500_get_eth_mac_stats,
+ .get_eth_phy_stats = s2500_get_eth_phy_stats,
+ .get_rmon_stats = s2500_rmon_stats,
+ .get_ts_info = s2500_get_ts_info,
+ .get_regs_len = s2500_get_regs_len,
+ .get_regs = s2500_get_regs,
+ .self_test = net_selftest,
+};
+
diff --git a/drivers/net/ethernet/onsemi/s2500/s2500_hw_def.h b/drivers/net/ethernet/onsemi/s2500/s2500_hw_def.h
new file mode 100644
index 0000000000000..0d0b335a397a9
--- /dev/null
+++ b/drivers/net/ethernet/onsemi/s2500/s2500_hw_def.h
@@ -0,0 +1,160 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright 2026 Semiconductor Components Industries, LLC ("onsemi").
+ * onsemi's S2500 10BASE-T1S MAC-PHY driver
+ */
+
+#ifndef S2500_HW_DEF_H
+#define S2500_HW_DEF_H
+
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/spi/spi.h>
+#include <linux/phylink.h>
+#include <linux/net_tstamp.h>
+#include <linux/ptp_clock_kernel.h>
+#include <linux/delay.h>
+#include <linux/mutex.h>
+#include <linux/ktime.h>
+#include <linux/errno.h>
+#include <linux/oa_tc6.h>
+
+#define DRV_NAME "s2500"
+
+#define S2500_N_MCAST_FILTERS 3
+
+#define S2500_REG_MMS_MASK GENMASK(19, 16)
+
+/* SPI OID and model register */
+#define S2500_REG_PHYID 0x1
+
+#define S2500_PHYID_OUI_SHIFT 10
+#define S2500_PHYID_OUI_MASK GENMASK(31, S2500_PHYID_OUI_SHIFT)
+#define S2500_PHYID_OUI_MASK0 GENMASK(21, 16)
+#define S2500_PHYID_OUI_MASK1 GENMASK(15, 8)
+#define S2500_PHYID_OUI_MASK2 GENMASK(7, 0)
+
+#define S2500_CONFIG0_TXCTHRESH_SHIFT 10
+#define S2500_CONFIG0_RXCTE BIT(8)
+#define S2500_CONFIG0_CPS_SHIFT 0
+#define S2500_CONFIG0_TXCTHRESH_8 0x2
+#define S2500_CONFIG0_CPS_64 0x6
+
+/* Read only bit in STATUS0 register */
+#define S2500_STATUS0_PHY_INT BIT(7)
+
+#define S2500_REG_MAC_CTRL 0x0
+
+#define S2500_MAC_CTRL_MCSF BIT(18)
+#define S2500_MAC_CTRL_ADRF BIT(16)
+#define S2500_MAC_CTRL_FCSA BIT(8)
+#define S2500_MAC_CTRL_TXEN BIT(1)
+#define S2500_MAC_CTRL_RXEN BIT(0)
+
+/* MAC address filter registers */
+#define S2500_REG_MAC_ADDRFILTL(n) (16 + 2 * (n))
+#define S2500_REG_MAC_ADDRFILTH(n) (17 + 2 * (n))
+#define S2500_REG_MAC_ADDRMASKL(n) (32 + 2 * (n))
+#define S2500_REG_MAC_ADDRMASKH(n) (33 + 2 * (n))
+
+#define S2500_MAC_ADDRFILT_ENABLE BIT(31)
+
+/* MAC statistic registers */
+#define S2500_REG_MAC_STOCTECTSTXL 48
+#define S2500_REG_MAC_STOCTECTSTXH 49
+#define S2500_REG_MAC_STOCTECTSRXL 65
+#define S2500_REG_MAC_STOCTECTSRXH 66
+#define S2500_REG_MAC_STRXDROPPED 82
+
+/* First/last statistic register for sequential access */
+#define S2500_REG_MAC_FIRST_STAT S2500_REG_MAC_STOCTECTSTXL
+#define S2500_REG_MAC_LAST_STAT S2500_REG_MAC_STRXDROPPED
+
+#define S2500_NUM_STAT_REGS \
+ (S2500_REG_MAC_LAST_STAT - S2500_REG_MAC_FIRST_STAT + 1)
+#define S2500_NUM_STAT_VARS (S2500_NUM_STAT_REGS - 2)
+#define S2500_STATS_CACHE_PERIOD msecs_to_jiffies(100)
+
+/* Vendor specific MMS4 registers */
+#define S2500_REG_VS_ONIPVER 0x8000
+#define S2500_REG_VS_TWEAKS1 0x8001
+#define S2500_REG_VS_PLCAEXT 0x8002
+#define S2500_REG_VS_PMATUNE0 0x8003
+#define S2500_REG_VS_PMATUNE1 0x8004
+#define S2500_REG_VS_T1SWUPTUNE 0x8007
+#define S2500_REG_VS_HDD 0xCC01
+#define S2500_REG_VS_DCQ_TOID 0xCC02
+#define S2500_REG_VS_DCQ_SQI 0xCC03
+#define S2500_REG_VS_DCQ_SQI_PLUS 0xCC04
+#define S2500_REG_VS_HDD_TUNE1 0xCD00
+#define S2500_REG_VS_HDD_TUNE2 0xCD01
+#define S2500_REG_VS_HDD_TUNE3 0xCD02
+#define S2500_REG_VS_WS_STATUS_0 0xD000
+#define S2500_REG_VS_WS_CTRL_0 0xD001
+#define S2500_REG_VS_WS_STATUS_1 0xD100
+#define S2500_REG_VS_WS_CTRL_1 0xD101
+
+/* Vendor specific MMS12 registers */
+#define S2500_REG_VS_MIIMIRQE 0x10
+
+/* MIIM IRQ status register */
+#define S2500_REG_VS_MIIMIRQS 0x11
+
+#define S2500_REG_VS_DIOCFG0 0x12
+
+#define S2500_REG_VS_CHIPID 0x1000
+#define S2500_REG_VS_TWEAKS2 0x1001
+
+/* Permanent MAC address register */
+#define S2500_REG_VS_MACID0 0x1002
+#define S2500_VS_MACID0_BYTE4_MASK GENMASK(15, 8)
+#define S2500_VS_MACID0_BYTE5_MASK GENMASK(7, 0)
+
+#define S2500_REG_VS_MACID1 0x1003
+#define S2500_VS_MACID1_BYTE3_MASK GENMASK(7, 0)
+#define S2500_REG_VS_NVM_HEALTH 0x1005
+
+/* PTP registers */
+#define S2500_REG_VS_PTP_SEC 0x1010
+#define S2500_REG_VS_PTP_SETSEC 0x1012
+#define S2500_REG_VS_PTP_ADJ 0x1014
+
+/* Frequency adjust magnitude, 1 LSB = 0.000125 ppm = 1/8 ppb */
+#define S2500_PTP_ADJ_MAX GENMASK(27, 0)
+#define S2500_PTP_MAX_ADJ_PPB (S2500_PTP_ADJ_MAX / 8)
+#define S2500_REG_VS_PTPNSEC 0x1011
+#define S2500_REG_VS_SETNSEC 0x1013
+#define S2500_REG_VS_CMPCTL 0x1015
+#define S2500_REG_VS_CMPSEC 0x1016
+#define S2500_REG_VS_CMPNSEC 0x1017
+#define S2500_REG_VS_CMPPER 0x1018
+#define S2500_REG_VS_CAPCTL 0x1019
+#define S2500_REG_VS_CAPSEC 0x101A
+#define S2500_REG_VS_CAPNSEC 0x101B
+#define S2500_REG_VS_BCNCNT 0x101C
+
+/* prototypes / forward declarations */
+extern const struct ethtool_ops s2500_ethtool_ops;
+
+struct s2500_info {
+ struct device *dev;
+ struct net_device *ndev;
+
+ /* To have atomic operation for PTP time registers */
+ struct mutex ptp_adj_lock;
+
+ struct spi_device *spi;
+
+ /* statistic counters variables */
+ u64 stats_data[S2500_NUM_STAT_VARS];
+ unsigned long stats_read_at;
+
+ /* PTP related variables */
+ struct ptp_clock_info ptp_clock_info;
+ struct oa_tc6 *tc6;
+};
+
+int s2500_ptp_register(struct s2500_info *priv);
+
+#endif /* S2500_HW_DEF_H */
+
diff --git a/drivers/net/ethernet/onsemi/s2500/s2500_main.c b/drivers/net/ethernet/onsemi/s2500/s2500_main.c
new file mode 100644
index 0000000000000..4cd0f5d106665
--- /dev/null
+++ b/drivers/net/ethernet/onsemi/s2500/s2500_main.c
@@ -0,0 +1,523 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2026 Semiconductor Components Industries, LLC ("onsemi").
+ * onsemi's S2500 10BASE-T1S MAC-PHY driver
+ */
+
+#include <linux/etherdevice.h>
+#include <linux/if_ether.h>
+#include <linux/irqchip.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/bitrev.h>
+#include <linux/phy.h>
+
+#include "s2500_hw_def.h"
+
+/* Initializes the net device MAC address by reading the UID stored
+ * into the device internal non-volatile memory.
+ */
+static int s2500_read_mac_from_nvmem(struct s2500_info *priv)
+{
+ u8 mms = OA_TC6_PHY_C45_VS_MMS12;
+ u8 addr[ETH_ALEN];
+ u32 mac1 = 0;
+ u32 mac0 = 0;
+ u32 val;
+ int ret;
+
+ ret = oa_tc6_read_register_mms(priv->tc6, mms,
+ S2500_REG_VS_MACID1, &mac1);
+ if (ret)
+ return ret;
+
+ ret = oa_tc6_read_register_mms(priv->tc6, mms,
+ S2500_REG_VS_MACID0, &mac0);
+ if (ret)
+ return ret;
+
+ /* Pre-production parts may have 0 */
+ if (mac0 == 0 && mac1 == 0)
+ return -ENXIO;
+
+ ret = oa_tc6_read_register(priv->tc6, S2500_REG_PHYID, &val);
+ if (ret)
+ return ret;
+
+ val = (val & S2500_PHYID_OUI_MASK) >> S2500_PHYID_OUI_SHIFT;
+
+ /* Mapping for bits from PHY ID register to OUI as give below.
+ * - PHY-ID[10:17] provides OUI[16:23]
+ * - PHY-ID[18:25] provides OUI[8:15]
+ * - PHY-ID[26:31] provides OUI[2:7]
+ *
+ * Hardware presents OUI such a way that this requires not just
+ * byte level swap, bit level swap is needed as well.
+ */
+ addr[0] = bitrev8(FIELD_GET(S2500_PHYID_OUI_MASK0, val));
+ addr[1] = bitrev8(FIELD_GET(S2500_PHYID_OUI_MASK1, val));
+ addr[2] = bitrev8(FIELD_GET(S2500_PHYID_OUI_MASK2, val));
+
+ addr[3] = FIELD_GET(S2500_VS_MACID1_BYTE3_MASK, mac1);
+ addr[4] = FIELD_GET(S2500_VS_MACID0_BYTE4_MASK, mac0);
+ addr[5] = FIELD_GET(S2500_VS_MACID0_BYTE5_MASK, mac0);
+
+ __dev_addr_set(priv->ndev, addr, ETH_ALEN);
+ priv->ndev->addr_assign_type = NET_ADDR_PERM;
+ return ret;
+}
+
+/* Writes MAC address to macphy registers */
+static int s2500_set_mac_filter(struct net_device *ndev, const u8 *mac)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+ u8 mms = OA_TC6_MAC_MMS1;
+ u32 val;
+ int ret;
+
+ /* Set unicast address filter */
+ ret = oa_tc6_write_register_mms(priv->tc6, mms,
+ S2500_REG_MAC_ADDRMASKL(0),
+ 0xffffffff);
+ if (ret)
+ return ret;
+
+ ret = oa_tc6_write_register_mms(priv->tc6, mms,
+ S2500_REG_MAC_ADDRMASKH(0),
+ 0xffff);
+ if (ret)
+ return ret;
+
+ val = get_unaligned_be32(&mac[2]);
+
+ ret = oa_tc6_write_register_mms(priv->tc6, mms,
+ S2500_REG_MAC_ADDRFILTL(0),
+ val);
+ if (ret)
+ return ret;
+
+ val = S2500_MAC_ADDRFILT_ENABLE | get_unaligned_be16(mac);
+
+ return oa_tc6_write_register_mms(priv->tc6, mms,
+ S2500_REG_MAC_ADDRFILTH(0),
+ val);
+}
+
+static int s2500_mac_ctrl_modify_bits(struct s2500_info *priv,
+ u32 in_bits, bool clr)
+{
+ u32 reg = S2500_REG_MAC_CTRL;
+ u8 mms = OA_TC6_MAC_MMS1;
+ u32 rval = 0;
+ u32 wval = 0;
+ int ret;
+
+ ret = oa_tc6_read_register_mms(priv->tc6, mms, reg, &rval);
+ if (ret)
+ return ret;
+
+ if (clr)
+ wval = rval & ~in_bits;
+ else
+ wval = rval | in_bits;
+ if (rval != wval)
+ ret = oa_tc6_write_register_mms(priv->tc6, mms,
+ reg, wval);
+ return ret;
+}
+
+static int s2500_init(struct s2500_info *priv)
+{
+ u32 val;
+ int ret;
+
+ /* Configure MAC-PHY's behavior */
+ val = OA_TC6_CONFIG0_SYNC | S2500_CONFIG0_RXCTE |
+ (S2500_CONFIG0_TXCTHRESH_8 <<
+ S2500_CONFIG0_TXCTHRESH_SHIFT) |
+ (S2500_CONFIG0_CPS_64 << S2500_CONFIG0_CPS_SHIFT) |
+ OA_TC6_CONFIG0_FTSS_64BIT_TSTAMP;
+
+ ret = oa_tc6_write_register(priv->tc6, OA_TC6_REG_CONFIG0,
+ val);
+ if (ret)
+ return ret;
+
+ /* Program the source MAC address into the device */
+ ret = s2500_set_mac_filter(priv->ndev, priv->ndev->dev_addr);
+ if (ret)
+ return ret;
+
+ val = S2500_MAC_CTRL_ADRF | S2500_MAC_CTRL_FCSA;
+
+ return s2500_mac_ctrl_modify_bits(priv, val, false);
+}
+
+static void s2500_shutdown(struct s2500_info *priv)
+{
+ u32 val = S2500_MAC_CTRL_TXEN | S2500_MAC_CTRL_RXEN;
+ struct net_device *ndev = priv->ndev;
+
+ netif_stop_queue(ndev);
+ phy_stop(ndev->phydev);
+
+ s2500_mac_ctrl_modify_bits(priv, val, true);
+}
+
+static int s2500_set_promiscuous_mode(struct s2500_info *priv,
+ unsigned int rx_flags)
+{
+ u32 val = S2500_MAC_CTRL_ADRF;
+ bool clr = false;
+
+ if (rx_flags & IFF_PROMISC)
+ clr = true;
+ return s2500_mac_ctrl_modify_bits(priv, val, clr);
+}
+
+static int s2500_set_multicast_mode(struct s2500_info *priv,
+ unsigned int rx_flags,
+ struct netdev_hw_addr_list *mc)
+{
+ struct netdev_hw_addr *ha;
+ u8 mms = OA_TC6_MAC_MMS1;
+ int i, ret = 0;
+ int mc_count;
+ u16 addr;
+ u32 val;
+
+ mc_count = netdev_hw_addr_list_count(mc);
+
+ if ((rx_flags & IFF_ALLMULTI) ||
+ mc_count > S2500_N_MCAST_FILTERS) {
+ /* Disable multicast filter */
+ ret = s2500_mac_ctrl_modify_bits(priv,
+ S2500_MAC_CTRL_MCSF,
+ true);
+ if (ret)
+ return ret;
+
+ /* Accept all multicasts */
+ addr = S2500_REG_MAC_ADDRMASKL(1);
+ ret = oa_tc6_write_register_mms(priv->tc6, mms,
+ addr, 0);
+ if (ret)
+ return ret;
+
+ addr = S2500_REG_MAC_ADDRMASKH(1);
+ ret = oa_tc6_write_register_mms(priv->tc6, mms,
+ addr, 0x100);
+ if (ret)
+ return ret;
+
+ addr = S2500_REG_MAC_ADDRFILTL(1);
+ ret = oa_tc6_write_register_mms(priv->tc6, mms,
+ addr, 0);
+ if (ret)
+ return ret;
+
+ val = S2500_MAC_ADDRFILT_ENABLE | 0x00000100;
+ addr = S2500_REG_MAC_ADDRFILTH(1);
+ ret = oa_tc6_write_register_mms(priv->tc6, mms,
+ addr, val);
+ } else if (mc_count == 0) {
+ /* Enable multicast filter */
+ ret = s2500_mac_ctrl_modify_bits(priv,
+ S2500_MAC_CTRL_MCSF,
+ false);
+ if (ret)
+ return ret;
+
+ /* Disable filters */
+ for (i = 1; i <= S2500_N_MCAST_FILTERS; i++) {
+ addr = S2500_REG_MAC_ADDRFILTH(i);
+ ret = oa_tc6_write_register_mms(priv->tc6,
+ mms, addr, 0);
+ if (ret)
+ return ret;
+ }
+ } else {
+ u32 addrh, addrl;
+
+ /* Disable multicast filter */
+ ret = s2500_mac_ctrl_modify_bits(priv,
+ S2500_MAC_CTRL_MCSF,
+ true);
+ if (ret)
+ return ret;
+
+ /* Disable filters */
+ for (i = 1; i <= S2500_N_MCAST_FILTERS; i++) {
+ addr = S2500_REG_MAC_ADDRFILTH(i);
+ ret = oa_tc6_write_register_mms(priv->tc6,
+ mms, addr, 0);
+ if (ret)
+ return ret;
+ }
+
+ /* Slot 0 holds the unicast MAC, multicast starts at 1 */
+ i = 1;
+ netdev_hw_addr_list_for_each(ha, mc) {
+ const u8 *mac = ha->addr;
+ int slot = i++;
+
+ addrh = S2500_MAC_ADDRFILT_ENABLE |
+ get_unaligned_be16(mac);
+ addrl = get_unaligned_be32(&mac[2]);
+
+ addr = S2500_REG_MAC_ADDRFILTH(slot);
+ ret = oa_tc6_write_register_mms(priv->tc6,
+ mms, addr,
+ addrh);
+ if (ret)
+ return ret;
+
+ addr = S2500_REG_MAC_ADDRFILTL(slot);
+ ret = oa_tc6_write_register_mms(priv->tc6,
+ mms, addr,
+ addrl);
+ if (ret)
+ return ret;
+
+ addr = S2500_REG_MAC_ADDRMASKL(slot);
+ ret = oa_tc6_write_register_mms(priv->tc6,
+ mms, addr,
+ 0xffffffff);
+ if (ret)
+ return ret;
+
+ addr = S2500_REG_MAC_ADDRMASKH(slot);
+ ret = oa_tc6_write_register_mms(priv->tc6,
+ mms, addr,
+ 0xffff);
+ if (ret)
+ return ret;
+ }
+ }
+ return ret;
+}
+
+static int s2500_set_rx_mode(struct net_device *ndev,
+ struct netdev_hw_addr_list *uc,
+ struct netdev_hw_addr_list *mc)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+ int ret;
+
+ ret = s2500_set_promiscuous_mode(priv, ndev->flags);
+ if (ret)
+ return ret;
+
+ return s2500_set_multicast_mode(priv, ndev->flags, mc);
+}
+
+static int s2500_set_mac_address(struct net_device *ndev, void *p)
+{
+ struct sockaddr *addr = p;
+ int ret;
+
+ if (!is_valid_ether_addr(addr->sa_data))
+ return -EADDRNOTAVAIL;
+
+ ret = s2500_set_mac_filter(ndev, addr->sa_data);
+ if (ret)
+ return ret;
+
+ eth_hw_addr_set(ndev, addr->sa_data);
+ return ret;
+}
+
+static netdev_tx_t s2500_start_xmit(struct sk_buff *skb,
+ struct net_device *ndev)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+
+ return oa_tc6_start_xmit(priv->tc6, skb);
+}
+
+static int s2500_open(struct net_device *ndev)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+ u32 val;
+ int ret;
+
+ dev_dbg(&ndev->dev, "%s", "s2500_open\n");
+ phy_start(priv->ndev->phydev);
+
+ val = S2500_MAC_CTRL_TXEN | S2500_MAC_CTRL_RXEN;
+ ret = s2500_mac_ctrl_modify_bits(priv, val, false);
+ if (!ret)
+ netif_start_queue(priv->ndev);
+ else
+ phy_stop(priv->ndev->phydev);
+ return ret;
+}
+
+static int s2500_stop(struct net_device *ndev)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+
+ dev_dbg(&ndev->dev, "%s", "s2500_stop\n");
+
+ s2500_shutdown(priv);
+ return 0;
+}
+
+static int s2500_hwtstamp_get(struct net_device *ndev,
+ struct kernel_hwtstamp_config *k_cfg)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+
+ oa_tc6_hwtstamp_get(priv->tc6, k_cfg);
+ return 0;
+}
+
+static int s2500_hwtstamp_set(struct net_device *ndev,
+ struct kernel_hwtstamp_config *cfg,
+ struct netlink_ext_ack *extack)
+{
+ struct s2500_info *priv = netdev_priv(ndev);
+
+ return oa_tc6_hwtstamp_set(priv->tc6, cfg);
+}
+
+static const struct net_device_ops s2500_netdev_ops = {
+ .ndo_open = s2500_open,
+ .ndo_stop = s2500_stop,
+ .ndo_start_xmit = s2500_start_xmit,
+ .ndo_set_mac_address = s2500_set_mac_address,
+ .ndo_set_rx_mode_async = s2500_set_rx_mode,
+ .ndo_eth_ioctl = phy_do_ioctl_running,
+ .ndo_hwtstamp_get = s2500_hwtstamp_get,
+ .ndo_hwtstamp_set = s2500_hwtstamp_set,
+};
+
+static int s2500_probe(struct spi_device *spi)
+{
+ struct device *dev = &spi->dev;
+ struct net_device *ndev;
+ struct s2500_info *priv;
+ u32 val;
+ int ret;
+
+ if (spi->irq < 0)
+ return -ENODEV;
+
+ ndev = devm_alloc_etherdev(dev, sizeof(struct s2500_info));
+ if (!ndev)
+ return -ENOMEM;
+
+ priv = netdev_priv(ndev);
+ priv->ndev = ndev;
+ priv->spi = spi;
+ priv->dev = dev;
+
+ SET_NETDEV_DEV(ndev, dev);
+
+ mutex_init(&priv->ptp_adj_lock);
+ ndev->irq = spi->irq;
+
+ /* Ensures that the first read is not from the cache. */
+ priv->stats_read_at = jiffies - S2500_STATS_CACHE_PERIOD;
+
+ spi_set_drvdata(spi, priv);
+
+ ndev->netdev_ops = &s2500_netdev_ops;
+ ndev->ethtool_ops = &s2500_ethtool_ops;
+ ndev->if_port = IF_PORT_10BASET;
+
+ priv->tc6 = oa_tc6_init(spi, ndev, NULL);
+ if (IS_ERR(priv->tc6)) {
+ ret = PTR_ERR(priv->tc6);
+ dev_err(&spi->dev, "OA TC6 init failed\n");
+ return ret;
+ }
+ oa_tc6_set_vend1_mms(priv->tc6, OA_TC6_PHY_C45_VS_MMS12);
+
+ /* All read-only bits. Some are self clear. No need to write */
+ ret = oa_tc6_read_register_mms(priv->tc6, OA_TC6_PHY_C45_VS_MMS12,
+ S2500_REG_VS_MIIMIRQS, &val);
+ if (ret) {
+ dev_err(&spi->dev, "Failed to read MIIM IRQ status\n");
+ goto err_reg_read;
+ }
+
+ /* Acknowledge all IRQ status bits */
+ ret = oa_tc6_read_register(priv->tc6,
+ OA_TC6_REG_STATUS0, &val);
+ if (!ret) {
+ /* Clear read only bit */
+ val &= ~S2500_STATUS0_PHY_INT;
+ oa_tc6_write_register(priv->tc6,
+ OA_TC6_REG_STATUS0, val);
+ }
+
+ ret = device_get_ethdev_address(priv->dev, ndev);
+ if (ret)
+ ret = s2500_read_mac_from_nvmem(priv);
+
+ if (ret) {
+ eth_hw_addr_random(ndev);
+ dev_warn(&spi->dev, "Using random MAC address %pM\n",
+ ndev->dev_addr);
+ }
+
+ ret = s2500_init(priv);
+ if (ret) {
+ dev_err(&spi->dev, "Failure seen in s2500_init\n");
+ goto err_reg_read;
+ }
+
+ /* Configure PTP as S2500 supports it */
+ ret = s2500_ptp_register(priv);
+ if (ret)
+ goto err_reg_read;
+
+ ret = register_netdev(ndev);
+ if (!ret)
+ return ret;
+ dev_err(&spi->dev, "Failed to register netdev\n");
+ oa_tc6_ptp_unregister(priv->tc6);
+err_reg_read:
+ oa_tc6_exit(priv->tc6);
+ return ret;
+}
+
+static void s2500_remove(struct spi_device *spi)
+{
+ struct s2500_info *priv = spi_get_drvdata(spi);
+
+ dev_dbg(&priv->ndev->dev, "%s", "s2500_remove\n");
+
+ unregister_netdev(priv->ndev);
+ oa_tc6_ptp_unregister(priv->tc6);
+ oa_tc6_exit(priv->tc6);
+}
+
+static const struct of_device_id s2500_of_match[] = {
+ { .compatible = "onnn,s2500" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, s2500_of_match);
+
+static const struct spi_device_id s2500_ids[] = {
+ { "s2500" },
+ { }
+};
+MODULE_DEVICE_TABLE(spi, s2500_ids);
+
+static struct spi_driver s2500_driver = {
+ .driver = {
+ .name = DRV_NAME,
+ .of_match_table = s2500_of_match,
+ },
+ .probe = s2500_probe,
+ .remove = s2500_remove,
+ .id_table = s2500_ids,
+};
+module_spi_driver(s2500_driver);
+
+MODULE_AUTHOR("Selva Rajagopal <selvamani.rajagopal@onsemi.com>");
+MODULE_AUTHOR("Piergiorgio Beruto");
+MODULE_DESCRIPTION("onsemi MACPHY ethernet driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/onsemi/s2500/s2500_ptp.c b/drivers/net/ethernet/onsemi/s2500/s2500_ptp.c
new file mode 100644
index 0000000000000..2bcf69c0d6a2e
--- /dev/null
+++ b/drivers/net/ethernet/onsemi/s2500/s2500_ptp.c
@@ -0,0 +1,174 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2026 Semiconductor Components Industries, LLC ("onsemi").
+ * onsemi's S2500 10BASE-T1S MAC-PHY driver
+ */
+
+#include "s2500_hw_def.h"
+
+static int s2500_ptp_get_time64(struct ptp_clock_info *ptp,
+ struct timespec64 *ts,
+ struct ptp_system_timestamp *ptp_sts)
+{
+ struct s2500_info *priv = container_of(ptp, struct s2500_info,
+ ptp_clock_info);
+ u32 data[2];
+ u32 addr;
+ int ret;
+
+ ptp_read_system_prets(ptp_sts);
+ addr = FIELD_PREP(S2500_REG_MMS_MASK,
+ OA_TC6_PHY_C45_VS_MMS12) |
+ S2500_REG_VS_PTP_SEC;
+ ret = oa_tc6_read_registers(priv->tc6, addr, &data[0], 2);
+ ptp_read_system_postts(ptp_sts);
+
+ if (!ret) {
+ ts->tv_sec = data[0];
+ ts->tv_nsec = data[1];
+ }
+
+ return ret;
+}
+
+static int s2500_ptp_write_time(struct s2500_info *priv,
+ const struct timespec64 *ts)
+{
+ u32 data[2];
+ u32 addr;
+
+ lockdep_assert_held(&priv->ptp_adj_lock);
+
+ if (ts->tv_sec >= (1ULL << 32))
+ return -ERANGE;
+
+ data[0] = (u32)ts->tv_sec;
+ /* bit 31 = execute set command */
+ data[1] = ts->tv_nsec | BIT(31);
+ addr = FIELD_PREP(S2500_REG_MMS_MASK,
+ OA_TC6_PHY_C45_VS_MMS12) |
+ S2500_REG_VS_PTP_SETSEC;
+
+ return oa_tc6_write_registers(priv->tc6, addr, &data[0], 2);
+}
+
+static int s2500_ptp_set_time64(struct ptp_clock_info *ptp,
+ const struct timespec64 *ts)
+{
+ struct s2500_info *priv = container_of(ptp, struct s2500_info,
+ ptp_clock_info);
+ int ret;
+
+ mutex_lock(&priv->ptp_adj_lock);
+ ret = s2500_ptp_write_time(priv, ts);
+ mutex_unlock(&priv->ptp_adj_lock);
+
+ return ret;
+}
+
+static int s2500_ptp_set_freq(struct s2500_info *priv, long scaled_ppm)
+{
+ u32 sign_bit = 0;
+ long adj;
+ u32 val;
+ u64 ppm;
+
+ if (scaled_ppm < 0) {
+ /* split sign / mod */
+ sign_bit = 1U << 31;
+ scaled_ppm = ~scaled_ppm + 1;
+ }
+
+ /*
+ * Convert unsigned scaled_ppm to atto-seconds per clock cycles.
+ * The scaled_ppm format is Qx.16 --> 1 lsb = 1/65536 ppm.
+ * The clock period of the S2500 is 8ns (125 MHz), so 1 lsb of
+ * adj register LSB is 1 atto-sec / 8ns = 0.000125 ppm.
+ * Represented in Qx.16 format, this is 0.000125 * 2^16 = 8(.192)
+ * To convert scaled_ppm into a register value we need to divide
+ * it by the LSB value, hence adj = (scaled_ppm * 1000) / 8192 to
+ * minimize the precision loss due to the integer arithmetic.
+ * That further reduces to (scaled_ppm * 125) / 1024.
+ */
+ ppm = (u64)scaled_ppm * 125;
+ do_div(ppm, 1024);
+ adj = (long)ppm;
+
+ /* check overflow */
+ if (adj > S2500_PTP_ADJ_MAX)
+ return -ERANGE;
+
+ val = (u32)adj | sign_bit;
+ return oa_tc6_write_register_mms(priv->tc6, OA_TC6_PHY_C45_VS_MMS12,
+ S2500_REG_VS_PTP_ADJ, val);
+}
+
+static int s2500_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
+{
+ struct s2500_info *priv = container_of(ptp, struct s2500_info,
+ ptp_clock_info);
+
+ return s2500_ptp_set_freq(priv, scaled_ppm);
+}
+
+static int s2500_ptp_step_time(struct s2500_info *priv, s64 delta)
+{
+ struct timespec64 target, now, delta_ts;
+ struct ptp_system_timestamp sts;
+ int ret;
+
+ memset(&sts, 0, sizeof(sts));
+ ret = s2500_ptp_get_time64(&priv->ptp_clock_info, &now, &sts);
+ if (ret)
+ return ret;
+ if (delta >= 0) {
+ delta_ts = ns_to_timespec64(delta);
+ target = timespec64_add(now, delta_ts);
+ } else {
+ delta_ts = ns_to_timespec64(-delta);
+ target = timespec64_sub(now, delta_ts);
+ }
+ /* The subtraction above can take the target below the epoch */
+ if (target.tv_sec < 0)
+ return -ERANGE;
+ return s2500_ptp_write_time(priv, &target);
+}
+
+static int s2500_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
+{
+ struct s2500_info *priv = container_of(ptp, struct s2500_info,
+ ptp_clock_info);
+ int ret;
+
+ /* Nothing to do */
+ if (delta == 0)
+ return 0;
+
+ /* The device has no add-delta register, so the offset is applied as
+ * a read-modify-write of the time registers.
+ */
+ mutex_lock(&priv->ptp_adj_lock);
+ ret = s2500_ptp_step_time(priv, delta);
+ mutex_unlock(&priv->ptp_adj_lock);
+
+ return ret;
+}
+
+int s2500_ptp_register(struct s2500_info *priv)
+{
+ struct ptp_clock_info *info = &priv->ptp_clock_info;
+ int ret;
+
+ info->max_adj = S2500_PTP_MAX_ADJ_PPB;
+ info->owner = THIS_MODULE;
+ info->adjfine = s2500_ptp_adjfine;
+ info->gettimex64 = s2500_ptp_get_time64;
+ info->settime64 = s2500_ptp_set_time64;
+ info->adjtime = s2500_ptp_adjtime;
+
+ ret = oa_tc6_ptp_register(priv->tc6, info);
+ if (ret)
+ dev_err(&priv->spi->dev, "PTP registration failed\n");
+ return ret;
+}
+
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index a3cd5cb11ea0a..a626676064225 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -1058,15 +1058,6 @@ static void dp83867_link_change_notify(struct phy_device *phydev)
}
}
-static int dp83867_loopback(struct phy_device *phydev, bool enable, int speed)
-{
- if (enable && speed)
- return -EOPNOTSUPP;
-
- return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
- enable ? BMCR_LOOPBACK : 0);
-}
-
static int
dp83867_led_brightness_set(struct phy_device *phydev,
u8 index, enum led_brightness brightness)
@@ -1292,7 +1283,7 @@ static struct phy_driver dp83867_driver[] = {
.resume = dp83867_resume,
.link_change_notify = dp83867_link_change_notify,
- .set_loopback = dp83867_loopback,
+ .set_loopback = genphy_loopback_no_speed,
.led_brightness_set = dp83867_led_brightness_set,
.led_hw_is_supported = dp83867_led_hw_is_supported,
diff --git a/drivers/net/phy/ncn26000.c b/drivers/net/phy/ncn26000.c
index cabdd83c614f0..de0fafda38761 100644
--- a/drivers/net/phy/ncn26000.c
+++ b/drivers/net/phy/ncn26000.c
@@ -2,7 +2,7 @@
/*
* Driver for the onsemi 10BASE-T1S NCN26000 PHYs family.
*
- * Copyright 2022 onsemi
+ * Copyright 2026 onsemi
*/
#include <linux/kernel.h>
#include <linux/bitfield.h>
@@ -14,6 +14,7 @@
#include "mdio-open-alliance.h"
+#define PHY_ID_S2500 0x180FF411
#define PHY_ID_NCN26000 0x180FF5A1
#define NCN26000_REG_IRQ_CTL 16
@@ -35,15 +36,24 @@
#define TO_TMR_DEFAULT 32
+#define NCN26000_REG_PHYCFG1 0x8001
+#define NCN26000_PHYCFG1_ENI BIT(7)
+#define NCN26000_PHYCFG1_ENI_MASK BIT(7)
+
static int ncn26000_config_init(struct phy_device *phydev)
{
+ int ret = 0;
+
/* HW bug workaround: the default value of the PLCA TO_TIMER should be
* 32, where the current version of NCN26000 reports 24. This will be
* fixed in future PHY versions. For the time being, we force the
* correct default here.
*/
- return phy_write_mmd(phydev, MDIO_MMD_VEND2, MDIO_OATC14_PLCA_TOTMR,
- TO_TMR_DEFAULT);
+ if (phy_id_compare_model(phydev->drv->phy_id, PHY_ID_NCN26000))
+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
+ MDIO_OATC14_PLCA_TOTMR,
+ TO_TMR_DEFAULT);
+ return ret;
}
static int ncn26000_config_aneg(struct phy_device *phydev)
@@ -100,6 +110,24 @@ static int ncn26000_read_status(struct phy_device *phydev)
return 0;
}
+/* Intercept PLCA enable/disable request to
+ * set the proprietary, ENI mode accordingly
+ */
+static int ncn26000_c45_plca_set_cfg(struct phy_device *phydev,
+ const struct phy_plca_cfg *plca_cfg)
+{
+ int ret = genphy_c45_plca_set_cfg(phydev, plca_cfg);
+ u16 eni_cfg = 0;
+
+ if (ret || plca_cfg->enabled < 0)
+ return ret;
+
+ eni_cfg = (plca_cfg->enabled) ? NCN26000_PHYCFG1_ENI : 0;
+ return phy_modify_mmd(phydev, MDIO_MMD_VEND2,
+ NCN26000_REG_PHYCFG1,
+ NCN26000_PHYCFG1_ENI_MASK, eni_cfg);
+}
+
static irqreturn_t ncn26000_handle_interrupt(struct phy_device *phydev)
{
int ret;
@@ -117,8 +145,8 @@ static irqreturn_t ncn26000_handle_interrupt(struct phy_device *phydev)
static int ncn26000_config_intr(struct phy_device *phydev)
{
- int ret;
u16 irqe;
+ int ret;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
// acknowledge IRQs
@@ -141,6 +169,27 @@ static int ncn26000_config_intr(struct phy_device *phydev)
}
static struct phy_driver ncn26000_driver[] = {
+ {
+ PHY_ID_MATCH_MODEL(PHY_ID_S2500),
+ .name = "S2500",
+ .features = PHY_BASIC_T1S_P2MP_FEATURES,
+ .config_init = ncn26000_config_init,
+ .config_intr = ncn26000_config_intr,
+ .config_aneg = ncn26000_config_aneg,
+ .read_status = ncn26000_read_status,
+ .handle_interrupt = ncn26000_handle_interrupt,
+ .set_loopback = genphy_loopback_no_speed,
+ .set_plca_cfg = ncn26000_c45_plca_set_cfg,
+ .get_plca_cfg = genphy_c45_plca_get_cfg,
+ .get_plca_status = genphy_c45_plca_get_status,
+ .soft_reset = genphy_soft_reset,
+ .get_sqi = genphy_c45_oatc14_get_sqi,
+ .get_sqi_max = genphy_c45_oatc14_get_sqi_max,
+ .read_mmd = genphy_read_mmd_c45,
+ .write_mmd = genphy_write_mmd_c45,
+ .cable_test_get_status = genphy_c45_oatc14_cable_test_get_status,
+ .cable_test_start = genphy_c45_oatc14_cable_test_start,
+ },
{
PHY_ID_MATCH_MODEL(PHY_ID_NCN26000),
.name = "NCN26000",
@@ -151,7 +200,7 @@ static struct phy_driver ncn26000_driver[] = {
.read_status = ncn26000_read_status,
.handle_interrupt = ncn26000_handle_interrupt,
.get_plca_cfg = genphy_c45_plca_get_cfg,
- .set_plca_cfg = genphy_c45_plca_set_cfg,
+ .set_plca_cfg = ncn26000_c45_plca_set_cfg,
.get_plca_status = genphy_c45_plca_get_status,
.soft_reset = genphy_soft_reset,
},
@@ -161,11 +210,13 @@ module_phy_driver(ncn26000_driver);
static const struct mdio_device_id __maybe_unused ncn26000_tbl[] = {
{ PHY_ID_MATCH_MODEL(PHY_ID_NCN26000) },
+ { PHY_ID_MATCH_MODEL(PHY_ID_S2500) },
{ }
};
MODULE_DEVICE_TABLE(mdio, ncn26000_tbl);
+MODULE_AUTHOR("Selva Rajagopal <selvamani.rajagopal@onsemi.com>");
MODULE_AUTHOR("Piergiorgio Beruto");
MODULE_DESCRIPTION("onsemi 10BASE-T1S PHY driver");
MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index bfce8b893644f..03419f6455875 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2791,6 +2791,28 @@ int genphy_resume(struct phy_device *phydev)
}
EXPORT_SYMBOL(genphy_resume);
+/**
+ * genphy_loopback_no_speed - Helper to modify the PHY loopback mode
+ * without setting speed. Some PHYs, like 10Base-T1S, don't support
+ * auto-negotiation and therefore setting the speed isn't supported.
+ *
+ * @phydev: The phy_device struct
+ * @enable: Flag to enable or disable the PHY level loopback.
+ * @speed: Speed setting. Not expected to be set. Error if it is set.
+ *
+ * Returns: 0 if successful, negative error code on failure.
+ */
+int genphy_loopback_no_speed(struct phy_device *phydev, bool enable,
+ int speed)
+{
+ if (enable && speed)
+ return -EOPNOTSUPP;
+
+ return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
+ enable ? BMCR_LOOPBACK : 0);
+}
+EXPORT_SYMBOL(genphy_loopback_no_speed);
+
int genphy_loopback(struct phy_device *phydev, bool enable, int speed)
{
if (enable) {
diff --git a/include/linux/oa_tc6.h b/include/linux/oa_tc6.h
index 27f652d4920b2..86075ee113feb 100644
--- a/include/linux/oa_tc6.h
+++ b/include/linux/oa_tc6.h
@@ -7,13 +7,18 @@
* Author: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
*/
+#ifndef _LINUX_OA_TC6_H
+#define _LINUX_OA_TC6_H
+
#include <linux/etherdevice.h>
#include <linux/spi/spi.h>
+#include <linux/ptp_clock_kernel.h>
/* OPEN Alliance TC6 registers */
/* Standard Capabilities Register */
#define OA_TC6_REG_STDCAP 0x0002
#define OA_TC6_STDCAP_DIRECT_PHY_REG_ACCESS BIT(8)
+#define OA_TC6_STDCAP_TIMESTAMP_CAPABILITY BIT(6)
/* Reset Control and Status Register */
#define OA_TC6_REG_RESET 0x0003
@@ -23,6 +28,8 @@
#define OA_TC6_REG_CONFIG0 0x0004
#define OA_TC6_CONFIG0_SYNC BIT(15)
#define OA_TC6_CONFIG0_ZARFE_ENABLE BIT(12)
+#define OA_TC6_CONFIG0_FTSE_ENABLE BIT(7)
+#define OA_TC6_CONFIG0_FTSS_64BIT_TSTAMP BIT(6)
#define OA_TC6_CONFIG0_PROTE BIT(5)
/* Configuration Register #2 */
@@ -30,6 +37,10 @@
/* Status Register #0 */
#define OA_TC6_REG_STATUS0 0x0008
+#define OA_TC6_STATUS0_TTSCAC BIT(10)
+#define OA_TC6_STATUS0_TTSCAB BIT(9)
+#define OA_TC6_STATUS0_TTSCAA BIT(8)
+#define OA_TC6_STATUS0_TTSCA_MASK GENMASK(10, 8)
#define OA_TC6_STATUS0_RESETC BIT(6) /* Reset Complete */
#define OA_TC6_STATUS0_HEADER_ERROR BIT(5)
#define OA_TC6_STATUS0_LOSS_OF_FRAME_ERROR BIT(4)
@@ -43,6 +54,7 @@
/* Interrupt Mask Register #0 */
#define OA_TC6_REG_INT_MASK0 0x000C
+#define OA_TC6_INT_MASK0_TTSCA_MASK GENMASK(10, 8)
#define OA_TC6_INT_MASK0_HEADER_ERR_MASK BIT(5)
#define OA_TC6_INT_MASK0_LOSS_OF_FRAME_ERR_MASK BIT(4)
#define OA_TC6_INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK BIT(3)
@@ -63,6 +75,7 @@
#define OA_TC6_PHY_C45_VS_PLCA_MMS4 4 /* MMD 31 */
#define OA_TC6_PHY_C45_AUTO_NEG_MMS5 5 /* MMD 7 */
#define OA_TC6_PHY_C45_POWER_UNIT_MMS6 6 /* MMD 13 */
+#define OA_TC6_PHY_C45_VS_MMS12 12 /* for vendors */
struct oa_tc6;
@@ -93,3 +106,15 @@ int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int devnum,
int regnum);
int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int devnum,
int regnum, u16 val);
+int oa_tc6_ptp_register(struct oa_tc6 *tc6, struct ptp_clock_info *info);
+int oa_tc6_get_ts_info(struct oa_tc6 *tc6,
+ struct kernel_ethtool_ts_info *info);
+void oa_tc6_hwtstamp_get(struct oa_tc6 *tc6,
+ struct kernel_hwtstamp_config *cfg);
+void oa_tc6_get_ts_stats(struct oa_tc6 *tc6,
+ struct ethtool_ts_stats *stats);
+int oa_tc6_hwtstamp_set(struct oa_tc6 *tc6,
+ struct kernel_hwtstamp_config *cfg);
+void oa_tc6_set_vend1_mms(struct oa_tc6 *tc6, int mms);
+void oa_tc6_ptp_unregister(struct oa_tc6 *tc6);
+#endif /* _LINUX_OA_TC6_H */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 7c5098a0dd6cd..ea3505e49316f 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -2307,6 +2307,8 @@ int genphy_read_status(struct phy_device *phydev);
int genphy_read_master_slave(struct phy_device *phydev);
int genphy_suspend(struct phy_device *phydev);
int genphy_resume(struct phy_device *phydev);
+int genphy_loopback_no_speed(struct phy_device *phydev, bool enable,
+ int speed);
int genphy_loopback(struct phy_device *phydev, bool enable, int speed);
int genphy_soft_reset(struct phy_device *phydev);
irqreturn_t genphy_handle_interrupt_no_ack(struct phy_device *phydev);
|
| 3/2 | 2026/10/09 20:15 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 46424 output: 20 thoughts: 884 Thoughts: **Patch Series Evaluation: Initial Assessment** Okay, let's dive into this patch series for the Linux kernel. My initial impression is that we've got a mixed bag here – some documentation, some configuration changes, and new drivers. First, I need to analyze what this actually *does*. The changes appear to center around several areas. We have a new Device Tree (DT) binding for the onsemi S2500 10BASE-T1S MACPHY, along with a corresponding driver. There's also documentation for a new `oa_tc6` framework and timestamping and PTP support. Notably, the onsemi S2500 is an SPI device, which raises some immediate questions. There's some existing PHY driver updates (dp83867, ncn26000) too. My primary concern, however, lies in *reachability* and testability. Based on the triage philosophy document, I need to ensure that the hardware or functionality addressed by these patches is, in fact, testable under standard conditions. Specifically, the "structurally unreachable hardware" criteria come to mind. SPI devices and MACPHY devices are definitely not as easily emulated as PCIe devices and standard network cards. Can they be instantiated and probed in QEMU or syzkaller? So, how do SPI devices get instantiated? Are there virtual buses, mock devices, spi-controllers, or spidev support available? I need to understand this to assess the overall testability and, by extension, the maintainability of these drivers. Furthermore, let's see about `genphy_loopback_no_speed`. Is this being used? And if so, how? And, is this used in any of the drivers we're introducing in the patch series. Is the functionality reachable through the existing PHY drivers? Specifically, are DP83867 and NCN26000 reachable? And how about the `oa_tc6` framework? I'm going to search the kernel source to see if `oa_tc6` is already being used somewhere else. Then I need to determine if SPI devices are generally instantiated somewhere. |
| 4/2 | 2026/10/09 20:16 | tool | grepper |
0mArgs:{
"Expression": "oa_tc6_init"
}Results: {
"Output": "Documentation/networking/oa-tc6-framework.rst=458=The include/linux/oa_tc6.h defines the following functions:\nDocumentation/networking/oa-tc6-framework.rst-459-\nDocumentation/networking/oa-tc6-framework.rst:460:.. c:function:: struct oa_tc6 *oa_tc6_init(struct spi_device *spi, \\\nDocumentation/networking/oa-tc6-framework.rst-461- struct net_device *netdev, \\\n--\ndrivers/net/ethernet/adi/adin1140.c=709=static int adin1140_probe(struct spi_device *spi)\n--\ndrivers/net/ethernet/adi/adin1140.c-726-\ndrivers/net/ethernet/adi/adin1140.c:727:\tpriv-\u003etc6 = oa_tc6_init(spi, netdev, \u0026tc6_quirks);\ndrivers/net/ethernet/adi/adin1140.c-728-\tif (IS_ERR(priv-\u003etc6))\n--\ndrivers/net/ethernet/microchip/lan865x/lan865x.c=333=static int lan865x_probe(struct spi_device *spi)\n--\ndrivers/net/ethernet/microchip/lan865x/lan865x.c-348-\ndrivers/net/ethernet/microchip/lan865x/lan865x.c:349:\tpriv-\u003etc6 = oa_tc6_init(spi, netdev, NULL);\ndrivers/net/ethernet/microchip/lan865x/lan865x.c-350-\tif (IS_ERR(priv-\u003etc6)) {\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c=1622=static int oa_tc6_check_ctrl_protection(struct oa_tc6 *tc6)\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-1636-/**\ndrivers/net/ethernet/oa_tc6/oa_tc6.c:1637: * oa_tc6_init - allocates and initializes oa_tc6 structure.\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-1638- * @spi: device with which data will be exchanged.\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-1644- */\ndrivers/net/ethernet/oa_tc6/oa_tc6.c:1645:struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-1646-\t\t\t struct oa_tc6_quirks *quirks)\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-1787-}\ndrivers/net/ethernet/oa_tc6/oa_tc6.c:1788:EXPORT_SYMBOL_GPL(oa_tc6_init);\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-1789-\n--\ndrivers/net/ethernet/onsemi/s2500/s2500_main.c=395=static int s2500_probe(struct spi_device *spi)\n--\ndrivers/net/ethernet/onsemi/s2500/s2500_main.c-428-\ndrivers/net/ethernet/onsemi/s2500/s2500_main.c:429:\tpriv-\u003etc6 = oa_tc6_init(spi, ndev, NULL);\ndrivers/net/ethernet/onsemi/s2500/s2500_main.c-430-\tif (IS_ERR(priv-\u003etc6)) {\n--\ninclude/linux/oa_tc6.h=86=struct oa_tc6_quirks {\n--\ninclude/linux/oa_tc6.h-89-\ninclude/linux/oa_tc6.h:90:struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,\ninclude/linux/oa_tc6.h-91-\t\t\t struct oa_tc6_quirks *quirks);\n"
} |
| 5/2 | 2026/10/09 20:16 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 48898 output: 27 thoughts: 159 Thoughts: **My Initial Thoughts on SPI Driver Instantiation** Okay, so I'm looking at this `oa_tc6_init` function, and it's getting called by a few SPI drivers: `adin1140_probe`, `lan865x_probe`, and `s2500_probe`. That's the starting point. My mind immediately jumps to the Linux SPI driver framework. How are these devices actually bound in the system? That's the core question here. Now, a critical point pops up: Can we instantiate an `spi_device` directly from userspace? The kernel documentation and my experience is telling me something I'm not confident in. The normal way is usually through a platform device entry or device tree binding, but the use case is not normal. This leads me to think about syzkaller and its potential. Can syzkaller, which is designed for fuzzing the kernel, instantiate SPI devices? This is a key question if the goal is to test and discover bugs in this code path. And since I'm thinking about that, I wonder if the same applies to I2C devices? I know I2C has `/sys/bus/i2c/devices/i2c-*/new_device`. Then it's like a mental jump: Does SPI have a similar mechanism? A way to dynamically create new devices through the sysfs like I2C does? That's what I need to figure out. Let's see... I'll need to search the SPI driver code for any usage of something like "new_device." Specifically, I'll need to look in `drivers/spi`. That's where I need to start. |
| 6/2 | 2026/10/09 20:16 | tool | grepper |
0mArgs:{
"Expression": "new_device",
"PathPrefixes": [
"drivers/spi"
]
}Results: {
"Output": "drivers/spi/spi-altera-dfl.c=124=static int dfl_spi_altera_probe(struct dfl_device *dfl_dev)\n--\ndrivers/spi/spi-altera-dfl.c-174-\ndrivers/spi/spi-altera-dfl.c:175:\tif (!spi_new_device(host, \u0026board_info)) {\ndrivers/spi/spi-altera-dfl.c-176-\t\tdev_err(dev, \"%s failed to create SPI device: %s\\n\",\n--\ndrivers/spi/spi-altera-platform.c=35=static int altera_spi_probe(struct platform_device *pdev)\n--\ndrivers/spi/spi-altera-platform.c-116-\t\tfor (i = 0; i \u003c pdata-\u003enum_devices; i++) {\ndrivers/spi/spi-altera-platform.c:117:\t\t\tif (!spi_new_device(host, pdata-\u003edevices + i))\ndrivers/spi/spi-altera-platform.c-118-\t\t\t\tdev_warn(\u0026pdev-\u003edev,\n--\ndrivers/spi/spi-butterfly.c=176=static void butterfly_attach(struct parport *p)\n--\ndrivers/spi/spi-butterfly.c-265-\tpp-\u003einfo[0].controller_data = pp;\ndrivers/spi/spi-butterfly.c:266:\tpp-\u003edataflash = spi_new_device(pp-\u003ebitbang.ctlr, \u0026pp-\u003einfo[0]);\ndrivers/spi/spi-butterfly.c-267-\tif (pp-\u003edataflash)\n--\ndrivers/spi/spi-ch341.c=141=static int ch341_probe(struct usb_interface *intf,\n--\ndrivers/spi/spi-ch341.c-206-\ndrivers/spi/spi-ch341.c:207:\tch341-\u003espidev = spi_new_device(ctrl, \u0026chip);\ndrivers/spi/spi-ch341.c-208-\tif (!ch341-\u003espidev) {\n--\ndrivers/spi/spi-cs42l43.c=409=static int cs42l43_spi_probe(struct platform_device *pdev)\n--\ndrivers/spi/spi-cs42l43.c-523-\ndrivers/spi/spi-cs42l43.c:524:\t\tif (!spi_new_device(priv-\u003ectlr, ampl_info))\ndrivers/spi/spi-cs42l43.c-525-\t\t\treturn dev_err_probe(priv-\u003edev, -ENODEV,\n--\ndrivers/spi/spi-cs42l43.c-527-\ndrivers/spi/spi-cs42l43.c:528:\t\tif (!spi_new_device(priv-\u003ectlr, ampr_info))\ndrivers/spi/spi-cs42l43.c-529-\t\t\treturn dev_err_probe(priv-\u003edev, -ENODEV,\n--\ndrivers/spi/spi-intel.c=1375=static int intel_spi_populate_chip(struct intel_spi *ispi)\n--\ndrivers/spi/spi-intel.c-1401-\ndrivers/spi/spi-intel.c:1402:\tif (!spi_new_device(ispi-\u003ehost, \u0026chip))\ndrivers/spi/spi-intel.c-1403-\t\treturn -ENODEV;\n--\ndrivers/spi/spi-intel.c-1430-\ndrivers/spi/spi-intel.c:1431:\tif (!spi_new_device(ispi-\u003ehost, \u0026chip))\ndrivers/spi/spi-intel.c-1432-\t\treturn -ENODEV;\n--\ndrivers/spi/spi-kspi2.c=310=static int kspi2_register_devices(struct kspi2 *kspi)\n--\ndrivers/spi/spi-kspi2.c-316-\tfor (i = 0; i \u003c kspi-\u003eauxdev-\u003einfo_size; i++) {\ndrivers/spi/spi-kspi2.c:317:\t\tstruct spi_device *device = spi_new_device(kspi-\u003ehost, \u0026info[i]);\ndrivers/spi/spi-kspi2.c-318-\n--\ndrivers/spi/spi-lm70llp.c=188=static void spi_lm70llp_attach(struct parport *p)\n--\ndrivers/spi/spi-lm70llp.c-266-\tpp-\u003einfo.controller_data = pp;\ndrivers/spi/spi-lm70llp.c:267:\tpp-\u003espidev_lm70 = spi_new_device(pp-\u003ebitbang.ctlr, \u0026pp-\u003einfo);\ndrivers/spi/spi-lm70llp.c-268-\tif (pp-\u003espidev_lm70)\n--\ndrivers/spi/spi-lm70llp.c-271-\telse {\ndrivers/spi/spi-lm70llp.c:272:\t\tdev_warn(\u0026pd-\u003edev, \"spi_new_device failed\\n\");\ndrivers/spi/spi-lm70llp.c-273-\t\tstatus = -ENODEV;\n--\ndrivers/spi/spi-xilinx.c=402=static int xilinx_spi_probe(struct platform_device *pdev)\n--\ndrivers/spi/spi-xilinx.c-509-\t\tfor (i = 0; i \u003c pdata-\u003enum_devices; i++)\ndrivers/spi/spi-xilinx.c:510:\t\t\tspi_new_device(host, pdata-\u003edevices + i);\ndrivers/spi/spi-xilinx.c-511-\t}\n--\ndrivers/spi/spi.c=297=static const struct attribute_group spi_controller_statistics_group = {\n--\ndrivers/spi/spi.c-304-/*\ndrivers/spi/spi.c:305: * new_device_store - instantiate a new SPI device from userspace\ndrivers/spi/spi.c-306- *\n--\ndrivers/spi/spi.c-309- * Examples:\ndrivers/spi/spi.c:310: * echo spidev 0 \u003e new_device\ndrivers/spi/spi.c:311: * echo spidev 0 10000000 \u003e new_device\ndrivers/spi/spi.c:312: * echo spidev 0 10000000 3 \u003e new_device\ndrivers/spi/spi.c-313- */\ndrivers/spi/spi.c=314=static ssize_t\ndrivers/spi/spi.c:315:new_device_store(struct device *dev, struct device_attribute *attr,\ndrivers/spi/spi.c-316-\t\t const char *buf, size_t count)\n--\ndrivers/spi/spi.c-329-\tif (!blank) {\ndrivers/spi/spi.c:330:\t\tdev_err(dev, \"new_device: Missing parameters\\n\");\ndrivers/spi/spi.c-331-\t\treturn -EINVAL;\n--\ndrivers/spi/spi.c-334-\tif (blank == buf || blank - buf \u003e SPI_NAME_SIZE - 1) {\ndrivers/spi/spi.c:335:\t\tdev_err(dev, \"new_device: Invalid device name\\n\");\ndrivers/spi/spi.c-336-\t\treturn -EINVAL;\n--\ndrivers/spi/spi.c-348-\tif (sscanf(++blank, \"%u %u %u\", \u0026chip_select, \u0026max_speed_hz, \u0026mode) \u003c 1) {\ndrivers/spi/spi.c:349:\t\tdev_err(dev, \"new_device: Can't parse chip select\\n\");\ndrivers/spi/spi.c-350-\t\treturn -EINVAL;\n--\ndrivers/spi/spi.c-359-\tif (chip_select \u003e U8_MAX || chip_select \u003e= ctlr-\u003enum_chipselect) {\ndrivers/spi/spi.c:360:\t\tdev_err(dev, \"new_device: Chip select %u out of range (num_chipselect=%u)\\n\",\ndrivers/spi/spi.c-361-\t\t\tchip_select, ctlr-\u003enum_chipselect);\n--\ndrivers/spi/spi.c-372-\tif (mode \u0026 ~(u32)SPI_MODE_USER_MASK) {\ndrivers/spi/spi.c:373:\t\tdev_err(dev, \"new_device: Invalid mode bits 0x%x\\n\",\ndrivers/spi/spi.c-374-\t\t\tmode \u0026 ~(u32)SPI_MODE_USER_MASK);\n--\ndrivers/spi/spi.c-401-\t/*\ndrivers/spi/spi.c:402:\t * spi_unregister_controller() removes the new_device/delete_device\ndrivers/spi/spi.c-403-\t * sysfs group before taking add_lock, so kernfs_drain() has already\n--\ndrivers/spi/spi.c-421-\ndrivers/spi/spi.c:422:\tdev_info(dev, \"new_device: Instantiated device %s at CS%u\\n\",\ndrivers/spi/spi.c-423-\t\t modalias, chip_select);\n--\ndrivers/spi/spi.c-425-}\ndrivers/spi/spi.c:426:static DEVICE_ATTR_IGNORE_LOCKDEP(new_device, 0200, NULL, new_device_store);\ndrivers/spi/spi.c-427-\n--\ndrivers/spi/spi.c=471=static struct attribute *spi_controller_userspace_attrs[] = {\ndrivers/spi/spi.c:472:\t\u0026dev_attr_new_device.attr,\ndrivers/spi/spi.c-473-\t\u0026dev_attr_delete_device.attr,\n--\ndrivers/spi/spi.c=477=static const struct attribute_group spi_controller_userspace_group = {\n--\ndrivers/spi/spi.c-484- * spi_controller_userspace_group is registered manually for host controllers\ndrivers/spi/spi.c:485: * at the end of spi_register_controller() so new_device/delete_device only\ndrivers/spi/spi.c-486- * appear after DT/ACPI children and the queue are set up.\n--\ndrivers/spi/spi.c=979=EXPORT_SYMBOL_GPL(spi_add_device);\n--\ndrivers/spi/spi.c-981-/**\ndrivers/spi/spi.c:982: * spi_new_device - instantiate one new SPI device\ndrivers/spi/spi.c-983- * @ctlr: Controller to which device is connected\n--\ndrivers/spi/spi.c-994- */\ndrivers/spi/spi.c:995:struct spi_device *spi_new_device(struct spi_controller *ctlr,\ndrivers/spi/spi.c-996-\t\t\t\t struct spi_board_info *chip)\n--\ndrivers/spi/spi.c-1050-}\ndrivers/spi/spi.c:1051:EXPORT_SYMBOL_GPL(spi_new_device);\ndrivers/spi/spi.c-1052-\n--\ndrivers/spi/spi.c=1081=static void spi_match_controller_to_boardinfo(struct spi_controller *ctlr,\n--\ndrivers/spi/spi.c-1088-\ndrivers/spi/spi.c:1089:\tdev = spi_new_device(ctlr, bi);\ndrivers/spi/spi.c-1090-\tif (!dev)\n--\ndrivers/spi/spi.c=3652=int spi_register_controller(struct spi_controller *ctlr)\n--\ndrivers/spi/spi.c-3757-\t/*\ndrivers/spi/spi.c:3758:\t * Register the new_device/delete_device sysfs interface as the\ndrivers/spi/spi.c-3759-\t * final step of host controller bringup, only after the queue,\n--\ndrivers/spi/spi.c=3838=void spi_unregister_controller(struct spi_controller *ctlr)\n--\ndrivers/spi/spi.c-3843-\t/*\ndrivers/spi/spi.c:3844:\t * Drain in-flight new_device/delete_device sysfs stores and\ndrivers/spi/spi.c-3845-\t * prevent new ones from starting. Must happen before we take\n"
} |
| 7/2 | 2026/10/09 20:16 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 52622 output: 35 thoughts: 75 Thoughts: Here's my summary, as though I'm thinking through this process: **A Quick Dive into SPI Device Instantiation** Okay, so I see something interesting here – SPI actually has a `new_device` entry in sysfs. That's not always the case with these kernel subsystems, so that immediately piqued my interest. Let's see... the code's pointing me to `new_device_store` in `drivers/spi/spi.c`. Alright, so the user writes something like "echo spidev 0 > new_device" into that file. But wait a minute, the implication is that this somehow *instantiates* arbitrary SPI devices based on that write? Does it just handle specific devices hardcoded into the kernel, or can it handle *any* kind of SPI device? It feels like it would be a security risk to be able to create arbitrary devices. Let's dig deeper into `new_device_store` in `drivers/spi/spi.c` and figure out exactly how the device creation is being handled to confirm whether the device creation is arbitrary. |
| 8/2 | 2026/10/09 20:16 | tool | read-file |
0mArgs:{
"File": "drivers/spi/spi.c",
"FirstLine": 314,
"LineCount": 90
}Results: {
"Contents": " 314:\tstatic ssize_t\n 315:\tnew_device_store(struct device *dev, struct device_attribute *attr,\n 316:\t\t\t const char *buf, size_t count)\n 317:\t{\n 318:\t\tstruct spi_controller *ctlr = container_of(dev, struct spi_controller,\n 319:\t\t\t\t\t\t\t dev);\n 320:\t\tstruct spi_device *spi;\n 321:\t\tchar modalias[SPI_NAME_SIZE];\n 322:\t\tunsigned int chip_select;\n 323:\t\tu32 max_speed_hz = 0;\n 324:\t\tu32 mode = 0;\n 325:\t\tchar *blank;\n 326:\t\tint status;\n 327:\t\n 328:\t\tblank = strchr(buf, ' ');\n 329:\t\tif (!blank) {\n 330:\t\t\tdev_err(dev, \"new_device: Missing parameters\\n\");\n 331:\t\t\treturn -EINVAL;\n 332:\t\t}\n 333:\t\n 334:\t\tif (blank == buf || blank - buf \u003e SPI_NAME_SIZE - 1) {\n 335:\t\t\tdev_err(dev, \"new_device: Invalid device name\\n\");\n 336:\t\t\treturn -EINVAL;\n 337:\t\t}\n 338:\t\n 339:\t\tmemset(modalias, 0, sizeof(modalias));\n 340:\t\tmemcpy(modalias, buf, blank - buf);\n 341:\t\n 342:\t\t/*\n 343:\t\t * sscanf fills only the fields it matches; unmatched optional\n 344:\t\t * fields (max_speed_hz, mode) stay zero from initialisation above.\n 345:\t\t * max_speed_hz == 0 is clamped to the controller max by spi_setup().\n 346:\t\t * mode == 0 selects SPI mode 0 (CPOL=0, CPHA=0).\n 347:\t\t */\n 348:\t\tif (sscanf(++blank, \"%u %u %u\", \u0026chip_select, \u0026max_speed_hz, \u0026mode) \u003c 1) {\n 349:\t\t\tdev_err(dev, \"new_device: Can't parse chip select\\n\");\n 350:\t\t\treturn -EINVAL;\n 351:\t\t}\n 352:\t\n 353:\t\t/*\n 354:\t\t * spi_device.chip_select[] is u8, so cap at U8_MAX independently of\n 355:\t\t * ctlr-\u003enum_chipselect (which is u16 and may exceed 255). Without\n 356:\t\t * this, values in (U8_MAX, num_chipselect) would silently truncate\n 357:\t\t * inside spi_set_chipselect() and select the wrong CS.\n 358:\t\t */\n 359:\t\tif (chip_select \u003e U8_MAX || chip_select \u003e= ctlr-\u003enum_chipselect) {\n 360:\t\t\tdev_err(dev, \"new_device: Chip select %u out of range (num_chipselect=%u)\\n\",\n 361:\t\t\t\tchip_select, ctlr-\u003enum_chipselect);\n 362:\t\t\treturn -EINVAL;\n 363:\t\t}\n 364:\t\n 365:\t\t/*\n 366:\t\t * Reject kernel-internal mode bits (SPI_NO_TX, SPI_NO_RX,\n 367:\t\t * SPI_TPM_HW_FLOW, ...). These are set only by in-kernel drivers\n 368:\t\t * that know they are safe on their controller/device pair and must\n 369:\t\t * not be settable through a userspace-writable sysfs. Matches\n 370:\t\t * spidev's SPI_IOC_WR_MODE32 handling (drivers/spi/spidev.c).\n 371:\t\t */\n 372:\t\tif (mode \u0026 ~(u32)SPI_MODE_USER_MASK) {\n 373:\t\t\tdev_err(dev, \"new_device: Invalid mode bits 0x%x\\n\",\n 374:\t\t\t\tmode \u0026 ~(u32)SPI_MODE_USER_MASK);\n 375:\t\t\treturn -EINVAL;\n 376:\t\t}\n 377:\t\n 378:\t\tspi = spi_alloc_device(ctlr);\n 379:\t\tif (!spi)\n 380:\t\t\treturn -ENOMEM;\n 381:\t\n 382:\t\tspi_set_chipselect(spi, 0, chip_select);\n 383:\t\tspi-\u003emax_speed_hz = max_speed_hz;\n 384:\t\tspi-\u003emode = mode;\n 385:\t\tspi-\u003ecs_index_mask = BIT(0);\n 386:\t\tstrscpy(spi-\u003emodalias, modalias, sizeof(spi-\u003emodalias));\n 387:\t\n 388:\t\t/*\n 389:\t\t * Set driver_override so that the device binds to the driver\n 390:\t\t * named by modalias regardless of whether that driver's\n 391:\t\t * id_table contains a matching entry. This is needed because\n 392:\t\t * some drivers (e.g. spidev) deliberately omit generic names\n 393:\t\t * from their id_table.\n 394:\t\t */\n 395:\t\tstatus = device_set_driver_override(\u0026spi-\u003edev, modalias);\n 396:\t\tif (status) {\n 397:\t\t\tspi_dev_put(spi);\n 398:\t\t\treturn status;\n 399:\t\t}\n 400:\t\n 401:\t\t/*\n 402:\t\t * spi_unregister_controller() removes the new_device/delete_device\n 403:\t\t * sysfs group before taking add_lock, so kernfs_drain() has already\n"
} |
| 9/2 | 2026/10/09 20:16 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 54484 output: 47 thoughts: 147 Thoughts: Okay, let me break this down. **Analyzing the `s2500_probe` Function** Hmm, is `s2500_probe` going to succeed? Let's take a look. I'm focusing on the code snippet you've provided, specifically the `s2500_probe` function. I see a check for `spi->irq`. If that's negative, it immediately returns `-ENODEV`. That's standard practice, nothing surprising there. But then, I see a call to `oa_tc6_init`. Now, that's where things get interesting. What's `oa_tc6_init` doing? I need to understand that function call to have a complete picture. Looks like it's defined in `drivers/net/ethernet/oa_tc6/oa_tc6.c`, so I'll go check that out. |
| 10/2 | 2026/10/09 20:16 | tool | read-file |
0mArgs:{
"File": "drivers/net/ethernet/oa_tc6/oa_tc6.c",
"FirstLine": 1645,
"LineCount": 90
}Results: {
"Contents": "1645:\tstruct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,\n1646:\t\t\t\t struct oa_tc6_quirks *quirks)\n1647:\t{\n1648:\t\tstruct oa_tc6 *tc6;\n1649:\t\tint ret;\n1650:\t\n1651:\t\ttc6 = devm_kzalloc(\u0026spi-\u003edev, sizeof(*tc6), GFP_KERNEL);\n1652:\t\tif (!tc6)\n1653:\t\t\treturn ERR_PTR(-ENOMEM);\n1654:\t\n1655:\t\ttc6-\u003espi = spi;\n1656:\t\ttc6-\u003enetdev = netdev;\n1657:\t\tSET_NETDEV_DEV(netdev, \u0026spi-\u003edev);\n1658:\t\tmutex_init(\u0026tc6-\u003espi_ctrl_lock);\n1659:\t\tspin_lock_init(\u0026tc6-\u003etx_skb_lock);\n1660:\t\ttc6-\u003evend1_mms = -EOPNOTSUPP;\n1661:\t\ttc6-\u003ettsc_current_id = OA_TC6_TTSCA_REG_ID;\n1662:\t\tINIT_LIST_HEAD(\u0026tc6-\u003etx_ts_skb_q);\n1663:\t\n1664:\t\tif (quirks)\n1665:\t\t\ttc6-\u003equirk_flags = quirks-\u003equirk_flags;\n1666:\t\n1667:\t\t/* Set the SPI controller to pump at realtime priority */\n1668:\t\ttc6-\u003espi-\u003ert = true;\n1669:\t\tret = spi_setup(tc6-\u003espi);\n1670:\t\tif (ret \u003c 0)\n1671:\t\t\treturn ERR_PTR(ret);\n1672:\t\n1673:\t\ttc6-\u003espi_ctrl_tx_buf = devm_kzalloc(\u0026tc6-\u003espi-\u003edev,\n1674:\t\t\t\t\t\t OA_TC6_CTRL_SPI_BUF_SIZE,\n1675:\t\t\t\t\t\t GFP_KERNEL);\n1676:\t\tif (!tc6-\u003espi_ctrl_tx_buf)\n1677:\t\t\treturn ERR_PTR(-ENOMEM);\n1678:\t\n1679:\t\ttc6-\u003espi_ctrl_rx_buf = devm_kzalloc(\u0026tc6-\u003espi-\u003edev,\n1680:\t\t\t\t\t\t OA_TC6_CTRL_SPI_BUF_SIZE,\n1681:\t\t\t\t\t\t GFP_KERNEL);\n1682:\t\tif (!tc6-\u003espi_ctrl_rx_buf)\n1683:\t\t\treturn ERR_PTR(-ENOMEM);\n1684:\t\n1685:\t\ttc6-\u003espi_data_tx_buf = devm_kzalloc(\u0026tc6-\u003espi-\u003edev,\n1686:\t\t\t\t\t\t OA_TC6_SPI_DATA_BUF_SIZE,\n1687:\t\t\t\t\t\t GFP_KERNEL);\n1688:\t\tif (!tc6-\u003espi_data_tx_buf)\n1689:\t\t\treturn ERR_PTR(-ENOMEM);\n1690:\t\n1691:\t\ttc6-\u003espi_data_rx_buf = devm_kzalloc(\u0026tc6-\u003espi-\u003edev,\n1692:\t\t\t\t\t\t OA_TC6_SPI_DATA_BUF_SIZE,\n1693:\t\t\t\t\t\t GFP_KERNEL);\n1694:\t\tif (!tc6-\u003espi_data_rx_buf)\n1695:\t\t\treturn ERR_PTR(-ENOMEM);\n1696:\t\n1697:\t\ttc6-\u003ereset_gpio = devm_gpiod_get_optional(\u0026spi-\u003edev, \"reset\",\n1698:\t\t\t\t\t\t\t GPIOD_OUT_HIGH);\n1699:\t\tif (IS_ERR(tc6-\u003ereset_gpio))\n1700:\t\t\treturn ERR_PTR(dev_err_probe(\u0026spi-\u003edev,\n1701:\t\t\t\t\t\t PTR_ERR(tc6-\u003ereset_gpio),\n1702:\t\t\t\t\t\t \"failed to get reset gpio\\n\"));\n1703:\t\n1704:\t\tif (tc6-\u003ereset_gpio) {\n1705:\t\t\t/* Keep the reset asserted for 10 us and then allow 1 ms of\n1706:\t\t\t * settle time for the crystal oscillator startup.\n1707:\t\t\t */\n1708:\t\t\tfsleep(10);\n1709:\t\t\tgpiod_set_value_cansleep(tc6-\u003ereset_gpio, 0);\n1710:\t\t\tfsleep(1000);\n1711:\t\t}\n1712:\t\n1713:\t\t/* Check the PROTE bit status so that we can reset the device */\n1714:\t\tret = oa_tc6_check_ctrl_protection(tc6);\n1715:\t\tif (ret) {\n1716:\t\t\tdev_err(\u0026tc6-\u003espi-\u003edev,\n1717:\t\t\t\t\"Failed to check the protection mode: %d\\n\", ret);\n1718:\t\t\treturn ERR_PTR(ret);\n1719:\t\t}\n1720:\t\n1721:\t\tret = oa_tc6_sw_reset_macphy(tc6);\n1722:\t\tif (ret) {\n1723:\t\t\tdev_err(\u0026tc6-\u003espi-\u003edev,\n1724:\t\t\t\t\"MAC-PHY software reset failed: %d\\n\", ret);\n1725:\t\t\treturn ERR_PTR(ret);\n1726:\t\t}\n1727:\t\n1728:\t\tret = oa_tc6_unmask_macphy_error_interrupts(tc6);\n1729:\t\tif (ret) {\n1730:\t\t\tdev_err(\u0026tc6-\u003espi-\u003edev,\n1731:\t\t\t\t\"MAC-PHY error interrupts unmask failed: %d\\n\", ret);\n1732:\t\t\treturn ERR_PTR(ret);\n1733:\t\t}\n1734:\t\n"
} |
| 11/2 | 2026/10/09 20:16 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 56392 output: 47 thoughts: 107 Thoughts: **Analyzing Potential Hardware Absence in MAC-PHY Communication** Okay, let's dive into this `oa_tc6_check_ctrl_protection` function, specifically focusing on lines 1714-1725. From what I see, it's responsible for SPI transfers to read registers from the MAC-PHY hardware. My immediate thought is, what happens if that hardware *isn't* actually there? Let's assume there's no actual device connected to the SPI bus. The function calls would attempt to read a register like `OA_TC6_REG_STATUS0` or something similar, and the resulting behavior is what I'm keen to understand. I need to closely examine the internal logic of `oa_tc6_check_ctrl_protection` to see how it handles (or doesn't handle) that scenario. This is going to be my primary area of focus. |
| 12/2 | 2026/10/09 20:16 | tool | read-file |
0mArgs:{
"File": "drivers/net/ethernet/oa_tc6/oa_tc6.c",
"FirstLine": 1620,
"LineCount": 25
}Results: {
"Contents": "1620:\tEXPORT_SYMBOL_GPL(oa_tc6_start_xmit);\n1621:\t\n1622:\tstatic int oa_tc6_check_ctrl_protection(struct oa_tc6 *tc6)\n1623:\t{\n1624:\t\tu32 regval;\n1625:\t\tint ret;\n1626:\t\n1627:\t\tret = oa_tc6_read_register(tc6, OA_TC6_REG_CONFIG0, \u0026regval);\n1628:\t\tif (ret)\n1629:\t\t\treturn ret;\n1630:\t\n1631:\t\ttc6-\u003eprot_ctrl = FIELD_GET(OA_TC6_CONFIG0_PROTE, regval);\n1632:\t\n1633:\t\treturn 0;\n1634:\t}\n1635:\t\n1636:\t/**\n1637:\t * oa_tc6_init - allocates and initializes oa_tc6 structure.\n1638:\t * @spi: device with which data will be exchanged.\n1639:\t * @netdev: network device interface structure.\n1640:\t * @quirks: device specific modifiers for the OA TC6 protocol.\n1641:\t *\n1642:\t * Return: pointer reference to the oa_tc6 structure if the MAC-PHY\n1643:\t * initialization is successful otherwise an ERR_PTR.\n1644:\t */\n"
} |
| 13/2 | 2026/10/09 20:16 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 57122 output: 42 thoughts: 46 Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience: **Diving into the `oa_tc6_read_register` Function** Alright, so the task at hand involves examining the `oa_tc6_read_register` function. To get a handle on this, my first instinct is to zero in on its implementation. Let's head over to the `oa_tc6.c` source file, specifically focusing on lines 300 through 350 within the `drivers/net/ethernet/oa_tc6/` directory. That section should give me the core logic of the register read operation. I'm expecting to see the low-level details of how this function interacts with the hardware, probably involving register addresses, read commands, and any error handling that might be present. My immediate goal is to understand the data flow and the intricacies of the driver's read mechanism. |
| 14/2 | 2026/10/09 20:17 | tool | grepper |
0mArgs:{
"Expression": "int oa_tc6_read_register",
"PathPrefixes": [
"drivers/net/ethernet/oa_tc6/"
]
}Results: {
"Output": "drivers/net/ethernet/oa_tc6/oa_tc6.c=382=static int oa_tc6_perform_ctrl(struct oa_tc6 *tc6, u32 address, u32 value[],\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-425- */\ndrivers/net/ethernet/oa_tc6/oa_tc6.c:426:int oa_tc6_read_registers(struct oa_tc6 *tc6, u32 address, u32 value[],\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-427-\t\t\t u8 length)\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c=443=EXPORT_SYMBOL_GPL(oa_tc6_read_registers);\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-452- */\ndrivers/net/ethernet/oa_tc6/oa_tc6.c:453:int oa_tc6_read_register(struct oa_tc6 *tc6, u32 address, u32 *value)\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-454-{\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c=457=EXPORT_SYMBOL_GPL(oa_tc6_read_register);\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-468- */\ndrivers/net/ethernet/oa_tc6/oa_tc6.c:469:int oa_tc6_read_register_mms(struct oa_tc6 *tc6, u8 mms, u16 address,\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-470-\t\t\t u32 *value)\n"
} |
| 15/2 | 2026/10/09 20:17 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 57888 output: 46 thoughts: 17 Thoughts: Okay, here's the summary, assuming I'm the expert and considering what `oa_tc6_perform_ctrl` might do: **Analyzing `oa_tc6_perform_ctrl`** Alright, let's dive into `oa_tc6_perform_ctrl`. Given the naming convention, it's highly likely this function, or potentially a section of code, is related to some control mechanism or performance aspects tied to, presumably, a test case labeled "tc6." The "oa" prefix is interesting; it could be an abbreviation for something like "operational analysis," "output analysis," or even a specific internal project identifier within the system I'm working with. The "ctrl" suffix clearly suggests control. My immediate thought is, what kind of control? Is it regulating resource allocation? Timing? Error handling? Maybe it's a wrapper for invoking several control functions. A more in-depth analysis of it might be necessary. I'll need to figure out the context of `tc6` -- what is being tested? What's the goal of this test? This will inform my assessment of the functions purpose. I'll need to carefully look at the inputs and outputs, and probably delve into the data structures it manipulates. I'll start by making assumptions about how it functions. Let's see what is next. |
| 16/2 | 2026/10/09 20:17 | tool | read-file |
0mArgs:{
"File": "drivers/net/ethernet/oa_tc6/oa_tc6.c",
"FirstLine": 380,
"LineCount": 45
}Results: {
"Contents": " 380:\t}\n 381:\t\n 382:\tstatic int oa_tc6_perform_ctrl(struct oa_tc6 *tc6, u32 address, u32 value[],\n 383:\t\t\t\t u8 length, enum oa_tc6_register_op reg_op)\n 384:\t{\n 385:\t\tu16 size;\n 386:\t\tint ret;\n 387:\t\n 388:\t\tsize = oa_tc6_calculate_ctrl_buf_size(length, tc6-\u003eprot_ctrl);\n 389:\t\n 390:\t\t/* Prepare control command and copy to SPI control buffer */\n 391:\t\toa_tc6_prepare_ctrl_spi_buf(tc6, address, value, length, reg_op, size);\n 392:\t\n 393:\t\t/* Perform SPI transfer */\n 394:\t\tret = oa_tc6_spi_transfer(tc6, OA_TC6_CTRL_HEADER, size);\n 395:\t\tif (ret) {\n 396:\t\t\tdev_err(\u0026tc6-\u003espi-\u003edev, \"SPI transfer failed for control: %d\\n\",\n 397:\t\t\t\tret);\n 398:\t\t\treturn ret;\n 399:\t\t}\n 400:\t\n 401:\t\t/* Check echoed/received control write command reply for errors */\n 402:\t\tif (reg_op == OA_TC6_CTRL_REG_WRITE)\n 403:\t\t\treturn oa_tc6_check_ctrl_write_reply(tc6, size);\n 404:\t\n 405:\t\t/* Check echoed/received control read command reply for errors */\n 406:\t\tret = oa_tc6_check_ctrl_read_reply(tc6, length);\n 407:\t\tif (ret)\n 408:\t\t\treturn ret;\n 409:\t\n 410:\t\toa_tc6_copy_ctrl_read_data(tc6, value, length);\n 411:\t\n 412:\t\treturn 0;\n 413:\t}\n 414:\t\n 415:\t/**\n 416:\t * oa_tc6_read_registers - function for reading multiple consecutive registers.\n 417:\t * @tc6: oa_tc6 struct.\n 418:\t * @address: address of the first register to be read in the MAC-PHY.\n 419:\t * @value: values to be read from the starting register address @address.\n 420:\t * @length: number of consecutive registers to be read from @address.\n 421:\t *\n 422:\t * Maximum of 128 consecutive registers can be read starting at @address.\n 423:\t *\n 424:\t * Return: 0 on success otherwise failed.\n"
} |
| 17/2 | 2026/10/09 20:17 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 58966 output: 23 thoughts: 1552 Thoughts: **Triage Time: Examining the Patch**
Okay, so I'm diving into this patch and need to determine if it's worth fuzzing. The initial `oa_tc6_check_ctrl_read_reply` check seems standard, but then I'm wondering about the prerequisites for `s2500_probe`. The code checks `spi->irq` and returns `-ENODEV` if it's negative. When the device is instantiated via sysfs in `new_device_store`, `spi->irq` is either zero or negative, depending on the controller/ACPI/OF configuration. Crucially, even if an interrupt *is* passed, `oa_tc6_init` does SPI transfers to the MAC-PHY chip. This makes me ask: is there even an SPI bus emulated in QEMU, the usual testing environment?
My first step is to revisit the triage guidelines. I need to remember the core philosophy: reachability. Can this code *actually* execute in a standard virtualized environment like QEMU? Specifically, I have to ensure that I avoid structurally unreachable hardware, like vendor-specific PCIe switches, or drivers that require physical ASICs. This is a crucial check!
I need to apply the negative criteria for a "WorthFuzzing=false" response. This applies to non-kernel or non-executable changes, or structurally unreachable hardware/execution paths, and the positive criteria when the patch touches reachable executable code.
Now, let's look at all the modified files. There are quite a few: documentation, `MAINTAINERS`, Kconfig/Makefile changes, along with several `oa_tc6` source files, `s2500` files, and some PHY-related changes. Given the large scope, I need to check each one.
Ah, I see a few key files in `drivers/net/phy`: `phy_device.c`, `dp83867.c`, and `ncn26000.c`! Let's examine what changed in `phy_device.c`.
It looks like `genphy_loopback_no_speed` was modified:
```c
int genphy_loopback_no_speed(struct phy_device *phydev, bool enable,
int speed)
{
if (enable && speed)
return -EOPNOTSUPP;
return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
enable ? BMCR_LOOPBACK : 0);
}
EXPORT_SYMBOL(genphy_loopback_no_speed);
```
If loopback is enabled AND a speed is requested, then `-EOPNOTSUPP` is returned. And crucially, `genphy_loopback_no_speed` is called in `dp83867.c` and `ncn26000.c`: `dp83867_driver.set_loopback = genphy_loopback_no_speed;` and `ncn26000_driver.set_loopback = genphy_loopback_no_speed;`
This feels like an interesting path to pursue. I need to make sure this code is reachable in QEMU, so I'll grep for `genphy_loopback_no_speed` to check if any other drivers call it.
|
| 18/2 | 2026/10/09 20:17 | tool | grepper |
0mArgs:{
"Expression": "genphy_loopback_no_speed"
}Results: {
"Output": "drivers/net/phy/dp83867.c=1259=static struct phy_driver dp83867_driver[] = {\n--\ndrivers/net/phy/dp83867.c-1285-\t\t.link_change_notify = dp83867_link_change_notify,\ndrivers/net/phy/dp83867.c:1286:\t\t.set_loopback\t= genphy_loopback_no_speed,\ndrivers/net/phy/dp83867.c-1287-\n--\ndrivers/net/phy/ncn26000.c=171=static struct phy_driver ncn26000_driver[] = {\n--\ndrivers/net/phy/ncn26000.c-180-\t\t.handle_interrupt = ncn26000_handle_interrupt,\ndrivers/net/phy/ncn26000.c:181:\t\t.set_loopback = genphy_loopback_no_speed,\ndrivers/net/phy/ncn26000.c-182-\t\t.set_plca_cfg = ncn26000_c45_plca_set_cfg,\n--\ndrivers/net/phy/phy_device.c=2792=EXPORT_SYMBOL(genphy_resume);\n--\ndrivers/net/phy/phy_device.c-2794-/**\ndrivers/net/phy/phy_device.c:2795: * genphy_loopback_no_speed - Helper to modify the PHY loopback mode\ndrivers/net/phy/phy_device.c-2796- * without setting speed. Some PHYs, like 10Base-T1S, don't support\n--\ndrivers/net/phy/phy_device.c-2804- */\ndrivers/net/phy/phy_device.c:2805:int genphy_loopback_no_speed(struct phy_device *phydev, bool enable,\ndrivers/net/phy/phy_device.c-2806-\t\t\t int speed)\n--\ndrivers/net/phy/phy_device.c-2813-}\ndrivers/net/phy/phy_device.c:2814:EXPORT_SYMBOL(genphy_loopback_no_speed);\ndrivers/net/phy/phy_device.c-2815-\n--\ninclude/linux/phy.h=2309=int genphy_resume(struct phy_device *phydev);\ninclude/linux/phy.h:2310:int genphy_loopback_no_speed(struct phy_device *phydev, bool enable,\ninclude/linux/phy.h-2311-\t\t\t int speed);\n"
} |
| 19/2 | 2026/10/09 20:17 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 61969 output: 20 thoughts: 374 Thoughts: **Analyzing the Reachability of Specific PHY Drivers in Virtualized Environments** Okay, let's break this down. First, I see that `genphy_loopback_no_speed` is exclusively tied to the `dp83867_driver` and the `ncn26000_driver`. Right, so `DP83867`...that's a Texas Instruments DP83867 PHY transceiver, a standard MDIO phy. And `NCN26000`, that's an onsemi 10BASE-T1S PHY transceiver, also MDIO. I also see mention of `S2500`, the onsemi S2500 10BASE-T1S MACPHY ethernet chip, which uses SPI and has an internal `NCN26000` PHY. Finally, there is `OA_TC6`, which is the OPEN Alliance TC6 10BASE-T1x MAC-PHY Serial Interface protocol library over SPI. Now, the crucial question: can *any* of this hardware or the driver code associated with it be realistically reached or tested in a standard virtualized environment like QEMU or Google Compute Engine on an amd64 architecture? The immediate thought is: are these MDIO PHYs or SPI MACPHYs capable of being emulated or instantiated within a virtual context? Let's dive in and assess. Starting with the DP83867, the question is simple: does QEMU offer any emulation for it? The answer seems to be no. QEMU's emulated network devices include e1000, e1000e, virtio-net, rtl8139, pcnet, ne2k_pci, igb, etc. None of those seem to leverage the functionality of the DP83867. Let me dig a little deeper. I'm going to have to check if QEMU emulates any PHYs in general or if any of the emulated PCI devices have bindings to the DP83867 or NCN26000. I need to find where dp83867 can be bound. |
| 20/2 | 2026/10/09 20:17 | tool | grepper |
0mArgs:{
"Expression": "DP83867"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 2082 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (108 files in total):\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml:8\nDocumentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml:2\narch/arm/boot/dts/nxp/imx/imx7-mba7.dtsi:4\narch/arm/boot/dts/nxp/imx/imx7d-mba7.dts:4\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:10\narch/arm/boot/dts/rockchip/rk3288-phycore-som.dtsi:4\narch/arm/boot/dts/st/stm32mp15xx-phycore-som.dtsi:4\narch/arm/boot/dts/ti/keystone/keystone-k2g-ice.dts:3\narch/arm/boot/dts/ti/omap/am335x-bonegreen-eco.dts:3\narch/arm/boot/dts/ti/omap/dra71-evm.dts:6\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts:6\narch/arm/boot/dts/ti/omap/dra76-evm.dts:6\narch/arm/configs/imx_v6_v7_defconfig:1\narch/arm/configs/keystone_defconfig:1\narch/arm/configs/multi_v7_defconfig:1\narch/arm/configs/omap2plus_defconfig:1\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi:6\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts:14\narch/arm64/boot/dts/freescale/imx8mm-phycore-som.dtsi:4\narch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi:5\narch/arm64/boot/dts/freescale/imx8mm-venice-gw7902.dts:5\narch/arm64/boot/dts/freescale/imx8mn-venice-gw7902.dts:5\narch/arm64/boot/dts/freescale/imx8mp-aristainetos3a-som-v1.dtsi:6\narch/arm64/boot/dts/freescale/imx8mp-libra-rdk-fpsc.dts:4\narch/arm64/boot/dts/freescale/imx8mp-msc-sm2s.dtsi:8\narch/arm64/boot/dts/freescale/imx8mp-phyboard-pollux-rdk.dts:4\narch/arm64/boot/dts/freescale/imx8mp-phycore-fpsc.dtsi:4\narch/arm64/boot/dts/freescale/imx8mp-phycore-som.dtsi:4\narch/arm64/boot/dts/freescale/imx8mp-toradex-smarc.dtsi:4\narch/arm64/boot/dts/freescale/imx8mp-tqma8mpql-mba8mp-ras314.dts:8\narch/arm64/boot/dts/freescale/imx8mp-tqma8mpql-mba8mpxl.dts:8\narch/arm64/boot/dts/freescale/imx8mp-tqma8mpqs.dtsi:8\narch/arm64/boot/dts/freescale/imx8mp-venice-gw702x.dtsi:5\narch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts:5\narch/arm64/boot/dts/freescale/imx8mp-verdin-ivy.dtsi:2\narch/arm64/boot/dts/freescale/imx8mp-verdin-zinnia.dtsi:2\narch/arm64/boot/dts/freescale/imx8mq-kontron-pitx-imx8m.dts:3\narch/arm64/boot/dts/freescale/imx8qm-tqma8qm-mba8x.dts:8\narch/arm64/boot/dts/freescale/imx91-tqma9131-mba91xxca.dts:8\narch/arm64/boot/dts/freescale/imx91-tqma9131-mba93xxca.dts:8\narch/arm64/boot/dts/freescale/imx93-phyboard-nash.dts:4\narch/arm64/boot/dts/freescale/imx93-tqma9352-mba91xxca.dts:8\narch/arm64/boot/dts/freescale/imx93-tqma9352-mba93xxca.dts:8\narch/arm64/boot/dts/freescale/imx93-tqma9352-mba93xxla-mini.dts:8\narch/arm64/boot/dts/freescale/imx93-tqma9352-mba93xxla.dts:8\narch/arm64/boot/dts/freescale/imx95-aquila.dtsi:2\narch/arm64/boot/dts/freescale/imx95-libra-rdk-fpsc.dts:4\narch/arm64/boot/dts/freescale/imx95-phycore-fpsc.dtsi:4\narch/arm64/boot/dts/freescale/imx95-toradex-smarc.dtsi:4\narch/arm64/boot/dts/freescale/imx95-tqma9596la-mba95xxca.dts:8\n... and 58 more files\n\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml=6=$schema: http://devicetree.org/meta-schemas/core.yaml#\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml-7-\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml:8:title: TI DP83867 ethernet PHY\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml-9-\n--\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml=16=description: |\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml:17: The DP83867 device is a robust, low power, fully featured Physical Layer\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml-18- transceiver with integrated PMD sublayers to support 10BASE-Te, 100BASE-TX\n--\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml-20-\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml:21: The DP83867 is designed for easy implementation of 10/100/1000 Mbps Ethernet\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml-22- LANs. It interfaces directly to twisted pair media via an external\n--\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml=126=examples:\n--\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml-133- reg = \u003c0\u003e;\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml:134: tx-fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml:135: rx-fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml-136- ti,max-output-impedance;\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml:137: ti,clk-output-sel = \u003cDP83867_CLK_O_SEL_CHN_A_RCLK\u003e;\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml:138: ti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_25_NS\u003e;\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml:139: ti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_2_75_NS\u003e;\nDocumentation/devicetree/bindings/net/ti,dp83867.yaml-140- };\n--\nDocumentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml=244=examples:\n--\nDocumentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml-307- reg = \u003c0\u003e;\nDocumentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml:308: ti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_00_NS\u003e;\nDocumentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml:309: ti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\nDocumentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml-310- };\n--\narch/arm/boot/dts/nxp/imx/imx7-mba7.dtsi=222=\t\tethphy1_0: ethernet-phy@0 {\n--\narch/arm/boot/dts/nxp/imx/imx7-mba7.dtsi-226-\t\t\tpinctrl-0 = \u003c\u0026pinctrl_enet1_phy\u003e;\narch/arm/boot/dts/nxp/imx/imx7-mba7.dtsi:227:\t\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_50_NS\u003e;\narch/arm/boot/dts/nxp/imx/imx7-mba7.dtsi:228:\t\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_2_50_NS\u003e;\narch/arm/boot/dts/nxp/imx/imx7-mba7.dtsi:229:\t\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\narch/arm/boot/dts/nxp/imx/imx7-mba7.dtsi:230:\t\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm/boot/dts/nxp/imx/imx7-mba7.dtsi-231-\t\t\treset-gpios = \u003c\u0026gpio7 15 GPIO_ACTIVE_LOW\u003e;\n--\narch/arm/boot/dts/nxp/imx/imx7d-mba7.dts=32=\t\tethphy2_0: ethernet-phy@0 {\n--\narch/arm/boot/dts/nxp/imx/imx7d-mba7.dts-36-\t\t\tpinctrl-0 = \u003c\u0026pinctrl_enet2_phy\u003e;\narch/arm/boot/dts/nxp/imx/imx7d-mba7.dts:37:\t\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_50_NS\u003e;\narch/arm/boot/dts/nxp/imx/imx7d-mba7.dts:38:\t\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_2_50_NS\u003e;\narch/arm/boot/dts/nxp/imx/imx7d-mba7.dts:39:\t\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\narch/arm/boot/dts/nxp/imx/imx7d-mba7.dts:40:\t\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm/boot/dts/nxp/imx/imx7d-mba7.dts-41-\t\t\treset-gpios = \u003c\u0026gpio2 28 GPIO_ACTIVE_LOW\u003e;\n--\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts=348=\tsgmii_phy03: ethernet-phy@3 {\n--\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts-350-\t\treg = \u003c0x03\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:351:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:352:\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts-353-\t\tti,dp83867-rxctrl-strap-quirk;\n--\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts=356=\trgmii_phy04: ethernet-phy@4 {\n--\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts-358-\t\treg = \u003c0x04\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:359:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_50_NS\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:360:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_2_00_NS\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:361:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:362:\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts-363-\t};\n--\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts=365=\trgmii_phy0c: ethernet-phy@c {\n--\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts-367-\t\treg = \u003c0x0c\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:368:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_50_NS\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:369:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_2_00_NS\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:370:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts:371:\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm/boot/dts/nxp/ls/ls1021a-tqmls1021a-mbls1021a.dts-372-\t};\n--\narch/arm/boot/dts/rockchip/rk3288-phycore-som.dtsi=108=\t\tphy0: ethernet-phy@0 {\n--\narch/arm/boot/dts/rockchip/rk3288-phycore-som.dtsi-112-\t\t\tinterrupts = \u003c2 IRQ_TYPE_EDGE_FALLING\u003e;\narch/arm/boot/dts/rockchip/rk3288-phycore-som.dtsi:113:\t\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_00_NS\u003e;\narch/arm/boot/dts/rockchip/rk3288-phycore-som.dtsi:114:\t\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_2_00_NS\u003e;\narch/arm/boot/dts/rockchip/rk3288-phycore-som.dtsi:115:\t\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\narch/arm/boot/dts/rockchip/rk3288-phycore-som.dtsi-116-\t\t\tenet-phy-lane-no-swap;\narch/arm/boot/dts/rockchip/rk3288-phycore-som.dtsi:117:\t\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_CHN_A_TCLK\u003e;\narch/arm/boot/dts/rockchip/rk3288-phycore-som.dtsi-118-\t\t};\n--\narch/arm/boot/dts/st/stm32mp15xx-phycore-som.dtsi=100=\t\tphy0: ethernet-phy@1 {\n--\narch/arm/boot/dts/st/stm32mp15xx-phycore-som.dtsi-105-\t\t\tenet-phy-lane-no-swap;\narch/arm/boot/dts/st/stm32mp15xx-phycore-som.dtsi:106:\t\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_00_NS\u003e;\narch/arm/boot/dts/st/stm32mp15xx-phycore-som.dtsi:107:\t\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_2_00_NS\u003e;\narch/arm/boot/dts/st/stm32mp15xx-phycore-som.dtsi:108:\t\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\narch/arm/boot/dts/st/stm32mp15xx-phycore-som.dtsi-109-\t\t\tti,min-output-impedance;\narch/arm/boot/dts/st/stm32mp15xx-phycore-som.dtsi:110:\t\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm/boot/dts/st/stm32mp15xx-phycore-som.dtsi-111-\t\t};\n--\narch/arm/boot/dts/ti/keystone/keystone-k2g-ice.dts=433=\tethphy0: ethernet-phy@0 {\narch/arm/boot/dts/ti/keystone/keystone-k2g-ice.dts-434-\t\treg = \u003c0\u003e;\narch/arm/boot/dts/ti/keystone/keystone-k2g-ice.dts:435:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_25_NS\u003e;\narch/arm/boot/dts/ti/keystone/keystone-k2g-ice.dts:436:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_250_PS\u003e;\narch/arm/boot/dts/ti/keystone/keystone-k2g-ice.dts:437:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_8_B_NIB\u003e;\narch/arm/boot/dts/ti/keystone/keystone-k2g-ice.dts-438-\t\tti,min-output-impedance;\n--\narch/arm/boot/dts/ti/omap/am335x-bonegreen-eco.dts=119=\tdp83867_0: ethernet-phy@0 {\narch/arm/boot/dts/ti/omap/am335x-bonegreen-eco.dts-120-\t\treg = \u003c0\u003e;\narch/arm/boot/dts/ti/omap/am335x-bonegreen-eco.dts:121:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_50_NS\u003e;\narch/arm/boot/dts/ti/omap/am335x-bonegreen-eco.dts:122:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_2_50_NS\u003e;\narch/arm/boot/dts/ti/omap/am335x-bonegreen-eco.dts:123:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_8_B_NIB\u003e;\narch/arm/boot/dts/ti/omap/am335x-bonegreen-eco.dts-124-\t\tti,min-output-impedance;\n--\narch/arm/boot/dts/ti/omap/dra71-evm.dts=244=\tdp83867_0: ethernet-phy@2 {\narch/arm/boot/dts/ti/omap/dra71-evm.dts-245-\t\treg = \u003c2\u003e;\narch/arm/boot/dts/ti/omap/dra71-evm.dts:246:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_25_NS\u003e;\narch/arm/boot/dts/ti/omap/dra71-evm.dts:247:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_250_PS\u003e;\narch/arm/boot/dts/ti/omap/dra71-evm.dts:248:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_8_B_NIB\u003e;\narch/arm/boot/dts/ti/omap/dra71-evm.dts-249-\t\tti,min-output-impedance;\n--\narch/arm/boot/dts/ti/omap/dra71-evm.dts=253=\tdp83867_1: ethernet-phy@3 {\narch/arm/boot/dts/ti/omap/dra71-evm.dts-254-\t\treg = \u003c3\u003e;\narch/arm/boot/dts/ti/omap/dra71-evm.dts:255:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_25_NS\u003e;\narch/arm/boot/dts/ti/omap/dra71-evm.dts:256:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_250_PS\u003e;\narch/arm/boot/dts/ti/omap/dra71-evm.dts:257:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_8_B_NIB\u003e;\narch/arm/boot/dts/ti/omap/dra71-evm.dts-258-\t\tti,min-output-impedance;\n--\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts=100=\tdp83867_0: ethernet-phy@2 {\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts-101-\t\treg = \u003c2\u003e;\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts:102:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_25_NS\u003e;\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts:103:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_250_PS\u003e;\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts:104:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_8_B_NIB\u003e;\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts-105-\t\tti,min-output-impedance;\n--\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts=111=\tdp83867_1: ethernet-phy@3 {\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts-112-\t\treg = \u003c3\u003e;\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts:113:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_25_NS\u003e;\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts:114:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_250_PS\u003e;\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts:115:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_8_B_NIB\u003e;\narch/arm/boot/dts/ti/omap/dra72-evm-revc.dts-116-\t\tti,min-output-impedance;\n--\narch/arm/boot/dts/ti/omap/dra76-evm.dts=468=\tdp83867_0: ethernet-phy@2 {\narch/arm/boot/dts/ti/omap/dra76-evm.dts-469-\t\treg = \u003c2\u003e;\narch/arm/boot/dts/ti/omap/dra76-evm.dts:470:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_25_NS\u003e;\narch/arm/boot/dts/ti/omap/dra76-evm.dts:471:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_250_PS\u003e;\narch/arm/boot/dts/ti/omap/dra76-evm.dts:472:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_8_B_NIB\u003e;\narch/arm/boot/dts/ti/omap/dra76-evm.dts-473-\t\tti,min-output-impedance;\n--\narch/arm/boot/dts/ti/omap/dra76-evm.dts=477=\tdp83867_1: ethernet-phy@3 {\narch/arm/boot/dts/ti/omap/dra76-evm.dts-478-\t\treg = \u003c3\u003e;\narch/arm/boot/dts/ti/omap/dra76-evm.dts:479:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_25_NS\u003e;\narch/arm/boot/dts/ti/omap/dra76-evm.dts:480:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_250_PS\u003e;\narch/arm/boot/dts/ti/omap/dra76-evm.dts:481:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_8_B_NIB\u003e;\narch/arm/boot/dts/ti/omap/dra76-evm.dts-482-\t\tti,min-output-impedance;\n--\narch/arm/configs/imx_v6_v7_defconfig=136=CONFIG_AT803X_PHY=y\narch/arm/configs/imx_v6_v7_defconfig:137:CONFIG_DP83867_PHY=y\narch/arm/configs/imx_v6_v7_defconfig-138-CONFIG_CAN_FLEXCAN=y\n--\narch/arm/configs/keystone_defconfig=134=CONFIG_MICREL_PHY=y\narch/arm/configs/keystone_defconfig:135:CONFIG_DP83867_PHY=y\narch/arm/configs/keystone_defconfig-136-CONFIG_CAN_C_CAN=m\n--\narch/arm/configs/multi_v7_defconfig=292=CONFIG_DP83848_PHY=m\narch/arm/configs/multi_v7_defconfig:293:CONFIG_DP83867_PHY=y\narch/arm/configs/multi_v7_defconfig-294-CONFIG_CAN_AT91=m\n--\narch/arm/configs/omap2plus_defconfig=334=CONFIG_DP83848_PHY=y\narch/arm/configs/omap2plus_defconfig:335:CONFIG_DP83867_PHY=y\narch/arm/configs/omap2plus_defconfig-336-CONFIG_CAN_C_CAN=m\n--\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi=151=\tmdio0_rgmii_phy00: ethernet-phy@0 {\n--\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi-158-\t\tinterrupts = \u003c0 IRQ_TYPE_LEVEL_LOW\u003e;\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi:159:\t\tti,rx-internal-delay = \u003cDP83867_RGMIIDCTL_2_50_NS\u003e;\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi:160:\t\tti,tx-internal-delay = \u003cDP83867_RGMIIDCTL_2_00_NS\u003e;\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi:161:\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi:162:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi-163-\t};\n--\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi=165=\tmdio0_sgmii_phy03: ethernet-phy@3 {\n--\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi-176-\t\tinterrupts = \u003c2 IRQ_TYPE_LEVEL_LOW\u003e;\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi:177:\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi:178:\t\tti,fifo-depth = \u003cDP83867_PHYCR_FIFO_DEPTH_4_B_NIB\u003e;\narch/arm64/boot/dts/freescale/fsl-ls1028a-tqmls1028a-mbls1028a.dtsi-179-\t};\n--\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts=112=\tdp83867_1_1: ethernet-phy@1 {\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts-113-\t\treg = \u003c1\u003e;\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts:114:\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts-115-\t};\n--\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts=117=\tdp83867_1_2: ethernet-phy@2 {\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts-118-\t\treg = \u003c2\u003e;\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts:119:\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts-120-\t};\n--\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts=122=\tdp83867_1_3: ethernet-phy@3 {\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts-123-\t\treg = \u003c3\u003e;\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts:124:\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts-125-\t};\n--\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts=127=\tdp83867_1_4: ethernet-phy@4 {\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts-128-\t\treg = \u003c4\u003e;\narch/arm64/boot/dts/freescale/fsl-lx2160a-tqmlx2160a-mblx2160a.dts:129:\t\tti,clk-output-sel = \u003cDP83867_CLK_O_SEL_OFF\u003e;\n\n"
} |
| 21/2 | 2026/10/09 20:17 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 72950 output: 20 thoughts: 219 Thoughts: **My Current Investigation into MDIO PHY Emulation** Okay, so I'm looking at these DP83867, NCN26000, and S2500 chips – all PHYs, right? The DP83867 is popular on embedded ARM/ARM64 platforms like TI, NXP, Rockchip, and STM32, and the NCN26000 is Onsemi's 10BASE-T1S PHY, both typically managed via MDIO. Then there's the S2500, an SPI MACPHY controller. Now, my initial thought is: can I probe these MDIO PHYs within QEMU? And then, the next question that popped up: does QEMU even have the capability to emulate MDIO busses with arbitrary PHYs? Unfortunately, it doesn't look like QEMU focuses on MDIO. It appears to emulate standard network devices like e1000 or virtio, which don't utilize MDIO PHY drivers like the DP83867 or NCN26000 that I'm interested in. But... are there other ways? Are there "mdio-gpio", "mdio-bitbang", or even a "virtual mdio" approaches that might work, or are there emulated MDIO bus configurations? Can I create an mdio bus or PHY through some kind of mock or software emulation? I need to dig deeper. I need to figure out if there is some kind of a virtual MDIO driver out there, or if syzkaller can probe PHY devices. That's the next step. |
| 22/2 | 2026/10/09 20:17 | tool | grepper |
0mError:no matches Args: {
"Expression": "mdio_bus_register"
}Results: {
"error": "no matches"
} |
| 23/2 | 2026/10/09 20:17 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 73553 output: 30 thoughts: 11 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, and delivered as a first-person summary: **Diving into `mdiobus_register`** Alright, let's get down to brass tacks. I need to refresh my memory on the `mdiobus_register` function. It's the cornerstone, isn't it? The starting point for integrating a new MDIO bus into the system. I need to quickly recall the exact structure it expects, the critical checks it performs, and, most importantly, how it interacts with the broader MDIO subsystem framework. I'm thinking about the implications for device driver authors. Making sure they've got their MDIO bus structure set up correctly is paramount – otherwise, we're talking about integration nightmares. I’m also mentally tracing the subsequent calls. What does it chain into? Is there any potential for race conditions I should immediately consider? Let's refresh that documentation and ensure I have the full picture. My goal is to grasp any subtle changes or potential pitfalls. |
| 24/2 | 2026/10/09 20:17 | tool | grepper |
0mArgs:{
"Expression": "mdiobus_register",
"PathPrefixes": [
"drivers/net/"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 1018 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (131 files in total):\ndrivers/net/dsa/bcm_sf2.c:1\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c:1\ndrivers/net/dsa/microchip/ksz9477.c:1\ndrivers/net/dsa/microchip/ksz_common.c:1\ndrivers/net/dsa/microchip/lan937x_main.c:1\ndrivers/net/dsa/motorcomm/mdio_bus.c:2\ndrivers/net/dsa/mt7530.c:1\ndrivers/net/dsa/mt7628.c:1\ndrivers/net/dsa/mv88e6xxx/chip.c:1\ndrivers/net/dsa/mxl862xx/mxl862xx.c:1\ndrivers/net/dsa/netc/netc_main.c:1\ndrivers/net/dsa/ocelot/felix_vsc9959.c:1\ndrivers/net/dsa/ocelot/seville_vsc9953.c:1\ndrivers/net/dsa/qca/ar9331.c:1\ndrivers/net/dsa/qca/qca8k-8xxx.c:1\ndrivers/net/dsa/realtek/rtl83xx.c:1\ndrivers/net/dsa/rzn1_a5psw.c:1\ndrivers/net/dsa/sja1105/sja1105.h:1\ndrivers/net/dsa/sja1105/sja1105_main.c:1\ndrivers/net/dsa/sja1105/sja1105_mdio.c:4\ndrivers/net/ethernet/8390/ax88796.c:1\ndrivers/net/ethernet/actions/owl-emac.c:1\ndrivers/net/ethernet/adi/adin1110.c:1\ndrivers/net/ethernet/adi/adin1140.c:1\ndrivers/net/ethernet/aeroflex/greth.c:1\ndrivers/net/ethernet/agere/et131x.c:1\ndrivers/net/ethernet/altera/altera_tse_main.c:1\ndrivers/net/ethernet/amd/au1000_eth.c:1\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:2\ndrivers/net/ethernet/apm/xgene-v2/mdio.c:1\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:4\ndrivers/net/ethernet/arc/emac_mdio.c:1\ndrivers/net/ethernet/asix/ax88796c_main.c:1\ndrivers/net/ethernet/atheros/ag71xx.c:1\ndrivers/net/ethernet/broadcom/b44.c:1\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c:1\ndrivers/net/ethernet/broadcom/bgmac-bcma-mdio.c:1\ndrivers/net/ethernet/broadcom/genet/bcmmii.c:1\ndrivers/net/ethernet/broadcom/sb1250-mac.c:1\ndrivers/net/ethernet/broadcom/tg3.c:1\ndrivers/net/ethernet/cadence/macb_main.c:5\ndrivers/net/ethernet/davicom/dm9051.c:1\ndrivers/net/ethernet/engleder/tsnep_main.c:1\ndrivers/net/ethernet/ethoc.c:1\ndrivers/net/ethernet/faraday/ftgmac100.c:1\ndrivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c:1\ndrivers/net/ethernet/freescale/enetc/enetc_pf_common.c:2\ndrivers/net/ethernet/freescale/fec_main.c:1\ndrivers/net/ethernet/freescale/fec_mpc52xx_phy.c:1\ndrivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:1\n... and 81 more files\n\ndrivers/net/dsa/bcm_sf2.c=607=static int bcm_sf2_mdio_register(struct dsa_switch *ds)\n--\ndrivers/net/dsa/bcm_sf2.c-683-\ndrivers/net/dsa/bcm_sf2.c:684:\terr = mdiobus_register(priv-\u003euser_mii_bus);\ndrivers/net/dsa/bcm_sf2.c-685-\tif (err)\n--\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c=187=static int gswip_mdio(struct gswip_priv *priv)\n--\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c-213-\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c:214:\terr = devm_of_mdiobus_register(dev, bus, mdio_np);\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c-215-\n--\ndrivers/net/dsa/microchip/ksz9477.c=321=static int ksz9477_pcs_create(struct ksz_device *dev)\n--\ndrivers/net/dsa/microchip/ksz9477.c-341-\ndrivers/net/dsa/microchip/ksz9477.c:342:\tret = devm_mdiobus_register(dev-\u003edev, bus);\ndrivers/net/dsa/microchip/ksz9477.c-343-\tif (ret)\n--\ndrivers/net/dsa/microchip/ksz_common.c=2407=int ksz_mdio_register(struct ksz_device *dev)\n--\ndrivers/net/dsa/microchip/ksz_common.c-2478-\ndrivers/net/dsa/microchip/ksz_common.c:2479:\tret = devm_of_mdiobus_register(ds-\u003edev, bus, mdio_np);\ndrivers/net/dsa/microchip/ksz_common.c-2480-\tif (ret) {\n--\ndrivers/net/dsa/microchip/lan937x_main.c=685=static int lan937x_mdio_register(struct ksz_device *dev)\n--\ndrivers/net/dsa/microchip/lan937x_main.c-755-\ndrivers/net/dsa/microchip/lan937x_main.c:756:\tret = devm_of_mdiobus_register(ds-\u003edev, bus, mdio_np);\ndrivers/net/dsa/microchip/lan937x_main.c-757-\tif (ret)\n--\ndrivers/net/dsa/motorcomm/mdio_bus.c=144=int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp)\n--\ndrivers/net/dsa/motorcomm/mdio_bus.c-161-\ndrivers/net/dsa/motorcomm/mdio_bus.c:162:\tres = devm_of_mdiobus_register(dev, mbus, mnp);\ndrivers/net/dsa/motorcomm/mdio_bus.c-163-\tif (res)\n--\ndrivers/net/dsa/motorcomm/mdio_bus.c=274=int yt921x_mbus_ext_init(struct yt921x_priv *priv, struct device_node *mnp)\n--\ndrivers/net/dsa/motorcomm/mdio_bus.c-291-\ndrivers/net/dsa/motorcomm/mdio_bus.c:292:\tres = devm_of_mdiobus_register(dev, mbus, mnp);\ndrivers/net/dsa/motorcomm/mdio_bus.c-293-\tif (res)\n--\ndrivers/net/dsa/mt7530.c=2331=mt7530_setup_mdio(struct mt7530_priv *priv)\n--\ndrivers/net/dsa/mt7530.c-2366-\ndrivers/net/dsa/mt7530.c:2367:\tret = devm_of_mdiobus_register(dev, bus, mnp);\ndrivers/net/dsa/mt7530.c-2368-\tif (ret) {\n--\ndrivers/net/dsa/mt7628.c=242=static int mt7628_setup_internal_mdio(struct dsa_switch *ds)\n--\ndrivers/net/dsa/mt7628.c-261-\ndrivers/net/dsa/mt7628.c:262:\treturn devm_mdiobus_register(dev, bus);\ndrivers/net/dsa/mt7628.c-263-}\n--\ndrivers/net/dsa/mv88e6xxx/chip.c=3843=static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,\n--\ndrivers/net/dsa/mv88e6xxx/chip.c-3896-\ndrivers/net/dsa/mv88e6xxx/chip.c:3897:\terr = of_mdiobus_register(bus, np);\ndrivers/net/dsa/mv88e6xxx/chip.c-3898-\tif (err) {\n--\ndrivers/net/dsa/mxl862xx/mxl862xx.c=267=static int mxl862xx_setup_mdio(struct dsa_switch *ds)\n--\ndrivers/net/dsa/mxl862xx/mxl862xx.c-292-\ndrivers/net/dsa/mxl862xx/mxl862xx.c:293:\tret = devm_of_mdiobus_register(dev, bus, mdio_np);\ndrivers/net/dsa/mxl862xx/mxl862xx.c-294-\tof_node_put(mdio_np);\n--\ndrivers/net/dsa/netc/netc_main.c=149=static int netc_port_create_emdio_bus(struct netc_port *np,\n--\ndrivers/net/dsa/netc/netc_main.c-179-\ndrivers/net/dsa/netc/netc_main.c:180:\terr = devm_of_mdiobus_register(dev, bus, node);\ndrivers/net/dsa/netc/netc_main.c-181-\tif (err)\n--\ndrivers/net/dsa/ocelot/felix_vsc9959.c=957=static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)\n--\ndrivers/net/dsa/ocelot/felix_vsc9959.c-1013-\t/* Needed in order to initialize the bus mutex lock */\ndrivers/net/dsa/ocelot/felix_vsc9959.c:1014:\trc = mdiobus_register(bus);\ndrivers/net/dsa/ocelot/felix_vsc9959.c-1015-\tif (rc \u003c 0) {\n--\ndrivers/net/dsa/ocelot/seville_vsc9953.c=878=static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)\n--\ndrivers/net/dsa/ocelot/seville_vsc9953.c-903-\t/* Needed in order to initialize the bus mutex lock */\ndrivers/net/dsa/ocelot/seville_vsc9953.c:904:\trc = devm_of_mdiobus_register(dev, bus, NULL);\ndrivers/net/dsa/ocelot/seville_vsc9953.c-905-\tif (rc \u003c 0) {\n--\ndrivers/net/dsa/qca/ar9331.c=357=static int ar9331_sw_mbus_init(struct ar9331_sw_priv *priv)\n--\ndrivers/net/dsa/qca/ar9331.c-381-\ndrivers/net/dsa/qca/ar9331.c:382:\tret = devm_of_mdiobus_register(dev, mbus, mnp);\ndrivers/net/dsa/qca/ar9331.c-383-\tof_node_put(mnp);\n--\ndrivers/net/dsa/qca/qca8k-8xxx.c=959=qca8k_mdio_register(struct qca8k_priv *priv)\n--\ndrivers/net/dsa/qca/qca8k-8xxx.c-998-\ndrivers/net/dsa/qca/qca8k-8xxx.c:999:\tret = devm_of_mdiobus_register(dev, bus, mdio);\ndrivers/net/dsa/qca/qca8k-8xxx.c-1000-\n--\ndrivers/net/dsa/realtek/rtl83xx.c=91=int rtl83xx_setup_user_mdio(struct dsa_switch *ds)\n--\ndrivers/net/dsa/realtek/rtl83xx.c-120-\ndrivers/net/dsa/realtek/rtl83xx.c:121:\tret = devm_of_mdiobus_register(priv-\u003edev, bus, mdio_np);\ndrivers/net/dsa/realtek/rtl83xx.c-122-\tif (ret) {\n--\ndrivers/net/dsa/rzn1_a5psw.c=1117=static int a5psw_probe_mdio(struct a5psw *a5psw, struct device_node *node)\n--\ndrivers/net/dsa/rzn1_a5psw.c-1143-\ndrivers/net/dsa/rzn1_a5psw.c:1144:\treturn devm_of_mdiobus_register(dev, bus, node);\ndrivers/net/dsa/rzn1_a5psw.c-1145-}\n--\ndrivers/net/dsa/sja1105/sja1105.h=307=void sja1105_frame_memory_partitioning(struct sja1105_private *priv);\n--\ndrivers/net/dsa/sja1105/sja1105.h-309-/* From sja1105_mdio.c */\ndrivers/net/dsa/sja1105/sja1105.h:310:int sja1105_mdiobus_register(struct dsa_switch *ds);\ndrivers/net/dsa/sja1105/sja1105.h-311-void sja1105_mdiobus_unregister(struct dsa_switch *ds);\n--\ndrivers/net/dsa/sja1105/sja1105_main.c=3026=static int sja1105_setup(struct dsa_switch *ds)\n--\ndrivers/net/dsa/sja1105/sja1105_main.c-3067-\ndrivers/net/dsa/sja1105/sja1105_main.c:3068:\trc = sja1105_mdiobus_register(ds);\ndrivers/net/dsa/sja1105/sja1105_main.c-3069-\tif (rc \u003c 0) {\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c=258=static int sja1105_mdiobus_base_tx_register(struct sja1105_private *priv,\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c-287-\ndrivers/net/dsa/sja1105/sja1105_mdio.c:288:\trc = of_mdiobus_register(bus, np);\ndrivers/net/dsa/sja1105/sja1105_mdio.c-289-\tif (rc) {\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c=312=static int sja1105_mdiobus_base_t1_register(struct sja1105_private *priv,\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c-343-\ndrivers/net/dsa/sja1105/sja1105_mdio.c:344:\trc = of_mdiobus_register(bus, np);\ndrivers/net/dsa/sja1105/sja1105_mdio.c-345-\tif (rc) {\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c=368=static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c-395-\ndrivers/net/dsa/sja1105/sja1105_mdio.c:396:\trc = mdiobus_register(bus);\ndrivers/net/dsa/sja1105/sja1105_mdio.c-397-\tif (rc) {\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c=439=static void sja1105_mdiobus_pcs_unregister(struct sja1105_private *priv)\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c-458-\ndrivers/net/dsa/sja1105/sja1105_mdio.c:459:int sja1105_mdiobus_register(struct dsa_switch *ds)\ndrivers/net/dsa/sja1105/sja1105_mdio.c-460-{\n--\ndrivers/net/ethernet/8390/ax88796.c=459=static int ax_mii_init(struct net_device *dev)\n--\ndrivers/net/ethernet/8390/ax88796.c-478-\ndrivers/net/ethernet/8390/ax88796.c:479:\terr = mdiobus_register(ax-\u003emii_bus);\ndrivers/net/ethernet/8390/ax88796.c-480-\tif (err)\n--\ndrivers/net/ethernet/actions/owl-emac.c=1321=static int owl_emac_mdio_init(struct net_device *netdev)\n--\ndrivers/net/ethernet/actions/owl-emac.c-1345-\ndrivers/net/ethernet/actions/owl-emac.c:1346:\tret = devm_of_mdiobus_register(dev, priv-\u003emii, mdio_node);\ndrivers/net/ethernet/actions/owl-emac.c-1347-\n--\ndrivers/net/ethernet/adi/adin1110.c=509=static int adin1110_register_mdiobus(struct adin1110_priv *priv,\n--\ndrivers/net/ethernet/adi/adin1110.c-529-\ndrivers/net/ethernet/adi/adin1110.c:530:\tret = devm_mdiobus_register(dev, mii_bus);\ndrivers/net/ethernet/adi/adin1110.c-531-\tif (ret)\n--\ndrivers/net/ethernet/adi/adin1140.c=617=static int adin1140_mdio_register(struct adin1140_priv *priv,\n--\ndrivers/net/ethernet/adi/adin1140.c-636-\ndrivers/net/ethernet/adi/adin1140.c:637:\treturn devm_mdiobus_register(\u0026spidev-\u003edev, priv-\u003emdiobus);\ndrivers/net/ethernet/adi/adin1140.c-638-}\n--\ndrivers/net/ethernet/aeroflex/greth.c=1290=static int greth_mdio_init(struct greth_private *greth)\n--\ndrivers/net/ethernet/aeroflex/greth.c-1306-\ndrivers/net/ethernet/aeroflex/greth.c:1307:\tret = mdiobus_register(greth-\u003emdio);\ndrivers/net/ethernet/aeroflex/greth.c-1308-\tif (ret) {\n--\ndrivers/net/ethernet/agere/et131x.c=3931=static int et131x_pci_setup(struct pci_dev *pdev,\n--\ndrivers/net/ethernet/agere/et131x.c-4026-\ndrivers/net/ethernet/agere/et131x.c:4027:\trc = mdiobus_register(adapter-\u003emii_bus);\ndrivers/net/ethernet/agere/et131x.c-4028-\tif (rc \u003c 0) {\n--\ndrivers/net/ethernet/altera/altera_tse_main.c=121=static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)\n--\ndrivers/net/ethernet/altera/altera_tse_main.c-157-\ndrivers/net/ethernet/altera/altera_tse_main.c:158:\tret = of_mdiobus_register(mdio, mdio_node);\ndrivers/net/ethernet/altera/altera_tse_main.c-159-\tif (ret != 0) {\n--\ndrivers/net/ethernet/amd/au1000_eth.c=1061=static int au1000_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/amd/au1000_eth.c-1221-\ndrivers/net/ethernet/amd/au1000_eth.c:1222:\terr = mdiobus_register(aup-\u003emii_bus);\ndrivers/net/ethernet/amd/au1000_eth.c-1223-\tif (err) {\n--\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c=3428=static int xgbe_phy_init(struct xgbe_prv_data *pdata)\n--\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-3717-\tsnprintf(mii-\u003eid, sizeof(mii-\u003eid), \"%s\", dev_name(pdata-\u003edev));\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:3718:\tret = mdiobus_register(mii);\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-3719-\tif (ret) {\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:3720:\t\tdev_err(pdata-\u003edev, \"mdiobus_register failed\\n\");\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-3721-\t\treturn ret;\n--\n\n"
} |
| 25/2 | 2026/10/09 20:17 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 80122 output: 45 thoughts: 296 Thoughts: **My Analysis of MDIO and SPI Device Probing** Okay, let's break this down. From what I'm seeing, MDIO PHY drivers operate on a very straightforward probing model. The MDIO bus controller simply iterates through addresses 0 to 31, attempting to read the PHYID register. If it's a real hardware bus, it's expecting an actual response. A return of `0xffff` from the reads, indicates that no PHY is present at that address. Simple enough. Now, when we move into the realm of SPI devices, it seems like things become a bit more involved. Specifically looking at devices like the `s2500` or `oa_tc6`. It's clear that even if someone tries to instantiate one of these using a sysfs node like `new_device`, the probe isn't guaranteed to work. The `s2500_probe` function relies on two key things. Firstly, the `spi->irq` must be a valid interrupt number (>= 0), which it typically won't be if instantiated via `new_device` because `spi_alloc_device` has `irq = 0` or `-1`. Secondly, and more importantly, the `oa_tc6_init` routine executes SPI transfers to actually *talk* to the hardware and reads registers. The crucial point here is that if there's no actual physical device responding, the driver's read and validation fails. For example, `oa_tc6_check_ctrl_protection` then calls `oa_tc6_read_register`, which subsequently performs the SPI transfer. The `oa_tc6_check_ctrl_read_reply` function seems to be the linchpin. It checks for things like parity, a header echo, and probably other stuff. If it fails, we get an error! Given the way this seems to work, let's take a closer look at `oa_tc6_check_ctrl_read_reply` specifically. I think that's where the problem is. |
| 26/2 | 2026/10/09 20:17 | tool | grepper |
0mArgs:{
"Expression": "oa_tc6_check_ctrl_read_reply",
"PathPrefixes": [
"drivers/net/ethernet/oa_tc6/"
]
}Results: {
"Output": "drivers/net/ethernet/oa_tc6/oa_tc6.c=321=static int oa_tc6_check_ctrl_write_reply(struct oa_tc6 *tc6, u8 size)\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-336-\ndrivers/net/ethernet/oa_tc6/oa_tc6.c:337:static int oa_tc6_check_ctrl_read_reply(struct oa_tc6 *tc6, u8 length)\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-338-{\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c=382=static int oa_tc6_perform_ctrl(struct oa_tc6 *tc6, u32 address, u32 value[],\n--\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-405-\t/* Check echoed/received control read command reply for errors */\ndrivers/net/ethernet/oa_tc6/oa_tc6.c:406:\tret = oa_tc6_check_ctrl_read_reply(tc6, length);\ndrivers/net/ethernet/oa_tc6/oa_tc6.c-407-\tif (ret)\n"
} |
| 27/2 | 2026/10/09 20:17 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 81236 output: 46 thoughts: 18 Thoughts: Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person: **Diving into `oa_tc6_check_ctrl_read_reply`** Right, let's take a look at `oa_tc6_check_ctrl_read_reply`. I immediately want to understand its role in the overall system. Based on the name, it's a "check" function, probably related to some kind of "control read reply." My initial hunch is this likely sits somewhere within the data path verification of our protocol. The "oa_tc6" prefix suggests it's specific to, or used by, a particular block or subsystem, probably linked to TC6. I need to understand what triggered it to be called, so the context is critical. Is it called in the same context as another function like `oa_tc6_ctrl_read` or is it triggered later after a delay? Where does this fit into the protocol's state machine? Is it used for validation, error handling, or performance optimization? Is it reading values from a register, memory, or something else entirely? My focus will be to determine what input parameters it accepts. And what does it do with this input data. I'll be looking for potential race conditions or other edge cases that might lead to unexpected behavior. For example, are we dealing with asynchronous operations? Does this function need to handle any interrupts or exceptions? Is it thread-safe if we have a multi-threaded design? I'll probably start by looking for any locks or mutexes if these questions come to mind. Ultimately, I want to nail down its exact functionality, particularly how it interacts with the control logic and the data path. I'll be looking for possible areas for optimization or potential bugs, particularly anything related to timing or data integrity. |
| 28/2 | 2026/10/09 20:17 | tool | read-file |
0mArgs:{
"File": "drivers/net/ethernet/oa_tc6/oa_tc6.c",
"FirstLine": 335,
"LineCount": 45
}Results: {
"Contents": " 335:\t}\n 336:\t\n 337:\tstatic int oa_tc6_check_ctrl_read_reply(struct oa_tc6 *tc6, u8 length)\n 338:\t{\n 339:\t\t__be32 *rx_buf = tc6-\u003espi_ctrl_rx_buf + OA_TC6_CTRL_IGNORED_SIZE;\n 340:\t\t__be32 *tx_buf = tc6-\u003espi_ctrl_tx_buf;\n 341:\t\tu32 complement;\n 342:\t\tu32 reply;\n 343:\t\n 344:\t\t/* The echoed control read header must match with the one that was\n 345:\t\t * transmitted.\n 346:\t\t */\n 347:\t\tif (*tx_buf != *rx_buf)\n 348:\t\t\treturn -EPROTO;\n 349:\t\n 350:\t\tif (tc6-\u003eprot_ctrl) {\n 351:\t\t\t/* Skip past the echoed header to the value/complement pairs */\n 352:\t\t\trx_buf += 1;\n 353:\t\t\tfor (int i = 0; i \u003c length; i++) {\n 354:\t\t\t\treply = be32_to_cpu(rx_buf[0]);\n 355:\t\t\t\tcomplement = be32_to_cpu(rx_buf[1]);\n 356:\t\n 357:\t\t\t\tif (complement != ~reply)\n 358:\t\t\t\t\treturn -EPROTO;\n 359:\t\n 360:\t\t\t\trx_buf += 2;\n 361:\t\t\t}\n 362:\t\t}\n 363:\t\n 364:\t\treturn 0;\n 365:\t}\n 366:\t\n 367:\tstatic void oa_tc6_copy_ctrl_read_data(struct oa_tc6 *tc6, u32 value[],\n 368:\t\t\t\t\t u8 length)\n 369:\t{\n 370:\t\t__be32 *rx_buf = tc6-\u003espi_ctrl_rx_buf + OA_TC6_CTRL_IGNORED_SIZE +\n 371:\t\t\t\t OA_TC6_CTRL_HEADER_SIZE;\n 372:\t\n 373:\t\tfor (int i = 0; i \u003c length; i++) {\n 374:\t\t\tvalue[i] = be32_to_cpu(*rx_buf++);\n 375:\t\n 376:\t\t\t/* skip complement word */\n 377:\t\t\tif (tc6-\u003eprot_ctrl)\n 378:\t\t\t\trx_buf++;\n 379:\t\t}\n"
} |
| 29/2 | 2026/10/09 20:17 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 82378 output: 31 thoughts: 440 Thoughts: **My Analysis of the Virtualized OA TC6/S2500 Scenario**
Okay, so I'm thinking, that initial `*tx_buf != *rx_buf` comparison in the `oa_tc6_init` function is a dead end. It's almost guaranteed to fail right off the bat because, in the absence of the actual hardware, `rx_buf` is just going to be filled with zeros or 0xFF, not the echoed header we're expecting. That means an immediate `-EPROTO` error.
Now, let's back up. The real question is, can we even get past that point in a virtual environment? I need to know if QEMU, specifically the amd64 version, even *simulates* an SPI controller, let alone the specific one we need. I'm thinking of checking for `spi-intel` devices (e.g., `CONFIG_SPI_INTEL`) configured as PCI devices. But even *if* QEMU had an Intel PCH SPI controller, which it probably doesn't, there's no way it's going to have an OA TC6 or S2500 chip attached to it.
So, the fundamental question: can `s2500` or `oa_tc6` ever initialize or run in a fuzzing environment? The answer, at this point, seems to be a resounding no.
But, wait... let's not give up completely. I'm recalling `phy_device.c`. Specifically, I am considering `genphy_loopback_no_speed`.
I see that it contains a generic function that seems somewhat promising:
```c
int genphy_loopback_no_speed(struct phy_device *phydev, bool enable,
int speed)
{
if (enable && speed)
return -EOPNOTSUPP;
return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
enable ? BMCR_LOOPBACK : 0);
}
EXPORT_SYMBOL(genphy_loopback_no_speed);
```
The question now is, is `genphy_loopback_no_speed` called anywhere *outside* of the `dp83867` and `ncn26000` drivers? If so, this might provide a useful avenue to explore. I'll need to check the calls to `phy_loopback` in `phy_device.c` to see if it calls `set_loopback`. That's where I need to look: `drivers/net/phy/`.
|
| 30/2 | 2026/10/09 20:18 | tool | grepper |
0mArgs:{
"Expression": "set_loopback",
"PathPrefixes": [
"drivers/net/phy/"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 238 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (16 files in total):\ndrivers/net/phy/adin1100.c:2\ndrivers/net/phy/adin1140-phy.c:1\ndrivers/net/phy/dap8211r.c:1\ndrivers/net/phy/dp83867.c:1\ndrivers/net/phy/marvell-88q2xxx.c:2\ndrivers/net/phy/marvell.c:1\ndrivers/net/phy/marvell10g.c:4\ndrivers/net/phy/micrel.c:5\ndrivers/net/phy/microchip_t1.c:1\ndrivers/net/phy/mxl-gpy.c:15\ndrivers/net/phy/ncn26000.c:1\ndrivers/net/phy/nxp-c45-tja11xx.c:4\ndrivers/net/phy/nxp-tja11xx.c:5\ndrivers/net/phy/phy.c:4\ndrivers/net/phy/phy_device.c:1\ndrivers/net/phy/xilinx_gmii2rgmii.c:4\n\ndrivers/net/phy/adin1100.c=212=static int adin_resume(struct phy_device *phydev)\n--\ndrivers/net/phy/adin1100.c-216-\ndrivers/net/phy/adin1100.c:217:static int adin_set_loopback(struct phy_device *phydev, bool enable, int speed)\ndrivers/net/phy/adin1100.c-218-{\n--\ndrivers/net/phy/adin1100.c=323=static struct phy_driver adin_driver[] = {\n--\ndrivers/net/phy/adin1100.c-334-\t\t.handle_interrupt\t= adin_phy_handle_interrupt,\ndrivers/net/phy/adin1100.c:335:\t\t.set_loopback\t\t= adin_set_loopback,\ndrivers/net/phy/adin1100.c-336-\t\t.suspend\t\t= adin_suspend,\n--\ndrivers/net/phy/adin1140-phy.c=46=static struct phy_driver adin1140_driver[] = {\n--\ndrivers/net/phy/adin1140-phy.c-52-\t\t.config_aneg = adin1140_config_aneg,\ndrivers/net/phy/adin1140-phy.c:53:\t\t.set_loopback = adin1140_loopback,\ndrivers/net/phy/adin1140-phy.c-54-\t\t.read_mmd = genphy_read_mmd_c45,\n--\ndrivers/net/phy/dap8211r.c=196=static struct phy_driver dap8211r_driver[] = {\n--\ndrivers/net/phy/dap8211r.c-202-\t\t.read_status\t= genphy_read_status,\ndrivers/net/phy/dap8211r.c:203:\t\t.set_loopback\t= genphy_loopback,\ndrivers/net/phy/dap8211r.c-204-\t\t.config_aneg\t= genphy_config_aneg,\n--\ndrivers/net/phy/dp83867.c=1259=static struct phy_driver dp83867_driver[] = {\n--\ndrivers/net/phy/dp83867.c-1285-\t\t.link_change_notify = dp83867_link_change_notify,\ndrivers/net/phy/dp83867.c:1286:\t\t.set_loopback\t= genphy_loopback_no_speed,\ndrivers/net/phy/dp83867.c-1287-\n--\ndrivers/net/phy/marvell-88q2xxx.c=1102=static struct phy_driver mv88q2xxx_driver[] = {\n--\ndrivers/net/phy/marvell-88q2xxx.c-1112-\t\t.soft_reset\t\t= mv88q2xxx_soft_reset,\ndrivers/net/phy/marvell-88q2xxx.c:1113:\t\t.set_loopback\t\t= genphy_c45_loopback,\ndrivers/net/phy/marvell-88q2xxx.c-1114-\t\t.get_sqi\t\t= mv88q2xxx_get_sqi,\n--\ndrivers/net/phy/marvell-88q2xxx.c-1130-\t\t.handle_interrupt\t= mv88q2xxx_handle_interrupt,\ndrivers/net/phy/marvell-88q2xxx.c:1131:\t\t.set_loopback\t\t= genphy_c45_loopback,\ndrivers/net/phy/marvell-88q2xxx.c-1132-\t\t.cable_test_start\t= mv88q222x_cable_test_start,\n--\ndrivers/net/phy/marvell.c=3667=static struct phy_driver marvell_drivers[] = {\n--\ndrivers/net/phy/marvell.c-3938-\t\t.get_stats = marvell_get_stats,\ndrivers/net/phy/marvell.c:3939:\t\t.set_loopback = m88e1510_loopback,\ndrivers/net/phy/marvell.c-3940-\t\t.get_tunable = m88e1011_get_tunable,\n--\ndrivers/net/phy/marvell10g.c=1388=static struct phy_driver mv3310_drivers[] = {\n--\ndrivers/net/phy/marvell10g.c-1405-\t\t.remove\t\t= mv3310_remove,\ndrivers/net/phy/marvell10g.c:1406:\t\t.set_loopback\t= genphy_c45_loopback,\ndrivers/net/phy/marvell10g.c-1407-\t\t.get_wol\t= mv3110_get_wol,\n--\ndrivers/net/phy/marvell10g.c-1428-\t\t.remove\t\t= mv3310_remove,\ndrivers/net/phy/marvell10g.c:1429:\t\t.set_loopback\t= genphy_c45_loopback,\ndrivers/net/phy/marvell10g.c-1430-\t\t.attach_mii_port = mv3310_attach_mii_port,\n--\ndrivers/net/phy/marvell10g.c-1448-\t\t.remove\t\t= mv3310_remove,\ndrivers/net/phy/marvell10g.c:1449:\t\t.set_loopback\t= genphy_c45_loopback,\ndrivers/net/phy/marvell10g.c-1450-\t\t.get_wol\t= mv3110_get_wol,\n--\ndrivers/net/phy/marvell10g.c-1470-\t\t.remove\t\t= mv3310_remove,\ndrivers/net/phy/marvell10g.c:1471:\t\t.set_loopback\t= genphy_c45_loopback,\ndrivers/net/phy/marvell10g.c-1472-\t\t.attach_mii_port = mv3310_attach_mii_port,\n--\ndrivers/net/phy/micrel.c=1050=static int ksz9021_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-1140-\ndrivers/net/phy/micrel.c:1141:static int ksz9031_set_loopback(struct phy_device *phydev, bool enable,\ndrivers/net/phy/micrel.c-1142-\t\t\t\tint speed)\n--\ndrivers/net/phy/micrel.c=1196=static void ksz9131_loopback_disable(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-1203-\ndrivers/net/phy/micrel.c:1204:static int ksz9131_set_loopback(struct phy_device *phydev, bool enable,\ndrivers/net/phy/micrel.c-1205-\t\t\t\tint speed)\n--\ndrivers/net/phy/micrel.c-1214-\ndrivers/net/phy/micrel.c:1215:\tret = ksz9031_set_loopback(phydev, enable, speed);\ndrivers/net/phy/micrel.c-1216-\n--\ndrivers/net/phy/micrel.c=6782=static struct phy_driver ksphy_driver[] = {\n--\ndrivers/net/phy/micrel.c-6949-\t.cable_test_get_status\t= ksz9x31_cable_test_get_status,\ndrivers/net/phy/micrel.c:6950:\t.set_loopback\t= ksz9031_set_loopback,\ndrivers/net/phy/micrel.c-6951-}, {\n--\ndrivers/net/phy/micrel.c-7055-\t.get_features\t= ksz9477_get_features,\ndrivers/net/phy/micrel.c:7056:\t.set_loopback\t= ksz9131_set_loopback,\ndrivers/net/phy/micrel.c-7057-}, {\n--\ndrivers/net/phy/microchip_t1.c=2106=static struct phy_driver microchip_t1_phy_driver[] = {\n--\ndrivers/net/phy/microchip_t1.c-2160-\t\t.get_sqi_max\t= lan87xx_get_sqi_max,\ndrivers/net/phy/microchip_t1.c:2161:\t\t.set_loopback\t= genphy_c45_loopback,\ndrivers/net/phy/microchip_t1.c-2162-\t}\n--\ndrivers/net/phy/mxl-gpy.c=1102=static struct phy_driver gpy_drivers[] = {\n--\ndrivers/net/phy/mxl-gpy.c-1119-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1120:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1121-\t\t.led_brightness_set = gpy_led_brightness_set,\n--\ndrivers/net/phy/mxl-gpy.c-1146-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1147:\t\t.set_loopback\t= gpy115_loopback,\ndrivers/net/phy/mxl-gpy.c-1148-\t\t.led_brightness_set = gpy_led_brightness_set,\n--\ndrivers/net/phy/mxl-gpy.c-1172-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1173:\t\t.set_loopback\t= gpy115_loopback,\ndrivers/net/phy/mxl-gpy.c-1174-\t\t.led_brightness_set = gpy_led_brightness_set,\n--\ndrivers/net/phy/mxl-gpy.c-1199-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1200:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1201-\t\t.led_brightness_set = gpy_led_brightness_set,\n--\ndrivers/net/phy/mxl-gpy.c-1225-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1226:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1227-\t\t.led_brightness_set = gpy_led_brightness_set,\n--\ndrivers/net/phy/mxl-gpy.c-1252-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1253:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1254-\t\t.led_brightness_set = gpy_led_brightness_set,\n--\ndrivers/net/phy/mxl-gpy.c-1278-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1279:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1280-\t\t.led_brightness_set = gpy_led_brightness_set,\n--\ndrivers/net/phy/mxl-gpy.c-1305-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1306:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1307-\t\t.led_brightness_set = gpy_led_brightness_set,\n--\ndrivers/net/phy/mxl-gpy.c-1331-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1332:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1333-\t\t.led_brightness_set = gpy_led_brightness_set,\n--\ndrivers/net/phy/mxl-gpy.c-1357-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1358:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1359-\t\t.update_stats\t= gpy_update_stats,\n--\ndrivers/net/phy/mxl-gpy.c-1378-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1379:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1380-\t\t.update_stats\t= gpy_update_stats,\n--\ndrivers/net/phy/mxl-gpy.c-1399-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1400:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1401-\t\t.update_stats\t= gpy_update_stats,\n--\ndrivers/net/phy/mxl-gpy.c-1420-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1421:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1422-\t\t.led_brightness_set = gpy_led_brightness_set,\n--\ndrivers/net/phy/mxl-gpy.c-1444-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1445:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1446-\t\t.update_stats\t= gpy_update_stats,\n--\ndrivers/net/phy/mxl-gpy.c-1468-\t\t.get_wol\t= gpy_get_wol,\ndrivers/net/phy/mxl-gpy.c:1469:\t\t.set_loopback\t= gpy_loopback,\ndrivers/net/phy/mxl-gpy.c-1470-\t\t.update_stats\t= gpy_update_stats,\n--\ndrivers/net/phy/ncn26000.c=171=static struct phy_driver ncn26000_driver[] = {\n--\ndrivers/net/phy/ncn26000.c-180-\t\t.handle_interrupt = ncn26000_handle_interrupt,\ndrivers/net/phy/ncn26000.c:181:\t\t.set_loopback = genphy_loopback_no_speed,\ndrivers/net/phy/ncn26000.c-182-\t\t.set_plca_cfg = ncn26000_c45_plca_set_cfg,\n--\ndrivers/net/phy/nxp-c45-tja11xx.c=2073=static struct phy_driver nxp_c45_driver[] = {\n--\ndrivers/net/phy/nxp-c45-tja11xx.c-2092-\t\t.cable_test_get_status\t= nxp_c45_cable_test_get_status,\ndrivers/net/phy/nxp-c45-tja11xx.c:2093:\t\t.set_loopback\t\t= genphy_c45_loopback,\ndrivers/net/phy/nxp-c45-tja11xx.c-2094-\t\t.get_sqi\t\t= nxp_c45_get_sqi,\n--\ndrivers/net/phy/nxp-c45-tja11xx.c-2117-\t\t.cable_test_get_status\t= nxp_c45_cable_test_get_status,\ndrivers/net/phy/nxp-c45-tja11xx.c:2118:\t\t.set_loopback\t\t= genphy_c45_loopback,\ndrivers/net/phy/nxp-c45-tja11xx.c-2119-\t\t.get_sqi\t\t= nxp_c45_get_sqi,\n--\ndrivers/net/phy/nxp-c45-tja11xx.c-2143-\t\t.cable_test_get_status\t= nxp_c45_cable_test_get_status,\ndrivers/net/phy/nxp-c45-tja11xx.c:2144:\t\t.set_loopback\t\t= genphy_c45_loopback,\ndrivers/net/phy/nxp-c45-tja11xx.c-2145-\t\t.get_sqi\t\t= nxp_c45_get_sqi,\n--\ndrivers/net/phy/nxp-c45-tja11xx.c-2169-\t\t.cable_test_get_status\t= nxp_c45_cable_test_get_status,\ndrivers/net/phy/nxp-c45-tja11xx.c:2170:\t\t.set_loopback\t\t= genphy_c45_loopback,\ndrivers/net/phy/nxp-c45-tja11xx.c-2171-\t\t.get_sqi\t\t= nxp_c45_get_sqi,\n--\ndrivers/net/phy/nxp-tja11xx.c=818=static struct phy_driver tja11xx_driver[] = {\n--\ndrivers/net/phy/nxp-tja11xx.c-831-\t\t.resume\t\t= genphy_resume,\ndrivers/net/phy/nxp-tja11xx.c:832:\t\t.set_loopback = genphy_loopback,\ndrivers/net/phy/nxp-tja11xx.c-833-\t\t/* Statistics */\n--\ndrivers/net/phy/nxp-tja11xx.c-849-\t\t.resume\t\t= genphy_resume,\ndrivers/net/phy/nxp-tja11xx.c:850:\t\t.set_loopback = genphy_loopback,\ndrivers/net/phy/nxp-tja11xx.c-851-\t\t/* Statistics */\n--\ndrivers/net/phy/nxp-tja11xx.c-869-\t\t.resume\t\t= genphy_resume,\ndrivers/net/phy/nxp-tja11xx.c:870:\t\t.set_loopback = genphy_loopback,\ndrivers/net/phy/nxp-tja11xx.c-871-\t\t/* Statistics */\n--\ndrivers/net/phy/nxp-tja11xx.c-892-\t\t.resume\t\t= genphy_resume,\ndrivers/net/phy/nxp-tja11xx.c:893:\t\t.set_loopback = genphy_loopback,\ndrivers/net/phy/nxp-tja11xx.c-894-\t\t/* Statistics */\n--\n\n"
} |
| 31/2 | 2026/10/09 20:18 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 88910 output: 172 thoughts: 3926 Thoughts: **Analysis of the Code Changes: Unreachable Hardware in Standard QEMU** Okay, so I've delved into these changes, and here's my take. The code touches a few areas. First, `genphy_loopback_no_speed` – this is a PHY library helper, right? And it's assigned to the `.set_loopback` function pointers of the TI DP83867 and onsemi NCN26000 PHY drivers. Right away, my antennae go up. These are *physical* PHY chips, not some virtual device QEMU conjures up. Phylib reads the MII registers, the PHY IDs. If there's no actual hardware present, it'll get `0xffffffff` or `0x00000000`, and that will ensure that the drivers do not get bound and, by extension, that the callback `genphy_loopback_no_speed` does not get invoked. The PHY ID has to match the specific vendor OUI/model for the driver to be instantiated, and that won't happen without the hardware. Then there's the `s2500` SPI driver. This is a bit more involved, but it's the same principle. `s2500_probe` is called, and immediately it does some SPI transfers, checking a "PROTE" bit via calls to `oa_tc6_init`. Inside `oa_tc6_init`, there's a handshake involving a register read: `oa_tc6_check_ctrl_protection`. The critical part? `oa_tc6_check_ctrl_read_reply`. It *echoes* the SPI read header to ensure everything is connected! If the `*tx_buf` and `*rx_buf` do not match, `-EPROTO` is returned. And without that MACPHY hardware on the SPI bus to respond with a valid header, this probe is immediately doomed. `oa_tc6_init` returns `-EPROTO`, and `s2500_probe` returns `-EPROTO`. Wait, let me just check the `oa_tc6` framework itself. Where else is `oa_tc6` used? I've seen it only with ADIN1140, LAN865x and S2500. All of them are SPI Ethernet drivers for 10BASE-T1S / 10BASE-T1L MACPHY chips. And like the PHY drivers, the code has to talk to *real* hardware. No emulation here. It's not something QEMU can just whip up on a whim. Now, could there be a mocked SPI bus or even a USB-to-SPI dongle? Maybe, but even if there was, the S2500, LAN8650, or ADIN1140 chip itself isn't connected to it! The driver is expecting an SPI response conforming to the OPEN Alliance TC6 spec. Without the chip responding, you're back to that handshake failing instantly. It's all about talking to the *right* hardware. So, let's look at the fuzzing guidelines. Section 2, "Structurally unreachable hardware," really hits home. I've got a lot of *vendor-specific* hardware here, which falls squarely into that category: `Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed, ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.` And section 1 says that "fuzzing can only discover bugs in code that can actually execute in standard virtualized environments." Okay, let's review the files that are touched in the patch. I see documentation, Kconfig and Makefiles, `oa_tc6` framework, `s2500` and `dp83867` and `ncn26000` driver files, and the `phy_device.c` file. Nothing is touched outside of the areas mentioned above, so nothing is reachable during fuzzing. The `genphy_loopback_no_speed` function is only for PHYs (DP83867, NCN26000) that are physical hardware, which means the code is not reachable in QEMU. I've verified that *every* modified file is either documentation/metadata, Kconfig/Makefiles, or drivers for *physical* hardware (PHYs and SPI MAC-PHY controllers) that are not emulated in QEMU. Therefore: * `WorthFuzzing = false` * `FocusSymbols = []` * `EnableConfigs = []` The |
| 32/2 | 2026/10/09 20:18 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch series adds support for the onsemi S2500 10BASE-T1S MAC-PHY Ethernet controller over SPI, adds PTP hardware timestamping support to the OPEN Alliance TC6 (OA TC6) MAC-PHY framework, and updates the NCN26000 and DP83867 PHY drivers along with adding a genphy_loopback_no_speed helper in phylib. All modified executable code belongs to physical SPI MAC-PHY controllers or physical MDIO PHY transceivers that cannot be instantiated or emulated in standard QEMU/GCE virtualized environments, making the changes structurally unreachable for syzkaller fuzzing.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series adds support for the onsemi S2500 10BASE-T1S MAC-PHY Ethernet controller over SPI, adds PTP hardware timestamping support to the OPEN Alliance TC6 (OA TC6) MAC-PHY framework, and updates the NCN26000 and DP83867 PHY drivers along with adding a genphy_loopback_no_speed helper in phylib. All modified executable code belongs to physical SPI MAC-PHY controllers or physical MDIO PHY transceivers that cannot be instantiated or emulated in standard QEMU/GCE virtualized environments, making the changes structurally unreachable for syzkaller fuzzing.",
"WorthFuzzing": false
} |
| 33/1 | 2026/10/09 20:18 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|