Re: [PATCH net-next v16 05/15] net: dsa: realtek: rtl8365mb: set RGMII mode for family D

From: Linus Walleij

Date: Sun Nov 29 2026 - 17:48:00 EST


On Sun, Nov 29, 2026 at 4:07 PM Mieczyslaw Nalewaj <namiltd@xxxxxxxxx> wrote:

> On family D, RGMII on extension interface 1 needs additional pin drive
> and slew controls, the EXT1 RGMII TX clock delay field in EXT_TXC_DLY
> (0x13f9, bits [5:3]) must be cleared, the pin mux in the top-level
> configuration register must be set up, and SerDes 1, which shares the
> pins, must be disabled.
>
> Program the EXT1 pin controls explicitly when selecting RGMII instead
> of relying on values inherited from the family C initialization table.
> Set the RG1 DN and DP fields to 7 and 5 respectively, as prescribed by
> the RTL8367D port API, while preserving unrelated register fields.
>
> The vendor RGMII setup for EXT1 clears the RGMII field of EXT_TXC_DLY
> (0x13f9, bits [5:3]) in addition to programming TXDELAY in RGMXF.
> Do the same so that any non-zero reset or bootloader value in that field
> cannot add an extra TX delay on top of tx-internal-delay-ps, making
> tx-internal-delay-ps the only source of TX delay.
>
> If the internal MAC4 block occupies extension 1, do not advertise RGMII
> for port 7 in phylink_get_caps(), so the configuration is refused before
> any EXT1 register is touched. This mirrors the vendor RTL8367D API, which
> returns an error for RGMII on port 7 when UTP port 4 uses the RGMII
> interface. The driver logs an error naming the conflict. RGMII is the
> only interface of port 7 this driver implements, so port 7 then has no
> supported interface: phylink_create() fails for it, and if it is a CPU
> port the switch does not probe.
>
> When MAC4 does not own the pins, bind the RGMII/MII pins to MAC7 and
> disable SerDes 1, which shares them. The TX delay field, the pin mux and
> the SerDes 1 disable are all programmed before RGMII is selected, so the
> shared pins are never driven by RGMII and SerDes 1 at the same time.
>
> The family D branch is not reachable until the chip table entry is
> added in the last patch.
>
> Signed-off-by: Mieczyslaw Nalewaj <namiltd@xxxxxxxxx>

It's a bit weird that the D branch is unused until later in the
patch series but I guess there are patch mechanics reasons
and other than that this looks good to me, so:
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>

Yours,
Linus Walleij