[PATCH v2 07/10] net: pcs: xpcs: add Rockchip RK3568 platform glue driver
Andrew Lunn
andrew at lunn.ch
Sat Aug 1 18:29:35 PDT 2026
On Sat, Aug 01, 2026 at 10:22:31PM +0800, Coia Prant wrote:
> The RK3568 SoC integrates a Synopsys DesignWare XPCS that is accessed
> via APB3 memory-mapped registers.
> This driver provides the glue logic to make the XPCS accessible to
> the generic pcs-xpcs core.
>
> The XPCS block contains four MII ports (0..3), each of which can be
> routed to GMAC0 or GMAC1 via the pcs-handle property in the MAC node.
> The hardware maps these ports to different MMDs:
> - port 0: MMD 7 (ROCKCHIP_MMD_MII)
> - port 1: MMD 2 (ROCKCHIP_MMD_MII1)
> - port 2: MMD 3 (ROCKCHIP_MMD_MII2)
> - port 3: MMD 4 (ROCKCHIP_MMD_MII3)
Why is port 0 called ROCKCHIP_MMD_MII not ROCKCHIP_MMD_MII0 ?
> This driver creates a virtual MDIO bus that translates MDIO operations
> to APB3 register accesses, with proper address remapping for each port.
> The generic xpcs driver then creates a phylink_pcs instance on top of
> this bus, allowing the MAC to use the PCS via the standard phylink API.
I would put some of this into the driver itself, but reading the code
it is not so obvious.
> +static int xpcs_rk_read_c22(struct mii_bus *bus, int addr, int reg)
> +{
> + struct dw_xpcs_rk *pxpcs = bus->priv;
> + int dev;
> +
> + if (!xpcs_rk_mdio_addr_validate(addr))
> + return -ENODEV;
> +
> + dev = xpcs_rk_mdio_read_remapping(addr, MDIO_MMD_VEND2, reg);
Does this mean C22 registers are mapped into the first 32 of C45
MDIO_MMD_VEND2?
> +static int xpcs_rk_read_c45(struct mii_bus *bus, int addr, int dev, int reg)
> +{
> + struct dw_xpcs_rk *pxpcs = bus->priv;
> +
> + if (!xpcs_rk_mdio_addr_validate(addr))
> + return -ENODEV;
> +
> + dev = xpcs_rk_mdio_read_remapping(addr, dev, reg);
Should it be returning an error for dev == MDIO_MMD_VEND2? Or at least
if reg < 32?
Andrew
More information about the linux-phy
mailing list