diff mbox series

[2/4] net: dsa: microchip: Add debug print for XMII port mode

Message ID 20200905140325.108846-3-pbarker@konsulko.com
State New
Headers show
Series ksz9477 dsa switch driver improvements | expand

Commit Message

Paul Barker Sept. 5, 2020, 2:03 p.m. UTC
When debug is enabled for this driver, this allows users to confirm that
the correct port mode is in use.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
---
 drivers/net/dsa/microchip/ksz9477.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Andrew Lunn Sept. 5, 2020, 3:31 p.m. UTC | #1
On Sat, Sep 05, 2020 at 03:03:23PM +0100, Paul Barker wrote:
> When debug is enabled for this driver, this allows users to confirm that
> the correct port mode is in use.
> 
> Signed-off-by: Paul Barker <pbarker@konsulko.com>
> ---
>  drivers/net/dsa/microchip/ksz9477.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index a48f5edab561..3e36aa628c9f 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -1211,21 +1211,25 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
>  		ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &data8);
>  		switch (dev->interface) {
>  		case PHY_INTERFACE_MODE_MII:
> +			dev_dbg(dev->dev, "Port%d: MII mode\n", port);
>  			ksz9477_set_xmii(dev, 0, &data8);
>  			ksz9477_set_gbit(dev, false, &data8);
>  			p->phydev.speed = SPEED_100;
>  			break;
>  		case PHY_INTERFACE_MODE_RMII:
> +			dev_dbg(dev->dev, "Port%d: RMII mode\n", port);
>  			ksz9477_set_xmii(dev, 1, &data8);
>  			ksz9477_set_gbit(dev, false, &data8);
>  			p->phydev.speed = SPEED_100;
>  			break;
>  		case PHY_INTERFACE_MODE_GMII:
> +			dev_dbg(dev->dev, "Port%d: GMII mode\n", port);
>  			ksz9477_set_xmii(dev, 2, &data8);
>  			ksz9477_set_gbit(dev, true, &data8);
>  			p->phydev.speed = SPEED_1000;
>  			break;
>  		default:
> +			dev_dbg(dev->dev, "Port%d: RGMII mode\n", port);
>  			ksz9477_set_xmii(dev, 3, &data8);
>  			ksz9477_set_gbit(dev, true, &data8);
>  			data8 &= ~PORT_RGMII_ID_IG_ENABLE;

You could do

dev_dbg(dev->dev, "Port%d: %s\n", port, phy_mode(dev->interface));

just before the switch statement.    

     Andrew
diff mbox series

Patch

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index a48f5edab561..3e36aa628c9f 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -1211,21 +1211,25 @@  static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
 		ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &data8);
 		switch (dev->interface) {
 		case PHY_INTERFACE_MODE_MII:
+			dev_dbg(dev->dev, "Port%d: MII mode\n", port);
 			ksz9477_set_xmii(dev, 0, &data8);
 			ksz9477_set_gbit(dev, false, &data8);
 			p->phydev.speed = SPEED_100;
 			break;
 		case PHY_INTERFACE_MODE_RMII:
+			dev_dbg(dev->dev, "Port%d: RMII mode\n", port);
 			ksz9477_set_xmii(dev, 1, &data8);
 			ksz9477_set_gbit(dev, false, &data8);
 			p->phydev.speed = SPEED_100;
 			break;
 		case PHY_INTERFACE_MODE_GMII:
+			dev_dbg(dev->dev, "Port%d: GMII mode\n", port);
 			ksz9477_set_xmii(dev, 2, &data8);
 			ksz9477_set_gbit(dev, true, &data8);
 			p->phydev.speed = SPEED_1000;
 			break;
 		default:
+			dev_dbg(dev->dev, "Port%d: RGMII mode\n", port);
 			ksz9477_set_xmii(dev, 3, &data8);
 			ksz9477_set_gbit(dev, true, &data8);
 			data8 &= ~PORT_RGMII_ID_IG_ENABLE;