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

net: phy: dp83869: support mii mode when rgmii strap cfg is used

The DP83869 PHY on TI's k3-am642-evm supports both MII and RGMII
interfaces and is configured by default to use RGMII interface (strap).
However, the board design allows switching dynamically to MII interface
for testing purposes by applying different set of pinmuxes.

To support switching to MII interface, update the DP83869 PHY driver to
configure OP_MODE_DECODE.RGMII_MII_SEL(bit 5) properly when MII PHY
interface mode is requested.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20230508070359.357474-1-s-vadapalli@ti.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Grygorii Strashko and committed by
Paolo Abeni
94e86ef1 ed23734c

+12 -1
+12 -1
drivers/net/phy/dp83869.c
··· 692 692 /* Below init sequence for each operational mode is defined in 693 693 * section 9.4.8 of the datasheet. 694 694 */ 695 + phy_ctrl_val = dp83869->mode; 696 + if (phydev->interface == PHY_INTERFACE_MODE_MII) { 697 + if (dp83869->mode == DP83869_100M_MEDIA_CONVERT || 698 + dp83869->mode == DP83869_RGMII_100_BASE) { 699 + phy_ctrl_val |= DP83869_OP_MODE_MII; 700 + } else { 701 + phydev_err(phydev, "selected op-mode is not valid with MII mode\n"); 702 + return -EINVAL; 703 + } 704 + } 705 + 695 706 ret = phy_write_mmd(phydev, DP83869_DEVADDR, DP83869_OP_MODE, 696 - dp83869->mode); 707 + phy_ctrl_val); 697 708 if (ret) 698 709 return ret; 699 710