summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/renesas/rswitch.c
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2023-02-01 22:14:52 +0900
committerDavid S. Miller <davem@davemloft.net>2023-02-03 09:19:40 +0000
commit0df024d0f1d3e556e38e5418fc3577a2c7263764 (patch)
treeb02a8aa6fc8055691b46f1ecdd09e2a733117095 /drivers/net/ethernet/renesas/rswitch.c
parentc16a5033f77b9ee7e5317efe288e97159f32108b (diff)
net: renesas: rswitch: Add host_interfaces setting
Set phydev->host_interfaces before calling of_phy_connect() to configure the PHY with the information of host_interfaces. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/renesas/rswitch.c')
-rw-r--r--drivers/net/ethernet/renesas/rswitch.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 479499f9fcb5..f8b3a81c0447 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1178,6 +1178,7 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev)
{
struct phy_device *phydev;
struct device_node *phy;
+ int err = -ENOENT;
if (!rdev->np_port)
return -ENODEV;
@@ -1186,11 +1187,18 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev)
if (!phy)
return -ENODEV;
+ /* Set phydev->host_interfaces before calling of_phy_connect() to
+ * configure the PHY with the information of host_interfaces.
+ */
+ phydev = of_phy_find_device(phy);
+ if (!phydev)
+ goto out;
+ __set_bit(rdev->etha->phy_interface, phydev->host_interfaces);
+
phydev = of_phy_connect(rdev->ndev, phy, rswitch_adjust_link, 0,
rdev->etha->phy_interface);
- of_node_put(phy);
if (!phydev)
- return -ENOENT;
+ goto out;
phy_set_max_speed(phydev, SPEED_2500);
phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
@@ -1201,7 +1209,11 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev)
phy_attached_info(phydev);
- return 0;
+ err = 0;
+out:
+ of_node_put(phy);
+
+ return err;
}
static void rswitch_phy_device_deinit(struct rswitch_device *rdev)