Re: [PATCH net 2/3] net: dsa: b53: fix configuring RGMII delay on bcm63xx

Andrew Lunn
2025-05-19T19:14:30Z

On Mon, May 19, 2025 at 07:45:49PM +0200, Jonas Gorski wrote:
> The RGMII delay type of the PHY interface is intended for the PHY, not
> the MAC, so we need to configure the opposite. Else we double the delay
> or don't add one at all if the PHY also supports configuring delays.
>
> Additionally, we need to enable RGMII_CTRL_TIMING_SEL for the delay
> actually being effective.
>
> Fixes e.g. BCM54612E connected on RGMII ports that also configures RGMII
> delays in its driver.

We have to be careful here not to cause regressions. It might be
wrong, but are there systems using this which actually work? Does this
change break them?

>
> Fixes: ce3bf94871f7 ("net: dsa: b53: add support for BCM63xx RGMIIs")
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
> ---
> drivers/net/dsa/b53/b53_common.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index a316f8c01d0a..b00975189dab 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -1328,19 +1328,19 @@ static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port,
>
> switch (interface) {
> case PHY_INTERFACE_MODE_RGMII_ID:
> - rgmii_ctrl |= (RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
> + rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
> break;
> case PHY_INTERFACE_MODE_RGMII_RXID:
> - rgmii_ctrl &= ~(RGMII_CTRL_DLL_TXC);
> - rgmii_ctrl |= RGMII_CTRL_DLL_RXC;
> + rgmii_ctrl |= RGMII_CTRL_DLL_TXC;
> + rgmii_ctrl &= ~RGMII_CTRL_DLL_RXC;
> break;
> case PHY_INTERFACE_MODE_RGMII_TXID:
> - rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC);
> - rgmii_ctrl |= RGMII_CTRL_DLL_TXC;
> + rgmii_ctrl |= RGMII_CTRL_DLL_RXC;
> + rgmii_ctrl &= ~RGMII_CTRL_DLL_TXC;
> break;
> case PHY_INTERFACE_MODE_RGMII:
> default:
> - rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
> + rgmii_ctrl |= RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC;
> break;

These changes look wrong. There is more background here:

https://elixir.bootlin.com/linux/v6.15-rc7/source/Documentation/devicetree/bindings/net/ethernet-controller.yaml#L287

Andrew