Commit 0df024d0 authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by David S. Miller

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: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c16a5033
...@@ -1178,6 +1178,7 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev) ...@@ -1178,6 +1178,7 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev)
{ {
struct phy_device *phydev; struct phy_device *phydev;
struct device_node *phy; struct device_node *phy;
int err = -ENOENT;
if (!rdev->np_port) if (!rdev->np_port)
return -ENODEV; return -ENODEV;
...@@ -1186,11 +1187,18 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev) ...@@ -1186,11 +1187,18 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev)
if (!phy) if (!phy)
return -ENODEV; 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, phydev = of_phy_connect(rdev->ndev, phy, rswitch_adjust_link, 0,
rdev->etha->phy_interface); rdev->etha->phy_interface);
of_node_put(phy);
if (!phydev) if (!phydev)
return -ENOENT; goto out;
phy_set_max_speed(phydev, SPEED_2500); phy_set_max_speed(phydev, SPEED_2500);
phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT); 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) ...@@ -1201,7 +1209,11 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev)
phy_attached_info(phydev); 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) static void rswitch_phy_device_deinit(struct rswitch_device *rdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment