Re: [PATCH net-next 2/2] net: lan743x: Add support to SGMII register dump for PCI11010/PCI11414 chips
From: Andrew Lunn
Date: Fri Sep 16 2022 - 08:18:56 EST
On Fri, Sep 16, 2022 at 01:53:27PM +0530, Raju Lakkaraju wrote:
> Add support to SGMII register dump
> +static void lan743x_get_pauseparam(struct net_device *dev,
> + struct ethtool_pauseparam *pause)
> +{
> + struct lan743x_adapter *adapter = netdev_priv(dev);
> +
> +// pause->autoneg = adapter->pause_autoneg;
> + pause->tx_pause = adapter->pause_tx;
> + pause->rx_pause = adapter->pause_rx;
> +}
> +
> +static int lan743x_set_pauseparam(struct net_device *dev,
> + struct ethtool_pauseparam *pause)
> +{
> + struct lan743x_adapter *adapter = netdev_priv(dev);
> + struct phy_device *phydev = dev->phydev;
> +
> + if (pause->autoneg)
> + return -EINVAL;
> +
> + if (!phydev)
> + return -EINVAL;
> +
> + if (!phy_validate_pause(phydev, pause))
> + return -EINVAL;
> +
> + //adapter->pause_auto = pause->autoneg;
> + adapter->pause_rx = pause->rx_pause;
> + adapter->pause_tx = pause->tx_pause;
> +
> + phy_set_asym_pause(phydev, pause->rx_pause, pause->tx_pause);
> +
> + return 0;
> }
This is not part of register dumping...
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> @@ -25,6 +25,22 @@
> #define PCS_POWER_STATE_DOWN 0x6
> #define PCS_POWER_STATE_UP 0x4
>
> +static int lan743x_sgmii_read(struct lan743x_adapter *adapter,
> + u8 mmd, u16 addr);
> +int lan743x_sgmii_dump_read(struct lan743x_adapter *adapter,
> + u8 dev, u16 adr)
> +{
> + int ret;
> +
> + ret = lan743x_sgmii_read(adapter, dev, adr);
> + if (ret < 0) {
> + pr_warn("SGMII read fail\n");
Better to use netdev_warn(), so we know which devices has read
problems.
Andrew