All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: realtek: enable ALDPS to save power for RTL8211F
@ 2020-09-18  2:47 Jisheng Zhang
  2020-09-18 13:21 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Jisheng Zhang @ 2020-09-18  2:47 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, netdev, linux-kernel

Enable ALDPS function to save power when link down.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
 drivers/net/phy/realtek.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 95dbe5e8e1d8..961570186822 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -39,6 +39,10 @@
 #define RTL8201F_ISR				0x1e
 #define RTL8201F_IER				0x13
 
+#define RTL8211F_ALDPS_PLL_OFF			BIT(1)
+#define RTL8211F_ALDPS_ENABLE			BIT(2)
+#define RTL8211F_ALDPS_XTAL_OFF			BIT(12)
+
 #define RTL8366RB_POWER_SAVE			0x15
 #define RTL8366RB_POWER_SAVE_ON			BIT(12)
 
@@ -178,8 +182,12 @@ static int rtl8211f_config_init(struct phy_device *phydev)
 {
 	struct device *dev = &phydev->mdio.dev;
 	u16 val_txdly, val_rxdly;
+	u16 val;
 	int ret;
 
+	val = RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_XTAL_OFF;
+	phy_modify_paged_changed(phydev, 0xa43, 0x18, val, val);
+
 	switch (phydev->interface) {
 	case PHY_INTERFACE_MODE_RGMII:
 		val_txdly = 0;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: phy: realtek: enable ALDPS to save power for RTL8211F
  2020-09-18  2:47 [PATCH net-next] net: phy: realtek: enable ALDPS to save power for RTL8211F Jisheng Zhang
@ 2020-09-18 13:21 ` Andrew Lunn
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2020-09-18 13:21 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Heiner Kallweit, Russell King, David S. Miller, Jakub Kicinski,
	netdev, linux-kernel

On Fri, Sep 18, 2020 at 10:47:56AM +0800, Jisheng Zhang wrote:
> Enable ALDPS function to save power when link down.

Hi Jisheng

It would be nice to give a hint what ALDPS means. It is not one of the
standard acronyms i know of, so it could be Realtek specific.

> 
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> ---
>  drivers/net/phy/realtek.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index 95dbe5e8e1d8..961570186822 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -39,6 +39,10 @@
>  #define RTL8201F_ISR				0x1e
>  #define RTL8201F_IER				0x13
>  
> +#define RTL8211F_ALDPS_PLL_OFF			BIT(1)
> +#define RTL8211F_ALDPS_ENABLE			BIT(2)
> +#define RTL8211F_ALDPS_XTAL_OFF			BIT(12)
> +
>  #define RTL8366RB_POWER_SAVE			0x15
>  #define RTL8366RB_POWER_SAVE_ON			BIT(12)
>  
> @@ -178,8 +182,12 @@ static int rtl8211f_config_init(struct phy_device *phydev)
>  {
>  	struct device *dev = &phydev->mdio.dev;
>  	u16 val_txdly, val_rxdly;
> +	u16 val;
>  	int ret;
>  
> +	val = RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_XTAL_OFF;
> +	phy_modify_paged_changed(phydev, 0xa43, 0x18, val, val);

Could we avoid some of these magic numbers? The datasheet seems to
call 0x18 PHYCR1, etc.

     Andrew

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-18 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18  2:47 [PATCH net-next] net: phy: realtek: enable ALDPS to save power for RTL8211F Jisheng Zhang
2020-09-18 13:21 ` Andrew Lunn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.