Re: [PATCH v2 3/4] net: stmmac: Add glue layer for Loongson-1 SoC

From: Andrew Lunn
Date: Sun Aug 20 2023 - 15:07:47 EST


> +static int ls1b_dwmac_syscon_init(struct plat_stmmacenet_data *plat)
> +{
> + struct ls1x_dwmac *dwmac = plat->bsp_priv;
> + struct regmap_field **regmap_fields = dwmac->regmap_fields;
> +
> + if (plat->bus_id) {
> + regmap_field_write(regmap_fields[GMAC1_USE_UART1], 1);
> + regmap_field_write(regmap_fields[GMAC1_USE_UART0], 1);
> +
> + switch (plat->phy_interface) {
> + case PHY_INTERFACE_MODE_RGMII:
> + regmap_field_write(regmap_fields[GMAC1_USE_TXCLK], 0);
> + regmap_field_write(regmap_fields[GMAC1_USE_PWM23], 0);
> + break;

What about the other three RGMII modes? Plain rgmii is pretty unusual,
rgmii-id is the most used.

> + case PHY_INTERFACE_MODE_MII:
> + regmap_field_write(regmap_fields[GMAC1_USE_TXCLK], 1);
> + regmap_field_write(regmap_fields[GMAC1_USE_PWM23], 1);
> + break;
> + default:
> + dev_err(dwmac->dev, "Unsupported PHY mode %u\n",
> + plat->phy_interface);
> + return -EOPNOTSUPP;
> + }
> +
> + regmap_field_write(regmap_fields[GMAC1_SHUT], 0);
> + } else {
> + switch (plat->phy_interface) {
> + case PHY_INTERFACE_MODE_RGMII:
> + regmap_field_write(regmap_fields[GMAC0_USE_TXCLK], 0);
> + regmap_field_write(regmap_fields[GMAC0_USE_PWM01], 0);
> + break;

same here.

Andrew