lkml.org 
[lkml]   [2019]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH net-next 10/10] net: stmmac: Try to get C45 PHY if everything else fails
    Date
    On PCI based setups that are connected to C45 PHY we won't have DT
    bindings specifying what's the correct PHY type.

    Fallback to C45 if everything else fails when trying to acquire PHY.

    Signed-off-by: Jose Abreu <joabreu@synopsys.com>
    Cc: Joao Pinto <jpinto@synopsys.com>
    Cc: David S. Miller <davem@davemloft.net>
    Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
    Cc: Alexandre Torgue <alexandre.torgue@st.com>
    ---
    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 ++++++++++++++
    1 file changed, 14 insertions(+)

    diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    index bc949665c529..e790ab79e819 100644
    --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    @@ -1014,6 +1014,20 @@ static int stmmac_init_phy(struct net_device *dev)

    phydev = mdiobus_get_phy(priv->mii, addr);
    if (!phydev) {
    + /* Try C45 */
    + phydev = get_phy_device(priv->mii, addr, true);
    + if (phydev && !IS_ERR(phydev)) {
    + ret = phy_device_register(phydev);
    + if (ret) {
    + phy_device_free(phydev);
    + phydev = NULL;
    + }
    + } else {
    + phydev = NULL;
    + }
    + }
    +
    + if (!phydev) {
    netdev_err(priv->dev, "no phy at addr %d\n", addr);
    return -ENODEV;
    }
    --
    2.7.4
    \
     
     \ /
      Last update: 2019-06-26 15:49    [W:4.101 / U:0.652 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site