diff mbox

[net-next,1/4] net: dsa: lan9303: Fix lan9303_detect_phy_setup() for MDIO

Message ID 20170728151157.28983-2-privat@egil-hjelmeland.no
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Egil Hjelmeland July 28, 2017, 3:11 p.m. UTC
Handle that MDIO read with no response return 0xffff.

Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
---
 drivers/net/dsa/lan9303-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andrew Lunn July 28, 2017, 3:19 p.m. UTC | #1
On Fri, Jul 28, 2017 at 05:11:54PM +0200, Egil Hjelmeland wrote:
> Handle that MDIO read with no response return 0xffff.
> 
> Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>

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

    Andrew
Vivien Didelot July 28, 2017, 3:36 p.m. UTC | #2
Egil Hjelmeland <privat@egil-hjelmeland.no> writes:

> Handle that MDIO read with no response return 0xffff.
>
> Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>

Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Florian Fainelli July 28, 2017, 5:02 p.m. UTC | #3
On 07/28/2017 08:11 AM, Egil Hjelmeland wrote:
> Handle that MDIO read with no response return 0xffff.
> 
> Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox

Patch

diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index cd76e61f1fca..9d0ab77edb4a 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -427,6 +427,7 @@  static int lan9303_detect_phy_setup(struct lan9303 *chip)
 	 * Special reg 18 of phy 3 reads as 0x0000, if 'phy_addr_sel_strap' is 0
 	 * and the IDs are 0-1-2, else it contains something different from
 	 * 0x0000, which means 'phy_addr_sel_strap' is 1 and the IDs are 1-2-3.
+	 * 0xffff is returned on MDIO read with no response.
 	 */
 	reg = lan9303_port_phy_reg_read(chip, 3, MII_LAN911X_SPECIAL_MODES);
 	if (reg < 0) {
@@ -434,7 +435,7 @@  static int lan9303_detect_phy_setup(struct lan9303 *chip)
 		return reg;
 	}
 
-	if (reg != 0)
+	if ((reg != 0) && (reg != 0xffff))
 		chip->phy_addr_sel_strap = 1;
 	else
 		chip->phy_addr_sel_strap = 0;