mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
Merge branch 'phy-handle-fixes'
Michael Sit Wei Hong says: ==================== Fix PHY handle no longer parsing After the fixed link support was introduced, it is observed that PHY no longer attach to the MAC properly. So we introduce a helper function to determine if the MAC should expect to connect to a PHY and proceed accordingly. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
279d8ff5ec
|
|
@ -251,7 +251,6 @@ static void intel_speed_mode_2500(struct net_device *ndev, void *intel_data)
|
||||||
priv->plat->mdio_bus_data->xpcs_an_inband = false;
|
priv->plat->mdio_bus_data->xpcs_an_inband = false;
|
||||||
} else {
|
} else {
|
||||||
priv->plat->max_speed = 1000;
|
priv->plat->max_speed = 1000;
|
||||||
priv->plat->mdio_bus_data->xpcs_an_inband = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1135,6 +1135,7 @@ static int stmmac_init_phy(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct stmmac_priv *priv = netdev_priv(dev);
|
struct stmmac_priv *priv = netdev_priv(dev);
|
||||||
struct fwnode_handle *fwnode;
|
struct fwnode_handle *fwnode;
|
||||||
|
bool phy_needed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
fwnode = of_fwnode_handle(priv->plat->phylink_node);
|
fwnode = of_fwnode_handle(priv->plat->phylink_node);
|
||||||
|
|
@ -1144,10 +1145,11 @@ static int stmmac_init_phy(struct net_device *dev)
|
||||||
if (fwnode)
|
if (fwnode)
|
||||||
ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0);
|
ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0);
|
||||||
|
|
||||||
|
phy_needed = phylink_expects_phy(priv->phylink);
|
||||||
/* Some DT bindings do not set-up the PHY handle. Let's try to
|
/* Some DT bindings do not set-up the PHY handle. Let's try to
|
||||||
* manually parse it
|
* manually parse it
|
||||||
*/
|
*/
|
||||||
if (!fwnode || ret) {
|
if (!fwnode || phy_needed || ret) {
|
||||||
int addr = priv->plat->phy_addr;
|
int addr = priv->plat->phy_addr;
|
||||||
struct phy_device *phydev;
|
struct phy_device *phydev;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1586,6 +1586,25 @@ void phylink_destroy(struct phylink *pl)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(phylink_destroy);
|
EXPORT_SYMBOL_GPL(phylink_destroy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* phylink_expects_phy() - Determine if phylink expects a phy to be attached
|
||||||
|
* @pl: a pointer to a &struct phylink returned from phylink_create()
|
||||||
|
*
|
||||||
|
* When using fixed-link mode, or in-band mode with 1000base-X or 2500base-X,
|
||||||
|
* no PHY is needed.
|
||||||
|
*
|
||||||
|
* Returns true if phylink will be expecting a PHY.
|
||||||
|
*/
|
||||||
|
bool phylink_expects_phy(struct phylink *pl)
|
||||||
|
{
|
||||||
|
if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
|
||||||
|
(pl->cfg_link_an_mode == MLO_AN_INBAND &&
|
||||||
|
phy_interface_mode_is_8023z(pl->link_config.interface)))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(phylink_expects_phy);
|
||||||
|
|
||||||
static void phylink_phy_change(struct phy_device *phydev, bool up)
|
static void phylink_phy_change(struct phy_device *phydev, bool up)
|
||||||
{
|
{
|
||||||
struct phylink *pl = phydev->phylink;
|
struct phylink *pl = phydev->phylink;
|
||||||
|
|
|
||||||
|
|
@ -574,6 +574,7 @@ struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *,
|
||||||
phy_interface_t iface,
|
phy_interface_t iface,
|
||||||
const struct phylink_mac_ops *mac_ops);
|
const struct phylink_mac_ops *mac_ops);
|
||||||
void phylink_destroy(struct phylink *);
|
void phylink_destroy(struct phylink *);
|
||||||
|
bool phylink_expects_phy(struct phylink *pl);
|
||||||
|
|
||||||
int phylink_connect_phy(struct phylink *, struct phy_device *);
|
int phylink_connect_phy(struct phylink *, struct phy_device *);
|
||||||
int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags);
|
int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user