[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53c8eeb2-f2f3-45a6-842f-44556c1098af@lunn.ch>
Date: Sun, 19 Mar 2023 19:50:47 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Álvaro Fernández Rojas <noltari@...il.com>
Cc: f.fainelli@...il.com, jonas.gorski@...il.com, olteanv@...il.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: dsa: b53: add support for BCM63xx RGMIIs
> +static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port,
> + phy_interface_t interface)
> +{
> + struct b53_device *dev = ds->priv;
> + u8 rgmii_ctrl = 0, off;
> +
> + if (port == dev->imp_port)
> + off = B53_RGMII_CTRL_IMP;
> + else
> + off = B53_RGMII_CTRL_P(port);
> +
> + b53_read8(dev, B53_CTRL_PAGE, off, &rgmii_ctrl);
> +
> + rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
> + if (interface == PHY_INTERFACE_MODE_RGMII_ID)
> + rgmii_ctrl |= (RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
> + else if (interface == PHY_INTERFACE_MODE_RGMII_RXID)
> + rgmii_ctrl |= RGMII_CTRL_DLL_RXC;
> + else if (interface == PHY_INTERFACE_MODE_RGMII_TXID)
> + rgmii_ctrl |= RGMII_CTRL_DLL_TXC;
Please change this to a switch statement. Then i would suggest having
a case PHY_INTERFACE_MODE_RGMII: to make it clear you are handling
that as well, removing all delays. You do look to be handling it, so
it is not a big problem, but in the past we have had code where one of
the RGMII modes has been ignored resulting in some horrible problems
later. So it is something i now always look for, and like to be obvious.
> +
> + if (port != dev->imp_port)
> + rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
> +
> + b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl);
> +
> + dev_info(ds->dev, "Configured port %d for %s\n", port,
> + phy_modes(interface));
dev_dbg().
Andrew
Powered by blists - more mailing lists