[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f9c612bf9ad9b2990d456e6673a65b95438d6c7c.camel@axis.com>
Date: Thu, 4 Dec 2025 14:27:50 +0000
From: Ivan Galkin <Ivan.Galkin@...s.com>
To: "marek.vasut@...lbox.org" <marek.vasut@...lbox.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"andrew@...n.ch" <andrew@...n.ch>, "davem@...emloft.net"
<davem@...emloft.net>, "hkallweit1@...il.com" <hkallweit1@...il.com>,
"michael@...sekall.de" <michael@...sekall.de>, "linux@...linux.org.uk"
<linux@...linux.org.uk>, "robh@...nel.org" <robh@...nel.org>,
"vladimir.oltean@....com" <vladimir.oltean@....com>, "olek2@...pl"
<olek2@...pl>, "kuba@...nel.org" <kuba@...nel.org>, "f.fainelli@...il.com"
<f.fainelli@...il.com>, "edumazet@...gle.com" <edumazet@...gle.com>,
"conor+dt@...nel.org" <conor+dt@...nel.org>, "krzk+dt@...nel.org"
<krzk+dt@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>
Subject: Re: [net-next,PATCH v2 3/3] net: phy: realtek: Add property to enable
SSC
On Wed, 2025-12-03 at 22:08 +0100, Marek Vasut wrote:
> Add support for spread spectrum clocking (SSC) on RTL8211F(D)(I)-CG,
> RTL8211FS(I)(-VS)-CG, RTL8211FG(I)(-VS)-CG PHYs. The implementation
> follows EMI improvement application note Rev. 1.2 for these PHYs.
>
> The current implementation enables SSC for both RXC and SYSCLK clock
> signals. Introduce DT properties 'realtek,clkout-ssc-enable',
> 'realtek,rxc-ssc-enable' and 'realtek,sysclk-ssc-enable' which
> control
> CLKOUT, RXC and SYSCLK SSC spread spectrum clocking enablement on
> these
> signals.
>
> Signed-off-by: Marek Vasut <marek.vasut@...lbox.org>
> ---
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Aleksander Jan Bajkowski <olek2@...pl>
> Cc: Andrew Lunn <andrew@...n.ch>
> Cc: Conor Dooley <conor+dt@...nel.org>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Cc: Florian Fainelli <f.fainelli@...il.com>
> Cc: Heiner Kallweit <hkallweit1@...il.com>
> Cc: Ivan Galkin <ivan.galkin@...s.com>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Krzysztof Kozlowski <krzk+dt@...nel.org>
> Cc: Michael Klein <michael@...sekall.de>
> Cc: Paolo Abeni <pabeni@...hat.com>
> Cc: Rob Herring <robh@...nel.org>
> Cc: Russell King <linux@...linux.org.uk>
> Cc: Vladimir Oltean <vladimir.oltean@....com>
> Cc: devicetree@...r.kernel.org
> Cc: netdev@...r.kernel.org
> ---
> V2: Split SSC clock control for each CLKOUT, RXC, SYSCLK signal
> ---
> drivers/net/phy/realtek/realtek_main.c | 124
> +++++++++++++++++++++++++
> 1 file changed, 124 insertions(+)
>
> diff --git a/drivers/net/phy/realtek/realtek_main.c
> b/drivers/net/phy/realtek/realtek_main.c
> index 67ecf3d4af2b1..ac80653cdbe28 100644
> --- a/drivers/net/phy/realtek/realtek_main.c
> +++ b/drivers/net/phy/realtek/realtek_main.c
> @@ -74,11 +74,19 @@
>
> #define RTL8211F_PHYCR2 0x19
> #define RTL8211F_CLKOUT_EN BIT(0)
> +#define RTL8211F_SYSCLK_SSC_EN BIT(3)
> #define RTL8211F_PHYCR2_PHY_EEE_ENABLE BIT(5)
> +#define RTL8211F_CLKOUT_SSC_EN BIT(7)
>
> #define RTL8211F_INSR_PAGE 0xa43
> #define RTL8211F_INSR 0x1d
>
> +/* RTL8211F SSC settings */
> +#define RTL8211F_SSC_PAGE 0xc44
> +#define RTL8211F_SSC_RXC 0x13
> +#define RTL8211F_SSC_SYSCLK 0x17
> +#define RTL8211F_SSC_CLKOUT 0x19
> +
> /* RTL8211F LED configuration */
> #define RTL8211F_LEDCR_PAGE 0xd04
> #define RTL8211F_LEDCR 0x10
> @@ -203,6 +211,9 @@ MODULE_LICENSE("GPL");
> struct rtl821x_priv {
> bool enable_aldps;
> bool disable_clk_out;
> + bool enable_clkout_ssc;
> + bool enable_rxc_ssc;
> + bool enable_sysclk_ssc;
> struct clk *clk;
> /* rtl8211f */
> u16 iner;
> @@ -266,6 +277,12 @@ static int rtl821x_probe(struct phy_device
> *phydev)
> "realtek,aldps-
> enable");
> priv->disable_clk_out = of_property_read_bool(dev->of_node,
>
> "realtek,clkout-disable");
> + priv->enable_clkout_ssc = of_property_read_bool(dev->of_node,
> + "realtek,clko
> ut-ssc-enable");
> + priv->enable_rxc_ssc = of_property_read_bool(dev->of_node,
> + "realtek,rxc-
> ssc-enable");
> + priv->enable_sysclk_ssc = of_property_read_bool(dev->of_node,
> + "realtek,sysc
> lk-ssc-enable");
>
> phydev->priv = priv;
>
> @@ -700,6 +717,101 @@ static int rtl8211f_config_phy_eee(struct
> phy_device *phydev)
> RTL8211F_PHYCR2_PHY_EEE_ENABLE, 0);
> }
>
> +static int rtl8211f_config_clkout_ssc(struct phy_device *phydev)
> +{
> + struct rtl821x_priv *priv = phydev->priv;
> + struct device *dev = &phydev->mdio.dev;
> + int ret;
> +
> + /* The value is preserved if the device tree property is
> absent */
> + if (!priv->enable_clkout_ssc)
> + return 0;
> +
> + /* RTL8211FVD has no PHYCR2 register */
> + if (phydev->drv->phy_id == RTL_8211FVD_PHYID)
> + return 0;
I recommend rewording this comment, otherwise any manipulation of
PHYCR2 on RTL8211FVD will be considered an error. For example, PHY-mode
EEE on this PHY is still set via PHYCR2.
IMHO the technically correct comment should state that the
configuration of CLKOUT SSC is not currently supported by this driver.
Powered by blists - more mailing lists