Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'net-phy-microchip_t1s-add-support-for-lan867x-rev-d0-phy'

Parthiban Veerasooran says:

====================
net: phy: microchip_t1s: Add support for LAN867x Rev.D0 PHY

This patch series adds support for the latest Microchip LAN8670/1/2 Rev.D0
10BASE-T1S PHYs to the microchip_t1s driver.

The new Rev.D0 silicon introduces updated initialization requirements and
link status handling behavior compared to earlier revisions (Rev.C2 and
below). These updates are necessary for full compliance with the OPEN
Alliance 10BASE-T1S specification and are documented in Microchip
Application Note AN1699 Revision G (DS60001699G – October 2025).

Summary of changes:
- Implements Rev.D0-specific configuration sequence as described in AN1699
Rev.G.
- Introduces link status control configuration for LAN867x Rev.D0.
====================

Link: https://patch.msgid.link/20251030102258.180061-1-parthiban.veerasooran@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+96 -2
+1 -1
drivers/net/phy/Kconfig
··· 308 308 config MICROCHIP_T1S_PHY 309 309 tristate "Microchip 10BASE-T1S Ethernet PHYs" 310 310 help 311 - Currently supports the LAN8670/1/2 Rev.B1/C1/C2 and 311 + Currently supports the LAN8670/1/2 Rev.B1/C1/C2/D0 and 312 312 LAN8650/1 Rev.B0/B1 Internal PHYs. 313 313 314 314 config MICROCHIP_PHY
+95 -1
drivers/net/phy/microchip_t1s.c
··· 3 3 * Driver for Microchip 10BASE-T1S PHYs 4 4 * 5 5 * Support: Microchip Phys: 6 - * lan8670/1/2 Rev.B1/C1/C2 6 + * lan8670/1/2 Rev.B1/C1/C2/D0 7 7 * lan8650/1 Rev.B0/B1 Internal PHYs 8 8 */ 9 9 ··· 14 14 #define PHY_ID_LAN867X_REVB1 0x0007C162 15 15 #define PHY_ID_LAN867X_REVC1 0x0007C164 16 16 #define PHY_ID_LAN867X_REVC2 0x0007C165 17 + #define PHY_ID_LAN867X_REVD0 0x0007C166 17 18 /* Both Rev.B0 and B1 clause 22 PHYID's are same due to B1 chip limitation */ 18 19 #define PHY_ID_LAN865X_REVB 0x0007C1B3 19 20 ··· 32 31 #define COL_DET_CTRL0_ENABLE_BIT_MASK BIT(15) 33 32 #define COL_DET_ENABLE BIT(15) 34 33 #define COL_DET_DISABLE 0x0000 34 + 35 + /* LAN8670/1/2 Rev.D0 Link Status Selection Register */ 36 + #define LAN867X_REG_LINK_STATUS_CTRL 0x0012 37 + #define LINK_STATUS_CONFIGURATION GENMASK(12, 11) 38 + #define LINK_STATUS_SEMAPHORE BIT(0) 39 + 40 + /* Link Status Configuration */ 41 + #define LINK_STATUS_CONFIG_PLCA_STATUS 0x1 42 + #define LINK_STATUS_CONFIG_SEMAPHORE 0x2 43 + 44 + #define LINK_STATUS_SEMAPHORE_SET 0x1 35 45 36 46 #define LAN865X_CFGPARAM_READ_ENABLE BIT(1) 37 47 ··· 119 107 120 108 static const u16 lan865x_revb_sqi_fixup_cfg_regs[3] = { 121 109 0x00AD, 0x00AE, 0x00AF, 110 + }; 111 + 112 + /* LAN867x Rev.D0 configuration parameters from AN1699 113 + * As per the Configuration Application Note AN1699 published in the below link, 114 + * https://www.microchip.com/en-us/application-notes/an1699 115 + * Revision G (DS60001699G - October 2025) 116 + */ 117 + static const u16 lan867x_revd0_fixup_regs[8] = { 118 + 0x0037, 0x008A, 0x0118, 0x00D6, 119 + 0x0082, 0x00FD, 0x00FD, 0x0091, 120 + }; 121 + 122 + static const u16 lan867x_revd0_fixup_values[8] = { 123 + 0x0800, 0xBFC0, 0x029C, 0x1001, 124 + 0x001C, 0x0C0B, 0x8C07, 0x9660, 122 125 }; 123 126 124 127 /* Pulled from AN1760 describing 'indirect read' ··· 404 377 return 0; 405 378 } 406 379 380 + static int lan867x_revd0_link_active_selection(struct phy_device *phydev, 381 + bool plca_enabled) 382 + { 383 + u16 value; 384 + 385 + if (plca_enabled) { 386 + /* 0x1 - When PLCA is enabled: link status reflects plca_status. 387 + */ 388 + value = FIELD_PREP(LINK_STATUS_CONFIGURATION, 389 + LINK_STATUS_CONFIG_PLCA_STATUS); 390 + } else { 391 + /* 0x2 - Link status is controlled by the value written into the 392 + * LINK_STATUS_SEMAPHORE bit written. Here the link semaphore 393 + * bit is written with 0x1 to set the link always active in 394 + * CSMA/CD mode as it doesn't support autoneg. 395 + */ 396 + value = FIELD_PREP(LINK_STATUS_CONFIGURATION, 397 + LINK_STATUS_CONFIG_SEMAPHORE) | 398 + FIELD_PREP(LINK_STATUS_SEMAPHORE, 399 + LINK_STATUS_SEMAPHORE_SET); 400 + } 401 + 402 + return phy_write_mmd(phydev, MDIO_MMD_VEND2, 403 + LAN867X_REG_LINK_STATUS_CTRL, value); 404 + } 405 + 407 406 /* As per LAN8650/1 Rev.B0/B1 AN1760 (Revision F (DS60001760G - June 2024)) and 408 407 * LAN8670/1/2 Rev.C1/C2 AN1699 (Revision E (DS60001699F - June 2024)), under 409 408 * normal operation, the device should be operated in PLCA mode. Disabling ··· 446 393 { 447 394 int ret; 448 395 396 + /* Link status selection must be configured for LAN8670/1/2 Rev.D0 */ 397 + if (phydev->phy_id == PHY_ID_LAN867X_REVD0) { 398 + ret = lan867x_revd0_link_active_selection(phydev, 399 + plca_cfg->enabled); 400 + if (ret) 401 + return ret; 402 + } 403 + 449 404 ret = genphy_c45_plca_set_cfg(phydev, plca_cfg); 450 405 if (ret) 451 406 return ret; ··· 466 405 467 406 return phy_modify_mmd(phydev, MDIO_MMD_VEND2, LAN86XX_REG_COL_DET_CTRL0, 468 407 COL_DET_CTRL0_ENABLE_BIT_MASK, COL_DET_ENABLE); 408 + } 409 + 410 + static int lan867x_revd0_config_init(struct phy_device *phydev) 411 + { 412 + int ret; 413 + 414 + ret = lan867x_check_reset_complete(phydev); 415 + if (ret) 416 + return ret; 417 + 418 + for (int i = 0; i < ARRAY_SIZE(lan867x_revd0_fixup_regs); i++) { 419 + ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, 420 + lan867x_revd0_fixup_regs[i], 421 + lan867x_revd0_fixup_values[i]); 422 + if (ret) 423 + return ret; 424 + } 425 + 426 + /* Initially the PHY will be in CSMA/CD mode by default. So it is 427 + * required to set the link always active as it doesn't support 428 + * autoneg. 429 + */ 430 + return lan867x_revd0_link_active_selection(phydev, false); 469 431 } 470 432 471 433 static int lan86xx_read_status(struct phy_device *phydev) ··· 566 482 .get_plca_status = genphy_c45_plca_get_status, 567 483 }, 568 484 { 485 + PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVD0), 486 + .name = "LAN867X Rev.D0", 487 + .features = PHY_BASIC_T1S_P2MP_FEATURES, 488 + .config_init = lan867x_revd0_config_init, 489 + .get_plca_cfg = genphy_c45_plca_get_cfg, 490 + .set_plca_cfg = lan86xx_plca_set_cfg, 491 + .get_plca_status = genphy_c45_plca_get_status, 492 + }, 493 + { 569 494 PHY_ID_MATCH_EXACT(PHY_ID_LAN865X_REVB), 570 495 .name = "LAN865X Rev.B0/B1 Internal Phy", 571 496 .features = PHY_BASIC_T1S_P2MP_FEATURES, ··· 594 501 { PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1) }, 595 502 { PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVC1) }, 596 503 { PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVC2) }, 504 + { PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVD0) }, 597 505 { PHY_ID_MATCH_EXACT(PHY_ID_LAN865X_REVB) }, 598 506 { } 599 507 };