Skip to content

Commit 0df024d

Browse files
shimodaydavem330
authored andcommitted
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>
1 parent c16a503 commit 0df024d

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

drivers/net/ethernet/renesas/rswitch.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev)
11781178
{
11791179
struct phy_device *phydev;
11801180
struct device_node *phy;
1181+
int err = -ENOENT;
11811182

11821183
if (!rdev->np_port)
11831184
return -ENODEV;
@@ -1186,11 +1187,18 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev)
11861187
if (!phy)
11871188
return -ENODEV;
11881189

1190+
/* Set phydev->host_interfaces before calling of_phy_connect() to
1191+
* configure the PHY with the information of host_interfaces.
1192+
*/
1193+
phydev = of_phy_find_device(phy);
1194+
if (!phydev)
1195+
goto out;
1196+
__set_bit(rdev->etha->phy_interface, phydev->host_interfaces);
1197+
11891198
phydev = of_phy_connect(rdev->ndev, phy, rswitch_adjust_link, 0,
11901199
rdev->etha->phy_interface);
1191-
of_node_put(phy);
11921200
if (!phydev)
1193-
return -ENOENT;
1201+
goto out;
11941202

11951203
phy_set_max_speed(phydev, SPEED_2500);
11961204
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)
12011209

12021210
phy_attached_info(phydev);
12031211

1204-
return 0;
1212+
err = 0;
1213+
out:
1214+
of_node_put(phy);
1215+
1216+
return err;
12051217
}
12061218

12071219
static void rswitch_phy_device_deinit(struct rswitch_device *rdev)

0 commit comments

Comments
 (0)