[PATCH net-next 2/2] net: dsa: mxl-gsw1xx: Support R(G)MII slew rate configuration

A. Sverdlin posted 2 patches 1 month, 4 weeks ago
There is a newer version of this series
[PATCH net-next 2/2] net: dsa: mxl-gsw1xx: Support R(G)MII slew rate configuration
Posted by A. Sverdlin 1 month, 4 weeks ago
From: Alexander Sverdlin <alexander.sverdlin@siemens.com>

Support newly introduced maxlinear,mii-slew-rate-slow device tree property
to configure R(G)MII interface pins slew rate into "slow" mode. It might be
used to reduce the radiated emissions.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
---
 drivers/net/dsa/lantiq/mxl-gsw1xx.c | 6 ++++++
 drivers/net/dsa/lantiq/mxl-gsw1xx.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.c b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
index 0816c61a47f12..ec7b92f62dcb5 100644
--- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c
+++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
@@ -526,6 +526,12 @@ static struct phylink_pcs *gsw1xx_phylink_mac_select_pcs(struct phylink_config *
 	switch (dp->index) {
 	case GSW1XX_SGMII_PORT:
 		return &gsw1xx_priv->pcs;
+	case GSW1XX_MII_PORT:
+		if (of_property_read_bool(dp->dn, "maxlinear,mii-slew-rate-slow"))
+			regmap_set_bits(gsw1xx_priv->shell,
+					RGMII_SLEW_CFG_DRV_TXD | RGMII_SLEW_CFG_DRV_TXC,
+					GSW1XX_SHELL_RGMII_SLEW_CFG);
+		return NULL;
 	default:
 		return NULL;
 	}
diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.h b/drivers/net/dsa/lantiq/mxl-gsw1xx.h
index 38e03c048a26c..8c0298b2b7663 100644
--- a/drivers/net/dsa/lantiq/mxl-gsw1xx.h
+++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.h
@@ -110,6 +110,8 @@
 #define   GSW1XX_RST_REQ_SGMII_SHELL		BIT(5)
 /* RGMII PAD Slew Control Register */
 #define  GSW1XX_SHELL_RGMII_SLEW_CFG		0x78
+#define   RGMII_SLEW_CFG_DRV_TXC		BIT(2)
+#define   RGMII_SLEW_CFG_DRV_TXD		BIT(3)
 #define   RGMII_SLEW_CFG_RX_2_5_V		BIT(4)
 #define   RGMII_SLEW_CFG_TX_2_5_V		BIT(5)
 
-- 
2.52.0
Re: [PATCH net-next 2/2] net: dsa: mxl-gsw1xx: Support R(G)MII slew rate configuration
Posted by Daniel Golle 1 month, 3 weeks ago
Hi Alexander,

On Fri, Dec 12, 2025 at 09:45:53PM +0100, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> Support newly introduced maxlinear,mii-slew-rate-slow device tree property
> to configure R(G)MII interface pins slew rate into "slow" mode. It might be
> used to reduce the radiated emissions.
> 
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> ---
>  drivers/net/dsa/lantiq/mxl-gsw1xx.c | 6 ++++++
>  drivers/net/dsa/lantiq/mxl-gsw1xx.h | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.c b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> index 0816c61a47f12..ec7b92f62dcb5 100644
> --- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> +++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> @@ -526,6 +526,12 @@ static struct phylink_pcs *gsw1xx_phylink_mac_select_pcs(struct phylink_config *
>  	switch (dp->index) {
>  	case GSW1XX_SGMII_PORT:
>  		return &gsw1xx_priv->pcs;
> +	case GSW1XX_MII_PORT:
> +		if (of_property_read_bool(dp->dn, "maxlinear,mii-slew-rate-slow"))
> +			regmap_set_bits(gsw1xx_priv->shell,
> +					RGMII_SLEW_CFG_DRV_TXD | RGMII_SLEW_CFG_DRV_TXC,
> +					GSW1XX_SHELL_RGMII_SLEW_CFG);
> +		return NULL;

Please apply this setting once in the probe function before calling
gswip_probe_common(). You will have to traverse the device tree to
the node of the port, but imho this is still better because there is
no need to apply it every time mac_select_pcs() is called. And while
it is not strictly speaking wrong to do it there, in my understanding
the purpose of .mac_select_pcs is to return the PCS and maybe setup
muxes, but not to apply low-level settings.

Apart from that, please program the register also in the 'else' case.
Re: [PATCH net-next 2/2] net: dsa: mxl-gsw1xx: Support R(G)MII slew rate configuration
Posted by Andrew Lunn 1 month, 4 weeks ago
> +	case GSW1XX_MII_PORT:
> +		if (of_property_read_bool(dp->dn, "maxlinear,mii-slew-rate-slow"))
> +			regmap_set_bits(gsw1xx_priv->shell,
> +					RGMII_SLEW_CFG_DRV_TXD | RGMII_SLEW_CFG_DRV_TXC,
> +					GSW1XX_SHELL_RGMII_SLEW_CFG);

The binding says:

+              Configure R(G)MII TXD/TXC pads' slew rate to "slow" instead
+              of "normal" to reduce radiated emissions.

So you really should set the slew to normal if the property does not
exist.

	Andrew