* [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode
@ 2021-09-20 21:54 Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 1/5] net: phy: broadcom: Add " Florian Fainelli
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Florian Fainelli @ 2021-09-20 21:54 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, open list
This patch series adds support for the IDDQ with soft recovery mode
which allows power savings of roughly 150mW compared to a simple
BMCR.PDOWN power off (called standby power down in Broadcom datasheets).
In order to leverage these modes we add a new PHY driver flags for
drivers to opt-in for that behavior, the PHY driver is modified to do
the appropriate programming and the PHYs on which this was tested get
updated to have an appropriate suspend/resume set of functions.
Florian Fainelli (5):
net: phy: broadcom: Add IDDQ-SR mode
net: phy: broadcom: Wire suspend/resume for BCM50610 and BCM50610M
net: phy: broadcom: Utilize appropriate suspend for BCM54810/11
net: bcmgenet: Request APD, DLL disable and IDDQ-SR
net: dsa: bcm_sf2: Request APD, DLL disable and IDDQ-SR
drivers/net/dsa/bcm_sf2.c | 4 +-
drivers/net/ethernet/broadcom/genet/bcmmii.c | 4 +-
drivers/net/phy/broadcom.c | 59 +++++++++++++++++++-
include/linux/brcmphy.h | 8 +++
4 files changed, 71 insertions(+), 4 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/5] net: phy: broadcom: Add IDDQ-SR mode
2021-09-20 21:54 [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode Florian Fainelli
@ 2021-09-20 21:54 ` Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 2/5] net: phy: broadcom: Wire suspend/resume for BCM50610 and BCM50610M Florian Fainelli
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2021-09-20 21:54 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, open list
Add support for putting the PHY into IDDQ Soft Recovery mode by setting
the TOP_MISC register bits accordingly. This requires us to implement a
custom bcm54xx_suspend() routine which diverges from genphy_suspend() in
order to configure the PHY to enter IDDQ with software recovery as well
as avoid doing a read/modify/write on the BMCR register.
Doing a read/modify/write on the BMCR register means that the
auto-negotation bit may remain which interferes with the ability to put
the PHY into IDDQ-SR mode. We do software reset upon suspend in order to
put the PHY back into its state prior to suspend as recommended by the
datasheet.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/broadcom.c | 51 ++++++++++++++++++++++++++++++++++++++
include/linux/brcmphy.h | 8 ++++++
2 files changed, 59 insertions(+)
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index add0c4e33425..f5868a0dee4b 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -392,10 +392,50 @@ static int bcm54xx_config_init(struct phy_device *phydev)
return 0;
}
+static int bcm54xx_iddq_set(struct phy_device *phydev, bool enable)
+{
+ int ret = 0;
+
+ if (!(phydev->dev_flags & PHY_BRCM_IDDQ_SUSPEND))
+ return ret;
+
+ ret = bcm_phy_read_exp(phydev, BCM54XX_TOP_MISC_IDDQ_CTRL);
+ if (ret < 0)
+ goto out;
+
+ if (enable)
+ ret |= BCM54XX_TOP_MISC_IDDQ_SR | BCM54XX_TOP_MISC_IDDQ_LP;
+ else
+ ret &= ~(BCM54XX_TOP_MISC_IDDQ_SR | BCM54XX_TOP_MISC_IDDQ_LP);
+
+ ret = bcm_phy_write_exp(phydev, BCM54XX_TOP_MISC_IDDQ_CTRL, ret);
+out:
+ return ret;
+}
+
+static int bcm54xx_suspend(struct phy_device *phydev)
+{
+ int ret;
+
+ /* We cannot use a read/modify/write here otherwise the PHY gets into
+ * a bad state where its LEDs keep flashing, thus defeating the purpose
+ * of low power mode.
+ */
+ ret = phy_write(phydev, MII_BMCR, BMCR_PDOWN);
+ if (ret < 0)
+ return ret;
+
+ return bcm54xx_iddq_set(phydev, true);
+}
+
static int bcm54xx_resume(struct phy_device *phydev)
{
int ret;
+ ret = bcm54xx_iddq_set(phydev, false);
+ if (ret < 0)
+ return ret;
+
/* Writes to register other than BMCR would be ignored
* unless we clear the PDOWN bit first
*/
@@ -408,6 +448,15 @@ static int bcm54xx_resume(struct phy_device *phydev)
*/
fsleep(40);
+ /* Issue a soft reset after clearing the power down bit
+ * and before doing any other configuration.
+ */
+ if (phydev->dev_flags & PHY_BRCM_IDDQ_SUSPEND) {
+ ret = genphy_soft_reset(phydev);
+ if (ret < 0)
+ return ret;
+ }
+
return bcm54xx_config_init(phydev);
}
@@ -772,6 +821,8 @@ static struct phy_driver broadcom_drivers[] = {
.config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt,
.link_change_notify = bcm54xx_link_change_notify,
+ .suspend = bcm54xx_suspend,
+ .resume = bcm54xx_resume,
}, {
.phy_id = PHY_ID_BCM5461,
.phy_id_mask = 0xfffffff0,
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 07e1dfadbbdf..b119d6819d6c 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -67,6 +67,7 @@
#define PHY_BRCM_CLEAR_RGMII_MODE 0x00000004
#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00000008
#define PHY_BRCM_EN_MASTER_MODE 0x00000010
+#define PHY_BRCM_IDDQ_SUSPEND 0x000000220
/* Broadcom BCM7xxx specific workarounds */
#define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff)
@@ -84,6 +85,7 @@
#define MII_BCM54XX_EXP_DATA 0x15 /* Expansion register data */
#define MII_BCM54XX_EXP_SEL 0x17 /* Expansion register select */
+#define MII_BCM54XX_EXP_SEL_TOP 0x0d00 /* TOP_MISC expansion register select */
#define MII_BCM54XX_EXP_SEL_SSD 0x0e00 /* Secondary SerDes select */
#define MII_BCM54XX_EXP_SEL_ER 0x0f00 /* Expansion register select */
#define MII_BCM54XX_EXP_SEL_ETC 0x0d00 /* Expansion register spare + 2k mem */
@@ -243,6 +245,12 @@
#define MII_BCM54XX_EXP_EXP97 0x0f97
#define MII_BCM54XX_EXP_EXP97_MYST 0x0c0c
+/* Top-MISC expansion registers */
+#define BCM54XX_TOP_MISC_IDDQ_CTRL (MII_BCM54XX_EXP_SEL_TOP + 0x06)
+#define BCM54XX_TOP_MISC_IDDQ_LP (1 << 0)
+#define BCM54XX_TOP_MISC_IDDQ_SD (1 << 2)
+#define BCM54XX_TOP_MISC_IDDQ_SR (1 << 3)
+
/*
* BCM5482: Secondary SerDes registers
*/
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/5] net: phy: broadcom: Wire suspend/resume for BCM50610 and BCM50610M
2021-09-20 21:54 [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 1/5] net: phy: broadcom: Add " Florian Fainelli
@ 2021-09-20 21:54 ` Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 3/5] net: phy: broadcom: Utilize appropriate suspend for BCM54810/11 Florian Fainelli
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2021-09-20 21:54 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, open list
These two Ethernet PHYs support IDDQ-SR therefore wire-up the suspend
and resume callbacks to point to bcm54xx_suspend() and bcm54xx_resume().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/broadcom.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index f5868a0dee4b..952341e0baec 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -948,6 +948,8 @@ static struct phy_driver broadcom_drivers[] = {
.config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt,
.link_change_notify = bcm54xx_link_change_notify,
+ .suspend = bcm54xx_suspend,
+ .resume = bcm54xx_resume,
}, {
.phy_id = PHY_ID_BCM50610M,
.phy_id_mask = 0xfffffff0,
@@ -961,6 +963,8 @@ static struct phy_driver broadcom_drivers[] = {
.config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt,
.link_change_notify = bcm54xx_link_change_notify,
+ .suspend = bcm54xx_suspend,
+ .resume = bcm54xx_resume,
}, {
.phy_id = PHY_ID_BCM57780,
.phy_id_mask = 0xfffffff0,
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 3/5] net: phy: broadcom: Utilize appropriate suspend for BCM54810/11
2021-09-20 21:54 [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 1/5] net: phy: broadcom: Add " Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 2/5] net: phy: broadcom: Wire suspend/resume for BCM50610 and BCM50610M Florian Fainelli
@ 2021-09-20 21:54 ` Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 4/5] net: bcmgenet: Request APD, DLL disable and IDDQ-SR Florian Fainelli
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2021-09-20 21:54 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, open list
Since we enable APD and DLL/RXC/TXC disable we need to use
bcm54xx_suspend() in order not to do a read/modify/write of the BMCR
register which is incompatible with the desired settings.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/broadcom.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 952341e0baec..bb5104ae4610 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -903,7 +903,7 @@ static struct phy_driver broadcom_drivers[] = {
.config_aneg = bcm5481_config_aneg,
.config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt,
- .suspend = genphy_suspend,
+ .suspend = bcm54xx_suspend,
.resume = bcm54xx_resume,
.link_change_notify = bcm54xx_link_change_notify,
}, {
@@ -919,7 +919,7 @@ static struct phy_driver broadcom_drivers[] = {
.config_aneg = bcm5481_config_aneg,
.config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt,
- .suspend = genphy_suspend,
+ .suspend = bcm54xx_suspend,
.resume = bcm54xx_resume,
.link_change_notify = bcm54xx_link_change_notify,
}, {
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 4/5] net: bcmgenet: Request APD, DLL disable and IDDQ-SR
2021-09-20 21:54 [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode Florian Fainelli
` (2 preceding siblings ...)
2021-09-20 21:54 ` [PATCH net-next 3/5] net: phy: broadcom: Utilize appropriate suspend for BCM54810/11 Florian Fainelli
@ 2021-09-20 21:54 ` Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 5/5] net: dsa: bcm_sf2: " Florian Fainelli
2021-09-21 10:10 ` [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2021-09-20 21:54 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, open list
When interfacing with a Broadcom PHY, request the auto-power down, DLL
disable and IDDQ-SR modes to be enabled.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/genet/bcmmii.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 2d29de9a33e3..ff1efd52ce16 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -288,7 +288,9 @@ int bcmgenet_mii_probe(struct net_device *dev)
struct device_node *dn = kdev->of_node;
phy_interface_t phy_iface = priv->phy_interface;
struct phy_device *phydev;
- u32 phy_flags = 0;
+ u32 phy_flags = PHY_BRCM_AUTO_PWRDWN_ENABLE |
+ PHY_BRCM_DIS_TXCRXC_NOENRGY |
+ PHY_BRCM_IDDQ_SUSPEND;
int ret;
/* Communicate the integrated PHY revision */
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 5/5] net: dsa: bcm_sf2: Request APD, DLL disable and IDDQ-SR
2021-09-20 21:54 [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode Florian Fainelli
` (3 preceding siblings ...)
2021-09-20 21:54 ` [PATCH net-next 4/5] net: bcmgenet: Request APD, DLL disable and IDDQ-SR Florian Fainelli
@ 2021-09-20 21:54 ` Florian Fainelli
2021-09-21 10:10 ` [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2021-09-20 21:54 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, open list
When interfacing with a Broadcom PHY, request the auto-power down, DLL
disable and IDDQ-SR modes to be enabled.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 6ce9ec1283e0..aa713936d77c 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -667,7 +667,9 @@ static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port)
if (priv->int_phy_mask & BIT(port))
return priv->hw_params.gphy_rev;
else
- return 0;
+ return PHY_BRCM_AUTO_PWRDWN_ENABLE |
+ PHY_BRCM_DIS_TXCRXC_NOENRGY |
+ PHY_BRCM_IDDQ_SUSPEND;
}
static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port,
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode
2021-09-20 21:54 [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode Florian Fainelli
` (4 preceding siblings ...)
2021-09-20 21:54 ` [PATCH net-next 5/5] net: dsa: bcm_sf2: " Florian Fainelli
@ 2021-09-21 10:10 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-09-21 10:10 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, linux-kernel
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
On Mon, 20 Sep 2021 14:54:13 -0700 you wrote:
> This patch series adds support for the IDDQ with soft recovery mode
> which allows power savings of roughly 150mW compared to a simple
> BMCR.PDOWN power off (called standby power down in Broadcom datasheets).
>
> In order to leverage these modes we add a new PHY driver flags for
> drivers to opt-in for that behavior, the PHY driver is modified to do
> the appropriate programming and the PHYs on which this was tested get
> updated to have an appropriate suspend/resume set of functions.
>
> [...]
Here is the summary with links:
- [net-next,1/5] net: phy: broadcom: Add IDDQ-SR mode
https://git.kernel.org/netdev/net-next/c/d6da08ed1425
- [net-next,2/5] net: phy: broadcom: Wire suspend/resume for BCM50610 and BCM50610M
https://git.kernel.org/netdev/net-next/c/38b6a9073007
- [net-next,3/5] net: phy: broadcom: Utilize appropriate suspend for BCM54810/11
https://git.kernel.org/netdev/net-next/c/72e78d22e152
- [net-next,4/5] net: bcmgenet: Request APD, DLL disable and IDDQ-SR
https://git.kernel.org/netdev/net-next/c/c3a4c69360ab
- [net-next,5/5] net: dsa: bcm_sf2: Request APD, DLL disable and IDDQ-SR
https://git.kernel.org/netdev/net-next/c/4972ce720101
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-21 10:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 21:54 [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 1/5] net: phy: broadcom: Add " Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 2/5] net: phy: broadcom: Wire suspend/resume for BCM50610 and BCM50610M Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 3/5] net: phy: broadcom: Utilize appropriate suspend for BCM54810/11 Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 4/5] net: bcmgenet: Request APD, DLL disable and IDDQ-SR Florian Fainelli
2021-09-20 21:54 ` [PATCH net-next 5/5] net: dsa: bcm_sf2: " Florian Fainelli
2021-09-21 10:10 ` [PATCH net-next 0/5] net: phy: broadcom: IDDQ-SR mode patchwork-bot+netdevbpf
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.