From patchwork Fri Jun 10 14:53:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Lauss X-Patchwork-Id: 633783 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rR4t514Knz9spN for ; Sat, 11 Jun 2016 00:53:17 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=YWe5tGrM; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526AbcFJOxP (ORCPT ); Fri, 10 Jun 2016 10:53:15 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33572 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751440AbcFJOxO (ORCPT ); Fri, 10 Jun 2016 10:53:14 -0400 Received: by mail-wm0-f68.google.com with SMTP id r5so18540337wmr.0 for ; Fri, 10 Jun 2016 07:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=5u3UkZg4PDXLA8lu9Ym42Vd9/6xdznFytstm4IGWJ3E=; b=YWe5tGrMbirKA1BBKGKXzqG2xqFBlavo0g14UOq3de3rw847tXh+aC8pNb+sOiMnKA 0MWIApk9qupYowjBU0ufS9QRe9ipBYg9E1ZOLjmvyvUoR9YgZDvOE6Sls7A8NUDtSScI buLWc65rXJUISGSggxbX270+cD+hhREvyUhbfQrTxAJa/k4KmBc6mR34ssL23arxKhLK O7VTLIFo6ib2be2If7gJ+S0x6N5v2pJydB6yJO4k2z+cLlSVkrZxLHL8eQ6tf24fbr8D TH8HBp5ZZbd2MFY0qED39NjwzSnnqvLO3J9D7Jz7b3Cocq3fhAnXp6G1gQTW3Z15KUa7 sDQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5u3UkZg4PDXLA8lu9Ym42Vd9/6xdznFytstm4IGWJ3E=; b=MRhFz5doLL4BJzz4fCmkH8MBOeh9ttPwOlM9PjbwZ9MAvhcIjp3Zwfc/jvW+tKZuFP VB6ANKTDWUNZojlS8bSINzutVkFU9lnvw4do8UETHtWvS6VsKU5K7qJRFFeHhoKQM9IU 66zY7J3es9h59EiQ21/kLgmD2gYRhVfbgDTd/RneZELVxdtPNH8Gyk8QRnA+tXbkWU6r aH3bq1vvX1csECx5fr9ecaJTrBxwNvUt8yrV+VnIn6MLoSCAQmKFAPD7MnUSpbZFso2J r3uI4RmVRPiJclqTl0hEb4GuD8R32nfQj8kRaBT3Gc7G+/7FCxKVuzvVKmY9zcRvOScU 05fA== X-Gm-Message-State: ALyK8tL5TNR4KFHhyW/e5TUCLxzRGSDX0hzl+kahFAG61qkbt3mCBTG2m4ALHTZiyoJWtQ== X-Received: by 10.194.99.244 with SMTP id et20mr2806643wjb.92.1465570392296; Fri, 10 Jun 2016 07:53:12 -0700 (PDT) Received: from dargo.Speedport_W_724V_Typ_A_05011603_00_009 (p200300C023C0446636E6D7FFFE14BFA6.dip0.t-ipconnect.de. [2003:c0:23c0:4466:36e6:d7ff:fe14:bfa6]) by smtp.gmail.com with ESMTPSA id b207sm36212163wmb.0.2016.06.10.07.53.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Jun 2016 07:53:11 -0700 (PDT) From: Manuel Lauss To: netdev@vger.kernel.org Cc: Florian Fainelli , Manuel Lauss , Andrew Lunn Subject: [PATCH] net: au1000_eth: fix PHY detection Date: Fri, 10 Jun 2016 16:53:05 +0200 Message-Id: <20160610145305.665482-1-manuel.lauss@gmail.com> X-Mailer: git-send-email 2.8.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit 7f854420fbfe9d49afe2ffb1df052cfe8e215541 ("phy: Add API for {un}registering an mdio device to a bus.") broke PHY detection on this driver with a copy-paste bug: The code is looking 32 times for a PHY at address 0. Fixes ethernet on AMD DB1100/DB1500/DB1550 boards which have their (autodetected) PHYs at address 31. Cc: Andrew Lunn Signed-off-by: Manuel Lauss --- before: libphy: au1000_eth_mii: probed au1000-eth au1000-eth.0 (unnamed net_device) (uninitialized): no PHY found au1000-eth: probe of au1000-eth.0 failed with error -1 after: libphy: au1000_eth_mii: probed AM79C874 au1000-eth-0:1f: attached PHY driver [AM79C874] (mii_bus:phy_addr=au1000-eth-0:1f, irq=-1) au1000-eth au1000-eth.0 eth0: Au1xx0 Ethernet found at 0x11500000, irq 36 drivers/net/ethernet/amd/au1000_eth.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c index e0fb0f1..d8c77e8 100644 --- a/drivers/net/ethernet/amd/au1000_eth.c +++ b/drivers/net/ethernet/amd/au1000_eth.c @@ -508,13 +508,12 @@ static int au1000_mii_probe(struct net_device *dev) /* find the first (lowest address) PHY * on the current MAC's MII bus */ - for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) - if (mdiobus_get_phy(aup->mii_bus, aup->phy_addr)) { - phydev = mdiobus_get_phy(aup->mii_bus, aup->phy_addr); - if (!aup->phy_search_highest_addr) - /* break out with first one found */ - break; - } + for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { + phydev = mdiobus_get_phy(aup->mii_bus, phy_addr); + if (phydev && !aup->phy_search_highest_addr) + /* break out with first one found */ + break; + } if (aup->phy1_search_mac0) { /* try harder to find a PHY */