net: ks8851: Add KS8851 PHY support
Subsystems (3)
v3 cover net: ks8851: Add KS8851 PHY support
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, including the PHY ID Low/High registers swap, which is present both in the MAC and the switch.
Marek Vasut (2):
net: phy: micrel: Add KS8851 PHY support
net: ks8851: Register MDIO bus and the internal PHY
drivers/net/ethernet/micrel/ks8851.h | 2 + drivers/net/ethernet/micrel/ks8851_common.c | 112 +++++++++++++++++--- drivers/net/phy/micrel.c | 2 +- 3 files changed, 99 insertions(+), 17 deletions(-)
Signature · 1 line
2.29.2
PATCH v3 1/2 net: phy: micrel: Add KS8851 PHY support
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, including the PHY ID Low/High registers swap, which is present both in the MAC and the switch.
---
V2: Merge the KSZ8851 and KS886X entries, as those PHYs cannot be discerned
V3: Add RB from Andrew
--- drivers/net/phy/micrel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/micrel.c +1 -1
@@ -1389,7 +1389,7 @@ static struct phy_driver ksphy_driver[] = { }, { .phy_id = PHY_ID_KSZ886X, .phy_id_mask = MICREL_PHY_ID_MASK, - .name = "Micrel KSZ886X Switch", + .name = "Micrel KSZ8851 Ethernet MAC or KSZ886X Switch",/* PHY_BASIC_FEATURES */ .config_init = kszphy_config_init, .suspend = genphy_suspend,
Signature · 1 line
2.29.2
PATCH v3 2/2 net: ks8851: Register MDIO bus and the internal PHY
In reply to Marek VasutThe 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. Register MDIO bus so this PHY can be detected and probed by phylib.
---
V2: - Cast the BIT(0) to u32 to avoid build warnings
- Swap PHY ID Hi/Lo registers for MDIO bus access (retain old behavior for MII bus access)
- Return -EOPNOTSUPP on read from nonexisting PHY registers
V3: - Add RB from Andrew
- Drop unused ret variable from ks8851_mdio_read()
- Document new mii_bus entry in ks8851_net {}
--- drivers/net/ethernet/micrel/ks8851.h | 2 + drivers/net/ethernet/micrel/ks8851_common.c | 112 +++++++++++++++++--- 2 files changed, 98 insertions(+), 16 deletions(-)
drivers/net/ethernet/micrel/ks8851.h +2 -0
@@ -358,6 +358,7 @@ union ks8851_tx_hdr {* @vdd_reg: Optional regulator supplying the chip * @vdd_io: Optional digital power supply for IO * @gpio: Optional reset_n gpio +* @mii_bus: Pointer to MII bus structure * @lock: Bus access lock callback * @unlock: Bus access unlock callback * @rdreg16: 16bit register read callback
@@ -403,6 +404,7 @@ struct ks8851_net {struct regulator *vdd_reg;struct regulator *vdd_io;int gpio; +struct mii_bus *mii_bus;void (*lock)(struct ks8851_net *ks,unsigned long *flags);
drivers/net/ethernet/micrel/ks8851_common.c +96 -16
188 lines not on this page · raw message
Signature · 1 line
2.29.2
David Miller
maintainerFrom: Marek Vasut <[email protected]>
Date: Tue, 5 Jan 2021 15:11:49 +0100
Quoted 4 lines
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, including the PHY ID Low/High registers swap, which is present both in the MAC and the switch.
Series applied, thanks.