Skip to contentSkip to conversation

net: phy: bcm54140: use genphy_soft_reset()

PATCH Applied Michael Walle 4 participants 10 messages Apr 28, 2020 – May 1, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 net: phy: bcm54140: use genphy_soft_reset()

Set the .soft_reset() op to be sure there will be a reset even if there is no hardware reset line registered.

---
changes since v1:
- added reviewed-by tags

 drivers/net/phy/bcm54140.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/phy/bcm54140.c +1 -0
index 7341f0126cc4..eb5dbacc1253 100644
@@ -862,6 +862,7 @@ static struct phy_driver bcm54140_drivers[] = {
 		.probe		= bcm54140_probe,
 		.suspend	= genphy_suspend,
 		.resume		= genphy_resume,
+		.soft_reset	= genphy_soft_reset,
 		.get_tunable	= bcm54140_get_tunable,
 		.set_tunable	= bcm54140_set_tunable,
 	},
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 2/4 net: phy: bcm54140: fix phy_id_mask

Broadcom defines the bits for this PHY as follows:
{ oui[24:3], model[6:0], revision[2:0] }

Thus we have to mask the lower three bits only.

Fixes 6937602ed3f9 ("net: phy: add Broadcom BCM54140 support")

---
changes since v1:
- added reviewed-by tags

 drivers/net/phy/bcm54140.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/bcm54140.c +2 -2
index eb5dbacc1253..edafc9dc2f63 100644
@@ -852,7 +852,7 @@ static int bcm54140_set_tunable(struct phy_device *phydev,
 static struct phy_driver bcm54140_drivers[] = {
 	{
 		.phy_id         = PHY_ID_BCM54140,
-		.phy_id_mask    = 0xfffffff0,
+		.phy_id_mask    = 0xfffffff8,
 		.name           = "Broadcom BCM54140",
 		.features       = PHY_GBIT_FEATURES,
 		.config_init    = bcm54140_config_init,
@@ -870,7 +870,7 @@ static struct phy_driver bcm54140_drivers[] = {
 module_phy_driver(bcm54140_drivers);
 
 static struct mdio_device_id __maybe_unused bcm54140_tbl[] = {
-	{ PHY_ID_BCM54140, 0xfffffff0 },
+	{ PHY_ID_BCM54140, 0xfffffff8 },
 	{ }
 };
 
Signature · 1 line
2.20.1
maintainer Applied
#2 lore raw

Re: [PATCH net-next v2 2/4] net: phy: bcm54140: fix phy_id_mask

From: Michael Walle <[email protected]>
Date: Wed, 29 Apr 2020 01:06:57 +0200

Quoted 9 lines

Broadcom defines the bits for this PHY as follows:
{ oui[24:3], model[6:0], revision[2:0] }

Thus we have to mask the lower three bits only.

Fixes 6937602ed3f9 ("net: phy: add Broadcom BCM54140 support")

Applied.

#3 lore raw

PATCH v2 3/4 net: phy: bcm54140: apply the workaround on b0 chips

In reply to Michael Walle

The lower three bits of the phy_id specifies the chip stepping. The workaround is specifically for the B0 stepping. Apply it only on these chips.

---
changes since v1:
- added reviewed-by tags

 drivers/net/phy/bcm54140.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/phy/bcm54140.c +8 -3
index edafc9dc2f63..d73cbddbc69b 100644
@@ -115,6 +115,9 @@
 #define BCM54140_HWMON_IN_ALARM_BIT(ch) ((ch) ? BCM54140_RDB_MON_ISR_3V3 \
 					      : BCM54140_RDB_MON_ISR_1V0)
 
+#define BCM54140_PHY_ID_REV(phy_id)	((phy_id) & 0x7)
+#define BCM54140_REV_B0			1
+
 #define BCM54140_DEFAULT_DOWNSHIFT 5
 #define BCM54140_MAX_DOWNSHIFT 9
 
@@ -632,9 +635,11 @@ static int bcm54140_config_init(struct phy_device *phydev)
 	int ret;
 
 	/* Apply hardware errata */
-	ret = bcm54140_b0_workaround(phydev);
-	if (ret)
-		return ret;
+	if (BCM54140_PHY_ID_REV(phydev->phy_id) == BCM54140_REV_B0) {
+		ret = bcm54140_b0_workaround(phydev);
+		if (ret)
+			return ret;
+	}
 
 	/* Unmask events we are interested in. */
 	reg &= ~(BCM54140_RDB_INT_DUPLEX |
Signature · 1 line
2.20.1
maintainer Applied
#4 lore raw

Re: [PATCH net-next v2 3/4] net: phy: bcm54140: apply the workaround on b0 chips

From: Michael Walle <[email protected]>
Date: Wed, 29 Apr 2020 01:06:58 +0200

Quoted 7 lines

The lower three bits of the phy_id specifies the chip stepping. The workaround is specifically for the B0 stepping. Apply it only on these chips.

Applied.

#5 lore raw

PATCH v2 4/4 net: phy: bcm54140: add second PHY ID

In reply to Michael Walle

This PHY has two PHY IDs depending on its mode. Adjust the mask so that it includes both IDs.

---
changes since v1:
- leave the PHY ID in brcmphy.h but clear the masked bit
- fixed typo in commit message

 drivers/net/phy/bcm54140.c | 11 +++++++++--
 include/linux/brcmphy.h    |  2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/net/phy/bcm54140.c +9 -2
index d73cbddbc69b..b5325157206a 100644
@@ -115,6 +115,13 @@
 #define BCM54140_HWMON_IN_ALARM_BIT(ch) ((ch) ? BCM54140_RDB_MON_ISR_3V3 \
 					      : BCM54140_RDB_MON_ISR_1V0)
 
+/* This PHY has two different PHY IDs depening on its MODE_SEL pin. This
+ * pin choses between 4x SGMII and QSGMII mode:
+ *   AE02_5009 4x SGMII
+ *   AE02_5019 QSGMII
+ */
+#define BCM54140_PHY_ID_MASK	0xffffffe8
+
 #define BCM54140_PHY_ID_REV(phy_id)	((phy_id) & 0x7)
 #define BCM54140_REV_B0			1
 
@@ -857,7 +864,7 @@ static int bcm54140_set_tunable(struct phy_device *phydev,
 static struct phy_driver bcm54140_drivers[] = {
 	{
 		.phy_id         = PHY_ID_BCM54140,
-		.phy_id_mask    = 0xfffffff8,
+		.phy_id_mask    = BCM54140_PHY_ID_MASK,
 		.name           = "Broadcom BCM54140",
 		.features       = PHY_GBIT_FEATURES,
 		.config_init    = bcm54140_config_init,
@@ -875,7 +882,7 @@ static struct phy_driver bcm54140_drivers[] = {
 module_phy_driver(bcm54140_drivers);
 
 static struct mdio_device_id __maybe_unused bcm54140_tbl[] = {
-	{ PHY_ID_BCM54140, 0xfffffff8 },
+	{ PHY_ID_BCM54140, BCM54140_PHY_ID_MASK },
 	{ }
 };
 
include/linux/brcmphy.h +1 -1
index 8be150e69c7c..58d0150acc3e 100644
@@ -25,7 +25,7 @@
 #define PHY_ID_BCM5461			0x002060c0
 #define PHY_ID_BCM54612E		0x03625e60
 #define PHY_ID_BCM54616S		0x03625d10
-#define PHY_ID_BCM54140			0xae025019
+#define PHY_ID_BCM54140			0xae025009
 #define PHY_ID_BCM57780			0x03625d90
 #define PHY_ID_BCM89610			0x03625cd0
 
Signature · 1 line
2.20.1
Reviewed-by on v2 4/4
#7 lore raw

Re: [PATCH net-next v2 4/4] net: phy: bcm54140: add second PHY ID

In reply to Michael Walle
Quoted 4 lines · Michael Walle

This PHY has two PHY IDs depending on its mode. Adjust the mask so that it includes both IDs.

For future submissions to netdev, if you have a patch count > 1, please include a cover letter:

Thanks!

Signature · 1 line
Florian