Skip to contentSkip to conversation

net: phy: DP83TC811: Add INT_STAT3

PATCH Applied Dan Murphy 3 participants 7 messages Jun 29, 2018 – Jul 3, 2018

Subsystems (3)
lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH v2 1/2 net: phy: DP83TC811: Add INT_STAT3

Add INT_STAT3 interrupt setting and clearing
support.

---

v2 - Removed bug fix removal of writing INT_STAT1 twice when disabling interrupts

 drivers/net/phy/dp83tc811.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/net/phy/dp83tc811.c +26 -0
index 49ac678eb2dc..f8653f5d8789 100644
@@ -21,6 +21,7 @@
 #define MII_DP83811_SGMII_CTRL	0x09
 #define MII_DP83811_INT_STAT1	0x12
 #define MII_DP83811_INT_STAT2	0x13
+#define MII_DP83811_INT_STAT3	0x18
 #define MII_DP83811_RESET_CTRL	0x1f
 
 #define DP83811_HW_RESET	BIT(15)
@@ -44,6 +45,11 @@
 #define DP83811_OVERVOLTAGE_INT_EN	BIT(6)
 #define DP83811_UNDERVOLTAGE_INT_EN	BIT(7)
 
+/* INT_STAT3 bits */
+#define DP83811_LPS_INT_EN	BIT(0)
+#define DP83811_NO_FRAME_INT_EN	BIT(3)
+#define DP83811_POR_DONE_INT_EN	BIT(4)
+
 #define MII_DP83811_RXSOP1	0x04a5
 #define MII_DP83811_RXSOP2	0x04a6
 #define MII_DP83811_RXSOP3	0x04a7
@@ -81,6 +87,10 @@ static int dp83811_ack_interrupt(struct phy_device *phydev)
 	if (err < 0)
 		return err;
 
+	err = phy_read(phydev, MII_DP83811_INT_STAT3);
+	if (err < 0)
+		return err;
+
 	return 0;
 }
 
@@ -216,6 +226,18 @@ static int dp83811_config_intr(struct phy_device *phydev)
 				DP83811_UNDERVOLTAGE_INT_EN);
 
 		err = phy_write(phydev, MII_DP83811_INT_STAT2, misr_status);
+		if (err < 0)
+			return err;
+
+		misr_status = phy_read(phydev, MII_DP83811_INT_STAT3);
+		if (misr_status < 0)
+			return misr_status;
+
+		misr_status |= (DP83811_LPS_INT_EN |
+				DP83811_NO_FRAME_INT_EN |
+				DP83811_POR_DONE_INT_EN);
+
+		err = phy_write(phydev, MII_DP83811_INT_STAT3, misr_status);
 
 	} else {
 		err = phy_write(phydev, MII_DP83811_INT_STAT1, 0);
@@ -223,6 +245,10 @@ static int dp83811_config_intr(struct phy_device *phydev)
 			return err;
 
 		err = phy_write(phydev, MII_DP83811_INT_STAT2, 0);
+		if (err < 0)
+			return err;
+
+		err = phy_write(phydev, MII_DP83811_INT_STAT3, 0);
 	}
 
 	return err;
Signature · 1 line
2.17.0.582.gccdcbd54c
author
#1 lore raw

PATCH v2 2/2 net: phy: DP83TC811: Fix SGMII enable/disable

If SGMII was selected in the DT then the device should write the SGMII enable bit.

If SGMII is not selected in the DT then the SGMII bit should be disabled.

---

v2 - Removed erroneous defconfig addtion in the patch.

 drivers/net/phy/dp83tc811.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/net/phy/dp83tc811.c +9 -11
index f8653f5d8789..78cad134a79e 100644
@@ -284,21 +284,19 @@ static int dp83811_config_init(struct phy_device *phydev)
 	if (err < 0)
 		return err;
 
+	value = phy_read(phydev, MII_DP83811_SGMII_CTRL);
 	if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
-		value = phy_read(phydev, MII_DP83811_SGMII_CTRL);
-		if (!(value & DP83811_SGMII_EN)) {
-			err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
+		err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
 					(DP83811_SGMII_EN | value));
-			if (err < 0)
-				return err;
-		} else {
-			err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
-					(~DP83811_SGMII_EN & value));
-			if (err < 0)
-				return err;
-		}
+	} else {
+		err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
+				(~DP83811_SGMII_EN & value));
 	}
 
+	if (err < 0)
+
+		return err;
+
 	value = DP83811_WOL_MAGIC_EN | DP83811_WOL_SECURE_ON | DP83811_WOL_EN;
 
 	return phy_write_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
Signature · 1 line
2.17.0.582.gccdcbd54c
maintainer
#3 lore raw
In reply to Dan Murphy
Quoted 47 lines · Dan Murphy

Add INT_STAT3 interrupt setting and clearing
support.

---

v2 - Removed bug fix removal of writing INT_STAT1 twice when disabling interrupts

 drivers/net/phy/dp83tc811.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/net/phy/dp83tc811.c +10 -0
index 49ac678eb2dc..f8653f5d8789 100644
@@ -21,6 +21,7 @@
 #define MII_DP83811_SGMII_CTRL	0x09
 #define MII_DP83811_INT_STAT1	0x12
 #define MII_DP83811_INT_STAT2	0x13
+#define MII_DP83811_INT_STAT3	0x18
 #define MII_DP83811_RESET_CTRL	0x1f
 
 #define DP83811_HW_RESET	BIT(15)
@@ -44,6 +45,11 @@
 #define DP83811_OVERVOLTAGE_INT_EN	BIT(6)
 #define DP83811_UNDERVOLTAGE_INT_EN	BIT(7)
 
+/* INT_STAT3 bits */
+#define DP83811_LPS_INT_EN	BIT(0)
+#define DP83811_NO_FRAME_INT_EN	BIT(3)
+#define DP83811_POR_DONE_INT_EN	BIT(4)
+
 #define MII_DP83811_RXSOP1	0x04a5
 #define MII_DP83811_RXSOP2	0x04a6
 #define MII_DP83811_RXSOP3	0x04a7
@@ -81,6 +87,10 @@ static int dp83811_ack_interrupt(struct phy_device *phydev)
 	if (err < 0)
 		return err;
 
+	err = phy_read(phydev, MII_DP83811_INT_STAT3);
+	if (err < 0)
+		return err;
+
 	return 0;
 }
 

drivers/net/phy/dp83tc811.c static int dp83811_config_intr(struct phy_device *phydev) · line 228

Quoted 3 lines
drivers/net/phy/dp83tc811.c +0 -0
@@ -216,6 +226,18 @@ static int dp83811_config_intr(struct phy_device *phydev)
 				DP83811_UNDERVOLTAGE_INT_EN);
 
 		err = phy_write(phydev, MII_DP83811_INT_STAT2, misr_status);

Hi Dan

Isn't this going to fail to apply because net-next says STAT1 here?

That is why i said you need to wait for David to merge net into net-next. Then you can submit these patches, and not have conflicts.

Andrew

author
#4 lore raw

Andrew

Quoted 47 lines · Andrew Lunn
Quoted 46 lines · Dan Murphy

Add INT_STAT3 interrupt setting and clearing
support.

---

v2 - Removed bug fix removal of writing INT_STAT1 twice when disabling interrupts

 drivers/net/phy/dp83tc811.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/net/phy/dp83tc811.c +10 -0
index 49ac678eb2dc..f8653f5d8789 100644
@@ -21,6 +21,7 @@
 #define MII_DP83811_SGMII_CTRL	0x09
 #define MII_DP83811_INT_STAT1	0x12
 #define MII_DP83811_INT_STAT2	0x13
+#define MII_DP83811_INT_STAT3	0x18
 #define MII_DP83811_RESET_CTRL	0x1f
 
 #define DP83811_HW_RESET	BIT(15)
@@ -44,6 +45,11 @@
 #define DP83811_OVERVOLTAGE_INT_EN	BIT(6)
 #define DP83811_UNDERVOLTAGE_INT_EN	BIT(7)
 
+/* INT_STAT3 bits */
+#define DP83811_LPS_INT_EN	BIT(0)
+#define DP83811_NO_FRAME_INT_EN	BIT(3)
+#define DP83811_POR_DONE_INT_EN	BIT(4)
+
 #define MII_DP83811_RXSOP1	0x04a5
 #define MII_DP83811_RXSOP2	0x04a6
 #define MII_DP83811_RXSOP3	0x04a7
@@ -81,6 +87,10 @@ static int dp83811_ack_interrupt(struct phy_device *phydev)
 	if (err < 0)
 		return err;
 
+	err = phy_read(phydev, MII_DP83811_INT_STAT3);
+	if (err < 0)
+		return err;
+
 	return 0;
 }
 
Quoted 9 lines

drivers/net/phy/dp83tc811.c static int dp83811_config_intr(struct phy_device *phydev) · line 228

Quoted 4 lines
drivers/net/phy/dp83tc811.c +0 -0
@@ -216,6 +226,18 @@ static int dp83811_config_intr(struct phy_device *phydev)
 				DP83811_UNDERVOLTAGE_INT_EN);
 
 		err = phy_write(phydev, MII_DP83811_INT_STAT2, misr_status);

Hi Dan

Isn't this going to fail to apply because net-next says STAT1 here?

Yes but this should not be a pre-requisite for a code review.

Maybe I should have put the RFC in the subject.

Quoted 5 lines

That is why i said you need to wait for David to merge net into net-next. Then you can submit these patches, and not have conflicts.

Andrew

Signature · 2 lines
------------------
Dan Murphy
author
#5 lore raw

Andrew

Quoted 57 lines · Dan Murphy

Andrew

Quoted 54 lines · Andrew Lunn
Quoted 47 lines · Dan Murphy

Add INT_STAT3 interrupt setting and clearing
support.

---

v2 - Removed bug fix removal of writing INT_STAT1 twice when disabling interrupts

 drivers/net/phy/dp83tc811.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/net/phy/dp83tc811.c +10 -0
index 49ac678eb2dc..f8653f5d8789 100644
@@ -21,6 +21,7 @@
 #define MII_DP83811_SGMII_CTRL	0x09
 #define MII_DP83811_INT_STAT1	0x12
 #define MII_DP83811_INT_STAT2	0x13
+#define MII_DP83811_INT_STAT3	0x18
 #define MII_DP83811_RESET_CTRL	0x1f
 
 #define DP83811_HW_RESET	BIT(15)
@@ -44,6 +45,11 @@
 #define DP83811_OVERVOLTAGE_INT_EN	BIT(6)
 #define DP83811_UNDERVOLTAGE_INT_EN	BIT(7)
 
+/* INT_STAT3 bits */
+#define DP83811_LPS_INT_EN	BIT(0)
+#define DP83811_NO_FRAME_INT_EN	BIT(3)
+#define DP83811_POR_DONE_INT_EN	BIT(4)
+
 #define MII_DP83811_RXSOP1	0x04a5
 #define MII_DP83811_RXSOP2	0x04a6
 #define MII_DP83811_RXSOP3	0x04a7
@@ -81,6 +87,10 @@ static int dp83811_ack_interrupt(struct phy_device *phydev)
 	if (err < 0)
 		return err;
 
+	err = phy_read(phydev, MII_DP83811_INT_STAT3);
+	if (err < 0)
+		return err;
+
 	return 0;
 }
 

drivers/net/phy/dp83tc811.c static int dp83811_config_intr(struct phy_device *phydev) · line 228

Quoted 3 lines
drivers/net/phy/dp83tc811.c +0 -0
@@ -216,6 +226,18 @@ static int dp83811_config_intr(struct phy_device *phydev)
 				DP83811_UNDERVOLTAGE_INT_EN);
 
 		err = phy_write(phydev, MII_DP83811_INT_STAT2, misr_status);

Hi Dan

Quoted 10 lines
Quoted 2 lines

Isn't this going to fail to apply because net-next says STAT1 here?

Yes but this should not be a pre-requisite for a code review.

Maybe I should have put the RFC in the subject.

Quoted 3 lines

That is why i said you need to wait for David to merge net into net-next. Then you can submit these patches, and not have conflicts.

David has applied the pre-requisite patch so this series can be review and tested.

Dan

Quoted 4 lines
Quoted 2 lines

Andrew

Signature · 2 lines
------------------
Dan Murphy
maintainer Applied
#2 lore raw

Re: [PATCH net-next v2 2/2] net: phy: DP83TC811: Fix SGMII enable/disable

In reply to Dan Murphy

From: Dan Murphy <[email protected]>
Date: Fri, 29 Jun 2018 10:35:46 -0500

Quoted 10 lines

If SGMII was selected in the DT then the device should write the SGMII enable bit.

If SGMII is not selected in the DT then the SGMII bit should be disabled.

---

v2 - Removed erroneous defconfig addtion in the patch.

Applied.