Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752550AbdG1PMn (ORCPT ); Fri, 28 Jul 2017 11:12:43 -0400 Received: from aibo.runbox.com ([91.220.196.211]:46594 "EHLO aibo.runbox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752482AbdG1PMg (ORCPT ); Fri, 28 Jul 2017 11:12:36 -0400 From: Egil Hjelmeland To: andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Cc: Egil Hjelmeland Subject: [PATCH net-next 1/4] net: dsa: lan9303: Fix lan9303_detect_phy_setup() for MDIO Date: Fri, 28 Jul 2017 17:11:54 +0200 Message-Id: <20170728151157.28983-2-privat@egil-hjelmeland.no> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170728151157.28983-1-privat@egil-hjelmeland.no> References: <20170728151157.28983-1-privat@egil-hjelmeland.no> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1080 Lines: 30 Handle that MDIO read with no response return 0xffff. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.11.0