Re: [PATCH v14, 2/2] net: Add dm9051 driver

From: Andrew Lunn
Date: Thu Jan 27 2022 - 21:19:26 EST


> +static int dm9051_mdiobus_read(struct mii_bus *bus, int addr, int regnum)
> +{
> + struct board_info *db = bus->priv;
> + unsigned int val = 0xffff;
> + int ret;
> +
> + if (addr == DM9051_PHY_ID) {

Thanks for fixing the variable name. But don't you think it would of
made sense to rename DM9051_PHY_ID as well? DM9051_PHY_ADDR?

> +static int dm9051_set_pauseparam(struct net_device *ndev,
> + struct ethtool_pauseparam *pause)
> +{
> + struct board_info *db = to_dm9051_board(ndev);
> + u8 fcr = 0;
> + int ret;
> +
> + db->eth_pause = *pause;
> +
> + if (pause->autoneg)
> + db->phydev->autoneg = AUTONEG_ENABLE;
> + else
> + db->phydev->autoneg = AUTONEG_DISABLE;
> +

pause->autoneg means that pause is negotiated as part of autoneg in
general. But pause->autoneg does not mean turn on autoneg. The
ksetting calls should be used for that.

If pause->autoneg is false, you write the pause settings direct to the
MAC. If it is true, you should call phy_set_sym_pause(). Once
negotiation has completed the link change callback will be called, and
you program the MAC with what has been negotiated.

Andrew