Skip to contentSkip to conversation

net: ks8851: Add KS8851 PHY support

PATCH In review Marek Vasut 2 participants 4 messages Jan 5, 2021 – Jan 6, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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(-)
Cc Andrew Lunn <[email protected]>
Cc Heiner Kallweit <[email protected]>
Cc Lukas Wunner <[email protected]>
Signature · 1 line
2.29.2
#1 lore raw

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.

Cc Andrew Lunn <[email protected]>
Cc Heiner Kallweit <[email protected]>
Cc Lukas Wunner <[email protected]>

---
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
index 54e0d75203da..39c7c786a912 100644
@@ -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
#2 lore raw

PATCH v3 2/2 net: ks8851: Register MDIO bus and the internal PHY

In reply to Marek Vasut

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. Register MDIO bus so this PHY can be detected and probed by phylib.

Cc Andrew Lunn <[email protected]>
Cc Heiner Kallweit <[email protected]>
Cc Lukas Wunner <[email protected]>

---
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
index 2b319e451121..e2eb0caeac82 100644
@@ -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
maintainer
#3 lore raw
In reply to Marek Vasut

From: 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.