Skip to content

Commit 18a9187

Browse files
ParthibanI17164kuba-moo
authored andcommitted
net: phy: microchip_t1s: add c45 direct access in LAN865x internal PHY
This patch adds c45 registers direct access support in Microchip's LAN865x internal PHY. 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 Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Parthiban Veerasooran <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8f9bf85 commit 18a9187

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

drivers/net/phy/microchip_t1s.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,34 @@ static int lan86xx_read_status(struct phy_device *phydev)
268268
return 0;
269269
}
270270

271+
/* OPEN Alliance 10BASE-T1x compliance MAC-PHYs will have both C22 and
272+
* C45 registers space. If the PHY is discovered via C22 bus protocol it assumes
273+
* it uses C22 protocol and always uses C22 registers indirect access to access
274+
* C45 registers. This is because, we don't have a clean separation between
275+
* C22/C45 register space and C22/C45 MDIO bus protocols. Resulting, PHY C45
276+
* registers direct access can't be used which can save multiple SPI bus access.
277+
* To support this feature, set .read_mmd/.write_mmd in the PHY driver to call
278+
* .read_c45/.write_c45 in the OPEN Alliance framework
279+
* drivers/net/ethernet/oa_tc6.c
280+
*/
281+
static int lan865x_phy_read_mmd(struct phy_device *phydev, int devnum,
282+
u16 regnum)
283+
{
284+
struct mii_bus *bus = phydev->mdio.bus;
285+
int addr = phydev->mdio.addr;
286+
287+
return __mdiobus_c45_read(bus, addr, devnum, regnum);
288+
}
289+
290+
static int lan865x_phy_write_mmd(struct phy_device *phydev, int devnum,
291+
u16 regnum, u16 val)
292+
{
293+
struct mii_bus *bus = phydev->mdio.bus;
294+
int addr = phydev->mdio.addr;
295+
296+
return __mdiobus_c45_write(bus, addr, devnum, regnum, val);
297+
}
298+
271299
static struct phy_driver microchip_t1s_driver[] = {
272300
{
273301
PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1),
@@ -285,6 +313,8 @@ static struct phy_driver microchip_t1s_driver[] = {
285313
.features = PHY_BASIC_T1S_P2MP_FEATURES,
286314
.config_init = lan865x_revb0_config_init,
287315
.read_status = lan86xx_read_status,
316+
.read_mmd = lan865x_phy_read_mmd,
317+
.write_mmd = lan865x_phy_write_mmd,
288318
.get_plca_cfg = genphy_c45_plca_get_cfg,
289319
.set_plca_cfg = genphy_c45_plca_set_cfg,
290320
.get_plca_status = genphy_c45_plca_get_status,

0 commit comments

Comments
 (0)