Re: [PATCH NET v3 2/2] net: hns: Use phy_driver to setup Phy loopback

From: Andrew Lunn
Date: Fri Jun 23 2017 - 23:19:18 EST


> static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en)
> {
> -#define COPPER_CONTROL_REG 0
> -#define PHY_POWER_DOWN BIT(11)
> -#define PHY_LOOP_BACK BIT(14)
> - u16 val = 0;
> + int err;
>
> if (phy_dev->is_c45) /* c45 branch adding for XGE PHY */
> return -ENOTSUPP;

You should take this out as well. You want the core to tell you if
loopback is supported or not. At some point, a c45 PHY could support
loopback.

> + case MAC_LOOP_PHY_NONE:
> if ((phy_dev) && (!phy_dev->is_c45))
> ret |= hns_nic_config_phy_loopback(phy_dev, 0x0);

same here.

Andrew