netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: phy: broadcom: APD improvements
@ 2021-02-12 20:57 Florian Fainelli
  2021-02-12 20:57 ` [PATCH net-next 1/3] net: phy: broadcom: Remove unused flags Florian Fainelli
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Florian Fainelli @ 2021-02-12 20:57 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, olteanv,
	michael

This patch series cleans up the brcmphy.h header and its numerous unused
phydev->dev_flags, fixes the RXC/TXC clock disabling bit and allows the
BCM54210E PHY to utilize APD.

Thanks!

Florian Fainelli (3):
  net: phy: broadcom: Remove unused flags
  net: phy: broadcom: Fix RXC/TXC auto disabling
  net: phy: broadcom: Allow BCM54210E to configure APD

 drivers/net/phy/broadcom.c |  1 +
 include/linux/brcmphy.h    | 24 ++++++++++--------------
 2 files changed, 11 insertions(+), 14 deletions(-)

-- 
2.25.1


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

* [PATCH net-next 1/3] net: phy: broadcom: Remove unused flags
  2021-02-12 20:57 [PATCH net-next 0/3] net: phy: broadcom: APD improvements Florian Fainelli
@ 2021-02-12 20:57 ` Florian Fainelli
  2021-02-13  0:56   ` Vladimir Oltean
  2021-02-12 20:57 ` [PATCH net-next 2/3] net: phy: broadcom: Fix RXC/TXC auto disabling Florian Fainelli
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2021-02-12 20:57 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, olteanv,
	michael

We have a number of unused flags defined today and since we are scarce
on space and may need to introduce new flags in the future remove and
shift every existing flag down into a contiguous assignment. No
functional change.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 include/linux/brcmphy.h | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index de9430d55c90..da7bf9dfef5b 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -61,19 +61,15 @@
 #define PHY_BCM_OUI_5			0x03625e00
 #define PHY_BCM_OUI_6			0xae025000
 
-#define PHY_BCM_FLAGS_MODE_COPPER	0x00000001
-#define PHY_BCM_FLAGS_MODE_1000BX	0x00000002
-#define PHY_BCM_FLAGS_INTF_SGMII	0x00000010
-#define PHY_BCM_FLAGS_INTF_XAUI		0x00000020
-#define PHY_BRCM_WIRESPEED_ENABLE	0x00000100
-#define PHY_BRCM_AUTO_PWRDWN_ENABLE	0x00000200
-#define PHY_BRCM_RX_REFCLK_UNUSED	0x00000400
-#define PHY_BRCM_STD_IBND_DISABLE	0x00000800
-#define PHY_BRCM_EXT_IBND_RX_ENABLE	0x00001000
-#define PHY_BRCM_EXT_IBND_TX_ENABLE	0x00002000
-#define PHY_BRCM_CLEAR_RGMII_MODE	0x00004000
-#define PHY_BRCM_DIS_TXCRXC_NOENRGY	0x00008000
-#define PHY_BRCM_EN_MASTER_MODE		0x00010000
+#define PHY_BCM_FLAGS_MODE_1000BX	0x00000001
+#define PHY_BRCM_AUTO_PWRDWN_ENABLE	0x00000002
+#define PHY_BRCM_RX_REFCLK_UNUSED	0x00000004
+#define PHY_BRCM_STD_IBND_DISABLE	0x00000008
+#define PHY_BRCM_EXT_IBND_RX_ENABLE	0x00000010
+#define PHY_BRCM_EXT_IBND_TX_ENABLE	0x00000020
+#define PHY_BRCM_CLEAR_RGMII_MODE	0x00000040
+#define PHY_BRCM_DIS_TXCRXC_NOENRGY	0x00000080
+#define PHY_BRCM_EN_MASTER_MODE		0x00000100
 
 /* Broadcom BCM7xxx specific workarounds */
 #define PHY_BRCM_7XXX_REV(x)		(((x) >> 8) & 0xff)
-- 
2.25.1


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

* [PATCH net-next 2/3] net: phy: broadcom: Fix RXC/TXC auto disabling
  2021-02-12 20:57 [PATCH net-next 0/3] net: phy: broadcom: APD improvements Florian Fainelli
  2021-02-12 20:57 ` [PATCH net-next 1/3] net: phy: broadcom: Remove unused flags Florian Fainelli
@ 2021-02-12 20:57 ` Florian Fainelli
  2021-02-13  1:11   ` Vladimir Oltean
  2021-02-12 20:57 ` [PATCH net-next 3/3] net: phy: broadcom: Allow BCM54210E to configure APD Florian Fainelli
  2021-02-12 21:59 ` [PATCH net-next 0/3] net: phy: broadcom: APD improvements Andrew Lunn
  3 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2021-02-12 20:57 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, olteanv,
	michael

When support for optionally disabling the TXC was introduced, bit 2 was
used to do that operation but the datasheet for 50610M from 2009 does
not show bit 2 as being defined. Bit 8 is the one that allows automatic
disabling of the RXC/TXC auto disabling during auto power down.

Fixes: 52fae0837153 ("tg3 / broadcom: Optionally disable TXC if no link")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 include/linux/brcmphy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index da7bf9dfef5b..3dd8203cf780 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -193,7 +193,7 @@
 #define BCM54XX_SHD_SCR3		0x05
 #define  BCM54XX_SHD_SCR3_DEF_CLK125	0x0001
 #define  BCM54XX_SHD_SCR3_DLLAPD_DIS	0x0002
-#define  BCM54XX_SHD_SCR3_TRDDAPD	0x0004
+#define  BCM54XX_SHD_SCR3_TRDDAPD	0x0100
 
 /* 01010: Auto Power-Down */
 #define BCM54XX_SHD_APD			0x0a
-- 
2.25.1


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

* [PATCH net-next 3/3] net: phy: broadcom: Allow BCM54210E to configure APD
  2021-02-12 20:57 [PATCH net-next 0/3] net: phy: broadcom: APD improvements Florian Fainelli
  2021-02-12 20:57 ` [PATCH net-next 1/3] net: phy: broadcom: Remove unused flags Florian Fainelli
  2021-02-12 20:57 ` [PATCH net-next 2/3] net: phy: broadcom: Fix RXC/TXC auto disabling Florian Fainelli
@ 2021-02-12 20:57 ` Florian Fainelli
  2021-02-12 21:59 ` [PATCH net-next 0/3] net: phy: broadcom: APD improvements Andrew Lunn
  3 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2021-02-12 20:57 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, olteanv,
	michael

BCM54210E/BCM50212E has been verified to work correctly with the
auto-power down configuration done by bcm54xx_adjust_rxrefclk(), add it
to the list of PHYs working.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/broadcom.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 0472b3470c59..cb790bd802ff 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -195,6 +195,7 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
 	if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 &&
 	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 &&
 	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M &&
+	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54210E &&
 	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54810 &&
 	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54811)
 		return;
-- 
2.25.1


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

* Re: [PATCH net-next 0/3] net: phy: broadcom: APD improvements
  2021-02-12 20:57 [PATCH net-next 0/3] net: phy: broadcom: APD improvements Florian Fainelli
                   ` (2 preceding siblings ...)
  2021-02-12 20:57 ` [PATCH net-next 3/3] net: phy: broadcom: Allow BCM54210E to configure APD Florian Fainelli
@ 2021-02-12 21:59 ` Andrew Lunn
  3 siblings, 0 replies; 12+ messages in thread
From: Andrew Lunn @ 2021-02-12 21:59 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, olteanv,
	michael

On Fri, Feb 12, 2021 at 12:57:18PM -0800, Florian Fainelli wrote:
> This patch series cleans up the brcmphy.h header and its numerous unused
> phydev->dev_flags, fixes the RXC/TXC clock disabling bit and allows the
> BCM54210E PHY to utilize APD.
> 
> Thanks!

Hi Florian

I don't know the hardware, but the descriptions seem to fit the code,
and i did not spot anything odd.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next 1/3] net: phy: broadcom: Remove unused flags
  2021-02-12 20:57 ` [PATCH net-next 1/3] net: phy: broadcom: Remove unused flags Florian Fainelli
@ 2021-02-13  0:56   ` Vladimir Oltean
  2021-02-13  1:08     ` Florian Fainelli
  0 siblings, 1 reply; 12+ messages in thread
From: Vladimir Oltean @ 2021-02-13  0:56 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, michael

On Fri, Feb 12, 2021 at 12:57:19PM -0800, Florian Fainelli wrote:
> We have a number of unused flags defined today and since we are scarce
> on space and may need to introduce new flags in the future remove and
> shift every existing flag down into a contiguous assignment. No
> functional change.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---

Good to see some of the dev_flags go away!

PHY_BCM_FLAGS_MODE_1000BX is used just from broadcom.c, therefore it can
probably be moved to a structure in phydev->priv.

PHY_BRCM_STD_IBND_DISABLE, PHY_BRCM_EXT_IBND_RX_ENABLE and
PHY_BRCM_EXT_IBND_TX_ENABLE are set by
drivers/net/ethernet/broadcom/tg3.c but not used anywhere.

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

* Re: [PATCH net-next 1/3] net: phy: broadcom: Remove unused flags
  2021-02-13  0:56   ` Vladimir Oltean
@ 2021-02-13  1:08     ` Florian Fainelli
  2021-02-13  1:14       ` Vladimir Oltean
  0 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2021-02-13  1:08 UTC (permalink / raw)
  To: Vladimir Oltean, Florian Fainelli
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, michael



On 2/12/2021 4:56 PM, Vladimir Oltean wrote:
> On Fri, Feb 12, 2021 at 12:57:19PM -0800, Florian Fainelli wrote:
>> We have a number of unused flags defined today and since we are scarce
>> on space and may need to introduce new flags in the future remove and
>> shift every existing flag down into a contiguous assignment. No
>> functional change.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
> 
> Good to see some of the dev_flags go away!
> 
> PHY_BCM_FLAGS_MODE_1000BX is used just from broadcom.c, therefore it can
> probably be moved to a structure in phydev->priv.

The next step would be to move it to a private flag, indeed.

> 
> PHY_BRCM_STD_IBND_DISABLE, PHY_BRCM_EXT_IBND_RX_ENABLE and
> PHY_BRCM_EXT_IBND_TX_ENABLE are set by
> drivers/net/ethernet/broadcom/tg3.c but not used anywhere.

That's right, tg3 drove a lot of the Broadcom PHY driver changes back
then, I also would like to rework the way we pass flags towards PHY
drivers because tg3 is basically the only driver doing it right, where
it checks the PHY ID first, then sets appropriate flags during connect.
-- 
Florian

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

* Re: [PATCH net-next 2/3] net: phy: broadcom: Fix RXC/TXC auto disabling
  2021-02-12 20:57 ` [PATCH net-next 2/3] net: phy: broadcom: Fix RXC/TXC auto disabling Florian Fainelli
@ 2021-02-13  1:11   ` Vladimir Oltean
  2021-02-13  1:14     ` Florian Fainelli
  0 siblings, 1 reply; 12+ messages in thread
From: Vladimir Oltean @ 2021-02-13  1:11 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, michael

On Fri, Feb 12, 2021 at 12:57:20PM -0800, Florian Fainelli wrote:
> When support for optionally disabling the TXC was introduced, bit 2 was
> used to do that operation but the datasheet for 50610M from 2009 does
> not show bit 2 as being defined. Bit 8 is the one that allows automatic
> disabling of the RXC/TXC auto disabling during auto power down.
> 
> Fixes: 52fae0837153 ("tg3 / broadcom: Optionally disable TXC if no link")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  include/linux/brcmphy.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
> index da7bf9dfef5b..3dd8203cf780 100644
> --- a/include/linux/brcmphy.h
> +++ b/include/linux/brcmphy.h
> @@ -193,7 +193,7 @@
>  #define BCM54XX_SHD_SCR3		0x05
>  #define  BCM54XX_SHD_SCR3_DEF_CLK125	0x0001
>  #define  BCM54XX_SHD_SCR3_DLLAPD_DIS	0x0002
> -#define  BCM54XX_SHD_SCR3_TRDDAPD	0x0004
> +#define  BCM54XX_SHD_SCR3_TRDDAPD	0x0100
>  
>  /* 01010: Auto Power-Down */
>  #define BCM54XX_SHD_APD			0x0a
> -- 
> 2.25.1
> 

We may have a problem here, with the layout of the Spare Control 3
register not being as universal as we think.

Your finding may have been the same as Kevin Lo's from commit
b0ed0bbfb304 ("net: phy: broadcom: add support for BCM54811 PHY"),
therefore your change is making BCM54XX_SHD_SCR3_TRDDAPD ==
BCM54810_SHD_SCR3_TRDDAPD, so currently this if condition is redundant
and probably something else is wrong too:

	if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) {
		if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 ||
		    BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811)
			val |= BCM54810_SHD_SCR3_TRDDAPD;
		else
			val |= BCM54XX_SHD_SCR3_TRDDAPD;
	}

I'm not sure what "TRDD" stands for, but my copy of the BCM5464R
datasheet shows both bits 2 as well as 8 as being reserved. I have
"CLK125 Output" in bit 0, "DLL Auto Power-Down" in bit 1, "SD/Energy
Detect Change" in bit 5, "TXC Disable" in bit 6, and that's about it.

But I think it doesn't matter what BCM5464R has, since this feature is
gated by PHY_BRCM_DIS_TXCRXC_NOENRGY.

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

* Re: [PATCH net-next 2/3] net: phy: broadcom: Fix RXC/TXC auto disabling
  2021-02-13  1:11   ` Vladimir Oltean
@ 2021-02-13  1:14     ` Florian Fainelli
  2021-02-13  3:43       ` Florian Fainelli
  0 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2021-02-13  1:14 UTC (permalink / raw)
  To: Vladimir Oltean, Florian Fainelli
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, michael



On 2/12/2021 5:11 PM, Vladimir Oltean wrote:
> On Fri, Feb 12, 2021 at 12:57:20PM -0800, Florian Fainelli wrote:
>> When support for optionally disabling the TXC was introduced, bit 2 was
>> used to do that operation but the datasheet for 50610M from 2009 does
>> not show bit 2 as being defined. Bit 8 is the one that allows automatic
>> disabling of the RXC/TXC auto disabling during auto power down.
>>
>> Fixes: 52fae0837153 ("tg3 / broadcom: Optionally disable TXC if no link")
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>>  include/linux/brcmphy.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
>> index da7bf9dfef5b..3dd8203cf780 100644
>> --- a/include/linux/brcmphy.h
>> +++ b/include/linux/brcmphy.h
>> @@ -193,7 +193,7 @@
>>  #define BCM54XX_SHD_SCR3		0x05
>>  #define  BCM54XX_SHD_SCR3_DEF_CLK125	0x0001
>>  #define  BCM54XX_SHD_SCR3_DLLAPD_DIS	0x0002
>> -#define  BCM54XX_SHD_SCR3_TRDDAPD	0x0004
>> +#define  BCM54XX_SHD_SCR3_TRDDAPD	0x0100
>>  
>>  /* 01010: Auto Power-Down */
>>  #define BCM54XX_SHD_APD			0x0a
>> -- 
>> 2.25.1
>>
> 
> We may have a problem here, with the layout of the Spare Control 3
> register not being as universal as we think.
> 
> Your finding may have been the same as Kevin Lo's from commit
> b0ed0bbfb304 ("net: phy: broadcom: add support for BCM54811 PHY"),
> therefore your change is making BCM54XX_SHD_SCR3_TRDDAPD ==
> BCM54810_SHD_SCR3_TRDDAPD, so currently this if condition is redundant
> and probably something else is wrong too:
> 
> 	if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) {
> 		if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 ||
> 		    BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811)
> 			val |= BCM54810_SHD_SCR3_TRDDAPD;
> 		else
> 			val |= BCM54XX_SHD_SCR3_TRDDAPD;
> 	}
> 
> I'm not sure what "TRDD" stands for, but my copy of the BCM5464R
> datasheet shows both bits 2 as well as 8 as being reserved. I have
> "CLK125 Output" in bit 0, "DLL Auto Power-Down" in bit 1, "SD/Energy
> Detect Change" in bit 5, "TXC Disable" in bit 6, and that's about it.

Let me go back to the datasheet of all of the PHYs supported by
bcm54xx_adjust_rxrefclk() and make sure we set the right bit.

I also have no idea what TRDD stands for.

> 
> But I think it doesn't matter what BCM5464R has, since this feature is
> gated by PHY_BRCM_DIS_TXCRXC_NOENRGY.
Yes, but it should be working nonetheless.
-- 
Florian

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

* Re: [PATCH net-next 1/3] net: phy: broadcom: Remove unused flags
  2021-02-13  1:08     ` Florian Fainelli
@ 2021-02-13  1:14       ` Vladimir Oltean
  2021-02-13  1:16         ` Florian Fainelli
  0 siblings, 1 reply; 12+ messages in thread
From: Vladimir Oltean @ 2021-02-13  1:14 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, michael

On Fri, Feb 12, 2021 at 05:08:58PM -0800, Florian Fainelli wrote:
> That's right, tg3 drove a lot of the Broadcom PHY driver changes back
> then, I also would like to rework the way we pass flags towards PHY
> drivers because tg3 is basically the only driver doing it right, where
> it checks the PHY ID first, then sets appropriate flags during connect.

Why does the tg3 controller need to enable the auto power down PHY
feature in the first place and the PHY driver can't just enable it by
itself?

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

* Re: [PATCH net-next 1/3] net: phy: broadcom: Remove unused flags
  2021-02-13  1:14       ` Vladimir Oltean
@ 2021-02-13  1:16         ` Florian Fainelli
  0 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2021-02-13  1:16 UTC (permalink / raw)
  To: Vladimir Oltean, Florian Fainelli
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, michael



On 2/12/2021 5:14 PM, Vladimir Oltean wrote:
> On Fri, Feb 12, 2021 at 05:08:58PM -0800, Florian Fainelli wrote:
>> That's right, tg3 drove a lot of the Broadcom PHY driver changes back
>> then, I also would like to rework the way we pass flags towards PHY
>> drivers because tg3 is basically the only driver doing it right, where
>> it checks the PHY ID first, then sets appropriate flags during connect.
> 
> Why does the tg3 controller need to enable the auto power down PHY
> feature in the first place and the PHY driver can't just enable it by
> itself?
> 

That would be a question for Michael if he remembers those details from
12 years ago.
-- 
Florian

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

* Re: [PATCH net-next 2/3] net: phy: broadcom: Fix RXC/TXC auto disabling
  2021-02-13  1:14     ` Florian Fainelli
@ 2021-02-13  3:43       ` Florian Fainelli
  0 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2021-02-13  3:43 UTC (permalink / raw)
  To: Florian Fainelli, Vladimir Oltean
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, Michael Chan,
	open list:BROADCOM ETHERNET PHY DRIVERS, open list, michael



On 2/12/2021 5:14 PM, Florian Fainelli wrote:
> 
> 
> On 2/12/2021 5:11 PM, Vladimir Oltean wrote:
>> On Fri, Feb 12, 2021 at 12:57:20PM -0800, Florian Fainelli wrote:
>>> When support for optionally disabling the TXC was introduced, bit 2 was
>>> used to do that operation but the datasheet for 50610M from 2009 does
>>> not show bit 2 as being defined. Bit 8 is the one that allows automatic
>>> disabling of the RXC/TXC auto disabling during auto power down.
>>>
>>> Fixes: 52fae0837153 ("tg3 / broadcom: Optionally disable TXC if no link")
>>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>>> ---
>>>  include/linux/brcmphy.h | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
>>> index da7bf9dfef5b..3dd8203cf780 100644
>>> --- a/include/linux/brcmphy.h
>>> +++ b/include/linux/brcmphy.h
>>> @@ -193,7 +193,7 @@
>>>  #define BCM54XX_SHD_SCR3		0x05
>>>  #define  BCM54XX_SHD_SCR3_DEF_CLK125	0x0001
>>>  #define  BCM54XX_SHD_SCR3_DLLAPD_DIS	0x0002
>>> -#define  BCM54XX_SHD_SCR3_TRDDAPD	0x0004
>>> +#define  BCM54XX_SHD_SCR3_TRDDAPD	0x0100
>>>  
>>>  /* 01010: Auto Power-Down */
>>>  #define BCM54XX_SHD_APD			0x0a
>>> -- 
>>> 2.25.1
>>>
>>
>> We may have a problem here, with the layout of the Spare Control 3
>> register not being as universal as we think.
>>
>> Your finding may have been the same as Kevin Lo's from commit
>> b0ed0bbfb304 ("net: phy: broadcom: add support for BCM54811 PHY"),
>> therefore your change is making BCM54XX_SHD_SCR3_TRDDAPD ==
>> BCM54810_SHD_SCR3_TRDDAPD, so currently this if condition is redundant
>> and probably something else is wrong too:
>>
>> 	if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) {
>> 		if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 ||
>> 		    BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811)
>> 			val |= BCM54810_SHD_SCR3_TRDDAPD;
>> 		else
>> 			val |= BCM54XX_SHD_SCR3_TRDDAPD;
>> 	}
>>
>> I'm not sure what "TRDD" stands for, but my copy of the BCM5464R
>> datasheet shows both bits 2 as well as 8 as being reserved. I have
>> "CLK125 Output" in bit 0, "DLL Auto Power-Down" in bit 1, "SD/Energy
>> Detect Change" in bit 5, "TXC Disable" in bit 6, and that's about it.
> 
> Let me go back to the datasheet of all of the PHYs supported by
> bcm54xx_adjust_rxrefclk() and make sure we set the right bit.

I really don't know what the situation is with the 50610 and 50610M and
the datasheet appears to reflect that the latest PHYs should be revision
3 or newer (which we explicitly check for earlier), and that bit 8 is
supposed to control the disabling of RXC/TXC during auto-power down. I
can only trust that Matt checked with the design team back then and that
the datasheet must be wrong (would not be an isolated incident), let's
try not to fix something that we do not know for sure is broken.

I will respin without this patch and with another clean up added.
-- 
Florian

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

end of thread, other threads:[~2021-02-13  3:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12 20:57 [PATCH net-next 0/3] net: phy: broadcom: APD improvements Florian Fainelli
2021-02-12 20:57 ` [PATCH net-next 1/3] net: phy: broadcom: Remove unused flags Florian Fainelli
2021-02-13  0:56   ` Vladimir Oltean
2021-02-13  1:08     ` Florian Fainelli
2021-02-13  1:14       ` Vladimir Oltean
2021-02-13  1:16         ` Florian Fainelli
2021-02-12 20:57 ` [PATCH net-next 2/3] net: phy: broadcom: Fix RXC/TXC auto disabling Florian Fainelli
2021-02-13  1:11   ` Vladimir Oltean
2021-02-13  1:14     ` Florian Fainelli
2021-02-13  3:43       ` Florian Fainelli
2021-02-12 20:57 ` [PATCH net-next 3/3] net: phy: broadcom: Allow BCM54210E to configure APD Florian Fainelli
2021-02-12 21:59 ` [PATCH net-next 0/3] net: phy: broadcom: APD improvements Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).