The KS8851 has a reduced internal PHY, which is accessible through its
registers at offset 0xe4. The PHY is compatible with KS886x PHY present
in Micrel switches, except the PHY ID Low/High registers are swapped.
Add PHY ID for this KS8851 PHY and use custom PHY ID mask due to the swap.

Signed-off-by: Marek Vasut <ma...@denx.de>
Cc: Andrew Lunn <and...@lunn.ch>
Cc: Heiner Kallweit <hkallwe...@gmail.com>
Cc: Lukas Wunner <lu...@wunner.de>
To: netdev@vger.kernel.org
---
 drivers/net/phy/micrel.c   | 9 +++++++++
 include/linux/micrel_phy.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 54e0d75203da..ca6da128e37a 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -1386,6 +1386,14 @@ static struct phy_driver ksphy_driver[] = {
        .read_status    = ksz8873mll_read_status,
        .suspend        = genphy_suspend,
        .resume         = genphy_resume,
+}, {
+       .phy_id         = PHY_ID_KSZ8851,
+       .phy_id_mask    = 0xfff000ff,
+       .name           = "Micrel KSZ8851 Ethernet MAC",
+       /* PHY_BASIC_FEATURES */
+       .config_init    = kszphy_config_init,
+       .suspend        = genphy_suspend,
+       .resume         = genphy_resume,
 }, {
        .phy_id         = PHY_ID_KSZ886X,
        .phy_id_mask    = MICREL_PHY_ID_MASK,
@@ -1432,6 +1440,7 @@ static struct mdio_device_id __maybe_unused micrel_tbl[] 
= {
        { PHY_ID_KSZ8061, MICREL_PHY_ID_MASK },
        { PHY_ID_KSZ8081, MICREL_PHY_ID_MASK },
        { PHY_ID_KSZ8873MLL, MICREL_PHY_ID_MASK },
+       { PHY_ID_KSZ8851, 0xfff000ff },
        { PHY_ID_KSZ886X, MICREL_PHY_ID_MASK },
        { PHY_ID_LAN8814, MICREL_PHY_ID_MASK },
        { }
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 416ee6dd2574..1c26e4ac0dc9 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -29,6 +29,8 @@
 #define PHY_ID_KSZ9131         0x00221640
 #define PHY_ID_LAN8814         0x00221660
 
+/* The PHY ID Low/High registers are swapped on KSZ8851 */
+#define PHY_ID_KSZ8851         0x14300022
 #define PHY_ID_KSZ886X         0x00221430
 #define PHY_ID_KSZ8863         0x00221435
 
-- 
2.29.2

Reply via email to