| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/07/08 09:22 | flow | patch-triage |
1mArgs:null Results: {
"EnableConfigs": [
"ADIN1140",
"SPI_GPIO"
],
"FocusSymbols": [
"adin1140_probe",
"adin1140_rx_mode",
"adin1140_set_mac_address",
"adin1140_mdiobus_read",
"adin1140_mdiobus_write",
"adin1140_get_eth_mac_stats",
"adin1140_get_ethtool_stats",
"adin1140_stats_work",
"adin1140_mac_filter_set",
"adin1140_promiscuous_mode",
"oa_tc6_read_register_mms",
"oa_tc6_write_register_mms",
"oa_tc6_mdiobus_read_c45",
"oa_tc6_mdiobus_write_c45",
"oa_tc6_check_ctrl_protection",
"adin1140_loopback",
"adin1140_read_status",
"adin1140_config_aneg",
"genphy_read_mmd_c45",
"genphy_write_mmd_c45"
],
"Reasoning": "The patch introduces a new Ethernet MAC-PHY driver for the Analog Devices ADIN1140, which is connected via SPI. It also adds a corresponding PHY driver and extends the OA TC6 framework to support memory map selectors (MMS) and protected control mode. The driver can be instantiated in a virtualized environment by injecting a Device Tree overlay that creates an `spi-gpio` controller and attaches the ADIN1140 device to it. This allows syzkaller to probe the driver and fuzz its netdev interface, ethtool ops, and MAC filtering logic.",
"WorthFuzzing": true
} |
| 1/1 | 2026/07/08 09:22 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 9d5c205b8b0e7e33c1b0a78da3d1b0e9aaaa4052\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Wed Jul 8 09:22:37 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/Documentation/devicetree/bindings/net/adi,ad3306.yaml b/Documentation/devicetree/bindings/net/adi,ad3306.yaml\nnew file mode 100644\nindex 00000000000000..785d05c995dbb9\n--- /dev/null\n+++ b/Documentation/devicetree/bindings/net/adi,ad3306.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/adi,ad3306.yaml#\n+$schema: http://devicetree.org/meta-schemas/core.yaml#\n+\n+title: ADI ADIN1140 10BASE-T1S MAC-PHY\n+\n+maintainers:\n+ - Ciprian Regus \u003cciprian.regus@analog.com\u003e\n+\n+description: |\n+ The ADIN1140 (also called AD3306) is a low power single port\n+ 10BASE-T1S MAC-PHY. It integrates an Ethernet PHY with a MAC\n+ and all the associated analog circuitry.\n+ The device tries to implement the Open Alliance TC6 10BASE-T1x MAC-PHY\n+ Serial Interface specification and is compliant with the\n+ IEEE 802.3cg-2019 Ethernet standard for 10 Mbps single pair\n+ Ethernet (SPE). The device has a 4-wire SPI interface for\n+ communication between the MAC and host processor.\n+\n+allOf:\n+ - $ref: /schemas/net/ethernet-controller.yaml#\n+ - $ref: /schemas/spi/spi-peripheral-props.yaml#\n+\n+properties:\n+ compatible:\n+ oneOf:\n+ - items:\n+ - const: adi,adin1140\n+ - const: adi,ad3306\n+ - const: adi,ad3306\n+\n+ reg:\n+ maxItems: 1\n+\n+ spi-max-frequency:\n+ maximum: 25000000\n+\n+ interrupts:\n+ maxItems: 1\n+ description: Interrupt from the MAC-PHY for receive data available\n+ and error conditions\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+\n+ spi {\n+ #address-cells = \u003c1\u003e;\n+ #size-cells = \u003c0\u003e;\n+\n+ ethernet@0 {\n+ compatible = \"adi,ad3306\";\n+ reg = \u003c0\u003e;\n+ spi-max-frequency = \u003c23000000\u003e;\n+\n+ interrupt-parent = \u003c\u0026gpio\u003e;\n+ interrupts = \u003c6 IRQ_TYPE_LEVEL_LOW\u003e;\n+\n+ local-mac-address = [ 00 11 22 33 44 55 ];\n+ };\n+ };\ndiff --git a/Documentation/networking/oa-tc6-framework.rst b/Documentation/networking/oa-tc6-framework.rst\nindex fe2aabde923a57..013824078cea40 100644\n--- a/Documentation/networking/oa-tc6-framework.rst\n+++ b/Documentation/networking/oa-tc6-framework.rst\n@@ -454,7 +454,8 @@ Device drivers API\n The include/linux/oa_tc6.h defines the following functions:\n \n .. c:function:: struct oa_tc6 *oa_tc6_init(struct spi_device *spi, \\\n- struct net_device *netdev)\n+ struct net_device *netdev, \\\n+ struct oa_tc6_quirks *quirks)\n \n Initialize OA TC6 lib.\n \ndiff --git a/MAINTAINERS b/MAINTAINERS\nindex 52f1a55eca99bf..ba946b63d4a535 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -1900,6 +1900,21 @@ S:\tSupported\n W:\thttps://ez.analog.com/linux-software-drivers\n F:\tdrivers/dma/dma-axi-dmac.c\n \n+ANALOG DEVICES INC ETHERNET DRIVERS\n+M:\tCiprian Regus \u003cciprian.regus@analog.com\u003e\n+L:\tnetdev@vger.kernel.org\n+S:\tMaintained\n+W:\thttps://ez.analog.com/linux-software-drivers\n+F:\tDocumentation/devicetree/bindings/net/adi,ad3306.yaml\n+F:\tdrivers/net/ethernet/adi/adin1140.c\n+\n+ANALOG DEVICES INC ETHERNET PHY DRIVERS\n+M:\tCiprian Regus \u003cciprian.regus@analog.com\u003e\n+L:\tnetdev@vger.kernel.org\n+S:\tMaintained\n+W:\thttps://ez.analog.com/linux-software-drivers\n+F:\tdrivers/net/phy/adin1140-phy.c\n+\n ANALOG DEVICES INC IIO DRIVERS\n M:\tNuno Sá \u003cnuno.sa@analog.com\u003e\n M:\tMichael Hennerich \u003cMichael.Hennerich@analog.com\u003e\ndiff --git a/drivers/net/ethernet/adi/Kconfig b/drivers/net/ethernet/adi/Kconfig\nindex 760a9a60bc15c1..bdb8ff7d15da6d 100644\n--- a/drivers/net/ethernet/adi/Kconfig\n+++ b/drivers/net/ethernet/adi/Kconfig\n@@ -26,4 +26,16 @@ config ADIN1110\n \t Say yes here to build support for Analog Devices ADIN1110\n \t Low Power 10BASE-T1L Ethernet MAC-PHY.\n \n+config ADIN1140\n+\ttristate \"Analog Devices ADIN1140 MAC-PHY\"\n+\tdepends on SPI\n+\tselect ADIN1140_PHY\n+\tselect OA_TC6\n+\thelp\n+\t Say yes here to build support for Analog Devices, Inc. ADIN1140\n+\t 10BASE-T1S Ethernet MAC-PHY.\n+\n+\t To compile this driver as a module, choose M here. The module will be\n+\t called adin1140.\n+\n endif # NET_VENDOR_ADI\ndiff --git a/drivers/net/ethernet/adi/Makefile b/drivers/net/ethernet/adi/Makefile\nindex d0383d94303c80..0390ca8ccc497e 100644\n--- a/drivers/net/ethernet/adi/Makefile\n+++ b/drivers/net/ethernet/adi/Makefile\n@@ -4,3 +4,4 @@\n #\n \n obj-$(CONFIG_ADIN1110) += adin1110.o\n+obj-$(CONFIG_ADIN1140) += adin1140.o\ndiff --git a/drivers/net/ethernet/adi/adin1140.c b/drivers/net/ethernet/adi/adin1140.c\nnew file mode 100644\nindex 00000000000000..93710baca1517a\n--- /dev/null\n+++ b/drivers/net/ethernet/adi/adin1140.c\n@@ -0,0 +1,791 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * Driver for Analog Devices, Inc. ADIN1140 10BASE-T1S MAC-PHY\n+ *\n+ * Copyright 2026 Analog Devices Inc.\n+ */\n+\n+#include \u003clinux/cleanup.h\u003e\n+#include \u003clinux/etherdevice.h\u003e\n+#include \u003clinux/kernel.h\u003e\n+#include \u003clinux/mdio.h\u003e\n+#include \u003clinux/module.h\u003e\n+#include \u003clinux/oa_tc6.h\u003e\n+#include \u003clinux/phy.h\u003e\n+\n+#define ADIN1140_MAC_CONFIG2_STAT_CLR_RD\tBIT(6)\n+#define ADIN1140_MAC_CONFIG2_FWD_UNK2HOST\tBIT(2)\n+\n+#define ADIN1140_MAC_P1_LOOP_ADDR_REG\t0xC4\n+\n+#define ADIN1140_MAC_ADDR_FILT_UPR_REG\t\t0x50\n+#define ADIN1140_MAC_ADDR_FILT_APPLY2PORT1\tBIT(30)\n+#define ADIN1140_MAC_ADDR_FILT_TO_HOST\t\tBIT(16)\n+\n+#define ADIN1140_MAC_ADDR_FILT_LWR_REG\t\t0x51\n+\n+#define ADIN1140_MAC_ADDR_MASK_UPR_REG\t0x70\n+#define ADIN1140_MAC_ADDR_MASK_LWR_REG\t0x71\n+\n+#define ADIN1140_MAC_FILT_MC_SLOT\t0U\n+#define ADIN1140_MAC_FILT_BC_SLOT\t1U\n+#define ADIN1140_MAC_FILT_UC_SLOT\t2U\n+#define ADIN1140_MAC_FILT_MAX_SLOT\t16U\n+#define ADIN1140_MAC_FILT_MASK_LIMIT\t2U\n+\n+#define ADIN1140_MAC_RX_FRAME_CNT\t\t0xA1\n+#define ADIN1140_MAC_RX_BC_FRAME_CNT\t\t0xA2\n+#define ADIN1140_MAC_RX_MC_FRAME_CNT\t\t0xA3\n+#define ADIN1140_MAC_RX_CRC_ERR_CNT\t\t0xA5\n+#define ADIN1140_MAC_RX_ALIGN_ERR_CNT\t\t0xA6\n+#define ADIN1140_MAC_RX_PREAMBLE_ERR_CNT\t0xA7\n+#define ADIN1140_MAC_RX_SHORT_ERR_CNT\t\t0xA8\n+#define ADIN1140_MAC_RX_LONG_ERR_CNT\t\t0xA9\n+#define ADIN1140_MAC_RX_PHY_ERR_CNT\t\t0xAA\n+#define ADIN1140_MAC_RX_DRP_FULL_CNT\t\t0xAB\n+#define ADIN1140_MAC_RX_DRP_FILTER_CNT\t\t0xAD\n+#define ADIN1140_MAC_RX_IFG_ERR_CNT\t\t0xAE\n+#define ADIN1140_MAC_TX_FRAME_CNT\t\t0xB1\n+#define ADIN1140_MAC_TX_BC_FRAME_CNT\t\t0xB2\n+#define ADIN1140_MAC_TX_MC_FRAME_CNT\t\t0xB3\n+#define ADIN1140_MAC_TX_SINGLE_COL_CNT\t\t0xB5\n+#define ADIN1140_MAC_TX_MULTI_COL_CNT\t\t0xB6\n+#define ADIN1140_MAC_TX_DEFERRED_CNT\t\t0xB7\n+#define ADIN1140_MAC_TX_LATE_COL_CNT\t\t0xB8\n+#define ADIN1140_MAC_TX_EXCESS_COL_CNT\t\t0xB9\n+#define ADIN1140_MAC_TX_UNDERRUN_CNT\t\t0xBA\n+\n+/* ADIN1140_MAC_FILT_MAX_SLOT - 3 (multicast, broadcast and unicast\n+ * reserved slots)\n+ */\n+#define ADIN1140_MAC_FILT_AVAIL\t13U\n+\n+#define ADIN1140_PHY_CTRL_DEFAULT\t0x1000\n+#define ADIN1140_PHY_STATUS_DEFAULT\t0x082D\n+#define ADIN1140_PHY_ID1\t\t0x0283\n+#define ADIN1140_PHY_ID2\t\t0xBE00\n+\n+#define ADIN1140_STATS_CHECK_DELAY\t(3 * HZ)\n+\n+enum adin1140_statistics_entry {\n+\trx_frames,\n+\trx_bc_frames,\n+\trx_mc_frames,\n+\trx_crc_errors,\n+\trx_align_errors,\n+\trx_preamble_errors,\n+\trx_short_frame_errors,\n+\trx_long_frame_errors,\n+\trx_phy_errors,\n+\trx_fifo_full_dropped,\n+\trx_addr_filter_dropped,\n+\trx_ifg_errors,\n+\ttx_frames,\n+\ttx_bc_frames,\n+\ttx_mc_frames,\n+\ttx_single_collision,\n+\ttx_multi_collision,\n+\ttx_deferred,\n+\ttx_late_collision,\n+\ttx_excess_collision,\n+\ttx_underrun,\n+\tADIN1140_STATS_CNT,\n+};\n+\n+struct adin1140_statistics_reg {\n+\tconst char *name;\n+\tenum adin1140_statistics_entry idx;\n+};\n+\n+struct adin1140_priv {\n+\tstruct net_device *netdev;\n+\tstruct oa_tc6 *tc6;\n+\tstruct mii_bus *mdiobus;\n+\tstruct phy_device *phydev;\n+\tstruct delayed_work stats_work;\n+\n+\t/* Protects stats[] from concurrent updates in adin1140_stats_work\n+\t * and reads in the get_stats functions\n+\t */\n+\tspinlock_t stat_lock;\n+\tu64 stats[ADIN1140_STATS_CNT];\n+};\n+\n+static const u32 adin1140_stat_regs[] = {\n+\t[rx_frames] = ADIN1140_MAC_RX_FRAME_CNT,\n+\t[rx_bc_frames] = ADIN1140_MAC_RX_BC_FRAME_CNT,\n+\t[rx_mc_frames] = ADIN1140_MAC_RX_MC_FRAME_CNT,\n+\t[rx_crc_errors] = ADIN1140_MAC_RX_CRC_ERR_CNT,\n+\t[rx_align_errors] = ADIN1140_MAC_RX_ALIGN_ERR_CNT,\n+\t[rx_preamble_errors] = ADIN1140_MAC_RX_PREAMBLE_ERR_CNT,\n+\t[rx_short_frame_errors]\t= ADIN1140_MAC_RX_SHORT_ERR_CNT,\n+\t[rx_long_frame_errors] = ADIN1140_MAC_RX_LONG_ERR_CNT,\n+\t[rx_phy_errors] = ADIN1140_MAC_RX_PHY_ERR_CNT,\n+\t[rx_fifo_full_dropped] = ADIN1140_MAC_RX_DRP_FULL_CNT,\n+\t[rx_addr_filter_dropped] = ADIN1140_MAC_RX_DRP_FILTER_CNT,\n+\t[rx_ifg_errors] = ADIN1140_MAC_RX_IFG_ERR_CNT,\n+\t[tx_frames] = ADIN1140_MAC_TX_FRAME_CNT,\n+\t[tx_bc_frames] = ADIN1140_MAC_TX_BC_FRAME_CNT,\n+\t[tx_mc_frames] = ADIN1140_MAC_TX_MC_FRAME_CNT,\n+\t[tx_single_collision] = ADIN1140_MAC_TX_SINGLE_COL_CNT,\n+\t[tx_multi_collision] = ADIN1140_MAC_TX_MULTI_COL_CNT,\n+\t[tx_deferred] = ADIN1140_MAC_TX_DEFERRED_CNT,\n+\t[tx_late_collision] = ADIN1140_MAC_TX_LATE_COL_CNT,\n+\t[tx_excess_collision] = ADIN1140_MAC_TX_EXCESS_COL_CNT,\n+\t[tx_underrun] = ADIN1140_MAC_TX_UNDERRUN_CNT,\n+};\n+\n+static const struct adin1140_statistics_reg adin1140_stats[] = {\n+\t{.name = \"rx_preamble_errors\", .idx = rx_preamble_errors},\n+\t{.name = \"rx_ifg_errors\", .idx = rx_ifg_errors},\n+};\n+\n+static int adin1140_mac_filter_set(struct adin1140_priv *priv,\n+\t\t\t\t const u8 *addr, const u8 *mask,\n+\t\t\t\t u8 slot)\n+{\n+\tu32 reg_address;\n+\tu32 val;\n+\tint ret;\n+\n+\tif (slot \u003e= ADIN1140_MAC_FILT_MAX_SLOT)\n+\t\treturn -ENOSPC;\n+\n+\treg_address = ADIN1140_MAC_ADDR_FILT_UPR_REG + 2 * slot;\n+\n+\tret = oa_tc6_write_register_mms(priv-\u003etc6, OA_TC6_MAC_MMS1,\n+\t\t\t\t\treg_address,\n+\t\t\t\t\tget_unaligned_be16(\u0026addr[0]) |\n+\t\t\t\t\tADIN1140_MAC_ADDR_FILT_APPLY2PORT1 |\n+\t\t\t\t\tADIN1140_MAC_ADDR_FILT_TO_HOST);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treg_address = ADIN1140_MAC_ADDR_FILT_LWR_REG + 2 * slot;\n+\tret = oa_tc6_write_register_mms(priv-\u003etc6, OA_TC6_MAC_MMS1,\n+\t\t\t\t\treg_address,\n+\t\t\t\t\tget_unaligned_be32(\u0026addr[2]));\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Only the first 2 destination MAC filter slots support masking.\n+\t * For the other entries, the destination address in the received\n+\t * frame must match exactly.\n+\t */\n+\tif (slot \u003e= ADIN1140_MAC_FILT_MASK_LIMIT)\n+\t\treturn 0;\n+\n+\tval = get_unaligned_be16(\u0026mask[0]);\n+\treg_address = ADIN1140_MAC_ADDR_MASK_UPR_REG + (2 * slot);\n+\n+\tret = oa_tc6_write_register_mms(priv-\u003etc6, OA_TC6_MAC_MMS1,\n+\t\t\t\t\treg_address, val);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tval = get_unaligned_be32(\u0026mask[2]);\n+\treg_address = ADIN1140_MAC_ADDR_MASK_LWR_REG + (2 * slot);\n+\n+\treturn oa_tc6_write_register_mms(priv-\u003etc6, OA_TC6_MAC_MMS1,\n+\t\t\t\t\t reg_address, val);\n+}\n+\n+static int adin1140_mac_filter_clear(struct adin1140_priv *priv, u8 slot)\n+{\n+\tu8 mask[ETH_ALEN];\n+\tu8 addr[ETH_ALEN];\n+\n+\tmemset(mask, 0xFF, ETH_ALEN);\n+\tmemset(addr, 0x0, ETH_ALEN);\n+\n+\treturn adin1140_mac_filter_set(priv, addr, mask, slot);\n+}\n+\n+static int adin1140_filter_unicast(struct adin1140_priv *priv)\n+{\n+\t/* Only the first 2 filter slots support masking, so no unicast\n+\t * address will ever need a mask. The first slots are used for the\n+\t * all multicast and broadcast filter.\n+\t */\n+\treturn adin1140_mac_filter_set(priv, priv-\u003enetdev-\u003edev_addr, NULL,\n+\t\t\t\t ADIN1140_MAC_FILT_UC_SLOT);\n+}\n+\n+static int adin1140_filter_all_multicast(struct adin1140_priv *priv, bool en)\n+{\n+\tu8 multicast_addr[ETH_ALEN] = {1, 0, 0, 0, 0, 0};\n+\n+\tif (en)\n+\t\treturn adin1140_mac_filter_set(priv, multicast_addr,\n+\t\t\t\t\t multicast_addr,\n+\t\t\t\t\t ADIN1140_MAC_FILT_MC_SLOT);\n+\n+\treturn adin1140_mac_filter_clear(priv, ADIN1140_MAC_FILT_MC_SLOT);\n+}\n+\n+static int adin1140_filter_broadcast(struct adin1140_priv *priv, bool enabled)\n+{\n+\tu8 mask[ETH_ALEN];\n+\n+\tif (enabled) {\n+\t\tmemset(mask, 0xFF, ETH_ALEN);\n+\t\treturn adin1140_mac_filter_set(priv, mask, mask,\n+\t\t\t\t\t ADIN1140_MAC_FILT_BC_SLOT);\n+\t}\n+\n+\treturn adin1140_mac_filter_clear(priv, ADIN1140_MAC_FILT_BC_SLOT);\n+}\n+\n+static int adin1140_default_filter_config(struct adin1140_priv *priv)\n+{\n+\tint ret;\n+\n+\tret = adin1140_filter_broadcast(priv, true);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn adin1140_filter_unicast(priv);\n+}\n+\n+static int adin1140_promiscuous_mode(struct adin1140_priv *priv, bool enabled)\n+{\n+\tint ret;\n+\tu32 val;\n+\n+\tret = oa_tc6_read_register(priv-\u003etc6, OA_TC6_REG_CONFIG2, \u0026val);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (enabled)\n+\t\tval |= ADIN1140_MAC_CONFIG2_FWD_UNK2HOST;\n+\telse\n+\t\tval \u0026= ~ADIN1140_MAC_CONFIG2_FWD_UNK2HOST;\n+\n+\treturn oa_tc6_write_register(priv-\u003etc6, OA_TC6_REG_CONFIG2, val);\n+}\n+\n+static int adin1140_rx_mode(struct net_device *dev,\n+\t\t\t struct netdev_hw_addr_list *uc,\n+\t\t\t struct netdev_hw_addr_list *mc)\n+{\n+\tstruct adin1140_priv *priv = netdev_priv(dev);\n+\tstruct netdev_hw_addr *ha;\n+\tbool all_multi, promisc;\n+\tu32 mac_addrs;\n+\tu8 slot, i;\n+\tint ret;\n+\n+\t/* The ADIN1140 has 16 dest MAC address filter slots:\n+\t * 0 - reserved for all multicast filter.\n+\t * 1 - reserved for broadcast filter.\n+\t * 2 - reserved for the device's own unicast MAC.\n+\t * 3 -\u003e 15 - available for other unicast/multicast filters.\n+\t */\n+\n+\tmac_addrs = netdev_hw_addr_list_count(uc);\n+\tall_multi = false;\n+\tpromisc = false;\n+\n+\tif (priv-\u003enetdev-\u003eflags \u0026 IFF_PROMISC)\n+\t\tpromisc = true;\n+\telse if (priv-\u003enetdev-\u003eflags \u0026 IFF_ALLMULTI)\n+\t\tall_multi = true;\n+\telse\n+\t\tmac_addrs += netdev_hw_addr_list_count(mc);\n+\n+\tif (mac_addrs \u003e ADIN1140_MAC_FILT_AVAIL) {\n+\t\t/* The filter table is full. Enable promisc mode. */\n+\t\tpromisc = true;\n+\t}\n+\n+\tret = adin1140_promiscuous_mode(priv, promisc);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = adin1140_filter_all_multicast(priv, all_multi);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tslot = ADIN1140_MAC_FILT_UC_SLOT + 1;\n+\tif (!promisc) {\n+\t\tnetdev_hw_addr_list_for_each(ha, uc) {\n+\t\t\tret = adin1140_mac_filter_set(priv, ha-\u003eaddr, NULL,\n+\t\t\t\t\t\t slot);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\n+\t\t\tslot++;\n+\t\t}\n+\n+\t\tif (!all_multi) {\n+\t\t\tnetdev_hw_addr_list_for_each(ha, mc) {\n+\t\t\t\tret = adin1140_mac_filter_set(priv, ha-\u003eaddr,\n+\t\t\t\t\t\t\t NULL, slot);\n+\t\t\t\tif (ret)\n+\t\t\t\t\treturn ret;\n+\n+\t\t\t\tslot++;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tfor (i = slot; i \u003c ADIN1140_MAC_FILT_MAX_SLOT; i++) {\n+\t\tret = adin1140_mac_filter_clear(priv, i);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static void adin1140_stats_work(struct work_struct *work)\n+{\n+\tstruct delayed_work *dwork = to_delayed_work(work);\n+\tstruct adin1140_priv *priv;\n+\tu32 reg_val;\n+\tint ret;\n+\tu32 i;\n+\n+\tpriv = container_of(dwork, struct adin1140_priv, stats_work);\n+\n+\tfor (i = 0; i \u003c ARRAY_SIZE(adin1140_stat_regs); i++) {\n+\t\tret = oa_tc6_read_register_mms(priv-\u003etc6, OA_TC6_MAC_MMS1,\n+\t\t\t\t\t adin1140_stat_regs[i],\n+\t\t\t\t\t \u0026reg_val);\n+\t\tif (ret)\n+\t\t\tgoto out;\n+\n+\t\tscoped_guard(spinlock, \u0026priv-\u003estat_lock)\n+\t\t\tpriv-\u003estats[i] += reg_val;\n+\t}\n+\n+out:\n+\tschedule_delayed_work(dwork, ADIN1140_STATS_CHECK_DELAY);\n+}\n+\n+static int adin1140_configure(struct adin1140_priv *priv)\n+{\n+\tu32 reg_val;\n+\tint ret;\n+\n+\tret = oa_tc6_zero_align_receive_frame_enable(priv-\u003etc6);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Disable MAC loopback */\n+\tret = oa_tc6_write_register_mms(priv-\u003etc6, OA_TC6_MAC_MMS1,\n+\t\t\t\t\tADIN1140_MAC_P1_LOOP_ADDR_REG, 0x0);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = oa_tc6_read_register(priv-\u003etc6, OA_TC6_REG_CONFIG2, \u0026reg_val);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treg_val |= ADIN1140_MAC_CONFIG2_STAT_CLR_RD;\n+\n+\tret = oa_tc6_write_register(priv-\u003etc6, OA_TC6_REG_CONFIG2, reg_val);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn adin1140_default_filter_config(priv);\n+}\n+\n+static int adin1140_open(struct net_device *netdev)\n+{\n+\tstruct adin1140_priv *priv = netdev_priv(netdev);\n+\n+\tschedule_delayed_work(\u0026priv-\u003estats_work, ADIN1140_STATS_CHECK_DELAY);\n+\n+\tphy_start(netdev-\u003ephydev);\n+\tnetif_start_queue(netdev);\n+\n+\treturn 0;\n+}\n+\n+static int adin1140_close(struct net_device *netdev)\n+{\n+\tstruct adin1140_priv *priv = netdev_priv(netdev);\n+\n+\tcancel_delayed_work_sync(\u0026priv-\u003estats_work);\n+\n+\tnetif_stop_queue(netdev);\n+\tphy_stop(netdev-\u003ephydev);\n+\n+\treturn 0;\n+}\n+\n+static netdev_tx_t adin1140_start_xmit(struct sk_buff *skb,\n+\t\t\t\t struct net_device *netdev)\n+{\n+\tstruct adin1140_priv *priv = netdev_priv(netdev);\n+\n+\t/* The MAC doesn't automatically pad the frame to a 60 byte minimum\n+\t * size in case the host sends a shorter skb, so we have to do it in\n+\t * the driver. The FCS will be added by the MAC.\n+\t */\n+\tif (skb_put_padto(skb, ETH_ZLEN))\n+\t\treturn NETDEV_TX_OK;\n+\n+\treturn oa_tc6_start_xmit(priv-\u003etc6, skb);\n+}\n+\n+static int adin1140_set_mac_address(struct net_device *netdev, void *addr)\n+{\n+\tstruct adin1140_priv *priv = netdev_priv(netdev);\n+\tstruct sockaddr *address = addr;\n+\tu8 mask[ETH_ALEN];\n+\tint ret;\n+\n+\tret = eth_prepare_mac_addr_change(netdev, addr);\n+\tif (ret \u003c 0)\n+\t\treturn ret;\n+\n+\tif (ether_addr_equal(address-\u003esa_data, netdev-\u003edev_addr))\n+\t\treturn 0;\n+\n+\tmemset(mask, 0xFF, ETH_ALEN);\n+\tret = adin1140_mac_filter_set(priv, address-\u003esa_data, mask,\n+\t\t\t\t ADIN1140_MAC_FILT_UC_SLOT);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\teth_commit_mac_addr_change(netdev, addr);\n+\n+\treturn 0;\n+}\n+\n+static void __adin1140_ndo_get_stats64(struct adin1140_priv *priv,\n+\t\t\t\t struct rtnl_link_stats64 *storage)\n+{\n+\tstorage-\u003erx_errors = priv-\u003estats[rx_crc_errors] +\n+\t\t\t priv-\u003estats[rx_align_errors] +\n+\t\t\t priv-\u003estats[rx_preamble_errors] +\n+\t\t\t priv-\u003estats[rx_short_frame_errors] +\n+\t\t\t priv-\u003estats[rx_long_frame_errors] +\n+\t\t\t priv-\u003estats[rx_phy_errors] +\n+\t\t\t priv-\u003estats[rx_ifg_errors];\n+\n+\tstorage-\u003etx_errors = priv-\u003estats[tx_excess_collision] +\n+\t\t\t priv-\u003estats[tx_underrun];\n+\n+\tstorage-\u003erx_dropped = priv-\u003estats[rx_fifo_full_dropped] +\n+\t\t\t priv-\u003estats[rx_addr_filter_dropped];\n+\n+\tstorage-\u003emulticast = priv-\u003estats[rx_mc_frames];\n+\n+\tstorage-\u003ecollisions = priv-\u003estats[tx_single_collision] +\n+\t\t\t priv-\u003estats[tx_multi_collision];\n+\n+\tstorage-\u003erx_length_errors = priv-\u003estats[rx_short_frame_errors] +\n+\t\t\t\t priv-\u003estats[rx_long_frame_errors];\n+\tstorage-\u003erx_over_errors = priv-\u003estats[rx_fifo_full_dropped];\n+\tstorage-\u003erx_crc_errors = priv-\u003estats[rx_crc_errors];\n+\tstorage-\u003erx_frame_errors = priv-\u003estats[rx_align_errors];\n+\tstorage-\u003erx_missed_errors = priv-\u003estats[rx_fifo_full_dropped];\n+\n+\tstorage-\u003etx_aborted_errors = priv-\u003estats[tx_excess_collision];\n+\tstorage-\u003etx_fifo_errors = priv-\u003estats[tx_underrun];\n+\tstorage-\u003etx_window_errors = priv-\u003estats[tx_late_collision];\n+}\n+\n+static void adin1140_ndo_get_stats64(struct net_device *dev,\n+\t\t\t\t struct rtnl_link_stats64 *storage)\n+{\n+\tstruct adin1140_priv *priv = netdev_priv(dev);\n+\n+\tstorage-\u003erx_packets = priv-\u003enetdev-\u003estats.rx_packets;\n+\tstorage-\u003etx_packets = priv-\u003enetdev-\u003estats.tx_packets;\n+\n+\tstorage-\u003erx_bytes = priv-\u003enetdev-\u003estats.rx_bytes;\n+\tstorage-\u003etx_bytes = priv-\u003enetdev-\u003estats.tx_bytes;\n+\n+\tscoped_guard(spinlock, \u0026priv-\u003estat_lock)\n+\t\t__adin1140_ndo_get_stats64(priv, storage);\n+}\n+\n+static void adin1140_get_drvinfo(struct net_device *netdev,\n+\t\t\t\t struct ethtool_drvinfo *info)\n+{\n+\tstrscpy(info-\u003edriver, \"ADIN1140\", sizeof(info-\u003edriver));\n+\tstrscpy(info-\u003ebus_info, dev_name(netdev-\u003edev.parent),\n+\t\tsizeof(info-\u003ebus_info));\n+}\n+\n+static void adin1140_get_ethtool_stats(struct net_device *netdev,\n+\t\t\t\t struct ethtool_stats *stats, u64 *data)\n+{\n+\tstruct adin1140_priv *priv = netdev_priv(netdev);\n+\tu32 i;\n+\n+\tscoped_guard(spinlock, \u0026priv-\u003estat_lock) {\n+\t\tfor (i = 0; i \u003c ARRAY_SIZE(adin1140_stats); i++)\n+\t\t\tdata[i] = priv-\u003estats[adin1140_stats[i].idx];\n+\t}\n+}\n+\n+static void adin1140_get_ethtool_strings(struct net_device *netdev, u32 sset,\n+\t\t\t\t\t u8 *p)\n+{\n+\tu32 i;\n+\n+\tswitch (sset) {\n+\tcase ETH_SS_STATS:\n+\t\tfor (i = 0; i \u003c ARRAY_SIZE(adin1140_stats); i++)\n+\t\t\tethtool_puts(\u0026p, adin1140_stats[i].name);\n+\n+\t\tbreak;\n+\t}\n+}\n+\n+static int adin1140_get_sset_count(struct net_device *netdev, int sset)\n+{\n+\tswitch (sset) {\n+\tcase ETH_SS_STATS:\n+\t\treturn ARRAY_SIZE(adin1140_stats);\n+\tdefault:\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+}\n+\n+static void __adin1140_eth_mac_stats(struct adin1140_priv *priv,\n+\t\t\t\t struct ethtool_eth_mac_stats *mac_stats)\n+{\n+\tmac_stats-\u003eFramesReceivedOK = priv-\u003estats[rx_frames];\n+\tmac_stats-\u003eBroadcastFramesReceivedOK = priv-\u003estats[rx_bc_frames];\n+\tmac_stats-\u003eMulticastFramesReceivedOK = priv-\u003estats[rx_mc_frames];\n+\tmac_stats-\u003eFrameCheckSequenceErrors = priv-\u003estats[rx_crc_errors];\n+\tmac_stats-\u003eAlignmentErrors = priv-\u003estats[rx_align_errors];\n+\tmac_stats-\u003eFrameTooLongErrors = priv-\u003estats[rx_long_frame_errors];\n+\tmac_stats-\u003eFramesLostDueToIntMACRcvError =\n+\t\t\t\t\tpriv-\u003estats[rx_fifo_full_dropped];\n+\tmac_stats-\u003eFramesTransmittedOK = priv-\u003estats[tx_frames];\n+\tmac_stats-\u003eBroadcastFramesXmittedOK = priv-\u003estats[tx_bc_frames];\n+\tmac_stats-\u003eMulticastFramesXmittedOK = priv-\u003estats[tx_mc_frames];\n+\tmac_stats-\u003eSingleCollisionFrames = priv-\u003estats[tx_single_collision];\n+\tmac_stats-\u003eMultipleCollisionFrames = priv-\u003estats[tx_multi_collision];\n+\tmac_stats-\u003eFramesWithDeferredXmissions = priv-\u003estats[tx_deferred];\n+\tmac_stats-\u003eLateCollisions = priv-\u003estats[tx_late_collision];\n+\tmac_stats-\u003eFramesAbortedDueToXSColls =\n+\t\t\t\t\tpriv-\u003estats[tx_excess_collision];\n+\tmac_stats-\u003eFramesLostDueToIntMACXmitError = priv-\u003estats[tx_underrun];\n+}\n+\n+static void adin1140_get_eth_mac_stats(struct net_device *netdev,\n+\t\t\t\t struct ethtool_eth_mac_stats *mac_stats)\n+{\n+\tstruct adin1140_priv *priv = netdev_priv(netdev);\n+\n+\tscoped_guard(spinlock, \u0026priv-\u003estat_lock)\n+\t\t__adin1140_eth_mac_stats(priv, mac_stats);\n+}\n+\n+static int adin1140_mdiobus_read(struct mii_bus *bus, int addr, int regnum)\n+{\n+\t/* The ADIN1140's standard PHY C22 register map (OA TC6 0xFF00 -\n+\t * 0xFF1F), of which only 0xFF00 - 0xFF03 are implemented) cannot be\n+\t * accessed while frames are being received by the PHY. In case this\n+\t * happens the CONFIG0 and CONFIG2 register values will get corrupted,\n+\t * getting a random value. Both reads and writes cause the same\n+\t * behavior. This is a workaround that avoids MDIO accesses all\n+\t * together. Since this is a 10BASE-T1S PHY, only the loopback and\n+\t * reset (AN) bits in the control register (0x0) can be written.\n+\t * These functionalities have custom implementations in the PHY\n+\t * driver. C45 accesses do not cause this issue.\n+\t */\n+\n+\tswitch (regnum) {\n+\tcase MII_BMCR:\n+\t\treturn ADIN1140_PHY_CTRL_DEFAULT;\n+\tcase MII_BMSR:\n+\t\treturn ADIN1140_PHY_STATUS_DEFAULT;\n+\tcase MII_PHYSID1:\n+\t\treturn ADIN1140_PHY_ID1;\n+\tcase MII_PHYSID2:\n+\t\treturn ADIN1140_PHY_ID2;\n+\tdefault:\n+\t\treturn 0xFFFF;\n+\t}\n+}\n+\n+static int adin1140_mdiobus_write(struct mii_bus *bus, int addr, int regnum,\n+\t\t\t\t u16 val)\n+{\n+\treturn -EIO;\n+}\n+\n+static int adin1140_mdio_register(struct adin1140_priv *priv,\n+\t\t\t\t struct spi_device *spidev)\n+{\n+\tpriv-\u003emdiobus = devm_mdiobus_alloc(\u0026spidev-\u003edev);\n+\tif (!priv-\u003emdiobus)\n+\t\treturn dev_err_probe(\u0026spidev-\u003edev, -ENOMEM,\n+\t\t\t\t \"MDIO bus alloc failed\\n\");\n+\n+\tpriv-\u003emdiobus-\u003ename = \"adin1140-mdiobus\";\n+\tpriv-\u003emdiobus-\u003epriv = priv-\u003etc6;\n+\tpriv-\u003emdiobus-\u003eparent = \u0026spidev-\u003edev;\n+\tpriv-\u003emdiobus-\u003ephy_mask = GENMASK(31, 1);\n+\tpriv-\u003emdiobus-\u003eread = adin1140_mdiobus_read;\n+\tpriv-\u003emdiobus-\u003ewrite = adin1140_mdiobus_write;\n+\tpriv-\u003emdiobus-\u003eread_c45 = oa_tc6_mdiobus_read_c45;\n+\tpriv-\u003emdiobus-\u003ewrite_c45 = oa_tc6_mdiobus_write_c45;\n+\n+\tsnprintf(priv-\u003emdiobus-\u003eid, MII_BUS_ID_SIZE, \"adin1140-%s.%u\",\n+\t\t dev_name(\u0026spidev-\u003edev), spi_get_chipselect(spidev, 0));\n+\n+\treturn devm_mdiobus_register(\u0026spidev-\u003edev, priv-\u003emdiobus);\n+}\n+\n+static void adin1140_handle_link_change(struct net_device *netdev)\n+{\n+\tphy_print_status(netdev-\u003ephydev);\n+}\n+\n+static void adin1140_phy_remove(void *data)\n+{\n+\tphy_disconnect(data);\n+}\n+\n+static int adin1140_phy_init(struct adin1140_priv *priv,\n+\t\t\t struct spi_device *spidev)\n+{\n+\tint ret;\n+\n+\tret = adin1140_mdio_register(priv, spidev);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tpriv-\u003ephydev = phy_find_first(priv-\u003emdiobus);\n+\tif (!priv-\u003ephydev)\n+\t\treturn dev_err_probe(\u0026spidev-\u003edev, -ENODEV, \"No PHY found\\n\");\n+\n+\tpriv-\u003ephydev-\u003eis_internal = true;\n+\tret = phy_connect_direct(priv-\u003enetdev, priv-\u003ephydev,\n+\t\t\t\t \u0026adin1140_handle_link_change,\n+\t\t\t\t PHY_INTERFACE_MODE_INTERNAL);\n+\tif (ret)\n+\t\treturn dev_err_probe(\u0026spidev-\u003edev, ret,\n+\t\t\t\t \"Can't attach PHY to %s\\n\",\n+\t\t\t\t priv-\u003emdiobus-\u003eid);\n+\n+\tret = devm_add_action_or_reset(\u0026spidev-\u003edev, adin1140_phy_remove,\n+\t\t\t\t priv-\u003ephydev);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tphy_attached_info(priv-\u003ephydev);\n+\n+\treturn 0;\n+}\n+\n+static const struct ethtool_ops adin1140_ethtool_ops = {\n+\t.get_drvinfo = adin1140_get_drvinfo,\n+\t.get_link = ethtool_op_get_link,\n+\t.get_ethtool_stats = adin1140_get_ethtool_stats,\n+\t.get_sset_count = adin1140_get_sset_count,\n+\t.get_strings = adin1140_get_ethtool_strings,\n+\t.get_link_ksettings = phy_ethtool_get_link_ksettings,\n+\t.set_link_ksettings = phy_ethtool_set_link_ksettings,\n+\t.get_eth_mac_stats = adin1140_get_eth_mac_stats,\n+};\n+\n+static const struct net_device_ops adin1140_netdev_ops = {\n+\t.ndo_open = adin1140_open,\n+\t.ndo_stop = adin1140_close,\n+\t.ndo_start_xmit\t= adin1140_start_xmit,\n+\t.ndo_set_mac_address = adin1140_set_mac_address,\n+\t.ndo_validate_addr = eth_validate_addr,\n+\t.ndo_set_rx_mode_async = adin1140_rx_mode,\n+\t.ndo_eth_ioctl = phy_do_ioctl_running,\n+\t.ndo_get_stats64 = adin1140_ndo_get_stats64,\n+};\n+\n+static void adin1140_oa_tc6_remove(void *data)\n+{\n+\toa_tc6_exit(data);\n+}\n+\n+static int adin1140_probe(struct spi_device *spi)\n+{\n+\tstruct oa_tc6_quirks tc6_quirks = {};\n+\tstruct net_device *netdev;\n+\tstruct adin1140_priv *priv;\n+\tint ret;\n+\n+\tnetdev = devm_alloc_etherdev(\u0026spi-\u003edev, sizeof(struct adin1140_priv));\n+\tif (!netdev)\n+\t\treturn -ENOMEM;\n+\n+\tpriv = netdev_priv(netdev);\n+\tpriv-\u003enetdev = netdev;\n+\tspi_set_drvdata(spi, priv);\n+\tspin_lock_init(\u0026priv-\u003estat_lock);\n+\n+\ttc6_quirks.quirk_flags = OA_TC6_BROKEN_PHY;\n+\n+\tpriv-\u003etc6 = oa_tc6_init(spi, netdev, \u0026tc6_quirks);\n+\tif (!priv-\u003etc6)\n+\t\treturn -ENODEV;\n+\n+\tret = devm_add_action_or_reset(\u0026spi-\u003edev, adin1140_oa_tc6_remove,\n+\t\t\t\t priv-\u003etc6);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = adin1140_phy_init(priv, spi);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (device_get_ethdev_address(\u0026spi-\u003edev, netdev))\n+\t\teth_hw_addr_random(netdev);\n+\n+\tret = adin1140_configure(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tINIT_DELAYED_WORK(\u0026priv-\u003estats_work, adin1140_stats_work);\n+\n+\tnetdev-\u003eif_port = IF_PORT_10BASET;\n+\tnetdev-\u003eirq = spi-\u003eirq;\n+\tnetdev-\u003enetdev_ops = \u0026adin1140_netdev_ops;\n+\tnetdev-\u003eethtool_ops = \u0026adin1140_ethtool_ops;\n+\tnetdev-\u003enetns_immutable = true;\n+\tnetdev-\u003epriv_flags |= IFF_LIVE_ADDR_CHANGE |\n+\t\t\t IFF_UNICAST_FLT;\n+\n+\tret = devm_register_netdev(\u0026spi-\u003edev, netdev);\n+\tif (ret)\n+\t\treturn dev_err_probe(\u0026spi-\u003edev, ret,\n+\t\t\t\t \"Failed to register netdev\");\n+\n+\treturn 0;\n+}\n+\n+static const struct spi_device_id adin1140_spi_id[] = {\n+\t{ .name = \"ad3306\" },\n+\t{ .name = \"adin1140\" },\n+\t{},\n+};\n+MODULE_DEVICE_TABLE(spi, adin1140_spi_id);\n+\n+static const struct of_device_id adin1140_match_table[] = {\n+\t{ .compatible = \"adi,ad3306\" },\n+\t{ .compatible = \"adi,adin1140\" },\n+\t{ }\n+};\n+MODULE_DEVICE_TABLE(of, adin1140_match_table);\n+\n+static struct spi_driver adin1140_driver = {\n+\t.driver = {\n+\t\t.name = \"adin1140\",\n+\t\t.of_match_table = adin1140_match_table,\n+\t },\n+\t.probe = adin1140_probe,\n+\t.id_table = adin1140_spi_id,\n+};\n+module_spi_driver(adin1140_driver);\n+\n+MODULE_DESCRIPTION(\"Analog Devices, Inc. ADIN1140 10BASE-T1S MAC-PHY\");\n+MODULE_AUTHOR(\"Ciprian Regus \u003cciprian.regus@analog.com\u003e\");\n+MODULE_LICENSE(\"GPL\");\ndiff --git a/drivers/net/ethernet/microchip/lan865x/lan865x.c b/drivers/net/ethernet/microchip/lan865x/lan865x.c\nindex 0277d9737369ad..26a2761332a5a1 100644\n--- a/drivers/net/ethernet/microchip/lan865x/lan865x.c\n+++ b/drivers/net/ethernet/microchip/lan865x/lan865x.c\n@@ -346,7 +346,7 @@ static int lan865x_probe(struct spi_device *spi)\n \tspi_set_drvdata(spi, priv);\n \tINIT_WORK(\u0026priv-\u003emulticast_work, lan865x_multicast_work_handler);\n \n-\tpriv-\u003etc6 = oa_tc6_init(spi, netdev);\n+\tpriv-\u003etc6 = oa_tc6_init(spi, netdev, NULL);\n \tif (!priv-\u003etc6) {\n \t\tret = -ENODEV;\n \t\tgoto free_netdev;\ndiff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c\nindex 0727d53345a33b..417c15d1ff4233 100644\n--- a/drivers/net/ethernet/oa_tc6.c\n+++ b/drivers/net/ethernet/oa_tc6.c\n@@ -12,46 +12,6 @@\n #include \u003clinux/phy.h\u003e\n #include \u003clinux/oa_tc6.h\u003e\n \n-/* OPEN Alliance TC6 registers */\n-/* Standard Capabilities Register */\n-#define OA_TC6_REG_STDCAP\t\t\t0x0002\n-#define STDCAP_DIRECT_PHY_REG_ACCESS\t\tBIT(8)\n-\n-/* Reset Control and Status Register */\n-#define OA_TC6_REG_RESET\t\t\t0x0003\n-#define RESET_SWRESET\t\t\t\tBIT(0)\t/* Software Reset */\n-\n-/* Configuration Register #0 */\n-#define OA_TC6_REG_CONFIG0\t\t\t0x0004\n-#define CONFIG0_SYNC\t\t\t\tBIT(15)\n-#define CONFIG0_ZARFE_ENABLE\t\t\tBIT(12)\n-\n-/* Status Register #0 */\n-#define OA_TC6_REG_STATUS0\t\t\t0x0008\n-#define STATUS0_RESETC\t\t\t\tBIT(6)\t/* Reset Complete */\n-#define STATUS0_HEADER_ERROR\t\t\tBIT(5)\n-#define STATUS0_LOSS_OF_FRAME_ERROR\t\tBIT(4)\n-#define STATUS0_RX_BUFFER_OVERFLOW_ERROR\tBIT(3)\n-#define STATUS0_TX_PROTOCOL_ERROR\t\tBIT(0)\n-\n-/* Buffer Status Register */\n-#define OA_TC6_REG_BUFFER_STATUS\t\t0x000B\n-#define BUFFER_STATUS_TX_CREDITS_AVAILABLE\tGENMASK(15, 8)\n-#define BUFFER_STATUS_RX_CHUNKS_AVAILABLE\tGENMASK(7, 0)\n-\n-/* Interrupt Mask Register #0 */\n-#define OA_TC6_REG_INT_MASK0\t\t\t0x000C\n-#define INT_MASK0_HEADER_ERR_MASK\t\tBIT(5)\n-#define INT_MASK0_LOSS_OF_FRAME_ERR_MASK\tBIT(4)\n-#define INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK\tBIT(3)\n-#define INT_MASK0_TX_PROTOCOL_ERR_MASK\t\tBIT(0)\n-#define INT_MASK0_ALL_INTERRUPTS (GENMASK(5, 0) | \\\n-\t\t\t\t\t\t GENMASK(12, 7))\n-\n-/* PHY Clause 22 registers base address and mask */\n-#define OA_TC6_PHY_STD_REG_ADDR_BASE\t\t0xFF00\n-#define OA_TC6_PHY_STD_REG_ADDR_MASK\t\t0x1F\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@@ -81,23 +41,17 @@\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-/* PHY – Clause 45 registers memory map selector (MMS) as per table 6 in the\n- * OPEN Alliance specification.\n- */\n-#define OA_TC6_PHY_C45_PCS_MMS2\t\t\t2\t/* MMD 3 */\n-#define OA_TC6_PHY_C45_PMA_PMD_MMS3\t\t3\t/* MMD 1 */\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-\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\t(OA_TC6_CTRL_HEADER_SIZE +\\\n-\t\t\t\t\t\t(OA_TC6_CTRL_MAX_REGISTERS *\\\n-\t\t\t\t\t\tOA_TC6_CTRL_REG_VALUE_SIZE) +\\\n-\t\t\t\t\t\tOA_TC6_CTRL_IGNORED_SIZE)\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@@ -108,6 +62,8 @@\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@@ -130,6 +86,8 @@ struct oa_tc6 {\n \tbool rx_buf_overflow;\n \tbool int_flag;\n \tbool disable_traffic;\n+\tbool prot_ctrl;\n+\tenum oa_tc6_quirk_flag quirk_flags;\n };\n \n enum oa_tc6_header_type {\n@@ -213,25 +171,36 @@ static void oa_tc6_update_ctrl_write_data(struct oa_tc6 *tc6, u32 value[],\n {\n \t__be32 *tx_buf = tc6-\u003espi_ctrl_tx_buf + OA_TC6_CTRL_HEADER_SIZE;\n \n-\tfor (int i = 0; i \u003c length; i++)\n+\tfor (int i = 0; i \u003c length; i++) {\n \t\t*tx_buf++ = cpu_to_be32(value[i]);\n+\t\tif (tc6-\u003eprot_ctrl)\n+\t\t\t*tx_buf++ = cpu_to_be32(~value[i]);\n+\t}\n }\n \n-static u16 oa_tc6_calculate_ctrl_buf_size(u8 length)\n+static u16 oa_tc6_calculate_ctrl_buf_size(u8 length, bool ctrl_prot)\n {\n+\tu32 reply_size = OA_TC6_CTRL_REG_VALUE_SIZE;\n+\n+\tif (ctrl_prot)\n+\t\treply_size += OA_TC6_CTRL_PROT_REPLY_SIZE;\n+\n \t/* Control command consists 4 bytes header + 4 bytes register value for\n-\t * each register + 4 bytes ignored value.\n+\t * each register (+ 4 bytes for the register value complement in case\n+\t * protected mode is used) + 4 bytes ignored value.\n \t */\n-\treturn OA_TC6_CTRL_HEADER_SIZE + OA_TC6_CTRL_REG_VALUE_SIZE * length +\n+\treturn OA_TC6_CTRL_HEADER_SIZE + reply_size * length +\n \t OA_TC6_CTRL_IGNORED_SIZE;\n }\n \n static void oa_tc6_prepare_ctrl_spi_buf(struct oa_tc6 *tc6, u32 address,\n \t\t\t\t\tu32 value[], u8 length,\n-\t\t\t\t\tenum oa_tc6_register_op reg_op)\n+\t\t\t\t\tenum oa_tc6_register_op reg_op,\n+\t\t\t\t\tu16 buf_size)\n {\n \t__be32 *tx_buf = tc6-\u003espi_ctrl_tx_buf;\n \n+\tmemset(tx_buf, 0, buf_size);\n \t*tx_buf = oa_tc6_prepare_ctrl_header(address, length, reg_op);\n \n \tif (reg_op == OA_TC6_CTRL_REG_WRITE)\n@@ -254,10 +223,12 @@ static int oa_tc6_check_ctrl_write_reply(struct oa_tc6 *tc6, u8 size)\n \treturn 0;\n }\n \n-static int oa_tc6_check_ctrl_read_reply(struct oa_tc6 *tc6, u8 size)\n+static int oa_tc6_check_ctrl_read_reply(struct oa_tc6 *tc6, u8 length)\n {\n-\tu32 *rx_buf = tc6-\u003espi_ctrl_rx_buf + OA_TC6_CTRL_IGNORED_SIZE;\n-\tu32 *tx_buf = tc6-\u003espi_ctrl_tx_buf;\n+\t__be32 *rx_buf = tc6-\u003espi_ctrl_rx_buf + OA_TC6_CTRL_IGNORED_SIZE;\n+\t__be32 *tx_buf = tc6-\u003espi_ctrl_tx_buf;\n+\tu32 complement;\n+\tu32 reply;\n \n \t/* The echoed control read header must match with the one that was\n \t * transmitted.\n@@ -265,6 +236,20 @@ static int oa_tc6_check_ctrl_read_reply(struct oa_tc6 *tc6, u8 size)\n \tif (*tx_buf != *rx_buf)\n \t\treturn -EPROTO;\n \n+\tif (tc6-\u003eprot_ctrl) {\n+\t\t/* Skip past the echoed header to the value/complement pairs */\n+\t\trx_buf += 1;\n+\t\tfor (int i = 0; i \u003c length; i++) {\n+\t\t\treply = be32_to_cpu(rx_buf[0]);\n+\t\t\tcomplement = be32_to_cpu(rx_buf[1]);\n+\n+\t\t\tif (complement != ~reply)\n+\t\t\t\treturn -EPROTO;\n+\n+\t\t\trx_buf += 2;\n+\t\t}\n+\t}\n+\n \treturn 0;\n }\n \n@@ -274,8 +259,13 @@ static void oa_tc6_copy_ctrl_read_data(struct oa_tc6 *tc6, u32 value[],\n \t__be32 *rx_buf = tc6-\u003espi_ctrl_rx_buf + OA_TC6_CTRL_IGNORED_SIZE +\n \t\t\t OA_TC6_CTRL_HEADER_SIZE;\n \n-\tfor (int i = 0; i \u003c length; i++)\n+\tfor (int i = 0; i \u003c length; i++) {\n \t\tvalue[i] = be32_to_cpu(*rx_buf++);\n+\n+\t\t/* skip complement word */\n+\t\tif (tc6-\u003eprot_ctrl)\n+\t\t\trx_buf++;\n+\t}\n }\n \n static int oa_tc6_perform_ctrl(struct oa_tc6 *tc6, u32 address, u32 value[],\n@@ -284,10 +274,10 @@ static int oa_tc6_perform_ctrl(struct oa_tc6 *tc6, u32 address, u32 value[],\n \tu16 size;\n \tint ret;\n \n-\t/* Prepare control command and copy to SPI control buffer */\n-\toa_tc6_prepare_ctrl_spi_buf(tc6, address, value, length, reg_op);\n+\tsize = oa_tc6_calculate_ctrl_buf_size(length, tc6-\u003eprot_ctrl);\n \n-\tsize = oa_tc6_calculate_ctrl_buf_size(length);\n+\t/* Prepare control command and copy to SPI control buffer */\n+\toa_tc6_prepare_ctrl_spi_buf(tc6, address, value, length, reg_op, size);\n \n \t/* Perform SPI transfer */\n \tret = oa_tc6_spi_transfer(tc6, OA_TC6_CTRL_HEADER, size);\n@@ -302,7 +292,7 @@ static int oa_tc6_perform_ctrl(struct oa_tc6 *tc6, u32 address, u32 value[],\n \t\treturn oa_tc6_check_ctrl_write_reply(tc6, size);\n \n \t/* Check echoed/received control read command reply for errors */\n-\tret = oa_tc6_check_ctrl_read_reply(tc6, size);\n+\tret = oa_tc6_check_ctrl_read_reply(tc6, length);\n \tif (ret)\n \t\treturn ret;\n \n@@ -355,6 +345,27 @@ int oa_tc6_read_register(struct oa_tc6 *tc6, u32 address, u32 *value)\n }\n EXPORT_SYMBOL_GPL(oa_tc6_read_register);\n \n+/**\n+ * oa_tc6_read_register_mms - function for reading a MAC-PHY register in a\n+ * specified memory map.\n+ * @tc6: oa_tc6 struct.\n+ * @mms: Memory map selector for the register.\n+ * @address: register address of the MAC-PHY to be read.\n+ * @value: value read from the @address register address of the MAC-PHY.\n+ *\n+ * Return: 0 on success or a negative error code on failure.\n+ */\n+int oa_tc6_read_register_mms(struct oa_tc6 *tc6, u8 mms, u16 address,\n+\t\t\t u32 *value)\n+{\n+\tu32 mms_reg;\n+\n+\tmms_reg = FIELD_PREP(OA_TC6_REG_MMS_MASK, mms) | address;\n+\n+\treturn oa_tc6_read_registers(tc6, mms_reg, value, 1);\n+}\n+EXPORT_SYMBOL_GPL(oa_tc6_read_register_mms);\n+\n /**\n * oa_tc6_write_registers - function for writing multiple consecutive registers.\n * @tc6: oa_tc6 struct.\n@@ -399,6 +410,27 @@ int oa_tc6_write_register(struct oa_tc6 *tc6, u32 address, u32 value)\n }\n EXPORT_SYMBOL_GPL(oa_tc6_write_register);\n \n+/**\n+ * oa_tc6_write_register_mms - function for writing a MAC-PHY register in a\n+ * specified memory map.\n+ * @tc6: oa_tc6 struct.\n+ * @mms: Memory map selector for the register.\n+ * @address: register address of the MAC-PHY to be written.\n+ * @value: value to be written in the @address register address of the MAC-PHY.\n+ *\n+ * Return: 0 on success or a negative error code on failure.\n+ */\n+int oa_tc6_write_register_mms(struct oa_tc6 *tc6, u8 mms, u16 address,\n+\t\t\t u32 value)\n+{\n+\tu32 mms_reg;\n+\n+\tmms_reg = FIELD_PREP(OA_TC6_REG_MMS_MASK, mms) | address;\n+\n+\treturn oa_tc6_write_registers(tc6, mms_reg, \u0026value, 1);\n+}\n+EXPORT_SYMBOL_GPL(oa_tc6_write_register_mms);\n+\n static int oa_tc6_check_phy_reg_direct_access_capability(struct oa_tc6 *tc6)\n {\n \tu32 regval;\n@@ -408,7 +440,7 @@ static int oa_tc6_check_phy_reg_direct_access_capability(struct oa_tc6 *tc6)\n \tif (ret)\n \t\treturn ret;\n \n-\tif (!(regval \u0026 STDCAP_DIRECT_PHY_REG_ACCESS))\n+\tif (!(regval \u0026 OA_TC6_STDCAP_DIRECT_PHY_REG_ACCESS))\n \t\treturn -ENODEV;\n \n \treturn 0;\n@@ -462,36 +494,39 @@ static int oa_tc6_get_phy_c45_mms(int devnum)\n \t}\n }\n \n-static int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int devnum,\n-\t\t\t\t int regnum)\n+int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int devnum,\n+\t\t\t int regnum)\n {\n \tstruct oa_tc6 *tc6 = bus-\u003epriv;\n \tu32 regval;\n+\tint mms;\n \tint ret;\n \n-\tret = oa_tc6_get_phy_c45_mms(devnum);\n-\tif (ret \u003c 0)\n-\t\treturn ret;\n+\tmms = oa_tc6_get_phy_c45_mms(devnum);\n+\tif (mms \u003c 0)\n+\t\treturn mms;\n \n-\tret = oa_tc6_read_register(tc6, (ret \u003c\u003c 16) | regnum, \u0026regval);\n+\tret = oa_tc6_read_register_mms(tc6, mms, regnum, \u0026regval);\n \tif (ret)\n \t\treturn ret;\n \n \treturn regval;\n }\n+EXPORT_SYMBOL_GPL(oa_tc6_mdiobus_read_c45);\n \n-static int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int devnum,\n-\t\t\t\t int regnum, u16 val)\n+int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int devnum,\n+\t\t\t int regnum, u16 val)\n {\n \tstruct oa_tc6 *tc6 = bus-\u003epriv;\n-\tint ret;\n+\tint mms;\n \n-\tret = oa_tc6_get_phy_c45_mms(devnum);\n-\tif (ret \u003c 0)\n-\t\treturn ret;\n+\tmms = oa_tc6_get_phy_c45_mms(devnum);\n+\tif (mms \u003c 0)\n+\t\treturn mms;\n \n-\treturn oa_tc6_write_register(tc6, (ret \u003c\u003c 16) | regnum, val);\n+\treturn oa_tc6_write_register_mms(tc6, mms, regnum, val);\n }\n+EXPORT_SYMBOL_GPL(oa_tc6_mdiobus_write_c45);\n \n static int oa_tc6_mdiobus_register(struct oa_tc6 *tc6)\n {\n@@ -544,6 +579,9 @@ static int oa_tc6_phy_init(struct oa_tc6 *tc6)\n {\n \tint ret;\n \n+\tif (tc6-\u003equirk_flags \u0026 OA_TC6_BROKEN_PHY)\n+\t\treturn 0;\n+\n \tret = oa_tc6_check_phy_reg_direct_access_capability(tc6);\n \tif (ret) {\n \t\tnetdev_err(tc6-\u003enetdev,\n@@ -580,6 +618,9 @@ static int oa_tc6_phy_init(struct oa_tc6 *tc6)\n \n static void oa_tc6_phy_exit(struct oa_tc6 *tc6)\n {\n+\tif (tc6-\u003equirk_flags \u0026 OA_TC6_BROKEN_PHY)\n+\t\treturn;\n+\n \tphy_disconnect(tc6-\u003ephydev);\n \toa_tc6_mdiobus_unregister(tc6);\n }\n@@ -601,7 +642,7 @@ static int oa_tc6_read_status0(struct oa_tc6 *tc6)\n \n static int oa_tc6_sw_reset_macphy(struct oa_tc6 *tc6)\n {\n-\tu32 regval = RESET_SWRESET;\n+\tu32 regval = OA_TC6_RESET_SWRESET;\n \tint ret;\n \n \tret = oa_tc6_write_register(tc6, OA_TC6_REG_RESET, regval);\n@@ -610,7 +651,7 @@ static int oa_tc6_sw_reset_macphy(struct oa_tc6 *tc6)\n \n \t/* Poll for soft reset complete for every 1ms until 1s timeout */\n \tret = readx_poll_timeout(oa_tc6_read_status0, tc6, regval,\n-\t\t\t\t regval \u0026 STATUS0_RESETC,\n+\t\t\t\t regval \u0026 OA_TC6_STATUS0_RESETC,\n \t\t\t\t STATUS0_RESETC_POLL_DELAY,\n \t\t\t\t STATUS0_RESETC_POLL_TIMEOUT);\n \tif (ret)\n@@ -629,10 +670,10 @@ static int oa_tc6_unmask_macphy_error_interrupts(struct oa_tc6 *tc6)\n \tif (ret)\n \t\treturn ret;\n \n-\tregval \u0026= ~(INT_MASK0_TX_PROTOCOL_ERR_MASK |\n-\t\t INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK |\n-\t\t INT_MASK0_LOSS_OF_FRAME_ERR_MASK |\n-\t\t INT_MASK0_HEADER_ERR_MASK);\n+\tregval \u0026= ~(OA_TC6_INT_MASK0_TX_PROTOCOL_ERR_MASK |\n+\t\t OA_TC6_INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK |\n+\t\t OA_TC6_INT_MASK0_LOSS_OF_FRAME_ERR_MASK |\n+\t\t OA_TC6_INT_MASK0_HEADER_ERR_MASK);\n \n \treturn oa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, regval);\n }\n@@ -647,7 +688,7 @@ static int oa_tc6_enable_data_transfer(struct oa_tc6 *tc6)\n \t\treturn ret;\n \n \t/* Enable configuration synchronization for data transfer */\n-\tvalue |= CONFIG0_SYNC;\n+\tvalue |= OA_TC6_CONFIG0_SYNC;\n \n \treturn oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, value);\n }\n@@ -692,7 +733,7 @@ static void oa_tc6_free_pending_skbs(struct oa_tc6 *tc6)\n */\n static void oa_tc6_disable_traffic(struct oa_tc6 *tc6)\n {\n-\tu32 regval = INT_MASK0_ALL_INTERRUPTS;\n+\tu32 regval = OA_TC6_INT_MASK0_ALL_INTERRUPTS;\n \n \ttc6-\u003edisable_traffic = true;\n \toa_tc6_free_pending_skbs(tc6);\n@@ -722,25 +763,25 @@ static int oa_tc6_process_extended_status(struct oa_tc6 *tc6)\n \t\treturn ret;\n \t}\n \n-\tif (FIELD_GET(STATUS0_RX_BUFFER_OVERFLOW_ERROR, value)) {\n+\tif (FIELD_GET(OA_TC6_STATUS0_RX_BUFFER_OVERFLOW_ERROR, value)) {\n \t\ttc6-\u003erx_buf_overflow = true;\n \t\toa_tc6_cleanup_ongoing_rx_skb(tc6);\n \t\tnet_err_ratelimited(\"%s: Receive buffer overflow error\\n\",\n \t\t\t\t tc6-\u003enetdev-\u003ename);\n \t\treturn -EAGAIN;\n \t}\n-\tif (FIELD_GET(STATUS0_TX_PROTOCOL_ERROR, value)) {\n+\tif (FIELD_GET(OA_TC6_STATUS0_TX_PROTOCOL_ERROR, value)) {\n \t\tnetdev_err(tc6-\u003enetdev, \"Transmit protocol error\\n\");\n \t\treturn -ENODEV;\n \t}\n \t/* TODO: Currently loss of frame and header errors are treated as\n \t * non-recoverable errors. They will be handled in the next version.\n \t */\n-\tif (FIELD_GET(STATUS0_LOSS_OF_FRAME_ERROR, value)) {\n+\tif (FIELD_GET(OA_TC6_STATUS0_LOSS_OF_FRAME_ERROR, value)) {\n \t\tnetdev_err(tc6-\u003enetdev, \"Loss of frame error\\n\");\n \t\treturn -ENODEV;\n \t}\n-\tif (FIELD_GET(STATUS0_HEADER_ERROR, value)) {\n+\tif (FIELD_GET(OA_TC6_STATUS0_HEADER_ERROR, value)) {\n \t\tnetdev_err(tc6-\u003enetdev, \"Header error\\n\");\n \t\treturn -ENODEV;\n \t}\n@@ -1187,9 +1228,10 @@ static int oa_tc6_update_buffer_status_from_register(struct oa_tc6 *tc6)\n \tif (ret)\n \t\treturn ret;\n \n-\ttc6-\u003etx_credits = FIELD_GET(BUFFER_STATUS_TX_CREDITS_AVAILABLE, value);\n-\ttc6-\u003erx_chunks_available = FIELD_GET(BUFFER_STATUS_RX_CHUNKS_AVAILABLE,\n-\t\t\t\t\t value);\n+\ttc6-\u003etx_credits = FIELD_GET(OA_TC6_BUFFER_STATUS_TX_CREDITS_AVAILABLE,\n+\t\t\t\t value);\n+\ttc6-\u003erx_chunks_available =\n+\t\tFIELD_GET(OA_TC6_BUFFER_STATUS_RX_CHUNKS_AVAILABLE, value);\n \n \treturn 0;\n }\n@@ -1233,7 +1275,7 @@ int oa_tc6_zero_align_receive_frame_enable(struct oa_tc6 *tc6)\n \t\treturn ret;\n \n \t/* Set Zero-Align Receive Frame Enable */\n-\tregval |= CONFIG0_ZARFE_ENABLE;\n+\tregval |= OA_TC6_CONFIG0_ZARFE_ENABLE;\n \n \treturn oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, regval);\n }\n@@ -1272,15 +1314,31 @@ netdev_tx_t oa_tc6_start_xmit(struct oa_tc6 *tc6, struct sk_buff *skb)\n }\n EXPORT_SYMBOL_GPL(oa_tc6_start_xmit);\n \n+static int oa_tc6_check_ctrl_protection(struct oa_tc6 *tc6)\n+{\n+\tu32 regval;\n+\tint ret;\n+\n+\tret = oa_tc6_read_register(tc6, OA_TC6_REG_CONFIG0, \u0026regval);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\ttc6-\u003eprot_ctrl = FIELD_GET(OA_TC6_CONFIG0_PROTE, regval);\n+\n+\treturn 0;\n+}\n+\n /**\n * oa_tc6_init - allocates and initializes oa_tc6 structure.\n * @spi: device with which data will be exchanged.\n * @netdev: network device interface structure.\n+ * @quirks: device specific modifiers for the OA TC6 protocol.\n *\n * Return: pointer reference to the oa_tc6 structure if the MAC-PHY\n * initialization is successful otherwise NULL.\n */\n-struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)\n+struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,\n+\t\t\t struct oa_tc6_quirks *quirks)\n {\n \tstruct oa_tc6 *tc6;\n \tint ret;\n@@ -1295,6 +1353,9 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)\n \tmutex_init(\u0026tc6-\u003espi_ctrl_lock);\n \tspin_lock_init(\u0026tc6-\u003etx_skb_lock);\n \n+\tif (quirks)\n+\t\ttc6-\u003equirk_flags = quirks-\u003equirk_flags;\n+\n \t/* Set the SPI controller to pump at realtime priority */\n \ttc6-\u003espi-\u003ert = true;\n \tif (spi_setup(tc6-\u003espi) \u003c 0)\n@@ -1324,6 +1385,14 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)\n \tif (!tc6-\u003espi_data_rx_buf)\n \t\treturn NULL;\n \n+\t/* Check the PROTE bit status so that we can reset the device */\n+\tret = oa_tc6_check_ctrl_protection(tc6);\n+\tif (ret) {\n+\t\tdev_err(\u0026tc6-\u003espi-\u003edev,\n+\t\t\t\"Failed to check the protection mode: %d\\n\", ret);\n+\t\treturn NULL;\n+\t}\n+\n \tret = oa_tc6_sw_reset_macphy(tc6);\n \tif (ret) {\n \t\tdev_err(\u0026tc6-\u003espi-\u003edev,\ndiff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig\nindex 099f25dceabbc7..a29d3fed8a053c 100644\n--- a/drivers/net/phy/Kconfig\n+++ b/drivers/net/phy/Kconfig\n@@ -136,6 +136,12 @@ config ADIN1100_PHY\n \t Currently supports the:\n \t - ADIN1100 - Robust,Industrial, Low Power 10BASE-T1L Ethernet PHY\n \n+config ADIN1140_PHY\n+\ttristate \"Analog Devices ADIN1140 10BASE-T1S PHY\"\n+\thelp\n+\t Adds support for the Analog Devices, Inc. ADIN1140's internal\n+\t 10BASE-T1S PHY.\n+\n config AMCC_QT2025_PHY\n \ttristate \"AMCC QT2025 PHY\"\n \tdepends on RUST_PHYLIB_ABSTRACTIONS\ndiff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile\nindex de660ae949453d..e23df5e836e9ea 100644\n--- a/drivers/net/phy/Makefile\n+++ b/drivers/net/phy/Makefile\n@@ -29,6 +29,7 @@ obj-y\t\t\t\t+= $(sfp-obj-y) $(sfp-obj-m)\n \n obj-$(CONFIG_ADIN_PHY)\t\t+= adin.o\n obj-$(CONFIG_ADIN1100_PHY)\t+= adin1100.o\n+obj-$(CONFIG_ADIN1140_PHY)\t+= adin1140-phy.o\n obj-$(CONFIG_AIR_AN8801_PHY)\t+= air_an8801.o\n obj-$(CONFIG_AIR_EN8811H_PHY) += air_en8811h.o\n obj-$(CONFIG_AIR_NET_PHYLIB)\t+= air_phy_lib.o\ndiff --git a/drivers/net/phy/adin1140-phy.c b/drivers/net/phy/adin1140-phy.c\nnew file mode 100644\nindex 00000000000000..d35da4ad680daa\n--- /dev/null\n+++ b/drivers/net/phy/adin1140-phy.c\n@@ -0,0 +1,72 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * Driver for Analog Devices, Inc. ADIN1140 10BASE-T1S PHY\n+ *\n+ * Copyright 2026 Analog Devices Inc.\n+ */\n+\n+#include \u003clinux/kernel.h\u003e\n+#include \u003clinux/module.h\u003e\n+#include \u003clinux/phy.h\u003e\n+\n+#define ADIN1140_PHY_ID\t\t0x0283be00\n+\n+#define ADIN1140_PCS_CTRL\t\t0x08f3\n+#define ADIN1140_PCS_CTRL_LOOPBACK\tBIT(14)\n+\n+static int adin1140_config_aneg(struct phy_device *phydev)\n+{\n+\t/* phylib tries to clear BIT(12) in MDIO_CTRL1, since AN is disabled.\n+\t * However, on the ADIN1140, that field is non-standard, being used\n+\t * to control the reset status of the PHY (thus it needs to remain set).\n+\t */\n+\treturn 0;\n+}\n+\n+static int adin1140_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_mmd(phydev, MDIO_MMD_PCS, ADIN1140_PCS_CTRL,\n+\t\t\t ADIN1140_PCS_CTRL_LOOPBACK,\n+\t\t\t enable ? ADIN1140_PCS_CTRL_LOOPBACK : 0);\n+}\n+\n+static int adin1140_read_status(struct phy_device *phydev)\n+{\n+\tphydev-\u003elink = 1;\n+\tphydev-\u003eduplex = DUPLEX_HALF;\n+\tphydev-\u003espeed = SPEED_10;\n+\tphydev-\u003eautoneg = AUTONEG_DISABLE;\n+\n+\treturn 0;\n+}\n+\n+static struct phy_driver adin1140_driver[] = {\n+\t{\n+\t\tPHY_ID_MATCH_EXACT(ADIN1140_PHY_ID),\n+\t\t.name = \"ADIN1140_PHY\",\n+\t\t.features = PHY_BASIC_T1S_P2MP_FEATURES,\n+\t\t.read_status = adin1140_read_status,\n+\t\t.config_aneg = adin1140_config_aneg,\n+\t\t.set_loopback = adin1140_loopback,\n+\t\t.read_mmd = genphy_read_mmd_c45,\n+\t\t.write_mmd = genphy_write_mmd_c45,\n+\t\t.get_plca_cfg = genphy_c45_plca_get_cfg,\n+\t\t.set_plca_cfg = genphy_c45_plca_set_cfg,\n+\t\t.get_plca_status = genphy_c45_plca_get_status,\n+\t},\n+};\n+module_phy_driver(adin1140_driver);\n+\n+static const struct mdio_device_id __maybe_unused adin1140_tbl[] = {\n+\t{ PHY_ID_MATCH_EXACT(ADIN1140_PHY_ID) },\n+\t{ }\n+};\n+\n+MODULE_DEVICE_TABLE(mdio, adin1140_tbl);\n+\n+MODULE_DESCRIPTION(\"Analog Devices, Inc. ADIN1140 10BASE-T1S PHY\");\n+MODULE_AUTHOR(\"Ciprian Regus \u003cciprian.regus@analog.com\u003e\");\n+MODULE_LICENSE(\"GPL\");\ndiff --git a/drivers/net/phy/microchip_t1s.c b/drivers/net/phy/microchip_t1s.c\nindex e601d56b2507f9..73c23d311d72aa 100644\n--- a/drivers/net/phy/microchip_t1s.c\n+++ b/drivers/net/phy/microchip_t1s.c\n@@ -506,34 +506,6 @@ static int lan86xx_read_status(struct phy_device *phydev)\n \treturn 0;\n }\n \n-/* OPEN Alliance 10BASE-T1x compliance MAC-PHYs will have both C22 and\n- * C45 registers space. If the PHY is discovered via C22 bus protocol it assumes\n- * it uses C22 protocol and always uses C22 registers indirect access to access\n- * C45 registers. This is because, we don't have a clean separation between\n- * C22/C45 register space and C22/C45 MDIO bus protocols. Resulting, PHY C45\n- * registers direct access can't be used which can save multiple SPI bus access.\n- * To support this feature, set .read_mmd/.write_mmd in the PHY driver to call\n- * .read_c45/.write_c45 in the OPEN Alliance framework\n- * drivers/net/ethernet/oa_tc6.c\n- */\n-static int lan865x_phy_read_mmd(struct phy_device *phydev, int devnum,\n-\t\t\t\tu16 regnum)\n-{\n-\tstruct mii_bus *bus = phydev-\u003emdio.bus;\n-\tint addr = phydev-\u003emdio.addr;\n-\n-\treturn __mdiobus_c45_read(bus, addr, devnum, regnum);\n-}\n-\n-static int lan865x_phy_write_mmd(struct phy_device *phydev, int devnum,\n-\t\t\t\t u16 regnum, u16 val)\n-{\n-\tstruct mii_bus *bus = phydev-\u003emdio.bus;\n-\tint addr = phydev-\u003emdio.addr;\n-\n-\treturn __mdiobus_c45_write(bus, addr, devnum, regnum, val);\n-}\n-\n static struct phy_driver microchip_t1s_driver[] = {\n \t{\n \t\tPHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1),\n@@ -584,8 +556,8 @@ static struct phy_driver microchip_t1s_driver[] = {\n \t\t.features = PHY_BASIC_T1S_P2MP_FEATURES,\n \t\t.config_init = lan865x_revb_config_init,\n \t\t.read_status = lan86xx_read_status,\n-\t\t.read_mmd = lan865x_phy_read_mmd,\n-\t\t.write_mmd = lan865x_phy_write_mmd,\n+\t\t.read_mmd = genphy_read_mmd_c45,\n+\t\t.write_mmd = genphy_write_mmd_c45,\n \t\t.get_plca_cfg\t = genphy_c45_plca_get_cfg,\n \t\t.set_plca_cfg\t = lan86xx_plca_set_cfg,\n \t\t.get_plca_status = genphy_c45_plca_get_status,\ndiff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c\nindex 0615228459ef42..94b2e85e00a379 100644\n--- a/drivers/net/phy/phy_device.c\n+++ b/drivers/net/phy/phy_device.c\n@@ -2770,6 +2770,31 @@ int genphy_read_abilities(struct phy_device *phydev)\n }\n EXPORT_SYMBOL(genphy_read_abilities);\n \n+/* Some PHYs support direct C45 register access but not C22 indirect\n+ * MMD access (registers 13 and 14). When discovered via C22, phylib\n+ * routes MMD access through the indirect path, which won't work on\n+ * these devices. These helpers bypass indirect access and use the bus\n+ * C45 accessors directly.\n+ */\n+int genphy_read_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum)\n+{\n+\tstruct mii_bus *bus = phydev-\u003emdio.bus;\n+\tint addr = phydev-\u003emdio.addr;\n+\n+\treturn __mdiobus_c45_read(bus, addr, devnum, regnum);\n+}\n+EXPORT_SYMBOL(genphy_read_mmd_c45);\n+\n+int genphy_write_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum,\n+\t\t\t u16 val)\n+{\n+\tstruct mii_bus *bus = phydev-\u003emdio.bus;\n+\tint addr = phydev-\u003emdio.addr;\n+\n+\treturn __mdiobus_c45_write(bus, addr, devnum, regnum, val);\n+}\n+EXPORT_SYMBOL(genphy_write_mmd_c45);\n+\n /* This is used for the phy device which doesn't support the MMD extended\n * register access, but it does have side effect when we are trying to access\n * the MMD register via indirect method.\ndiff --git a/include/linux/oa_tc6.h b/include/linux/oa_tc6.h\nindex 15f58e3c56c740..27f652d4920b22 100644\n--- a/include/linux/oa_tc6.h\n+++ b/include/linux/oa_tc6.h\n@@ -10,15 +10,86 @@\n #include \u003clinux/etherdevice.h\u003e\n #include \u003clinux/spi/spi.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+\n+/* Reset Control and Status Register */\n+#define OA_TC6_REG_RESET\t\t\t0x0003\n+#define OA_TC6_RESET_SWRESET\t\t\tBIT(0)\t/* Software Reset */\n+\n+/* Configuration Register #0 */\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_PROTE\t\t\tBIT(5)\n+\n+/* Configuration Register #2 */\n+#define OA_TC6_REG_CONFIG2\t\t\t0x0006\n+\n+/* Status Register #0 */\n+#define OA_TC6_REG_STATUS0\t\t\t0x0008\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+#define OA_TC6_STATUS0_RX_BUFFER_OVERFLOW_ERROR\tBIT(3)\n+#define OA_TC6_STATUS0_TX_PROTOCOL_ERROR\tBIT(0)\n+\n+/* Buffer Status Register */\n+#define OA_TC6_REG_BUFFER_STATUS\t\t\t0x000B\n+#define OA_TC6_BUFFER_STATUS_TX_CREDITS_AVAILABLE\tGENMASK(15, 8)\n+#define OA_TC6_BUFFER_STATUS_RX_CHUNKS_AVAILABLE\tGENMASK(7, 0)\n+\n+/* Interrupt Mask Register #0 */\n+#define OA_TC6_REG_INT_MASK0\t\t\t\t0x000C\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+#define OA_TC6_INT_MASK0_TX_PROTOCOL_ERR_MASK\t\tBIT(0)\n+#define OA_TC6_INT_MASK0_ALL_INTERRUPTS (GENMASK(5, 0) | \\\n+\t\t\t\t\t\t\t GENMASK(12, 7))\n+\n+/* PHY Clause 22 registers base address and mask */\n+#define OA_TC6_PHY_STD_REG_ADDR_BASE\t\t0xFF00\n+#define OA_TC6_PHY_STD_REG_ADDR_MASK\t\t0x1F\n+\n+/* Memory map selector (MMS) values as per table 6 in the\n+ * OPEN Alliance specification.\n+ */\n+#define OA_TC6_MAC_MMS1\t\t\t\t1\n+#define OA_TC6_PHY_C45_PCS_MMS2\t\t\t2\t/* MMD 3 */\n+#define OA_TC6_PHY_C45_PMA_PMD_MMS3\t\t3\t/* MMD 1 */\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+\n struct oa_tc6;\n \n-struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev);\n+enum oa_tc6_quirk_flag {\n+\tOA_TC6_BROKEN_PHY = BIT(0),\n+};\n+\n+struct oa_tc6_quirks {\n+\tenum oa_tc6_quirk_flag quirk_flags;\n+};\n+\n+struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,\n+\t\t\t struct oa_tc6_quirks *quirks);\n void oa_tc6_exit(struct oa_tc6 *tc6);\n int oa_tc6_write_register(struct oa_tc6 *tc6, u32 address, u32 value);\n+int oa_tc6_write_register_mms(struct oa_tc6 *tc6, u8 mms, u16 address,\n+\t\t\t u32 value);\n int oa_tc6_write_registers(struct oa_tc6 *tc6, u32 address, u32 value[],\n \t\t\t u8 length);\n int oa_tc6_read_register(struct oa_tc6 *tc6, u32 address, u32 *value);\n+int oa_tc6_read_register_mms(struct oa_tc6 *tc6, u8 mms, u16 address,\n+\t\t\t u32 *value);\n int oa_tc6_read_registers(struct oa_tc6 *tc6, u32 address, u32 value[],\n \t\t\t u8 length);\n netdev_tx_t oa_tc6_start_xmit(struct oa_tc6 *tc6, struct sk_buff *skb);\n int oa_tc6_zero_align_receive_frame_enable(struct oa_tc6 *tc6);\n+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);\ndiff --git a/include/linux/phy.h b/include/linux/phy.h\nindex 199a7aaa341bfd..432d44188dbc58 100644\n--- a/include/linux/phy.h\n+++ b/include/linux/phy.h\n@@ -2297,6 +2297,9 @@ static inline int genphy_no_config_intr(struct phy_device *phydev)\n {\n \treturn 0;\n }\n+int genphy_read_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum);\n+int genphy_write_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum,\n+\t\t\t u16 val);\n int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad,\n \t\t\t\tu16 regnum);\n int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum,\n"
} |
| 2/1 | 2026/07/08 09:22 | agent | patch-evaluator |
1mModel:gemini-3.1-pro-preview Args: null Results: {
"EnableConfigs": [
"ADIN1140",
"SPI_GPIO"
],
"FocusSymbols": [
"adin1140_probe",
"adin1140_rx_mode",
"adin1140_set_mac_address",
"adin1140_mdiobus_read",
"adin1140_mdiobus_write",
"adin1140_get_eth_mac_stats",
"adin1140_get_ethtool_stats",
"adin1140_stats_work",
"adin1140_mac_filter_set",
"adin1140_promiscuous_mode",
"oa_tc6_read_register_mms",
"oa_tc6_write_register_mms",
"oa_tc6_mdiobus_read_c45",
"oa_tc6_mdiobus_write_c45",
"oa_tc6_check_ctrl_protection",
"adin1140_loopback",
"adin1140_read_status",
"adin1140_config_aneg",
"genphy_read_mmd_c45",
"genphy_write_mmd_c45"
],
"Reasoning": "The patch introduces a new Ethernet MAC-PHY driver for the Analog Devices ADIN1140, which is connected via SPI. It also adds a corresponding PHY driver and extends the OA TC6 framework to support memory map selectors (MMS) and protected control mode. The driver can be instantiated in a virtualized environment by injecting a Device Tree overlay that creates an `spi-gpio` controller and attaches the ADIN1140 device to it. This allows syzkaller to probe the driver and fuzz its netdev interface, ethtool ops, and MAC filtering logic.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer. Your job is to review a provided patch series and determine if it makes functional changes to the kernel that should be fuzzed. IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively use your code access tools to examine the actual source code and confirm any assumptions. Return WorthFuzzing=false if the patch only contains: - Modifications to Documentation/, Kconfig files, or code comments. - Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints. - Changes to numeric constants or macros that do not functionally alter execution flow. - Code paths that are impossible to reach in virtualized environments like GCE or QEMU, even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim). If it modifies reachable core kernel logic, drivers, or architectures, use your code search tools to verify the code can be executed, then return WorthFuzzing=true. When returning WorthFuzzing=true, you MUST ALSO: 1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols. Avoid listing generic hot-path functions to prevent skewed test distributions. 2. Identify any specific CONFIG_ options required to properly test this new/modified feature. Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions. Do not list too generic configs (we already have them enabled). Only list those that specifically cover the modified code. List them in the EnableConfigs output array, and DO NOT add a '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: For your convenience, here is the diff of the changes:
commit 9d5c205b8b0e7e33c1b0a78da3d1b0e9aaaa4052
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Jul 8 09:22:37 2026 +0000
syz-cluster: applied patch under review
diff --git a/Documentation/devicetree/bindings/net/adi,ad3306.yaml b/Documentation/devicetree/bindings/net/adi,ad3306.yaml
new file mode 100644
index 00000000000000..785d05c995dbb9
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/adi,ad3306.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/adi,ad3306.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ADI ADIN1140 10BASE-T1S MAC-PHY
+
+maintainers:
+ - Ciprian Regus <ciprian.regus@analog.com>
+
+description: |
+ The ADIN1140 (also called AD3306) is a low power single port
+ 10BASE-T1S MAC-PHY. It integrates an Ethernet PHY with a MAC
+ and all the associated analog circuitry.
+ The device tries to implement the Open Alliance TC6 10BASE-T1x MAC-PHY
+ Serial Interface specification and is compliant with the
+ IEEE 802.3cg-2019 Ethernet standard for 10 Mbps single pair
+ Ethernet (SPE). The device has a 4-wire SPI interface for
+ communication between the MAC and host processor.
+
+allOf:
+ - $ref: /schemas/net/ethernet-controller.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+ compatible:
+ oneOf:
+ - items:
+ - const: adi,adin1140
+ - const: adi,ad3306
+ - const: adi,ad3306
+
+ reg:
+ maxItems: 1
+
+ spi-max-frequency:
+ maximum: 25000000
+
+ interrupts:
+ maxItems: 1
+ description: Interrupt from the MAC-PHY for receive data available
+ and error conditions
+
+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 = "adi,ad3306";
+ reg = <0>;
+ spi-max-frequency = <23000000>;
+
+ interrupt-parent = <&gpio>;
+ interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
+
+ local-mac-address = [ 00 11 22 33 44 55 ];
+ };
+ };
diff --git a/Documentation/networking/oa-tc6-framework.rst b/Documentation/networking/oa-tc6-framework.rst
index fe2aabde923a57..013824078cea40 100644
--- a/Documentation/networking/oa-tc6-framework.rst
+++ b/Documentation/networking/oa-tc6-framework.rst
@@ -454,7 +454,8 @@ Device drivers API
The include/linux/oa_tc6.h defines the following functions:
.. c:function:: struct oa_tc6 *oa_tc6_init(struct spi_device *spi, \
- struct net_device *netdev)
+ struct net_device *netdev, \
+ struct oa_tc6_quirks *quirks)
Initialize OA TC6 lib.
diff --git a/MAINTAINERS b/MAINTAINERS
index 52f1a55eca99bf..ba946b63d4a535 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1900,6 +1900,21 @@ S: Supported
W: https://ez.analog.com/linux-software-drivers
F: drivers/dma/dma-axi-dmac.c
+ANALOG DEVICES INC ETHERNET DRIVERS
+M: Ciprian Regus <ciprian.regus@analog.com>
+L: netdev@vger.kernel.org
+S: Maintained
+W: https://ez.analog.com/linux-software-drivers
+F: Documentation/devicetree/bindings/net/adi,ad3306.yaml
+F: drivers/net/ethernet/adi/adin1140.c
+
+ANALOG DEVICES INC ETHERNET PHY DRIVERS
+M: Ciprian Regus <ciprian.regus@analog.com>
+L: netdev@vger.kernel.org
+S: Maintained
+W: https://ez.analog.com/linux-software-drivers
+F: drivers/net/phy/adin1140-phy.c
+
ANALOG DEVICES INC IIO DRIVERS
M: Nuno Sá <nuno.sa@analog.com>
M: Michael Hennerich <Michael.Hennerich@analog.com>
diff --git a/drivers/net/ethernet/adi/Kconfig b/drivers/net/ethernet/adi/Kconfig
index 760a9a60bc15c1..bdb8ff7d15da6d 100644
--- a/drivers/net/ethernet/adi/Kconfig
+++ b/drivers/net/ethernet/adi/Kconfig
@@ -26,4 +26,16 @@ config ADIN1110
Say yes here to build support for Analog Devices ADIN1110
Low Power 10BASE-T1L Ethernet MAC-PHY.
+config ADIN1140
+ tristate "Analog Devices ADIN1140 MAC-PHY"
+ depends on SPI
+ select ADIN1140_PHY
+ select OA_TC6
+ help
+ Say yes here to build support for Analog Devices, Inc. ADIN1140
+ 10BASE-T1S Ethernet MAC-PHY.
+
+ To compile this driver as a module, choose M here. The module will be
+ called adin1140.
+
endif # NET_VENDOR_ADI
diff --git a/drivers/net/ethernet/adi/Makefile b/drivers/net/ethernet/adi/Makefile
index d0383d94303c80..0390ca8ccc497e 100644
--- a/drivers/net/ethernet/adi/Makefile
+++ b/drivers/net/ethernet/adi/Makefile
@@ -4,3 +4,4 @@
#
obj-$(CONFIG_ADIN1110) += adin1110.o
+obj-$(CONFIG_ADIN1140) += adin1140.o
diff --git a/drivers/net/ethernet/adi/adin1140.c b/drivers/net/ethernet/adi/adin1140.c
new file mode 100644
index 00000000000000..93710baca1517a
--- /dev/null
+++ b/drivers/net/ethernet/adi/adin1140.c
@@ -0,0 +1,791 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Driver for Analog Devices, Inc. ADIN1140 10BASE-T1S MAC-PHY
+ *
+ * Copyright 2026 Analog Devices Inc.
+ */
+
+#include <linux/cleanup.h>
+#include <linux/etherdevice.h>
+#include <linux/kernel.h>
+#include <linux/mdio.h>
+#include <linux/module.h>
+#include <linux/oa_tc6.h>
+#include <linux/phy.h>
+
+#define ADIN1140_MAC_CONFIG2_STAT_CLR_RD BIT(6)
+#define ADIN1140_MAC_CONFIG2_FWD_UNK2HOST BIT(2)
+
+#define ADIN1140_MAC_P1_LOOP_ADDR_REG 0xC4
+
+#define ADIN1140_MAC_ADDR_FILT_UPR_REG 0x50
+#define ADIN1140_MAC_ADDR_FILT_APPLY2PORT1 BIT(30)
+#define ADIN1140_MAC_ADDR_FILT_TO_HOST BIT(16)
+
+#define ADIN1140_MAC_ADDR_FILT_LWR_REG 0x51
+
+#define ADIN1140_MAC_ADDR_MASK_UPR_REG 0x70
+#define ADIN1140_MAC_ADDR_MASK_LWR_REG 0x71
+
+#define ADIN1140_MAC_FILT_MC_SLOT 0U
+#define ADIN1140_MAC_FILT_BC_SLOT 1U
+#define ADIN1140_MAC_FILT_UC_SLOT 2U
+#define ADIN1140_MAC_FILT_MAX_SLOT 16U
+#define ADIN1140_MAC_FILT_MASK_LIMIT 2U
+
+#define ADIN1140_MAC_RX_FRAME_CNT 0xA1
+#define ADIN1140_MAC_RX_BC_FRAME_CNT 0xA2
+#define ADIN1140_MAC_RX_MC_FRAME_CNT 0xA3
+#define ADIN1140_MAC_RX_CRC_ERR_CNT 0xA5
+#define ADIN1140_MAC_RX_ALIGN_ERR_CNT 0xA6
+#define ADIN1140_MAC_RX_PREAMBLE_ERR_CNT 0xA7
+#define ADIN1140_MAC_RX_SHORT_ERR_CNT 0xA8
+#define ADIN1140_MAC_RX_LONG_ERR_CNT 0xA9
+#define ADIN1140_MAC_RX_PHY_ERR_CNT 0xAA
+#define ADIN1140_MAC_RX_DRP_FULL_CNT 0xAB
+#define ADIN1140_MAC_RX_DRP_FILTER_CNT 0xAD
+#define ADIN1140_MAC_RX_IFG_ERR_CNT 0xAE
+#define ADIN1140_MAC_TX_FRAME_CNT 0xB1
+#define ADIN1140_MAC_TX_BC_FRAME_CNT 0xB2
+#define ADIN1140_MAC_TX_MC_FRAME_CNT 0xB3
+#define ADIN1140_MAC_TX_SINGLE_COL_CNT 0xB5
+#define ADIN1140_MAC_TX_MULTI_COL_CNT 0xB6
+#define ADIN1140_MAC_TX_DEFERRED_CNT 0xB7
+#define ADIN1140_MAC_TX_LATE_COL_CNT 0xB8
+#define ADIN1140_MAC_TX_EXCESS_COL_CNT 0xB9
+#define ADIN1140_MAC_TX_UNDERRUN_CNT 0xBA
+
+/* ADIN1140_MAC_FILT_MAX_SLOT - 3 (multicast, broadcast and unicast
+ * reserved slots)
+ */
+#define ADIN1140_MAC_FILT_AVAIL 13U
+
+#define ADIN1140_PHY_CTRL_DEFAULT 0x1000
+#define ADIN1140_PHY_STATUS_DEFAULT 0x082D
+#define ADIN1140_PHY_ID1 0x0283
+#define ADIN1140_PHY_ID2 0xBE00
+
+#define ADIN1140_STATS_CHECK_DELAY (3 * HZ)
+
+enum adin1140_statistics_entry {
+ rx_frames,
+ rx_bc_frames,
+ rx_mc_frames,
+ rx_crc_errors,
+ rx_align_errors,
+ rx_preamble_errors,
+ rx_short_frame_errors,
+ rx_long_frame_errors,
+ rx_phy_errors,
+ rx_fifo_full_dropped,
+ rx_addr_filter_dropped,
+ rx_ifg_errors,
+ tx_frames,
+ tx_bc_frames,
+ tx_mc_frames,
+ tx_single_collision,
+ tx_multi_collision,
+ tx_deferred,
+ tx_late_collision,
+ tx_excess_collision,
+ tx_underrun,
+ ADIN1140_STATS_CNT,
+};
+
+struct adin1140_statistics_reg {
+ const char *name;
+ enum adin1140_statistics_entry idx;
+};
+
+struct adin1140_priv {
+ struct net_device *netdev;
+ struct oa_tc6 *tc6;
+ struct mii_bus *mdiobus;
+ struct phy_device *phydev;
+ struct delayed_work stats_work;
+
+ /* Protects stats[] from concurrent updates in adin1140_stats_work
+ * and reads in the get_stats functions
+ */
+ spinlock_t stat_lock;
+ u64 stats[ADIN1140_STATS_CNT];
+};
+
+static const u32 adin1140_stat_regs[] = {
+ [rx_frames] = ADIN1140_MAC_RX_FRAME_CNT,
+ [rx_bc_frames] = ADIN1140_MAC_RX_BC_FRAME_CNT,
+ [rx_mc_frames] = ADIN1140_MAC_RX_MC_FRAME_CNT,
+ [rx_crc_errors] = ADIN1140_MAC_RX_CRC_ERR_CNT,
+ [rx_align_errors] = ADIN1140_MAC_RX_ALIGN_ERR_CNT,
+ [rx_preamble_errors] = ADIN1140_MAC_RX_PREAMBLE_ERR_CNT,
+ [rx_short_frame_errors] = ADIN1140_MAC_RX_SHORT_ERR_CNT,
+ [rx_long_frame_errors] = ADIN1140_MAC_RX_LONG_ERR_CNT,
+ [rx_phy_errors] = ADIN1140_MAC_RX_PHY_ERR_CNT,
+ [rx_fifo_full_dropped] = ADIN1140_MAC_RX_DRP_FULL_CNT,
+ [rx_addr_filter_dropped] = ADIN1140_MAC_RX_DRP_FILTER_CNT,
+ [rx_ifg_errors] = ADIN1140_MAC_RX_IFG_ERR_CNT,
+ [tx_frames] = ADIN1140_MAC_TX_FRAME_CNT,
+ [tx_bc_frames] = ADIN1140_MAC_TX_BC_FRAME_CNT,
+ [tx_mc_frames] = ADIN1140_MAC_TX_MC_FRAME_CNT,
+ [tx_single_collision] = ADIN1140_MAC_TX_SINGLE_COL_CNT,
+ [tx_multi_collision] = ADIN1140_MAC_TX_MULTI_COL_CNT,
+ [tx_deferred] = ADIN1140_MAC_TX_DEFERRED_CNT,
+ [tx_late_collision] = ADIN1140_MAC_TX_LATE_COL_CNT,
+ [tx_excess_collision] = ADIN1140_MAC_TX_EXCESS_COL_CNT,
+ [tx_underrun] = ADIN1140_MAC_TX_UNDERRUN_CNT,
+};
+
+static const struct adin1140_statistics_reg adin1140_stats[] = {
+ {.name = "rx_preamble_errors", .idx = rx_preamble_errors},
+ {.name = "rx_ifg_errors", .idx = rx_ifg_errors},
+};
+
+static int adin1140_mac_filter_set(struct adin1140_priv *priv,
+ const u8 *addr, const u8 *mask,
+ u8 slot)
+{
+ u32 reg_address;
+ u32 val;
+ int ret;
+
+ if (slot >= ADIN1140_MAC_FILT_MAX_SLOT)
+ return -ENOSPC;
+
+ reg_address = ADIN1140_MAC_ADDR_FILT_UPR_REG + 2 * slot;
+
+ ret = oa_tc6_write_register_mms(priv->tc6, OA_TC6_MAC_MMS1,
+ reg_address,
+ get_unaligned_be16(&addr[0]) |
+ ADIN1140_MAC_ADDR_FILT_APPLY2PORT1 |
+ ADIN1140_MAC_ADDR_FILT_TO_HOST);
+ if (ret)
+ return ret;
+
+ reg_address = ADIN1140_MAC_ADDR_FILT_LWR_REG + 2 * slot;
+ ret = oa_tc6_write_register_mms(priv->tc6, OA_TC6_MAC_MMS1,
+ reg_address,
+ get_unaligned_be32(&addr[2]));
+ if (ret)
+ return ret;
+
+ /* Only the first 2 destination MAC filter slots support masking.
+ * For the other entries, the destination address in the received
+ * frame must match exactly.
+ */
+ if (slot >= ADIN1140_MAC_FILT_MASK_LIMIT)
+ return 0;
+
+ val = get_unaligned_be16(&mask[0]);
+ reg_address = ADIN1140_MAC_ADDR_MASK_UPR_REG + (2 * slot);
+
+ ret = oa_tc6_write_register_mms(priv->tc6, OA_TC6_MAC_MMS1,
+ reg_address, val);
+ if (ret)
+ return ret;
+
+ val = get_unaligned_be32(&mask[2]);
+ reg_address = ADIN1140_MAC_ADDR_MASK_LWR_REG + (2 * slot);
+
+ return oa_tc6_write_register_mms(priv->tc6, OA_TC6_MAC_MMS1,
+ reg_address, val);
+}
+
+static int adin1140_mac_filter_clear(struct adin1140_priv *priv, u8 slot)
+{
+ u8 mask[ETH_ALEN];
+ u8 addr[ETH_ALEN];
+
+ memset(mask, 0xFF, ETH_ALEN);
+ memset(addr, 0x0, ETH_ALEN);
+
+ return adin1140_mac_filter_set(priv, addr, mask, slot);
+}
+
+static int adin1140_filter_unicast(struct adin1140_priv *priv)
+{
+ /* Only the first 2 filter slots support masking, so no unicast
+ * address will ever need a mask. The first slots are used for the
+ * all multicast and broadcast filter.
+ */
+ return adin1140_mac_filter_set(priv, priv->netdev->dev_addr, NULL,
+ ADIN1140_MAC_FILT_UC_SLOT);
+}
+
+static int adin1140_filter_all_multicast(struct adin1140_priv *priv, bool en)
+{
+ u8 multicast_addr[ETH_ALEN] = {1, 0, 0, 0, 0, 0};
+
+ if (en)
+ return adin1140_mac_filter_set(priv, multicast_addr,
+ multicast_addr,
+ ADIN1140_MAC_FILT_MC_SLOT);
+
+ return adin1140_mac_filter_clear(priv, ADIN1140_MAC_FILT_MC_SLOT);
+}
+
+static int adin1140_filter_broadcast(struct adin1140_priv *priv, bool enabled)
+{
+ u8 mask[ETH_ALEN];
+
+ if (enabled) {
+ memset(mask, 0xFF, ETH_ALEN);
+ return adin1140_mac_filter_set(priv, mask, mask,
+ ADIN1140_MAC_FILT_BC_SLOT);
+ }
+
+ return adin1140_mac_filter_clear(priv, ADIN1140_MAC_FILT_BC_SLOT);
+}
+
+static int adin1140_default_filter_config(struct adin1140_priv *priv)
+{
+ int ret;
+
+ ret = adin1140_filter_broadcast(priv, true);
+ if (ret)
+ return ret;
+
+ return adin1140_filter_unicast(priv);
+}
+
+static int adin1140_promiscuous_mode(struct adin1140_priv *priv, bool enabled)
+{
+ int ret;
+ u32 val;
+
+ ret = oa_tc6_read_register(priv->tc6, OA_TC6_REG_CONFIG2, &val);
+ if (ret)
+ return ret;
+
+ if (enabled)
+ val |= ADIN1140_MAC_CONFIG2_FWD_UNK2HOST;
+ else
+ val &= ~ADIN1140_MAC_CONFIG2_FWD_UNK2HOST;
+
+ return oa_tc6_write_register(priv->tc6, OA_TC6_REG_CONFIG2, val);
+}
+
+static int adin1140_rx_mode(struct net_device *dev,
+ struct netdev_hw_addr_list *uc,
+ struct netdev_hw_addr_list *mc)
+{
+ struct adin1140_priv *priv = netdev_priv(dev);
+ struct netdev_hw_addr *ha;
+ bool all_multi, promisc;
+ u32 mac_addrs;
+ u8 slot, i;
+ int ret;
+
+ /* The ADIN1140 has 16 dest MAC address filter slots:
+ * 0 - reserved for all multicast filter.
+ * 1 - reserved for broadcast filter.
+ * 2 - reserved for the device's own unicast MAC.
+ * 3 -> 15 - available for other unicast/multicast filters.
+ */
+
+ mac_addrs = netdev_hw_addr_list_count(uc);
+ all_multi = false;
+ promisc = false;
+
+ if (priv->netdev->flags & IFF_PROMISC)
+ promisc = true;
+ else if (priv->netdev->flags & IFF_ALLMULTI)
+ all_multi = true;
+ else
+ mac_addrs += netdev_hw_addr_list_count(mc);
+
+ if (mac_addrs > ADIN1140_MAC_FILT_AVAIL) {
+ /* The filter table is full. Enable promisc mode. */
+ promisc = true;
+ }
+
+ ret = adin1140_promiscuous_mode(priv, promisc);
+ if (ret)
+ return ret;
+
+ ret = adin1140_filter_all_multicast(priv, all_multi);
+ if (ret)
+ return ret;
+
+ slot = ADIN1140_MAC_FILT_UC_SLOT + 1;
+ if (!promisc) {
+ netdev_hw_addr_list_for_each(ha, uc) {
+ ret = adin1140_mac_filter_set(priv, ha->addr, NULL,
+ slot);
+ if (ret)
+ return ret;
+
+ slot++;
+ }
+
+ if (!all_multi) {
+ netdev_hw_addr_list_for_each(ha, mc) {
+ ret = adin1140_mac_filter_set(priv, ha->addr,
+ NULL, slot);
+ if (ret)
+ return ret;
+
+ slot++;
+ }
+ }
+ }
+
+ for (i = slot; i < ADIN1140_MAC_FILT_MAX_SLOT; i++) {
+ ret = adin1140_mac_filter_clear(priv, i);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
+static void adin1140_stats_work(struct work_struct *work)
+{
+ struct delayed_work *dwork = to_delayed_work(work);
+ struct adin1140_priv *priv;
+ u32 reg_val;
+ int ret;
+ u32 i;
+
+ priv = container_of(dwork, struct adin1140_priv, stats_work);
+
+ for (i = 0; i < ARRAY_SIZE(adin1140_stat_regs); i++) {
+ ret = oa_tc6_read_register_mms(priv->tc6, OA_TC6_MAC_MMS1,
+ adin1140_stat_regs[i],
+ ®_val);
+ if (ret)
+ goto out;
+
+ scoped_guard(spinlock, &priv->stat_lock)
+ priv->stats[i] += reg_val;
+ }
+
+out:
+ schedule_delayed_work(dwork, ADIN1140_STATS_CHECK_DELAY);
+}
+
+static int adin1140_configure(struct adin1140_priv *priv)
+{
+ u32 reg_val;
+ int ret;
+
+ ret = oa_tc6_zero_align_receive_frame_enable(priv->tc6);
+ if (ret)
+ return ret;
+
+ /* Disable MAC loopback */
+ ret = oa_tc6_write_register_mms(priv->tc6, OA_TC6_MAC_MMS1,
+ ADIN1140_MAC_P1_LOOP_ADDR_REG, 0x0);
+ if (ret)
+ return ret;
+
+ ret = oa_tc6_read_register(priv->tc6, OA_TC6_REG_CONFIG2, ®_val);
+ if (ret)
+ return ret;
+
+ reg_val |= ADIN1140_MAC_CONFIG2_STAT_CLR_RD;
+
+ ret = oa_tc6_write_register(priv->tc6, OA_TC6_REG_CONFIG2, reg_val);
+ if (ret)
+ return ret;
+
+ return adin1140_default_filter_config(priv);
+}
+
+static int adin1140_open(struct net_device *netdev)
+{
+ struct adin1140_priv *priv = netdev_priv(netdev);
+
+ schedule_delayed_work(&priv->stats_work, ADIN1140_STATS_CHECK_DELAY);
+
+ phy_start(netdev->phydev);
+ netif_start_queue(netdev);
+
+ return 0;
+}
+
+static int adin1140_close(struct net_device *netdev)
+{
+ struct adin1140_priv *priv = netdev_priv(netdev);
+
+ cancel_delayed_work_sync(&priv->stats_work);
+
+ netif_stop_queue(netdev);
+ phy_stop(netdev->phydev);
+
+ return 0;
+}
+
+static netdev_tx_t adin1140_start_xmit(struct sk_buff *skb,
+ struct net_device *netdev)
+{
+ struct adin1140_priv *priv = netdev_priv(netdev);
+
+ /* The MAC doesn't automatically pad the frame to a 60 byte minimum
+ * size in case the host sends a shorter skb, so we have to do it in
+ * the driver. The FCS will be added by the MAC.
+ */
+ if (skb_put_padto(skb, ETH_ZLEN))
+ return NETDEV_TX_OK;
+
+ return oa_tc6_start_xmit(priv->tc6, skb);
+}
+
+static int adin1140_set_mac_address(struct net_device *netdev, void *addr)
+{
+ struct adin1140_priv *priv = netdev_priv(netdev);
+ struct sockaddr *address = addr;
+ u8 mask[ETH_ALEN];
+ int ret;
+
+ ret = eth_prepare_mac_addr_change(netdev, addr);
+ if (ret < 0)
+ return ret;
+
+ if (ether_addr_equal(address->sa_data, netdev->dev_addr))
+ return 0;
+
+ memset(mask, 0xFF, ETH_ALEN);
+ ret = adin1140_mac_filter_set(priv, address->sa_data, mask,
+ ADIN1140_MAC_FILT_UC_SLOT);
+ if (ret)
+ return ret;
+
+ eth_commit_mac_addr_change(netdev, addr);
+
+ return 0;
+}
+
+static void __adin1140_ndo_get_stats64(struct adin1140_priv *priv,
+ struct rtnl_link_stats64 *storage)
+{
+ storage->rx_errors = priv->stats[rx_crc_errors] +
+ priv->stats[rx_align_errors] +
+ priv->stats[rx_preamble_errors] +
+ priv->stats[rx_short_frame_errors] +
+ priv->stats[rx_long_frame_errors] +
+ priv->stats[rx_phy_errors] +
+ priv->stats[rx_ifg_errors];
+
+ storage->tx_errors = priv->stats[tx_excess_collision] +
+ priv->stats[tx_underrun];
+
+ storage->rx_dropped = priv->stats[rx_fifo_full_dropped] +
+ priv->stats[rx_addr_filter_dropped];
+
+ storage->multicast = priv->stats[rx_mc_frames];
+
+ storage->collisions = priv->stats[tx_single_collision] +
+ priv->stats[tx_multi_collision];
+
+ storage->rx_length_errors = priv->stats[rx_short_frame_errors] +
+ priv->stats[rx_long_frame_errors];
+ storage->rx_over_errors = priv->stats[rx_fifo_full_dropped];
+ storage->rx_crc_errors = priv->stats[rx_crc_errors];
+ storage->rx_frame_errors = priv->stats[rx_align_errors];
+ storage->rx_missed_errors = priv->stats[rx_fifo_full_dropped];
+
+ storage->tx_aborted_errors = priv->stats[tx_excess_collision];
+ storage->tx_fifo_errors = priv->stats[tx_underrun];
+ storage->tx_window_errors = priv->stats[tx_late_collision];
+}
+
+static void adin1140_ndo_get_stats64(struct net_device *dev,
+ struct rtnl_link_stats64 *storage)
+{
+ struct adin1140_priv *priv = netdev_priv(dev);
+
+ storage->rx_packets = priv->netdev->stats.rx_packets;
+ storage->tx_packets = priv->netdev->stats.tx_packets;
+
+ storage->rx_bytes = priv->netdev->stats.rx_bytes;
+ storage->tx_bytes = priv->netdev->stats.tx_bytes;
+
+ scoped_guard(spinlock, &priv->stat_lock)
+ __adin1140_ndo_get_stats64(priv, storage);
+}
+
+static void adin1140_get_drvinfo(struct net_device *netdev,
+ struct ethtool_drvinfo *info)
+{
+ strscpy(info->driver, "ADIN1140", sizeof(info->driver));
+ strscpy(info->bus_info, dev_name(netdev->dev.parent),
+ sizeof(info->bus_info));
+}
+
+static void adin1140_get_ethtool_stats(struct net_device *netdev,
+ struct ethtool_stats *stats, u64 *data)
+{
+ struct adin1140_priv *priv = netdev_priv(netdev);
+ u32 i;
+
+ scoped_guard(spinlock, &priv->stat_lock) {
+ for (i = 0; i < ARRAY_SIZE(adin1140_stats); i++)
+ data[i] = priv->stats[adin1140_stats[i].idx];
+ }
+}
+
+static void adin1140_get_ethtool_strings(struct net_device *netdev, u32 sset,
+ u8 *p)
+{
+ u32 i;
+
+ switch (sset) {
+ case ETH_SS_STATS:
+ for (i = 0; i < ARRAY_SIZE(adin1140_stats); i++)
+ ethtool_puts(&p, adin1140_stats[i].name);
+
+ break;
+ }
+}
+
+static int adin1140_get_sset_count(struct net_device *netdev, int sset)
+{
+ switch (sset) {
+ case ETH_SS_STATS:
+ return ARRAY_SIZE(adin1140_stats);
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
+static void __adin1140_eth_mac_stats(struct adin1140_priv *priv,
+ struct ethtool_eth_mac_stats *mac_stats)
+{
+ mac_stats->FramesReceivedOK = priv->stats[rx_frames];
+ mac_stats->BroadcastFramesReceivedOK = priv->stats[rx_bc_frames];
+ mac_stats->MulticastFramesReceivedOK = priv->stats[rx_mc_frames];
+ mac_stats->FrameCheckSequenceErrors = priv->stats[rx_crc_errors];
+ mac_stats->AlignmentErrors = priv->stats[rx_align_errors];
+ mac_stats->FrameTooLongErrors = priv->stats[rx_long_frame_errors];
+ mac_stats->FramesLostDueToIntMACRcvError =
+ priv->stats[rx_fifo_full_dropped];
+ mac_stats->FramesTransmittedOK = priv->stats[tx_frames];
+ mac_stats->BroadcastFramesXmittedOK = priv->stats[tx_bc_frames];
+ mac_stats->MulticastFramesXmittedOK = priv->stats[tx_mc_frames];
+ mac_stats->SingleCollisionFrames = priv->stats[tx_single_collision];
+ mac_stats->MultipleCollisionFrames = priv->stats[tx_multi_collision];
+ mac_stats->FramesWithDeferredXmissions = priv->stats[tx_deferred];
+ mac_stats->LateCollisions = priv->stats[tx_late_collision];
+ mac_stats->FramesAbortedDueToXSColls =
+ priv->stats[tx_excess_collision];
+ mac_stats->FramesLostDueToIntMACXmitError = priv->stats[tx_underrun];
+}
+
+static void adin1140_get_eth_mac_stats(struct net_device *netdev,
+ struct ethtool_eth_mac_stats *mac_stats)
+{
+ struct adin1140_priv *priv = netdev_priv(netdev);
+
+ scoped_guard(spinlock, &priv->stat_lock)
+ __adin1140_eth_mac_stats(priv, mac_stats);
+}
+
+static int adin1140_mdiobus_read(struct mii_bus *bus, int addr, int regnum)
+{
+ /* The ADIN1140's standard PHY C22 register map (OA TC6 0xFF00 -
+ * 0xFF1F), of which only 0xFF00 - 0xFF03 are implemented) cannot be
+ * accessed while frames are being received by the PHY. In case this
+ * happens the CONFIG0 and CONFIG2 register values will get corrupted,
+ * getting a random value. Both reads and writes cause the same
+ * behavior. This is a workaround that avoids MDIO accesses all
+ * together. Since this is a 10BASE-T1S PHY, only the loopback and
+ * reset (AN) bits in the control register (0x0) can be written.
+ * These functionalities have custom implementations in the PHY
+ * driver. C45 accesses do not cause this issue.
+ */
+
+ switch (regnum) {
+ case MII_BMCR:
+ return ADIN1140_PHY_CTRL_DEFAULT;
+ case MII_BMSR:
+ return ADIN1140_PHY_STATUS_DEFAULT;
+ case MII_PHYSID1:
+ return ADIN1140_PHY_ID1;
+ case MII_PHYSID2:
+ return ADIN1140_PHY_ID2;
+ default:
+ return 0xFFFF;
+ }
+}
+
+static int adin1140_mdiobus_write(struct mii_bus *bus, int addr, int regnum,
+ u16 val)
+{
+ return -EIO;
+}
+
+static int adin1140_mdio_register(struct adin1140_priv *priv,
+ struct spi_device *spidev)
+{
+ priv->mdiobus = devm_mdiobus_alloc(&spidev->dev);
+ if (!priv->mdiobus)
+ return dev_err_probe(&spidev->dev, -ENOMEM,
+ "MDIO bus alloc failed\n");
+
+ priv->mdiobus->name = "adin1140-mdiobus";
+ priv->mdiobus->priv = priv->tc6;
+ priv->mdiobus->parent = &spidev->dev;
+ priv->mdiobus->phy_mask = GENMASK(31, 1);
+ priv->mdiobus->read = adin1140_mdiobus_read;
+ priv->mdiobus->write = adin1140_mdiobus_write;
+ priv->mdiobus->read_c45 = oa_tc6_mdiobus_read_c45;
+ priv->mdiobus->write_c45 = oa_tc6_mdiobus_write_c45;
+
+ snprintf(priv->mdiobus->id, MII_BUS_ID_SIZE, "adin1140-%s.%u",
+ dev_name(&spidev->dev), spi_get_chipselect(spidev, 0));
+
+ return devm_mdiobus_register(&spidev->dev, priv->mdiobus);
+}
+
+static void adin1140_handle_link_change(struct net_device *netdev)
+{
+ phy_print_status(netdev->phydev);
+}
+
+static void adin1140_phy_remove(void *data)
+{
+ phy_disconnect(data);
+}
+
+static int adin1140_phy_init(struct adin1140_priv *priv,
+ struct spi_device *spidev)
+{
+ int ret;
+
+ ret = adin1140_mdio_register(priv, spidev);
+ if (ret)
+ return ret;
+
+ priv->phydev = phy_find_first(priv->mdiobus);
+ if (!priv->phydev)
+ return dev_err_probe(&spidev->dev, -ENODEV, "No PHY found\n");
+
+ priv->phydev->is_internal = true;
+ ret = phy_connect_direct(priv->netdev, priv->phydev,
+ &adin1140_handle_link_change,
+ PHY_INTERFACE_MODE_INTERNAL);
+ if (ret)
+ return dev_err_probe(&spidev->dev, ret,
+ "Can't attach PHY to %s\n",
+ priv->mdiobus->id);
+
+ ret = devm_add_action_or_reset(&spidev->dev, adin1140_phy_remove,
+ priv->phydev);
+ if (ret)
+ return ret;
+
+ phy_attached_info(priv->phydev);
+
+ return 0;
+}
+
+static const struct ethtool_ops adin1140_ethtool_ops = {
+ .get_drvinfo = adin1140_get_drvinfo,
+ .get_link = ethtool_op_get_link,
+ .get_ethtool_stats = adin1140_get_ethtool_stats,
+ .get_sset_count = adin1140_get_sset_count,
+ .get_strings = adin1140_get_ethtool_strings,
+ .get_link_ksettings = phy_ethtool_get_link_ksettings,
+ .set_link_ksettings = phy_ethtool_set_link_ksettings,
+ .get_eth_mac_stats = adin1140_get_eth_mac_stats,
+};
+
+static const struct net_device_ops adin1140_netdev_ops = {
+ .ndo_open = adin1140_open,
+ .ndo_stop = adin1140_close,
+ .ndo_start_xmit = adin1140_start_xmit,
+ .ndo_set_mac_address = adin1140_set_mac_address,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_rx_mode_async = adin1140_rx_mode,
+ .ndo_eth_ioctl = phy_do_ioctl_running,
+ .ndo_get_stats64 = adin1140_ndo_get_stats64,
+};
+
+static void adin1140_oa_tc6_remove(void *data)
+{
+ oa_tc6_exit(data);
+}
+
+static int adin1140_probe(struct spi_device *spi)
+{
+ struct oa_tc6_quirks tc6_quirks = {};
+ struct net_device *netdev;
+ struct adin1140_priv *priv;
+ int ret;
+
+ netdev = devm_alloc_etherdev(&spi->dev, sizeof(struct adin1140_priv));
+ if (!netdev)
+ return -ENOMEM;
+
+ priv = netdev_priv(netdev);
+ priv->netdev = netdev;
+ spi_set_drvdata(spi, priv);
+ spin_lock_init(&priv->stat_lock);
+
+ tc6_quirks.quirk_flags = OA_TC6_BROKEN_PHY;
+
+ priv->tc6 = oa_tc6_init(spi, netdev, &tc6_quirks);
+ if (!priv->tc6)
+ return -ENODEV;
+
+ ret = devm_add_action_or_reset(&spi->dev, adin1140_oa_tc6_remove,
+ priv->tc6);
+ if (ret)
+ return ret;
+
+ ret = adin1140_phy_init(priv, spi);
+ if (ret)
+ return ret;
+
+ if (device_get_ethdev_address(&spi->dev, netdev))
+ eth_hw_addr_random(netdev);
+
+ ret = adin1140_configure(priv);
+ if (ret)
+ return ret;
+
+ INIT_DELAYED_WORK(&priv->stats_work, adin1140_stats_work);
+
+ netdev->if_port = IF_PORT_10BASET;
+ netdev->irq = spi->irq;
+ netdev->netdev_ops = &adin1140_netdev_ops;
+ netdev->ethtool_ops = &adin1140_ethtool_ops;
+ netdev->netns_immutable = true;
+ netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE |
+ IFF_UNICAST_FLT;
+
+ ret = devm_register_netdev(&spi->dev, netdev);
+ if (ret)
+ return dev_err_probe(&spi->dev, ret,
+ "Failed to register netdev");
+
+ return 0;
+}
+
+static const struct spi_device_id adin1140_spi_id[] = {
+ { .name = "ad3306" },
+ { .name = "adin1140" },
+ {},
+};
+MODULE_DEVICE_TABLE(spi, adin1140_spi_id);
+
+static const struct of_device_id adin1140_match_table[] = {
+ { .compatible = "adi,ad3306" },
+ { .compatible = "adi,adin1140" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, adin1140_match_table);
+
+static struct spi_driver adin1140_driver = {
+ .driver = {
+ .name = "adin1140",
+ .of_match_table = adin1140_match_table,
+ },
+ .probe = adin1140_probe,
+ .id_table = adin1140_spi_id,
+};
+module_spi_driver(adin1140_driver);
+
+MODULE_DESCRIPTION("Analog Devices, Inc. ADIN1140 10BASE-T1S MAC-PHY");
+MODULE_AUTHOR("Ciprian Regus <ciprian.regus@analog.com>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/microchip/lan865x/lan865x.c b/drivers/net/ethernet/microchip/lan865x/lan865x.c
index 0277d9737369ad..26a2761332a5a1 100644
--- a/drivers/net/ethernet/microchip/lan865x/lan865x.c
+++ b/drivers/net/ethernet/microchip/lan865x/lan865x.c
@@ -346,7 +346,7 @@ static int lan865x_probe(struct spi_device *spi)
spi_set_drvdata(spi, priv);
INIT_WORK(&priv->multicast_work, lan865x_multicast_work_handler);
- priv->tc6 = oa_tc6_init(spi, netdev);
+ priv->tc6 = oa_tc6_init(spi, netdev, NULL);
if (!priv->tc6) {
ret = -ENODEV;
goto free_netdev;
diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
index 0727d53345a33b..417c15d1ff4233 100644
--- a/drivers/net/ethernet/oa_tc6.c
+++ b/drivers/net/ethernet/oa_tc6.c
@@ -12,46 +12,6 @@
#include <linux/phy.h>
#include <linux/oa_tc6.h>
-/* OPEN Alliance TC6 registers */
-/* Standard Capabilities Register */
-#define OA_TC6_REG_STDCAP 0x0002
-#define STDCAP_DIRECT_PHY_REG_ACCESS BIT(8)
-
-/* Reset Control and Status Register */
-#define OA_TC6_REG_RESET 0x0003
-#define RESET_SWRESET BIT(0) /* Software Reset */
-
-/* Configuration Register #0 */
-#define OA_TC6_REG_CONFIG0 0x0004
-#define CONFIG0_SYNC BIT(15)
-#define CONFIG0_ZARFE_ENABLE BIT(12)
-
-/* Status Register #0 */
-#define OA_TC6_REG_STATUS0 0x0008
-#define STATUS0_RESETC BIT(6) /* Reset Complete */
-#define STATUS0_HEADER_ERROR BIT(5)
-#define STATUS0_LOSS_OF_FRAME_ERROR BIT(4)
-#define STATUS0_RX_BUFFER_OVERFLOW_ERROR BIT(3)
-#define STATUS0_TX_PROTOCOL_ERROR BIT(0)
-
-/* Buffer Status Register */
-#define OA_TC6_REG_BUFFER_STATUS 0x000B
-#define BUFFER_STATUS_TX_CREDITS_AVAILABLE GENMASK(15, 8)
-#define BUFFER_STATUS_RX_CHUNKS_AVAILABLE GENMASK(7, 0)
-
-/* Interrupt Mask Register #0 */
-#define OA_TC6_REG_INT_MASK0 0x000C
-#define INT_MASK0_HEADER_ERR_MASK BIT(5)
-#define INT_MASK0_LOSS_OF_FRAME_ERR_MASK BIT(4)
-#define INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK BIT(3)
-#define INT_MASK0_TX_PROTOCOL_ERR_MASK BIT(0)
-#define INT_MASK0_ALL_INTERRUPTS (GENMASK(5, 0) | \
- GENMASK(12, 7))
-
-/* PHY Clause 22 registers base address and mask */
-#define OA_TC6_PHY_STD_REG_ADDR_BASE 0xFF00
-#define OA_TC6_PHY_STD_REG_ADDR_MASK 0x1F
-
/* Control command header */
#define OA_TC6_CTRL_HEADER_DATA_NOT_CTRL BIT(31)
#define OA_TC6_CTRL_HEADER_WRITE_NOT_READ BIT(29)
@@ -81,23 +41,17 @@
#define OA_TC6_DATA_FOOTER_END_BYTE_OFFSET GENMASK(13, 8)
#define OA_TC6_DATA_FOOTER_TX_CREDITS GENMASK(5, 1)
-/* PHY – Clause 45 registers memory map selector (MMS) as per table 6 in the
- * OPEN Alliance specification.
- */
-#define OA_TC6_PHY_C45_PCS_MMS2 2 /* MMD 3 */
-#define OA_TC6_PHY_C45_PMA_PMD_MMS3 3 /* MMD 1 */
-#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_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_IGNORED_SIZE)
+#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 +\
@@ -108,6 +62,8 @@
#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;
@@ -130,6 +86,8 @@ struct oa_tc6 {
bool rx_buf_overflow;
bool int_flag;
bool disable_traffic;
+ bool prot_ctrl;
+ enum oa_tc6_quirk_flag quirk_flags;
};
enum oa_tc6_header_type {
@@ -213,25 +171,36 @@ static void oa_tc6_update_ctrl_write_data(struct oa_tc6 *tc6, u32 value[],
{
__be32 *tx_buf = tc6->spi_ctrl_tx_buf + OA_TC6_CTRL_HEADER_SIZE;
- for (int i = 0; i < length; i++)
+ for (int i = 0; i < length; i++) {
*tx_buf++ = cpu_to_be32(value[i]);
+ if (tc6->prot_ctrl)
+ *tx_buf++ = cpu_to_be32(~value[i]);
+ }
}
-static u16 oa_tc6_calculate_ctrl_buf_size(u8 length)
+static u16 oa_tc6_calculate_ctrl_buf_size(u8 length, bool ctrl_prot)
{
+ u32 reply_size = OA_TC6_CTRL_REG_VALUE_SIZE;
+
+ if (ctrl_prot)
+ reply_size += OA_TC6_CTRL_PROT_REPLY_SIZE;
+
/* Control command consists 4 bytes header + 4 bytes register value for
- * each register + 4 bytes ignored value.
+ * each register (+ 4 bytes for the register value complement in case
+ * protected mode is used) + 4 bytes ignored value.
*/
- return OA_TC6_CTRL_HEADER_SIZE + OA_TC6_CTRL_REG_VALUE_SIZE * length +
+ return OA_TC6_CTRL_HEADER_SIZE + reply_size * length +
OA_TC6_CTRL_IGNORED_SIZE;
}
static void oa_tc6_prepare_ctrl_spi_buf(struct oa_tc6 *tc6, u32 address,
u32 value[], u8 length,
- enum oa_tc6_register_op reg_op)
+ enum oa_tc6_register_op reg_op,
+ u16 buf_size)
{
__be32 *tx_buf = tc6->spi_ctrl_tx_buf;
+ memset(tx_buf, 0, buf_size);
*tx_buf = oa_tc6_prepare_ctrl_header(address, length, reg_op);
if (reg_op == OA_TC6_CTRL_REG_WRITE)
@@ -254,10 +223,12 @@ static int oa_tc6_check_ctrl_write_reply(struct oa_tc6 *tc6, u8 size)
return 0;
}
-static int oa_tc6_check_ctrl_read_reply(struct oa_tc6 *tc6, u8 size)
+static int oa_tc6_check_ctrl_read_reply(struct oa_tc6 *tc6, u8 length)
{
- u32 *rx_buf = tc6->spi_ctrl_rx_buf + OA_TC6_CTRL_IGNORED_SIZE;
- u32 *tx_buf = tc6->spi_ctrl_tx_buf;
+ __be32 *rx_buf = tc6->spi_ctrl_rx_buf + OA_TC6_CTRL_IGNORED_SIZE;
+ __be32 *tx_buf = tc6->spi_ctrl_tx_buf;
+ u32 complement;
+ u32 reply;
/* The echoed control read header must match with the one that was
* transmitted.
@@ -265,6 +236,20 @@ static int oa_tc6_check_ctrl_read_reply(struct oa_tc6 *tc6, u8 size)
if (*tx_buf != *rx_buf)
return -EPROTO;
+ if (tc6->prot_ctrl) {
+ /* Skip past the echoed header to the value/complement pairs */
+ rx_buf += 1;
+ for (int i = 0; i < length; i++) {
+ reply = be32_to_cpu(rx_buf[0]);
+ complement = be32_to_cpu(rx_buf[1]);
+
+ if (complement != ~reply)
+ return -EPROTO;
+
+ rx_buf += 2;
+ }
+ }
+
return 0;
}
@@ -274,8 +259,13 @@ static void oa_tc6_copy_ctrl_read_data(struct oa_tc6 *tc6, u32 value[],
__be32 *rx_buf = tc6->spi_ctrl_rx_buf + OA_TC6_CTRL_IGNORED_SIZE +
OA_TC6_CTRL_HEADER_SIZE;
- for (int i = 0; i < length; i++)
+ for (int i = 0; i < length; i++) {
value[i] = be32_to_cpu(*rx_buf++);
+
+ /* skip complement word */
+ if (tc6->prot_ctrl)
+ rx_buf++;
+ }
}
static int oa_tc6_perform_ctrl(struct oa_tc6 *tc6, u32 address, u32 value[],
@@ -284,10 +274,10 @@ static int oa_tc6_perform_ctrl(struct oa_tc6 *tc6, u32 address, u32 value[],
u16 size;
int ret;
- /* Prepare control command and copy to SPI control buffer */
- oa_tc6_prepare_ctrl_spi_buf(tc6, address, value, length, reg_op);
+ size = oa_tc6_calculate_ctrl_buf_size(length, tc6->prot_ctrl);
- size = oa_tc6_calculate_ctrl_buf_size(length);
+ /* Prepare control command and copy to SPI control buffer */
+ oa_tc6_prepare_ctrl_spi_buf(tc6, address, value, length, reg_op, size);
/* Perform SPI transfer */
ret = oa_tc6_spi_transfer(tc6, OA_TC6_CTRL_HEADER, size);
@@ -302,7 +292,7 @@ static int oa_tc6_perform_ctrl(struct oa_tc6 *tc6, u32 address, u32 value[],
return oa_tc6_check_ctrl_write_reply(tc6, size);
/* Check echoed/received control read command reply for errors */
- ret = oa_tc6_check_ctrl_read_reply(tc6, size);
+ ret = oa_tc6_check_ctrl_read_reply(tc6, length);
if (ret)
return ret;
@@ -355,6 +345,27 @@ int oa_tc6_read_register(struct oa_tc6 *tc6, u32 address, u32 *value)
}
EXPORT_SYMBOL_GPL(oa_tc6_read_register);
+/**
+ * oa_tc6_read_register_mms - function for reading a MAC-PHY register in a
+ * specified memory map.
+ * @tc6: oa_tc6 struct.
+ * @mms: Memory map selector for the register.
+ * @address: register address of the MAC-PHY to be read.
+ * @value: value read from the @address register address of the MAC-PHY.
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int oa_tc6_read_register_mms(struct oa_tc6 *tc6, u8 mms, u16 address,
+ u32 *value)
+{
+ u32 mms_reg;
+
+ mms_reg = FIELD_PREP(OA_TC6_REG_MMS_MASK, mms) | address;
+
+ return oa_tc6_read_registers(tc6, mms_reg, value, 1);
+}
+EXPORT_SYMBOL_GPL(oa_tc6_read_register_mms);
+
/**
* oa_tc6_write_registers - function for writing multiple consecutive registers.
* @tc6: oa_tc6 struct.
@@ -399,6 +410,27 @@ int oa_tc6_write_register(struct oa_tc6 *tc6, u32 address, u32 value)
}
EXPORT_SYMBOL_GPL(oa_tc6_write_register);
+/**
+ * oa_tc6_write_register_mms - function for writing a MAC-PHY register in a
+ * specified memory map.
+ * @tc6: oa_tc6 struct.
+ * @mms: Memory map selector for the register.
+ * @address: register address of the MAC-PHY to be written.
+ * @value: value to be written in the @address register address of the MAC-PHY.
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int oa_tc6_write_register_mms(struct oa_tc6 *tc6, u8 mms, u16 address,
+ u32 value)
+{
+ u32 mms_reg;
+
+ mms_reg = FIELD_PREP(OA_TC6_REG_MMS_MASK, mms) | address;
+
+ return oa_tc6_write_registers(tc6, mms_reg, &value, 1);
+}
+EXPORT_SYMBOL_GPL(oa_tc6_write_register_mms);
+
static int oa_tc6_check_phy_reg_direct_access_capability(struct oa_tc6 *tc6)
{
u32 regval;
@@ -408,7 +440,7 @@ static int oa_tc6_check_phy_reg_direct_access_capability(struct oa_tc6 *tc6)
if (ret)
return ret;
- if (!(regval & STDCAP_DIRECT_PHY_REG_ACCESS))
+ if (!(regval & OA_TC6_STDCAP_DIRECT_PHY_REG_ACCESS))
return -ENODEV;
return 0;
@@ -462,36 +494,39 @@ static int oa_tc6_get_phy_c45_mms(int devnum)
}
}
-static int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int devnum,
- int regnum)
+int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int devnum,
+ int regnum)
{
struct oa_tc6 *tc6 = bus->priv;
u32 regval;
+ int mms;
int ret;
- ret = oa_tc6_get_phy_c45_mms(devnum);
- if (ret < 0)
- return ret;
+ mms = oa_tc6_get_phy_c45_mms(devnum);
+ if (mms < 0)
+ return mms;
- ret = oa_tc6_read_register(tc6, (ret << 16) | regnum, ®val);
+ ret = oa_tc6_read_register_mms(tc6, mms, regnum, ®val);
if (ret)
return ret;
return regval;
}
+EXPORT_SYMBOL_GPL(oa_tc6_mdiobus_read_c45);
-static int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int devnum,
- int regnum, u16 val)
+int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int devnum,
+ int regnum, u16 val)
{
struct oa_tc6 *tc6 = bus->priv;
- int ret;
+ int mms;
- ret = oa_tc6_get_phy_c45_mms(devnum);
- if (ret < 0)
- return ret;
+ mms = oa_tc6_get_phy_c45_mms(devnum);
+ if (mms < 0)
+ return mms;
- return oa_tc6_write_register(tc6, (ret << 16) | regnum, val);
+ return oa_tc6_write_register_mms(tc6, mms, regnum, val);
}
+EXPORT_SYMBOL_GPL(oa_tc6_mdiobus_write_c45);
static int oa_tc6_mdiobus_register(struct oa_tc6 *tc6)
{
@@ -544,6 +579,9 @@ static int oa_tc6_phy_init(struct oa_tc6 *tc6)
{
int ret;
+ if (tc6->quirk_flags & OA_TC6_BROKEN_PHY)
+ return 0;
+
ret = oa_tc6_check_phy_reg_direct_access_capability(tc6);
if (ret) {
netdev_err(tc6->netdev,
@@ -580,6 +618,9 @@ static int oa_tc6_phy_init(struct oa_tc6 *tc6)
static void oa_tc6_phy_exit(struct oa_tc6 *tc6)
{
+ if (tc6->quirk_flags & OA_TC6_BROKEN_PHY)
+ return;
+
phy_disconnect(tc6->phydev);
oa_tc6_mdiobus_unregister(tc6);
}
@@ -601,7 +642,7 @@ static int oa_tc6_read_status0(struct oa_tc6 *tc6)
static int oa_tc6_sw_reset_macphy(struct oa_tc6 *tc6)
{
- u32 regval = RESET_SWRESET;
+ u32 regval = OA_TC6_RESET_SWRESET;
int ret;
ret = oa_tc6_write_register(tc6, OA_TC6_REG_RESET, regval);
@@ -610,7 +651,7 @@ static int oa_tc6_sw_reset_macphy(struct oa_tc6 *tc6)
/* Poll for soft reset complete for every 1ms until 1s timeout */
ret = readx_poll_timeout(oa_tc6_read_status0, tc6, regval,
- regval & STATUS0_RESETC,
+ regval & OA_TC6_STATUS0_RESETC,
STATUS0_RESETC_POLL_DELAY,
STATUS0_RESETC_POLL_TIMEOUT);
if (ret)
@@ -629,10 +670,10 @@ static int oa_tc6_unmask_macphy_error_interrupts(struct oa_tc6 *tc6)
if (ret)
return ret;
- regval &= ~(INT_MASK0_TX_PROTOCOL_ERR_MASK |
- INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK |
- INT_MASK0_LOSS_OF_FRAME_ERR_MASK |
- INT_MASK0_HEADER_ERR_MASK);
+ regval &= ~(OA_TC6_INT_MASK0_TX_PROTOCOL_ERR_MASK |
+ OA_TC6_INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK |
+ OA_TC6_INT_MASK0_LOSS_OF_FRAME_ERR_MASK |
+ OA_TC6_INT_MASK0_HEADER_ERR_MASK);
return oa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, regval);
}
@@ -647,7 +688,7 @@ static int oa_tc6_enable_data_transfer(struct oa_tc6 *tc6)
return ret;
/* Enable configuration synchronization for data transfer */
- value |= CONFIG0_SYNC;
+ value |= OA_TC6_CONFIG0_SYNC;
return oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, value);
}
@@ -692,7 +733,7 @@ static void oa_tc6_free_pending_skbs(struct oa_tc6 *tc6)
*/
static void oa_tc6_disable_traffic(struct oa_tc6 *tc6)
{
- u32 regval = INT_MASK0_ALL_INTERRUPTS;
+ u32 regval = OA_TC6_INT_MASK0_ALL_INTERRUPTS;
tc6->disable_traffic = true;
oa_tc6_free_pending_skbs(tc6);
@@ -722,25 +763,25 @@ static int oa_tc6_process_extended_status(struct oa_tc6 *tc6)
return ret;
}
- if (FIELD_GET(STATUS0_RX_BUFFER_OVERFLOW_ERROR, value)) {
+ if (FIELD_GET(OA_TC6_STATUS0_RX_BUFFER_OVERFLOW_ERROR, value)) {
tc6->rx_buf_overflow = true;
oa_tc6_cleanup_ongoing_rx_skb(tc6);
net_err_ratelimited("%s: Receive buffer overflow error\n",
tc6->netdev->name);
return -EAGAIN;
}
- if (FIELD_GET(STATUS0_TX_PROTOCOL_ERROR, value)) {
+ if (FIELD_GET(OA_TC6_STATUS0_TX_PROTOCOL_ERROR, value)) {
netdev_err(tc6->netdev, "Transmit protocol error\n");
return -ENODEV;
}
/* TODO: Currently loss of frame and header errors are treated as
* non-recoverable errors. They will be handled in the next version.
*/
- if (FIELD_GET(STATUS0_LOSS_OF_FRAME_ERROR, value)) {
+ if (FIELD_GET(OA_TC6_STATUS0_LOSS_OF_FRAME_ERROR, value)) {
netdev_err(tc6->netdev, "Loss of frame error\n");
return -ENODEV;
}
- if (FIELD_GET(STATUS0_HEADER_ERROR, value)) {
+ if (FIELD_GET(OA_TC6_STATUS0_HEADER_ERROR, value)) {
netdev_err(tc6->netdev, "Header error\n");
return -ENODEV;
}
@@ -1187,9 +1228,10 @@ static int oa_tc6_update_buffer_status_from_register(struct oa_tc6 *tc6)
if (ret)
return ret;
- tc6->tx_credits = FIELD_GET(BUFFER_STATUS_TX_CREDITS_AVAILABLE, value);
- tc6->rx_chunks_available = FIELD_GET(BUFFER_STATUS_RX_CHUNKS_AVAILABLE,
- value);
+ tc6->tx_credits = FIELD_GET(OA_TC6_BUFFER_STATUS_TX_CREDITS_AVAILABLE,
+ value);
+ tc6->rx_chunks_available =
+ FIELD_GET(OA_TC6_BUFFER_STATUS_RX_CHUNKS_AVAILABLE, value);
return 0;
}
@@ -1233,7 +1275,7 @@ int oa_tc6_zero_align_receive_frame_enable(struct oa_tc6 *tc6)
return ret;
/* Set Zero-Align Receive Frame Enable */
- regval |= CONFIG0_ZARFE_ENABLE;
+ regval |= OA_TC6_CONFIG0_ZARFE_ENABLE;
return oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, regval);
}
@@ -1272,15 +1314,31 @@ netdev_tx_t oa_tc6_start_xmit(struct oa_tc6 *tc6, struct sk_buff *skb)
}
EXPORT_SYMBOL_GPL(oa_tc6_start_xmit);
+static int oa_tc6_check_ctrl_protection(struct oa_tc6 *tc6)
+{
+ u32 regval;
+ int ret;
+
+ ret = oa_tc6_read_register(tc6, OA_TC6_REG_CONFIG0, ®val);
+ if (ret)
+ return ret;
+
+ tc6->prot_ctrl = FIELD_GET(OA_TC6_CONFIG0_PROTE, regval);
+
+ return 0;
+}
+
/**
* oa_tc6_init - allocates and initializes oa_tc6 structure.
* @spi: device with which data will be exchanged.
* @netdev: network device interface structure.
+ * @quirks: device specific modifiers for the OA TC6 protocol.
*
* Return: pointer reference to the oa_tc6 structure if the MAC-PHY
* initialization is successful otherwise NULL.
*/
-struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)
+struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
+ struct oa_tc6_quirks *quirks)
{
struct oa_tc6 *tc6;
int ret;
@@ -1295,6 +1353,9 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)
mutex_init(&tc6->spi_ctrl_lock);
spin_lock_init(&tc6->tx_skb_lock);
+ if (quirks)
+ tc6->quirk_flags = quirks->quirk_flags;
+
/* Set the SPI controller to pump at realtime priority */
tc6->spi->rt = true;
if (spi_setup(tc6->spi) < 0)
@@ -1324,6 +1385,14 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)
if (!tc6->spi_data_rx_buf)
return NULL;
+ /* Check the PROTE bit status so that we can reset the device */
+ ret = oa_tc6_check_ctrl_protection(tc6);
+ if (ret) {
+ dev_err(&tc6->spi->dev,
+ "Failed to check the protection mode: %d\n", ret);
+ return NULL;
+ }
+
ret = oa_tc6_sw_reset_macphy(tc6);
if (ret) {
dev_err(&tc6->spi->dev,
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 099f25dceabbc7..a29d3fed8a053c 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -136,6 +136,12 @@ config ADIN1100_PHY
Currently supports the:
- ADIN1100 - Robust,Industrial, Low Power 10BASE-T1L Ethernet PHY
+config ADIN1140_PHY
+ tristate "Analog Devices ADIN1140 10BASE-T1S PHY"
+ help
+ Adds support for the Analog Devices, Inc. ADIN1140's internal
+ 10BASE-T1S PHY.
+
config AMCC_QT2025_PHY
tristate "AMCC QT2025 PHY"
depends on RUST_PHYLIB_ABSTRACTIONS
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index de660ae949453d..e23df5e836e9ea 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -29,6 +29,7 @@ obj-y += $(sfp-obj-y) $(sfp-obj-m)
obj-$(CONFIG_ADIN_PHY) += adin.o
obj-$(CONFIG_ADIN1100_PHY) += adin1100.o
+obj-$(CONFIG_ADIN1140_PHY) += adin1140-phy.o
obj-$(CONFIG_AIR_AN8801_PHY) += air_an8801.o
obj-$(CONFIG_AIR_EN8811H_PHY) += air_en8811h.o
obj-$(CONFIG_AIR_NET_PHYLIB) += air_phy_lib.o
diff --git a/drivers/net/phy/adin1140-phy.c b/drivers/net/phy/adin1140-phy.c
new file mode 100644
index 00000000000000..d35da4ad680daa
--- /dev/null
+++ b/drivers/net/phy/adin1140-phy.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Driver for Analog Devices, Inc. ADIN1140 10BASE-T1S PHY
+ *
+ * Copyright 2026 Analog Devices Inc.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/phy.h>
+
+#define ADIN1140_PHY_ID 0x0283be00
+
+#define ADIN1140_PCS_CTRL 0x08f3
+#define ADIN1140_PCS_CTRL_LOOPBACK BIT(14)
+
+static int adin1140_config_aneg(struct phy_device *phydev)
+{
+ /* phylib tries to clear BIT(12) in MDIO_CTRL1, since AN is disabled.
+ * However, on the ADIN1140, that field is non-standard, being used
+ * to control the reset status of the PHY (thus it needs to remain set).
+ */
+ return 0;
+}
+
+static int adin1140_loopback(struct phy_device *phydev, bool enable, int speed)
+{
+ if (enable && speed)
+ return -EOPNOTSUPP;
+
+ return phy_modify_mmd(phydev, MDIO_MMD_PCS, ADIN1140_PCS_CTRL,
+ ADIN1140_PCS_CTRL_LOOPBACK,
+ enable ? ADIN1140_PCS_CTRL_LOOPBACK : 0);
+}
+
+static int adin1140_read_status(struct phy_device *phydev)
+{
+ phydev->link = 1;
+ phydev->duplex = DUPLEX_HALF;
+ phydev->speed = SPEED_10;
+ phydev->autoneg = AUTONEG_DISABLE;
+
+ return 0;
+}
+
+static struct phy_driver adin1140_driver[] = {
+ {
+ PHY_ID_MATCH_EXACT(ADIN1140_PHY_ID),
+ .name = "ADIN1140_PHY",
+ .features = PHY_BASIC_T1S_P2MP_FEATURES,
+ .read_status = adin1140_read_status,
+ .config_aneg = adin1140_config_aneg,
+ .set_loopback = adin1140_loopback,
+ .read_mmd = genphy_read_mmd_c45,
+ .write_mmd = genphy_write_mmd_c45,
+ .get_plca_cfg = genphy_c45_plca_get_cfg,
+ .set_plca_cfg = genphy_c45_plca_set_cfg,
+ .get_plca_status = genphy_c45_plca_get_status,
+ },
+};
+module_phy_driver(adin1140_driver);
+
+static const struct mdio_device_id __maybe_unused adin1140_tbl[] = {
+ { PHY_ID_MATCH_EXACT(ADIN1140_PHY_ID) },
+ { }
+};
+
+MODULE_DEVICE_TABLE(mdio, adin1140_tbl);
+
+MODULE_DESCRIPTION("Analog Devices, Inc. ADIN1140 10BASE-T1S PHY");
+MODULE_AUTHOR("Ciprian Regus <ciprian.regus@analog.com>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/phy/microchip_t1s.c b/drivers/net/phy/microchip_t1s.c
index e601d56b2507f9..73c23d311d72aa 100644
--- a/drivers/net/phy/microchip_t1s.c
+++ b/drivers/net/phy/microchip_t1s.c
@@ -506,34 +506,6 @@ static int lan86xx_read_status(struct phy_device *phydev)
return 0;
}
-/* OPEN Alliance 10BASE-T1x compliance MAC-PHYs will have both C22 and
- * C45 registers space. If the PHY is discovered via C22 bus protocol it assumes
- * it uses C22 protocol and always uses C22 registers indirect access to access
- * C45 registers. This is because, we don't have a clean separation between
- * C22/C45 register space and C22/C45 MDIO bus protocols. Resulting, PHY C45
- * registers direct access can't be used which can save multiple SPI bus access.
- * To support this feature, set .read_mmd/.write_mmd in the PHY driver to call
- * .read_c45/.write_c45 in the OPEN Alliance framework
- * drivers/net/ethernet/oa_tc6.c
- */
-static int lan865x_phy_read_mmd(struct phy_device *phydev, int devnum,
- u16 regnum)
-{
- struct mii_bus *bus = phydev->mdio.bus;
- int addr = phydev->mdio.addr;
-
- return __mdiobus_c45_read(bus, addr, devnum, regnum);
-}
-
-static int lan865x_phy_write_mmd(struct phy_device *phydev, int devnum,
- u16 regnum, u16 val)
-{
- struct mii_bus *bus = phydev->mdio.bus;
- int addr = phydev->mdio.addr;
-
- return __mdiobus_c45_write(bus, addr, devnum, regnum, val);
-}
-
static struct phy_driver microchip_t1s_driver[] = {
{
PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1),
@@ -584,8 +556,8 @@ static struct phy_driver microchip_t1s_driver[] = {
.features = PHY_BASIC_T1S_P2MP_FEATURES,
.config_init = lan865x_revb_config_init,
.read_status = lan86xx_read_status,
- .read_mmd = lan865x_phy_read_mmd,
- .write_mmd = lan865x_phy_write_mmd,
+ .read_mmd = genphy_read_mmd_c45,
+ .write_mmd = genphy_write_mmd_c45,
.get_plca_cfg = genphy_c45_plca_get_cfg,
.set_plca_cfg = lan86xx_plca_set_cfg,
.get_plca_status = genphy_c45_plca_get_status,
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 0615228459ef42..94b2e85e00a379 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2770,6 +2770,31 @@ int genphy_read_abilities(struct phy_device *phydev)
}
EXPORT_SYMBOL(genphy_read_abilities);
+/* Some PHYs support direct C45 register access but not C22 indirect
+ * MMD access (registers 13 and 14). When discovered via C22, phylib
+ * routes MMD access through the indirect path, which won't work on
+ * these devices. These helpers bypass indirect access and use the bus
+ * C45 accessors directly.
+ */
+int genphy_read_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum)
+{
+ struct mii_bus *bus = phydev->mdio.bus;
+ int addr = phydev->mdio.addr;
+
+ return __mdiobus_c45_read(bus, addr, devnum, regnum);
+}
+EXPORT_SYMBOL(genphy_read_mmd_c45);
+
+int genphy_write_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum,
+ u16 val)
+{
+ struct mii_bus *bus = phydev->mdio.bus;
+ int addr = phydev->mdio.addr;
+
+ return __mdiobus_c45_write(bus, addr, devnum, regnum, val);
+}
+EXPORT_SYMBOL(genphy_write_mmd_c45);
+
/* This is used for the phy device which doesn't support the MMD extended
* register access, but it does have side effect when we are trying to access
* the MMD register via indirect method.
diff --git a/include/linux/oa_tc6.h b/include/linux/oa_tc6.h
index 15f58e3c56c740..27f652d4920b22 100644
--- a/include/linux/oa_tc6.h
+++ b/include/linux/oa_tc6.h
@@ -10,15 +10,86 @@
#include <linux/etherdevice.h>
#include <linux/spi/spi.h>
+/* OPEN Alliance TC6 registers */
+/* Standard Capabilities Register */
+#define OA_TC6_REG_STDCAP 0x0002
+#define OA_TC6_STDCAP_DIRECT_PHY_REG_ACCESS BIT(8)
+
+/* Reset Control and Status Register */
+#define OA_TC6_REG_RESET 0x0003
+#define OA_TC6_RESET_SWRESET BIT(0) /* Software Reset */
+
+/* Configuration Register #0 */
+#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_PROTE BIT(5)
+
+/* Configuration Register #2 */
+#define OA_TC6_REG_CONFIG2 0x0006
+
+/* Status Register #0 */
+#define OA_TC6_REG_STATUS0 0x0008
+#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)
+#define OA_TC6_STATUS0_RX_BUFFER_OVERFLOW_ERROR BIT(3)
+#define OA_TC6_STATUS0_TX_PROTOCOL_ERROR BIT(0)
+
+/* Buffer Status Register */
+#define OA_TC6_REG_BUFFER_STATUS 0x000B
+#define OA_TC6_BUFFER_STATUS_TX_CREDITS_AVAILABLE GENMASK(15, 8)
+#define OA_TC6_BUFFER_STATUS_RX_CHUNKS_AVAILABLE GENMASK(7, 0)
+
+/* Interrupt Mask Register #0 */
+#define OA_TC6_REG_INT_MASK0 0x000C
+#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)
+#define OA_TC6_INT_MASK0_TX_PROTOCOL_ERR_MASK BIT(0)
+#define OA_TC6_INT_MASK0_ALL_INTERRUPTS (GENMASK(5, 0) | \
+ GENMASK(12, 7))
+
+/* PHY Clause 22 registers base address and mask */
+#define OA_TC6_PHY_STD_REG_ADDR_BASE 0xFF00
+#define OA_TC6_PHY_STD_REG_ADDR_MASK 0x1F
+
+/* Memory map selector (MMS) values as per table 6 in the
+ * OPEN Alliance specification.
+ */
+#define OA_TC6_MAC_MMS1 1
+#define OA_TC6_PHY_C45_PCS_MMS2 2 /* MMD 3 */
+#define OA_TC6_PHY_C45_PMA_PMD_MMS3 3 /* MMD 1 */
+#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 */
+
struct oa_tc6;
-struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev);
+enum oa_tc6_quirk_flag {
+ OA_TC6_BROKEN_PHY = BIT(0),
+};
+
+struct oa_tc6_quirks {
+ enum oa_tc6_quirk_flag quirk_flags;
+};
+
+struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
+ struct oa_tc6_quirks *quirks);
void oa_tc6_exit(struct oa_tc6 *tc6);
int oa_tc6_write_register(struct oa_tc6 *tc6, u32 address, u32 value);
+int oa_tc6_write_register_mms(struct oa_tc6 *tc6, u8 mms, u16 address,
+ u32 value);
int oa_tc6_write_registers(struct oa_tc6 *tc6, u32 address, u32 value[],
u8 length);
int oa_tc6_read_register(struct oa_tc6 *tc6, u32 address, u32 *value);
+int oa_tc6_read_register_mms(struct oa_tc6 *tc6, u8 mms, u16 address,
+ u32 *value);
int oa_tc6_read_registers(struct oa_tc6 *tc6, u32 address, u32 value[],
u8 length);
netdev_tx_t oa_tc6_start_xmit(struct oa_tc6 *tc6, struct sk_buff *skb);
int oa_tc6_zero_align_receive_frame_enable(struct oa_tc6 *tc6);
+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);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 199a7aaa341bfd..432d44188dbc58 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -2297,6 +2297,9 @@ static inline int genphy_no_config_intr(struct phy_device *phydev)
{
return 0;
}
+int genphy_read_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum);
+int genphy_write_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum,
+ u16 val);
int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad,
u16 regnum);
int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum,
|
| 3/2 | 2026/07/08 09:22 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 26307 output: 20 thoughts: 757 Thoughts: **Reaching the ADIN1140 Driver with Syzkaller** Okay, so we've got this patch series introducing support for the ADIN1140 MAC-PHY. We've got new drivers, `adin1140.c` and `adin1140-phy.c`, and modifications to `oa_tc6.c`. The immediate question is: can we fuzz this thing? It's an SPI-connected network driver, using `oa_tc6`, which is an SPI protocol for MAC-PHYs. My initial thought is yes, syzkaller *can* fuzz SPI devices. If the driver is enabled, we're building a netdev. The netdev interface is reachable, right? So, syzkaller *should* be able to create this netdev if it can instantiate the SPI device. The issue, though, is how it gets instantiated. SPI devices are tricky. They usually need Device Tree or specific board code. Syzkaller *could* potentially use `syz_dev_spi` or a similar function, or maybe it just fuzzes the netdev if it's somehow instantiated, but I'm not confident about that. I need to think about alternatives. Okay, syzkaller can use `syz_genetlink` or other methods, but SPI typically relies on DT. Wait, it *does* have a way to instantiate I2C/SPI devices via `syz_i2c_setup` etc., but even if it doesn't, the netdev interface should be reachable *if* the device probes. If it *doesn't* probe, then the netdev isn't created, and we're stuck. But, that's the rub, isn't it? How does this SPI device probe in a virtual environment? Usually, SPI devices need DT nodes, right? Syzkaller could inject DT overlays or use `spi_new_device` *if* it has a way, but the prompt highlights the problem of being unreachable in virtual environments. It mentions "Code paths that are impossible to reach in virtualized environments," which is the core issue. Can QEMU help? Does QEMU even have ADIN1140 emulation? No. What about Syzkaller's tricks? It uses `mac80211_hwsim`, `vkms`, etc., but can they instantiate arbitrary SPI devices? No. There's also `CONFIG_SPI_LOOPBACK_TEST` and `CONFIG_SPI_MOCKUP` – maybe that’s a way? No. Ah, but syzkaller *does* fuzz SPI drivers *if* they can be instantiated. So, it comes down to *reaching* the driver. This patch modifies `oa_tc6.c`, which is a framework. Maybe that is reachable if some other driver uses it? That is something I should check. Let's look for `oa_tc6_init` callers to see how else this might be exercised. |
| 4/2 | 2026/07/08 09:22 | tool | grepper |
0mArgs:{
"Expression": "oa_tc6_init"
}Results: {
"Output": "Documentation/networking/oa-tc6-framework.rst=454=The include/linux/oa_tc6.h defines the following functions:\nDocumentation/networking/oa-tc6-framework.rst-455-\nDocumentation/networking/oa-tc6-framework.rst:456:.. c:function:: struct oa_tc6 *oa_tc6_init(struct spi_device *spi, \\\nDocumentation/networking/oa-tc6-framework.rst-457- 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 (!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 (!priv-\u003etc6) {\n--\ndrivers/net/ethernet/oa_tc6.c=1317=static int oa_tc6_check_ctrl_protection(struct oa_tc6 *tc6)\n--\ndrivers/net/ethernet/oa_tc6.c-1331-/**\ndrivers/net/ethernet/oa_tc6.c:1332: * oa_tc6_init - allocates and initializes oa_tc6 structure.\ndrivers/net/ethernet/oa_tc6.c-1333- * @spi: device with which data will be exchanged.\n--\ndrivers/net/ethernet/oa_tc6.c-1339- */\ndrivers/net/ethernet/oa_tc6.c:1340:struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,\ndrivers/net/ethernet/oa_tc6.c-1341-\t\t\t struct oa_tc6_quirks *quirks)\n--\ndrivers/net/ethernet/oa_tc6.c-1456-}\ndrivers/net/ethernet/oa_tc6.c:1457:EXPORT_SYMBOL_GPL(oa_tc6_init);\ndrivers/net/ethernet/oa_tc6.c-1458-\n--\ninclude/linux/oa_tc6.h=73=struct oa_tc6_quirks {\n--\ninclude/linux/oa_tc6.h-76-\ninclude/linux/oa_tc6.h:77:struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,\ninclude/linux/oa_tc6.h-78-\t\t\t struct oa_tc6_quirks *quirks);\n"
} |
| 5/2 | 2026/07/08 09:22 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 28610 output: 18 thoughts: 247 Thoughts: **My Assessment of SPI Device Fuzzing Feasibility with Syzkaller** Okay, so I'm looking at how `oa_tc6_init` gets called – it's used by `adin1140.c` and `lan865x.c`, both SPI devices. My immediate thought is, "Can we effectively fuzz these with syzkaller?" The tricky part is syzkaller's lack of built-in support for emulating arbitrary SPI devices. If a driver *is* SPI-based, it's usually difficult to reach unless there's a specific mock driver or it's a platform device that can be instantiated somehow. Then I paused – wait, isn't there the `syz_dev_spi` pseudo-syscall, or perhaps through writing to a `/sys/devices/.../spi_master/.../new_device` type thing? No, that's wrong. SPI doesn't offer a `new_device` sysfs attribute like I2C does, which immediately blocks that approach. But hang on, there *might* be workarounds. Could we exploit `syz_genetlink` or something similar, some generic method for adding devices from userspace? For SPI, that seems unlikely without a driver-specific trick like `spi-mockup`. Therefore, the next logical step is to check if an SPI mockup driver exists within the kernel. I need to know if there's a pre-existing infrastructure that might allow me to test these drivers effectively. |
| 6/2 | 2026/07/08 09:23 | tool | grepper |
0mError:no matches Args: {
"Expression": "spi-mockup"
}Results: {
"error": "no matches"
} |
| 7/2 | 2026/07/08 09:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 29212 output: 18 thoughts: 12 Thoughts: Okay, let's see. My first thought is: **SPI Support in syzkaller? Let's Investigate.** I need to quickly determine if syzkaller currently incorporates support for SPI (Serial Peripheral Interface). I'm quite familiar with its architecture and recent developments, so this shouldn't take long. My plan is to mentally run through the potential locations where this functionality might be implemented, checking for relevant keywords or mentions within the code or documentation. I'll focus on the target architectures I'm most interested in at the moment as a shortcut. If SPI support is present, I need to know the extent of that support - are there relevant syscall definitions, fuzz targets, or perhaps even device driver emulation? If it's missing, then I need to figure out what level of work would be required to introduce it. |
| 8/2 | 2026/07/08 09:23 | tool | grepper |
0mError:no matches Args: {
"Expression": "syz_spi"
}Results: {
"error": "no matches"
} |
| 9/2 | 2026/07/08 09:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 29428 output: 19 thoughts: 14 Thoughts: Okay, here's my attempt at summarizing that thought process, keeping in mind I'm speaking to a fellow expert: **Investigating SPI Device Instantiation** Right, let's take a quick look. I'm pondering the best approach to actually get these SPI devices instantiated. We've got the general framework in place, of course, but now I'm thinking specifically about the mechanisms we'll use. Are there specific patterns, perhaps an established library we can lean on, or maybe a more flexible, custom approach that suits this implementation best? I need to think this through and identify all the methods. |
| 10/2 | 2026/07/08 09:23 | tool | grepper |
0mArgs:{
"Expression": "spi_new_device"
}Results: {
"Output": "drivers/media/pci/mgb4/mgb4_core.c=161=static int init_spi(struct mgb4_dev *mgbdev, u32 devid)\n--\ndrivers/media/pci/mgb4/mgb4_core.c-247-\ndrivers/media/pci/mgb4/mgb4_core.c:248:\tspi_dev = spi_new_device(ctlr, \u0026spi_info);\ndrivers/media/pci/mgb4/mgb4_core.c-249-\tput_device(\u0026ctlr-\u003edev);\n--\ndrivers/media/pci/netup_unidvb/netup_unidvb_spi.c=173=int netup_spi_init(struct netup_unidvb_dev *ndev)\n--\ndrivers/media/pci/netup_unidvb/netup_unidvb_spi.c-209-\t\tndev-\u003epci_func);\ndrivers/media/pci/netup_unidvb/netup_unidvb_spi.c:210:\tif (!spi_new_device(ctlr, \u0026netup_spi_board)) {\ndrivers/media/pci/netup_unidvb/netup_unidvb_spi.c-211-\t\tspi_unregister_controller(ctlr);\n--\ndrivers/media/v4l2-core/v4l2-spi.c=36=struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev,\n--\ndrivers/media/v4l2-core/v4l2-spi.c-47-\ndrivers/media/v4l2-core/v4l2-spi.c:48:\tspi = spi_new_device(ctlr, info);\ndrivers/media/v4l2-core/v4l2-spi.c-49-\n--\ndrivers/platform/x86/x86-android-tablets/core.c=236=static __init int x86_instantiate_spi_dev(const struct x86_dev_info *dev_info, int idx)\n--\ndrivers/platform/x86/x86-android-tablets/core.c-266-\ndrivers/platform/x86/x86-android-tablets/core.c:267:\tspi_devs[idx] = spi_new_device(controller, \u0026board_info);\ndrivers/platform/x86/x86-android-tablets/core.c-268-\tput_device(\u0026controller-\u003edev);\n--\ndrivers/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-119-\t\tfor (i = 0; i \u003c pdata-\u003enum_devices; i++) {\ndrivers/spi/spi-altera-platform.c:120:\t\t\tif (!spi_new_device(host, pdata-\u003edevices + i))\ndrivers/spi/spi-altera-platform.c-121-\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=313=static int cs42l43_spi_probe(struct platform_device *pdev)\n--\ndrivers/spi/spi-cs42l43.c-427-\ndrivers/spi/spi-cs42l43.c:428:\t\tif (!spi_new_device(priv-\u003ectlr, ampl_info))\ndrivers/spi/spi-cs42l43.c-429-\t\t\treturn dev_err_probe(priv-\u003edev, -ENODEV,\n--\ndrivers/spi/spi-cs42l43.c-431-\ndrivers/spi/spi-cs42l43.c:432:\t\tif (!spi_new_device(priv-\u003ectlr, ampr_info))\ndrivers/spi/spi-cs42l43.c-433-\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=792=EXPORT_SYMBOL_GPL(spi_add_device);\n--\ndrivers/spi/spi.c-794-/**\ndrivers/spi/spi.c:795: * spi_new_device - instantiate one new SPI device\ndrivers/spi/spi.c-796- * @ctlr: Controller to which device is connected\n--\ndrivers/spi/spi.c-807- */\ndrivers/spi/spi.c:808:struct spi_device *spi_new_device(struct spi_controller *ctlr,\ndrivers/spi/spi.c-809-\t\t\t\t struct spi_board_info *chip)\n--\ndrivers/spi/spi.c-863-}\ndrivers/spi/spi.c:864:EXPORT_SYMBOL_GPL(spi_new_device);\ndrivers/spi/spi.c-865-\n--\ndrivers/spi/spi.c=894=static void spi_match_controller_to_boardinfo(struct spi_controller *ctlr,\n--\ndrivers/spi/spi.c-901-\ndrivers/spi/spi.c:902:\tdev = spi_new_device(ctlr, bi);\ndrivers/spi/spi.c-903-\tif (!dev)\n--\ndrivers/staging/greybus/spilib.c=441=static int gb_spi_setup_device(struct gb_spilib *spi, u8 cs)\n--\ndrivers/staging/greybus/spilib.c-477-\ndrivers/staging/greybus/spilib.c:478:\tspidev = spi_new_device(ctlr, \u0026spi_board);\ndrivers/staging/greybus/spilib.c-479-\tif (!spidev)\n--\ninclude/linux/spi/spi.h=1612=static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd)\n--\ninclude/linux/spi/spi.h-1652- * @bus_num: Identifies which spi_controller parents the spi_device; unused\ninclude/linux/spi/spi.h:1653: *\tby spi_new_device(), and otherwise depends on board wiring.\ninclude/linux/spi/spi.h-1654- * @chip_select: Initializes spi_device.chip_select; depends on how\n--\ninclude/linux/spi/spi.h-1669- * initializes. A secondary (and atypical) role is as a parameter to\ninclude/linux/spi/spi.h:1670: * spi_new_device() call, which happens after those controller drivers\ninclude/linux/spi/spi.h-1671- * are active in some dynamic board configuration models.\n--\ninclude/linux/spi/spi.h=1722=spi_register_board_info(struct spi_board_info const *info, unsigned n)\n--\ninclude/linux/spi/spi.h-1727- * If you're hotplugging an adapter with devices (parport, USB, etc)\ninclude/linux/spi/spi.h:1728: * use spi_new_device() to describe each device. You can also call\ninclude/linux/spi/spi.h-1729- * spi_unregister_device() to start making that device vanish, but\n--\ninclude/linux/spi/spi.h=1744=extern struct spi_device *\ninclude/linux/spi/spi.h:1745:spi_new_device(struct spi_controller *, struct spi_board_info *);\ninclude/linux/spi/spi.h-1746-\n--\nsound/soc/codecs/rt5575-spi.c=25=struct spi_device *rt5575_spi_get_device(struct device *dev)\n--\nsound/soc/codecs/rt5575-spi.c-53-\nsound/soc/codecs/rt5575-spi.c:54:\tspi = spi_new_device(ctlr, \u0026(struct spi_board_info){\nsound/soc/codecs/rt5575-spi.c-55-\t\t.modalias = \"rt5575\",\n"
} |
| 11/2 | 2026/07/08 09:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 32739 output: 17 thoughts: 570 Thoughts: **Reaching that SPI Device in a Virtualized Environment** Okay, so I'm thinking about this `greybus` and the `gb_spi_setup_device` function using `spi_new_device`. Can I fuzz this through something like `syz_genetlink`? Probably not, syzkaller doesn't have a direct, generic way to create SPI devices, as far as I know. Wait, is there a backdoor in `sysfs`? Nope, no `new_device` entry there either. Hmm, what about something like `CONFIG_SPI_SLAVE` or `CONFIG_SPI_LOOPBACK_TEST`? Hold on... the patch is touching `drivers/net/ethernet/oa_tc6.c` which is a core framework, and then adding `adin1140.c`. Maybe this is unreachable due to where it is. But the prompt! It specifically mentions paths that are *unreachable* in virtualized environments like GCE or QEMU, even with emulated hardware like USB or `mac80211_hwsim`. Is there even a software-emulated SPI controller in the kernel? I thought about `spi-mockup`, but grep didn't turn anything up. `spi-loopback-test` only tests controllers, not devices. Also, `mac80211_hwsim` is for WiFi so I can rule that out. Okay, so how *do* I instantiate SPI devices? Syzkaller can fuzz them *if* they're already instantiated. Does `syz_dev_spi` exist? Nope, doesn't. Aha! Syzkaller uses `devicetree` overlays! Right, it can inject those to create devices! I can inject an overlay that creates an SPI controller, like `spi-gpio` or `spi-fsl-dspi`, and then add an SPI device on it! Let's see... is `spi-gpio` available? Yes, it is! And the DT overlay can specify a `compatible` string like "adi,ad3306" or "adi,adin1140"! That means the `adin1140.c` driver will probe. Since it's using `spi-gpio`, the SPI controller is just bitbanging GPIOs, and those GPIOs can be backed by `gpio-mockup` or `gpio-sim`. So, yes, this IS reachable in a virtualized environment! Excellent! Time to make sure `spi-gpio` is present. |
| 12/2 | 2026/07/08 09:23 | tool | grepper |
0mArgs:{
"Expression": "spi-gpio"
}Results: {
"Output": "Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml=58=examples:\n--\nDocumentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml-63- spi {\nDocumentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml:64: compatible = \"spi-gpio\";\nDocumentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml-65- sck-gpios = \u003c\u0026gpio 0 GPIO_ACTIVE_HIGH\u003e;\n--\nDocumentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml=52=examples:\n--\nDocumentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml-56- spi {\nDocumentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml:57: compatible = \"spi-gpio\";\nDocumentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml-58- sck-gpios = \u003c\u0026gpio 0 GPIO_ACTIVE_HIGH\u003e;\n--\nDocumentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml=59=examples:\n--\nDocumentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml-64- spi {\nDocumentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml:65: compatible = \"spi-gpio\";\nDocumentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml-66- sck-gpios = \u003c\u0026gpio 0 GPIO_ACTIVE_HIGH\u003e;\n--\nDocumentation/devicetree/bindings/leds/leds-bcm6328.yaml=12=description: |\n--\nDocumentation/devicetree/bindings/leds/leds-bcm6328.yaml-16- controller), which can either be controlled by software (exporting the 74x164\nDocumentation/devicetree/bindings/leds/leds-bcm6328.yaml:17: as spi-gpio. See\nDocumentation/devicetree/bindings/leds/leds-bcm6328.yaml-18- Documentation/devicetree/bindings/gpio/fairchild,74hc595.yaml), or by hardware\n--\nDocumentation/devicetree/bindings/leds/leds-bcm6328.yaml-20- Some of these Serial LEDs are hardware controlled (e.g. ethernet LEDs) and\nDocumentation/devicetree/bindings/leds/leds-bcm6328.yaml:21: exporting the 74x164 as spi-gpio prevents those LEDs to be hardware\nDocumentation/devicetree/bindings/leds/leds-bcm6328.yaml-22- controlled, so the only chance to keep them working is by using this driver.\n--\nDocumentation/devicetree/bindings/leds/leds-bcm6358.txt=4=In these SoCs there are Serial LEDs (LEDs connected to a 74x164 controller),\nDocumentation/devicetree/bindings/leds/leds-bcm6358.txt:5:which can either be controlled by software (exporting the 74x164 as spi-gpio.\nDocumentation/devicetree/bindings/leds/leds-bcm6358.txt-6-See Documentation/devicetree/bindings/gpio/fairchild,74hc595.yaml), or\n--\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml-3----\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml:4:$id: http://devicetree.org/schemas/spi/spi-gpio.yaml#\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml-5-$schema: http://devicetree.org/meta-schemas/core.yaml#\n--\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml=19=properties:\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml-20- compatible:\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml:21: const: spi-gpio\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml-22-\n--\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml=58=examples:\n--\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml-60- spi {\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml:61: compatible = \"spi-gpio\";\nDocumentation/devicetree/bindings/spi/spi-gpio.yaml-62- #address-cells = \u003c0x1\u003e;\n--\nDocumentation/driver-api/gpio/drivers-on-gpio.rst=8=hardware descriptions such as device tree or ACPI:\n--\nDocumentation/driver-api/gpio/drivers-on-gpio.rst-57-\nDocumentation/driver-api/gpio/drivers-on-gpio.rst:58:- spi_gpio: drivers/spi/spi-gpio.c is used to drive an SPI bus (variable number\nDocumentation/driver-api/gpio/drivers-on-gpio.rst-59- of wires, at least SCK and optionally MISO, MOSI and chip select lines) using\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-anacapa.dts=124=\tspi_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-anacapa.dts:125:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-anacapa.dts-126-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-bletchley.dts=37=\tspi1_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-bletchley.dts:38:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-bletchley.dts-39-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-catalina.dts=79=\tspi1_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-catalina.dts:80:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-catalina.dts-81-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-clemente.dts=147=\tspi1_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-clemente.dts:148:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-clemente.dts-149-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-harma.dts=69=\tspi_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-harma.dts-70-\t\tstatus = \"okay\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-harma.dts:71:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-harma.dts-72-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-minerva.dts=111=\tspi_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-minerva.dts-112-\t\tstatus = \"okay\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-minerva.dts:113:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-minerva.dts-114-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-rainiera6.dts=82=\tspi_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-rainiera6.dts:83:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-rainiera6.dts-84-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-sanmiguel.dts=73=\tspi2_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-sanmiguel.dts:74:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-sanmiguel.dts-75-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dts=127=\tspi_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dts:128:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-santabarbara.dts-129-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-wedge400-data64.dts=70=\tspi_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-wedge400-data64.dts-71-\t\tstatus = \"okay\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-wedge400-data64.dts:72:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-wedge400-data64.dts-73-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts=73=\tspi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts:74:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts-75-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite5.dts=78=\tspi_gpio: spi {\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite5.dts:79:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite5.dts-80-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/aspeed/ast2600-facebook-netbmc-common.dtsi=28=\tspi_gpio: spi {\narch/arm/boot/dts/aspeed/ast2600-facebook-netbmc-common.dtsi-29-\t\tstatus = \"okay\";\narch/arm/boot/dts/aspeed/ast2600-facebook-netbmc-common.dtsi:30:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/aspeed/ast2600-facebook-netbmc-common.dtsi-31-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/broadcom/bcm4708-buffalo-wzr-1166dhp-common.dtsi=16=\tspi {\narch/arm/boot/dts/broadcom/bcm4708-buffalo-wzr-1166dhp-common.dtsi:17:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/broadcom/bcm4708-buffalo-wzr-1166dhp-common.dtsi-18-\t\tnum-chipselects = \u003c1\u003e;\n--\narch/arm/boot/dts/broadcom/bcm4708-buffalo-wzr-1750dhp.dts=28=\tspi {\narch/arm/boot/dts/broadcom/bcm4708-buffalo-wzr-1750dhp.dts:29:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/broadcom/bcm4708-buffalo-wzr-1750dhp.dts-30-\t\tnum-chipselects = \u003c1\u003e;\n--\narch/arm/boot/dts/broadcom/bcm47081-buffalo-wzr-600dhp2.dts=28=\tspi {\narch/arm/boot/dts/broadcom/bcm47081-buffalo-wzr-600dhp2.dts:29:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/broadcom/bcm47081-buffalo-wzr-600dhp2.dts-30-\t\tnum-chipselects = \u003c1\u003e;\n--\narch/arm/boot/dts/broadcom/bcm47081-buffalo-wzr-900dhp.dts=28=\tspi {\narch/arm/boot/dts/broadcom/bcm47081-buffalo-wzr-900dhp.dts:29:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/broadcom/bcm47081-buffalo-wzr-900dhp.dts-30-\t\tnum-chipselects = \u003c1\u003e;\n--\narch/arm/boot/dts/broadcom/bcm947189acdbmr.dts=60=\tspi {\narch/arm/boot/dts/broadcom/bcm947189acdbmr.dts:61:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/broadcom/bcm947189acdbmr.dts-62-\t\tnum-chipselects = \u003c1\u003e;\n--\narch/arm/boot/dts/gemini/gemini-dlink-dir-685.dts=58=\tspi {\narch/arm/boot/dts/gemini/gemini-dlink-dir-685.dts:59:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/gemini/gemini-dlink-dir-685.dts-60-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/gemini/gemini-sl93512r.dts=85=\tspi {\narch/arm/boot/dts/gemini/gemini-sl93512r.dts:86:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/gemini/gemini-sl93512r.dts-87-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/gemini/gemini-sq201.dts=70=\tspi {\narch/arm/boot/dts/gemini/gemini-sq201.dts:71:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/gemini/gemini-sq201.dts-72-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/intel/ixp/intel-ixp42x-actiontec-mi424wr.dtsi=109=\tspi {\narch/arm/boot/dts/intel/ixp/intel-ixp42x-actiontec-mi424wr.dtsi:110:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/intel/ixp/intel-ixp42x-actiontec-mi424wr.dtsi-111-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/intel/ixp/intel-ixp42x-linksys-wrv54g.dts=64=\tspi {\narch/arm/boot/dts/intel/ixp/intel-ixp42x-linksys-wrv54g.dts:65:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/intel/ixp/intel-ixp42x-linksys-wrv54g.dts-66-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/intel/pxa/pxa300-raumfeld-common.dtsi=71=\tspi: spi {\narch/arm/boot/dts/intel/pxa/pxa300-raumfeld-common.dtsi:72:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/intel/pxa/pxa300-raumfeld-common.dtsi-73-\t\t#address-cells = \u003c0x1\u003e;\n--\narch/arm/boot/dts/marvell/armada-xp-lenovo-ix4-300d.dts=167=\tspi-3 {\narch/arm/boot/dts/marvell/armada-xp-lenovo-ix4-300d.dts:168:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/marvell/armada-xp-lenovo-ix4-300d.dts-169-\t\tstatus = \"okay\";\n--\narch/arm/boot/dts/marvell/mmp3-dell-ariel.dts=34=\tec_input_spi: spi {\narch/arm/boot/dts/marvell/mmp3-dell-ariel.dts:35:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/marvell/mmp3-dell-ariel.dts-36-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/nxp/imx/imx51-zii-rdu1.dts=140=\tspi_gpio: spi {\narch/arm/boot/dts/nxp/imx/imx51-zii-rdu1.dts:141:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/imx/imx51-zii-rdu1.dts-142-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/nxp/imx/imx53-sk-imx53-atm0700d4.dtsi=21=\tspi_ts: spi {\narch/arm/boot/dts/nxp/imx/imx53-sk-imx53-atm0700d4.dtsi:22:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/imx/imx53-sk-imx53-atm0700d4.dtsi-23-\t\t#address-cells = \u003c0x1\u003e;\n--\narch/arm/boot/dts/nxp/imx/imx6q-lxr.dts=16=\tspi {\narch/arm/boot/dts/nxp/imx/imx6q-lxr.dts:17:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/imx/imx6q-lxr.dts-18-\t\tpinctrl-names = \"default\";\n--\narch/arm/boot/dts/nxp/imx/imx6ul-14x14-evk.dtsi=141=\tspi-4 {\narch/arm/boot/dts/nxp/imx/imx6ul-14x14-evk.dtsi:142:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/imx/imx6ul-14x14-evk.dtsi-143-\t\tpinctrl-names = \"default\";\n--\narch/arm/boot/dts/nxp/imx/imx6ul-tx6ul.dtsi=177=\tspi_gpio: spi {\n--\narch/arm/boot/dts/nxp/imx/imx6ul-tx6ul.dtsi-179-\t\t#size-cells = \u003c0\u003e;\narch/arm/boot/dts/nxp/imx/imx6ul-tx6ul.dtsi:180:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/imx/imx6ul-tx6ul.dtsi-181-\t\tpinctrl-names = \"default\";\n--\narch/arm/boot/dts/nxp/imx/imx6ul-tx6ul.dtsi=794=\t\t\tMX6UL_PAD_JTAG_TDO__SAI2_TX_SYNC\t0x0b0b0 /* SSI1_FS */\n--\narch/arm/boot/dts/nxp/imx/imx6ul-tx6ul.dtsi-797-\narch/arm/boot/dts/nxp/imx/imx6ul-tx6ul.dtsi:798:\tpinctrl_spi_gpio: spi-gpiogrp {\narch/arm/boot/dts/nxp/imx/imx6ul-tx6ul.dtsi-799-\t\tfsl,pins = \u003c\n--\narch/arm/boot/dts/nxp/imx/imx7d-sdb.dts=47=\tspi-4 {\narch/arm/boot/dts/nxp/imx/imx7d-sdb.dts:48:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/imx/imx7d-sdb.dts-49-\t\tpinctrl-names = \"default\";\n--\narch/arm/boot/dts/nxp/mxs/imx28-cfa10049.dts=91=\tspi-2 {\narch/arm/boot/dts/nxp/mxs/imx28-cfa10049.dts:92:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/mxs/imx28-cfa10049.dts-93-\t\tpinctrl-names = \"default\";\n--\narch/arm/boot/dts/nxp/mxs/imx28-cfa10049.dts=115=\tspi-3 {\narch/arm/boot/dts/nxp/mxs/imx28-cfa10049.dts:116:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/mxs/imx28-cfa10049.dts-117-\t\tpinctrl-names = \"default\";\n--\narch/arm/boot/dts/nxp/mxs/imx28-cfa10055.dts=17=\tspi-2 {\narch/arm/boot/dts/nxp/mxs/imx28-cfa10055.dts:18:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/mxs/imx28-cfa10055.dts-19-\t\tpinctrl-names = \"default\";\n--\narch/arm/boot/dts/nxp/mxs/imx28-cfa10056.dts=16=\tspi-2 {\narch/arm/boot/dts/nxp/mxs/imx28-cfa10056.dts:17:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/mxs/imx28-cfa10056.dts-18-\t\tpinctrl-names = \"default\";\n--\narch/arm/boot/dts/nxp/mxs/imx28-tx28.dts=183=\tspi_gpio: spi {\narch/arm/boot/dts/nxp/mxs/imx28-tx28.dts:184:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/mxs/imx28-tx28.dts-185-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/nxp/mxs/imx28-tx28.dts=554=\t\t\tMX28_PAD_PWM3__GPIO_3_28\n--\narch/arm/boot/dts/nxp/mxs/imx28-tx28.dts-560-\narch/arm/boot/dts/nxp/mxs/imx28-tx28.dts:561:\ttx28_spi_gpio_pins: spi-gpiogrp@0 {\narch/arm/boot/dts/nxp/mxs/imx28-tx28.dts-562-\t\treg = \u003c0\u003e;\n--\narch/arm/boot/dts/nxp/vf/vf610-bk4.dts=64=\tspi {\narch/arm/boot/dts/nxp/vf/vf610-bk4.dts:65:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/vf/vf610-bk4.dts-66-\t\tpinctrl-0 = \u003c\u0026pinctrl_gpio_spi\u003e;\n--\narch/arm/boot/dts/nxp/vf/vf610-zii-dev-rev-b.dts=291=\tspi-0 {\narch/arm/boot/dts/nxp/vf/vf610-zii-dev-rev-b.dts:292:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/nxp/vf/vf610-zii-dev-rev-b.dts-293-\t\tpinctrl-0 = \u003c\u0026pinctrl_gpio_spi0\u003e;\n--\narch/arm/boot/dts/samsung/exynos4210-i9100.dts=209=\tspi-3 {\narch/arm/boot/dts/samsung/exynos4210-i9100.dts:210:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/samsung/exynos4210-i9100.dts-211-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/samsung/exynos4210-universal_c210.dts=129=\tspi-3 {\narch/arm/boot/dts/samsung/exynos4210-universal_c210.dts:130:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/samsung/exynos4210-universal_c210.dts-131-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/samsung/s5pv210-aries.dtsi=548=\tspi_lcd: spi-2 {\narch/arm/boot/dts/samsung/s5pv210-aries.dtsi:549:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/samsung/s5pv210-aries.dtsi-550-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/st/ste-nomadik-nhk15.dts=202=\tspi {\narch/arm/boot/dts/st/ste-nomadik-nhk15.dts:203:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/st/ste-nomadik-nhk15.dts-204-\t\t#address-cells = \u003c1\u003e;\n--\narch/arm/boot/dts/st/ste-ux500-samsung-codina-tmo.dts=250=\tspi {\narch/arm/boot/dts/st/ste-ux500-samsung-codina-tmo.dts:251:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/st/ste-ux500-samsung-codina-tmo.dts-252-\t\t/* Clock on GPIO220, pin SCL */\n--\narch/arm/boot/dts/st/ste-ux500-samsung-codina-tmo.dts=705=\t\t\tcodina_cfg1 {\n--\narch/arm/boot/dts/st/ste-ux500-samsung-codina-tmo.dts-711-\t/* GPIO-based SPI bus for the display */\narch/arm/boot/dts/st/ste-ux500-samsung-codina-tmo.dts:712:\tspi-gpio-0 {\narch/arm/boot/dts/st/ste-ux500-samsung-codina-tmo.dts-713-\t\tspi_gpio_0_default: spi_gpio_0_d {\n--\narch/arm/boot/dts/st/ste-ux500-samsung-codina.dts=336=\tspi {\narch/arm/boot/dts/st/ste-ux500-samsung-codina.dts:337:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/st/ste-ux500-samsung-codina.dts-338-\t\t/* Clock on GPIO220, pin SCL */\n--\narch/arm/boot/dts/st/ste-ux500-samsung-codina.dts=831=\t\t\tcodina_cfg1 {\n--\narch/arm/boot/dts/st/ste-ux500-samsung-codina.dts-837-\t/* GPIO-based SPI bus for the display */\narch/arm/boot/dts/st/ste-ux500-samsung-codina.dts:838:\tspi-gpio-0 {\narch/arm/boot/dts/st/ste-ux500-samsung-codina.dts-839-\t\tspi_gpio_0_default: spi_gpio_0_d {\n--\narch/arm/boot/dts/st/ste-ux500-samsung-gavini.dts=280=\tspi {\narch/arm/boot/dts/st/ste-ux500-samsung-gavini.dts:281:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/st/ste-ux500-samsung-gavini.dts-282-\t\t/* Clock on GPIO220, pin SCL */\n--\narch/arm/boot/dts/st/ste-ux500-samsung-gavini.dts=819=\t\t\tgavini_cfg1 {\n--\narch/arm/boot/dts/st/ste-ux500-samsung-gavini.dts-825-\t/* GPIO-based SPI bus for the display */\narch/arm/boot/dts/st/ste-ux500-samsung-gavini.dts:826:\tspi-gpio-0 {\narch/arm/boot/dts/st/ste-ux500-samsung-gavini.dts-827-\t\tspi_gpio_0_default: spi_gpio_0_d {\n--\narch/arm/boot/dts/st/ste-ux500-samsung-janice.dts=274=\tspi {\narch/arm/boot/dts/st/ste-ux500-samsung-janice.dts:275:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/st/ste-ux500-samsung-janice.dts-276-\t\t/* Clock on GPIO220 */\n--\narch/arm/boot/dts/st/ste-ux500-samsung-janice.dts=908=\t\t\tjanice_cfg1 {\n--\narch/arm/boot/dts/st/ste-ux500-samsung-janice.dts-914-\t/* GPIO-based SPI bus for the display */\narch/arm/boot/dts/st/ste-ux500-samsung-janice.dts:915:\tspi-gpio-0 {\narch/arm/boot/dts/st/ste-ux500-samsung-janice.dts-916-\t\tspi_gpio_0_default: spi_gpio_0 {\n--\narch/arm/boot/dts/ti/omap/omap3-gta04.dtsi=108=\tspi_lcd: spi {\narch/arm/boot/dts/ti/omap/omap3-gta04.dtsi:109:\t\tcompatible = \"spi-gpio\";\narch/arm/boot/dts/ti/omap/omap3-gta04.dtsi-110-\t\t#address-cells = \u003c0x1\u003e;\n--\narch/arm/boot/dts/ti/omap/omap3-gta04.dtsi=468=\t\t\tOMAP3630_CORE2_IOPAD(0x25e2, PIN_OUTPUT_PULLDOWN | MUX_MODE4)\t/* etk_d3 */\n--\narch/arm/boot/dts/ti/omap/omap3-gta04.dtsi-471-\narch/arm/boot/dts/ti/omap/omap3-gta04.dtsi:472:\tspi_gpio_pins: spi-gpio-pinmux-pins {\narch/arm/boot/dts/ti/omap/omap3-gta04.dtsi-473-\t\tpinctrl-single,pins = \u003c\n--\narch/arm64/boot/dts/freescale/imx95-15x15-frdm.dts=304=\tpcal6524: gpio@22 {\n--\narch/arm64/boot/dts/freescale/imx95-15x15-frdm.dts-339-\narch/arm64/boot/dts/freescale/imx95-15x15-frdm.dts:340:\t\tlpspi-gpio-sel-hog {\narch/arm64/boot/dts/freescale/imx95-15x15-frdm.dts-341-\t\t\tgpio-hog;\n--\narch/arm64/boot/dts/freescale/imx95-19x19-frdm-pro.dts=378=\ti2c4_gpio_expander_22: i2c4-gpio-expander@22 {\n--\narch/arm64/boot/dts/freescale/imx95-19x19-frdm-pro.dts-408-\t\t/* When high, select lpspi; When low, select gpio. */\narch/arm64/boot/dts/freescale/imx95-19x19-frdm-pro.dts:409:\t\tlpspi-gpio-sel-hog {\narch/arm64/boot/dts/freescale/imx95-19x19-frdm-pro.dts-410-\t\t\tgpios = \u003c16 GPIO_ACTIVE_HIGH\u003e;\n--\narch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts=101=\tgpio_spi: spi {\narch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts:102:\t\tcompatible = \"spi-gpio\";\narch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts-103-\t\tpinctrl-names = \"default\";\n--\narch/arm64/boot/dts/rockchip/rk3568-wolfvision-pf5-display.dtsi=27=\tdisplay_spi: spi {\narch/arm64/boot/dts/rockchip/rk3568-wolfvision-pf5-display.dtsi:28:\t\tcompatible = \"spi-gpio\";\narch/arm64/boot/dts/rockchip/rk3568-wolfvision-pf5-display.dtsi-29-\t\t#address-cells = \u003c1\u003e;\n--\narch/mips/boot/dts/ingenic/gcw0.dts=328=\tspi {\narch/mips/boot/dts/ingenic/gcw0.dts:329:\t\tcompatible = \"spi-gpio\";\narch/mips/boot/dts/ingenic/gcw0.dts-330-\t\t#address-cells = \u003c1\u003e;\n--\narch/mips/boot/dts/ingenic/qi_lb60.dts=181=\tspi {\narch/mips/boot/dts/ingenic/qi_lb60.dts:182:\t\tcompatible = \"spi-gpio\";\narch/mips/boot/dts/ingenic/qi_lb60.dts-183-\t\t#address-cells = \u003c1\u003e;\n--\narch/riscv/boot/dts/microchip/pic64gx-pinctrl.dtsi=128=\tqspi_default: mux-qspi {\n--\narch/riscv/boot/dts/microchip/pic64gx-pinctrl.dtsi-132-\narch/riscv/boot/dts/microchip/pic64gx-pinctrl.dtsi:133:\tqspi_gpio: mux-qspi-gpio2 {\narch/riscv/boot/dts/microchip/pic64gx-pinctrl.dtsi-134-\t\tfunction = \"gpio\";\n--\ndrivers/gpio/gpiolib-of.c=487=static struct gpio_desc *of_find_gpio_rename(struct device_node *np,\n--\ndrivers/gpio/gpiolib-of.c-568-\t\t */\ndrivers/gpio/gpiolib-of.c:569:\t\t{ \"miso\",\t\"gpio-miso\",\t\"spi-gpio\" },\ndrivers/gpio/gpiolib-of.c:570:\t\t{ \"mosi\",\t\"gpio-mosi\",\t\"spi-gpio\" },\ndrivers/gpio/gpiolib-of.c:571:\t\t{ \"sck\",\t\"gpio-sck\",\t\"spi-gpio\" },\ndrivers/gpio/gpiolib-of.c-572-#endif\n--\ndrivers/spi/Makefile=68=obj-$(CONFIG_SPI_FSL_SPI)\t\t+= spi-fsl-spi.o\ndrivers/spi/Makefile:69:obj-$(CONFIG_SPI_GPIO)\t\t\t+= spi-gpio.o\ndrivers/spi/Makefile-70-obj-$(CONFIG_SPI_GXP)\t\t\t+= spi-gxp.o\n--\ndrivers/spi/spi-ath79.c-6- *\ndrivers/spi/spi-ath79.c:7: * This driver has been based on the spi-gpio.c:\ndrivers/spi/spi-ath79.c-8- *\tCopyright (C) 2006,2008 David Brownell\n--\ndrivers/spi/spi-gpio.c=417=static const struct of_device_id spi_gpio_dt_ids[] = {\ndrivers/spi/spi-gpio.c:418:\t{ .compatible = \"spi-gpio\" },\ndrivers/spi/spi-gpio.c-419-\t{}\n"
} |
| 13/2 | 2026/07/08 09:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 44129 output: 25 thoughts: 1323 Thoughts: **Fuzzing Strategy for the ADIN1140 MAC-PHY Driver** Okay, so we're looking at fuzzing the ADIN1140 MAC-PHY driver. The good news is, I've confirmed that `spi-gpio` is available and can be instantiated through Device Tree overlays, which means Syzkaller should be able to probe and fuzz this driver. First, let's nail down the configuration requirements. The relevant Kconfig entry (`drivers/net/ethernet/adi/Kconfig`) reveals that we need `ADIN1140` enabled, which automatically selects `ADIN1140_PHY` and `OA_TC6`. SPI is a dependency, but it's usually already enabled, and `SPI_GPIO`, while not explicitly *required* by the driver itself, is essential for Syzkaller to properly instantiate it. But since syzkaller configs tend to have `SPI_GPIO` enabled, we should just list `ADIN1140`. Now, let's drill down into the driver code to pinpoint specific functions to target. Examining `drivers/net/ethernet/adi/adin1140.c`, I see a comprehensive list of functions: `adin1140_probe`, `adin1140_open`, `adin1140_close`, `adin1140_start_xmit`, `adin1140_set_mac_address`, `adin1140_rx_mode`, `adin1140_stats_work`, `adin1140_configure`, `adin1140_mdiobus_read`, `adin1140_mdiobus_write`, and `adin1140_phy_init`. Then, looking at `drivers/net/ethernet/oa_tc6.c`, I notice `oa_tc6_init`, `oa_tc6_read_register_mms`, `oa_tc6_write_register_mms`, `oa_tc6_mdiobus_read_c45`, `oa_tc6_mdiobus_write_c45`, and `oa_tc6_check_ctrl_protection`. These `oa_tc6` functions look like promising targets, as they aren't necessarily in the hot path. Similarly, `drivers/net/phy/adin1140-phy.c` has `adin1140_config_aneg`, `adin1140_loopback`, and `adin1140_read_status` functions that should be included as fuzzing targets. Focusing on `adin1140.c` further, the MAC filtering and RX mode functions, like `adin1140_mac_filter_set`, `adin1140_mac_filter_clear`, `adin1140_filter_unicast`, `adin1140_filter_all_multicast`, `adin1140_filter_broadcast`, `adin1140_default_filter_config`, `adin1140_promiscuous_mode`, and `adin1140_rx_mode` are all interesting because they're likely triggered via netlink/ioctl, and therefore good fuzz targets. Also, `adin1140_set_mac_address`, and `adin1140_mdiobus_read`, `adin1140_mdiobus_write`. The ethtool and statistics related functions: `adin1140_get_eth_mac_stats`, `adin1140_get_ethtool_stats`, `adin1140_get_sset_count`, `adin1140_get_strings`, `adin1140_get_drvinfo`, also have the potential for deeper exploration. So, here's my list of target symbols: * `adin1140_probe` * `adin1140_rx_mode` * `adin1140_set_mac_address` * `adin1140_mdiobus_read` * `adin1140_mdiobus_write` * `adin1140_get_eth_mac_stats` * `adin1140_get_ethtool_stats` * `adin1140_stats_work` * `adin1140_mac_filter_set` * `adin1140_promiscuous_mode` * `oa_tc6_read_ |
| 14/2 | 2026/07/08 09:23 | tool | grepper |
0mArgs:{
"Expression": "genphy_read_mmd_c45"
}Results: {
"Output": "drivers/net/phy/adin1140-phy.c=46=static struct phy_driver adin1140_driver[] = {\n--\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,\ndrivers/net/phy/adin1140-phy.c-55-\t\t.write_mmd = genphy_write_mmd_c45,\n--\ndrivers/net/phy/microchip_t1s.c=509=static struct phy_driver microchip_t1s_driver[] = {\n--\ndrivers/net/phy/microchip_t1s.c-558-\t\t.read_status = lan86xx_read_status,\ndrivers/net/phy/microchip_t1s.c:559:\t\t.read_mmd = genphy_read_mmd_c45,\ndrivers/net/phy/microchip_t1s.c-560-\t\t.write_mmd = genphy_write_mmd_c45,\n--\ndrivers/net/phy/phy_device.c=2771=EXPORT_SYMBOL(genphy_read_abilities);\n--\ndrivers/net/phy/phy_device.c-2778- */\ndrivers/net/phy/phy_device.c:2779:int genphy_read_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum)\ndrivers/net/phy/phy_device.c-2780-{\n--\ndrivers/net/phy/phy_device.c-2785-}\ndrivers/net/phy/phy_device.c:2786:EXPORT_SYMBOL(genphy_read_mmd_c45);\ndrivers/net/phy/phy_device.c-2787-\n--\ninclude/linux/phy.h=2296=static inline int genphy_no_config_intr(struct phy_device *phydev)\n--\ninclude/linux/phy.h-2299-}\ninclude/linux/phy.h:2300:int genphy_read_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum);\ninclude/linux/phy.h-2301-int genphy_write_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum,\n"
} |
| 15/2 | 2026/07/08 09:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 47156 output: 18 thoughts: 561 Thoughts: **My Assessment of the New ADIN1140 Driver Patch** Okay, so this patch introduces the ADIN1140 driver – that much is clear. Let's dig into the configurations. The central configuration is `ADIN1140`. That pulls in `ADIN1140_PHY` and `OA_TC6` as dependencies. So, from a build perspective, I only need to worry about `ADIN1140` itself. Simple enough. Now, for fuzzing considerations, I need to identify the key functions. Looking over the list of symbols, I see `adin1140_probe`, `adin1140_rx_mode`, `adin1140_set_mac_address`, and the MDIO access functions (`adin1140_mdiobus_read`, `adin1140_mdiobus_write`) as core candidates. The statistics-related functions (`adin1140_get_eth_mac_stats`, `adin1140_get_ethtool_stats`, `adin1140_stats_work`) are definitely worth a closer look, especially the workqueue function `adin1140_stats_work`. Filtering and promiscuous mode settings (`adin1140_mac_filter_set`, `adin1140_promiscuous_mode`) are important for network interactions. The OA_TC6 functions, like register reads/writes and the C45 MDIO functions, are potentially interesting too. I see the usual suspects `adin1140_loopback`, `adin1140_read_status`, `adin1140_config_aneg` and the generic phy functions like `genphy_read_mmd_c45` and `genphy_write_mmd_c45` also on my list. I'm going to omit the transmit function `adin1140_start_xmit` for now; it's probably on the hot path, and therefore less likely to be vulnerable, or require fuzzing. `adin1140_open` and `adin1140_close` are the simple ones, I will leave them be. I'll focus on the ones with more complexity. Just a quick sanity check regarding dependencies. It looks like `SPI` is required, which is usually enabled in most configurations, but I'll add `SPI_GPIO` just to be safe. It is tri-state. A quick cross-reference to `drivers/spi/Kconfig` will confirm its usage. |
| 16/2 | 2026/07/08 09:23 | tool | grepper |
0mArgs:{
"Expression": "config SPI_GPIO"
}Results: {
"Output": "drivers/spi/Kconfig=477=config SPI_NXP_XSPI\n--\ndrivers/spi/Kconfig-486-\ndrivers/spi/Kconfig:487:config SPI_GPIO\ndrivers/spi/Kconfig-488-\ttristate \"GPIO-based bitbanging SPI Master\"\n"
} |
| 17/2 | 2026/07/08 09:24 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 48387 output: 439 thoughts: 488 Thoughts: **My Analysis of the ADIN1140 Ethernet MAC-PHY Driver Patch** Okay, so I've confirmed that `SPI_GPIO` is indeed the correct configuration name. I'll add that to the `EnableConfigs` list. Now, let's break down the implications of this patch. My initial assessment is that this patch introduces a new driver for the Analog Devices ADIN1140, a MAC-PHY connected via SPI. A corresponding PHY driver is also being added. Crucially, the patch extends the OA TC6 framework to handle memory map selectors (MMS) and protected control mode. This is important because it highlights the level of control and security being implemented within the driver. The driver's design allows for instantiation in virtualized environments via Device Tree overlays, specifically creating an `spi-gpio` controller. This allows `syzkaller` to be used to probe the driver and fuzz its interfaces. This is a robust approach as it'll help identify any potential vulnerabilities within the netdev interface, ethtool operations, and MAC filtering logic. This is an excellent way to validate that they are operating as expected. I've taken a look at a collection of key functions, including `adin1140_probe`, `adin1140_rx_mode`, `adin1140_set_mac_address`, and several others related to MDIO bus interaction, statistics gathering, MAC filtering, and control mode. I will want to take a closer look at `oa_tc6_read_register_mms` and `oa_tc6_write_register_mms` to understand how the memory map selector is handled as it is a critical part of the new framework. This list is a good starting point for a deeper dive. The inclusion of `genphy_read_mmd_c45` and `genphy_write_mmd_c45` is also interesting as I can compare to existing drivers that are already working. The crucial configurations are clearly `ADIN1140` and `SPI_GPIO`. I have identified those as important for this patch. I'm ready to proceed with a more in-depth analysis based on this initial assessment. |
| 18/2 | 2026/07/08 09:24 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"ADIN1140",
"SPI_GPIO"
],
"FocusSymbols": [
"adin1140_probe",
"adin1140_rx_mode",
"adin1140_set_mac_address",
"adin1140_mdiobus_read",
"adin1140_mdiobus_write",
"adin1140_get_eth_mac_stats",
"adin1140_get_ethtool_stats",
"adin1140_stats_work",
"adin1140_mac_filter_set",
"adin1140_promiscuous_mode",
"oa_tc6_read_register_mms",
"oa_tc6_write_register_mms",
"oa_tc6_mdiobus_read_c45",
"oa_tc6_mdiobus_write_c45",
"oa_tc6_check_ctrl_protection",
"adin1140_loopback",
"adin1140_read_status",
"adin1140_config_aneg",
"genphy_read_mmd_c45",
"genphy_write_mmd_c45"
],
"Reasoning": "The patch introduces a new Ethernet MAC-PHY driver for the Analog Devices ADIN1140, which is connected via SPI. It also adds a corresponding PHY driver and extends the OA TC6 framework to support memory map selectors (MMS) and protected control mode. The driver can be instantiated in a virtualized environment by injecting a Device Tree overlay that creates an `spi-gpio` controller and attaches the ADIN1140 device to it. This allows syzkaller to probe the driver and fuzz its netdev interface, ethtool ops, and MAC filtering logic.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"ADIN1140",
"SPI_GPIO"
],
"FocusSymbols": [
"adin1140_probe",
"adin1140_rx_mode",
"adin1140_set_mac_address",
"adin1140_mdiobus_read",
"adin1140_mdiobus_write",
"adin1140_get_eth_mac_stats",
"adin1140_get_ethtool_stats",
"adin1140_stats_work",
"adin1140_mac_filter_set",
"adin1140_promiscuous_mode",
"oa_tc6_read_register_mms",
"oa_tc6_write_register_mms",
"oa_tc6_mdiobus_read_c45",
"oa_tc6_mdiobus_write_c45",
"oa_tc6_check_ctrl_protection",
"adin1140_loopback",
"adin1140_read_status",
"adin1140_config_aneg",
"genphy_read_mmd_c45",
"genphy_write_mmd_c45"
],
"Reasoning": "The patch introduces a new Ethernet MAC-PHY driver for the Analog Devices ADIN1140, which is connected via SPI. It also adds a corresponding PHY driver and extends the OA TC6 framework to support memory map selectors (MMS) and protected control mode. The driver can be instantiated in a virtualized environment by injecting a Device Tree overlay that creates an `spi-gpio` controller and attaches the ADIN1140 device to it. This allows syzkaller to probe the driver and fuzz its netdev interface, ethtool ops, and MAC filtering logic.",
"WorthFuzzing": true
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|