Commit f4e5f775 authored by Yonglong Liu's avatar Yonglong Liu Committed by David S. Miller

net: hns: fix LED configuration for marvell phy

Since commit(net: phy: marvell: change default m88e1510 LED configuration),
the active LED of Hip07 devices is always off, because Hip07 just
use 2 LEDs.
This patch adds a phy_register_fixup_for_uid() for m88e1510 to
correct the LED configuration.

Fixes: 07777246 ("net: phy: marvell: change default m88e1510 LED configuration")
Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
Reviewed-by: default avatarlinyunsheng <linyunsheng@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bba18318
......@@ -11,6 +11,7 @@
#include <linux/io.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/marvell_phy.h>
#include <linux/module.h>
#include <linux/phy.h>
#include <linux/platform_device.h>
......@@ -1149,6 +1150,13 @@ static void hns_nic_adjust_link(struct net_device *ndev)
}
}
static int hns_phy_marvell_fixup(struct phy_device *phydev)
{
phydev->dev_flags |= MARVELL_PHY_LED0_LINK_LED1_ACTIVE;
return 0;
}
/**
*hns_nic_init_phy - init phy
*@ndev: net device
......@@ -1174,6 +1182,16 @@ int hns_nic_init_phy(struct net_device *ndev, struct hnae_handle *h)
if (h->phy_if != PHY_INTERFACE_MODE_XGMII) {
phy_dev->dev_flags = 0;
/* register the PHY fixup (for Marvell 88E1510) */
ret = phy_register_fixup_for_uid(MARVELL_PHY_ID_88E1510,
MARVELL_PHY_ID_MASK,
hns_phy_marvell_fixup);
/* we can live without it, so just issue a warning */
if (ret)
netdev_warn(ndev,
"Cannot register PHY fixup, ret=%d\n",
ret);
ret = phy_connect_direct(ndev, phy_dev, hns_nic_adjust_link,
h->phy_if);
} else {
......@@ -2430,8 +2448,11 @@ static int hns_nic_dev_remove(struct platform_device *pdev)
hns_nic_uninit_ring_data(priv);
priv->ring_data = NULL;
if (ndev->phydev)
if (ndev->phydev) {
phy_unregister_fixup_for_uid(MARVELL_PHY_ID_88E1510,
MARVELL_PHY_ID_MASK);
phy_disconnect(ndev->phydev);
}
if (!IS_ERR_OR_NULL(priv->ae_handle))
hnae_put_handle(priv->ae_handle);
......
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