aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier2023-03-22 09:42:47 +0100
committerTom Rini2023-05-05 17:48:44 -0400
commit29003429617945250e2cafed985f8221d4b46832 (patch)
tree87041ba8b70cca470a3598b32c9521de3bf7e215
parente4bd95bba16bd57fcbf8bc38592c8a83f37be458 (diff)
net: phy: gmii2rgmii: Support external rgmii-id phy
Read the phy mode of the external phy from the device tree if available and check that it is a RGMII variant. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
-rw-r--r--drivers/net/phy/xilinx_gmii2rgmii.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index 0b7436a7e1e..e2969bc4842 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -48,7 +48,14 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev)
return -EINVAL;
}
- ext_phydev->interface = PHY_INTERFACE_MODE_RGMII;
+ ext_phydev->interface = ofnode_read_phy_mode(node);
+ if (ext_phydev->interface == PHY_INTERFACE_MODE_NA) {
+ ext_phydev->interface = PHY_INTERFACE_MODE_RGMII;
+ } else if (!phy_interface_is_rgmii(ext_phydev)) {
+ printf("Incorrect external interface type\n");
+ return -EINVAL;
+ }
+
ext_phydev->node = phandle.node;
phydev->priv = ext_phydev;