From patchwork Wed Oct 5 13:19:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 678445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3spxKy3rPhz9s3s for ; Thu, 6 Oct 2016 00:23:02 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=googlemail.com header.i=@googlemail.com header.b=bxYs09O7; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1brm78-00033H-Cn; Wed, 05 Oct 2016 13:20:02 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1brm73-0002xN-KJ for lede-dev@lists.infradead.org; Wed, 05 Oct 2016 13:19:59 +0000 Received: by mail-wm0-x242.google.com with SMTP id p138so24558292wmb.0 for ; Wed, 05 Oct 2016 06:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+ITRIb7XtxNlzHEceGopprViM9KsvIw1imNEyexLqE8=; b=bxYs09O7M85v0hu16ueqp+EMob03hvzFbKPzMPEI5fMGND13KzXnB11Ebosqx2Xw8n zXf0kUZ1eJBX6HfdIXtxn6Yh1KDhN2cOvrYBjxsI3V+6IqsMIHA4D0tdw0cEixb4sA/Z YG0N1WwHfcI5llE/fCt0WnZszjn/7f+TuP2m2zc4mkLifZu02g2x9lXlbyx7ECFWuG33 rjphdIy/9Qjtu1RTfcyGstxhfMipN2tAjmhVN/HjUG86MDktgjnu+SO3YAhn1K5+ogxp eXBDIilfrDcP+GPiWPhle5q4B3Vxuuqc/fa6djc0Fb2PUwQ7BIwDBjdROTfzbywP5wNO ApmA== 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:in-reply-to :references; bh=+ITRIb7XtxNlzHEceGopprViM9KsvIw1imNEyexLqE8=; b=bFHLhSQxpic59CMtSFDtyUwwhLtkq9XvdOH8I8ZeKfbxqYpzY8144EAKtKJPx/VIlR wjMQt4/xfEjac3TLmw/wYICakO3nV7I7lCW9hcBf/EzWkAQYCqESi1dLyw3hKJh7zzDI gtWTND4SxwHjQ+HF3M6f+MPfLhuMUMb9ATCzzdk/tJZog1dENjVz1XKvGqX+PO9Qhpqt Uc+z74f/R/FF/JQCmmIACOJBAFxW0opeSZ+Xx+YViSJAeV3qBnULhRKLK65MErhgRkaF CilJGfjdrJvV46EP6w2tFRalrBxX+iPCxEeUHbGbwRv/ec6D1GZR/RAV/tEFeP/vjd9j dGBQ== X-Gm-Message-State: AA6/9RnXYjas8yxbwWFkP4Rd+r4K/r4IdE6tFvENTucQFY4eG0hdnxztLIgfTp6tywEVoA== X-Received: by 10.194.109.229 with SMTP id hv5mr7465863wjb.131.1475673575579; Wed, 05 Oct 2016 06:19:35 -0700 (PDT) Received: from debian64.daheim (pD9F8ACE2.dip0.t-ipconnect.de. [217.248.172.226]) by smtp.gmail.com with ESMTPSA id e1sm29752636wma.9.2016.10.05.06.19.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Oct 2016 06:19:34 -0700 (PDT) From: Christian Lamparter X-Google-Original-From: Christian Lamparter Received: from chuck by debian64.daheim with local (Exim 4.87) (envelope-from ) id 1brm6g-0005IC-3X; Wed, 05 Oct 2016 15:19:34 +0200 To: lede-dev@lists.infradead.org Date: Wed, 5 Oct 2016 15:19:34 +0200 Message-Id: <90d12bb47606b1987ee32a46d3ba3013c2526ce1.1475673312.git.chunkeey@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <9bc4b077c8a9cc3bd99f4cf8d38222b352dd9a70.1475671799.git.chunkeey@gmail.com> References: <9bc4b077c8a9cc3bd99f4cf8d38222b352dd9a70.1475671799.git.chunkeey@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161005_061957_866351_A058D61F X-CRM114-Status: GOOD ( 14.36 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (chunkeey[at]googlemail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [LEDE-DEV] [PATCH v3.1] generic: ar8216: improve ar8xxx_is_possible check X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chris Blake , John Crispin MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The commit "generic: ar8216: add sanity check to ar8216_probe" (774da6c7a40320a320b28d71291c0e61fcf7bc8a) stated that PHY IDs should be checked at address 0-4. However, the PHY 4 was never check by the loop. This patch extends the check to be similar to the Atheors SDK. It tries all 4 ports and skips unconnected PHYs if necessary. If it cannot find any familiar PHYs, it will prevent the phy driver from initializing. This patch is necessary for the C-60. It doesn't have a PHY at port 3, so this caused the check in ar8xxx_is_possible to fail. As a result, the ethernet ports on the C-60 didn't work. Signed-off-by: Christian Lamparter --- Oops, I just found your comment about !!found_phys. I've integrated it in this version. Regards, Christian --- target/linux/generic/files/drivers/net/phy/ar8216.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 70f4774..cd5fbac 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -2113,21 +2113,21 @@ ar8xxx_phy_match(u32 phy_id) static bool ar8xxx_is_possible(struct mii_bus *bus) { - unsigned i; + unsigned int i, found_phys = 0; - for (i = 0; i < 4; i++) { + for (i = 0; i < 5; i++) { u32 phy_id; phy_id = mdiobus_read(bus, i, MII_PHYSID1) << 16; phy_id |= mdiobus_read(bus, i, MII_PHYSID2); - if (!ar8xxx_phy_match(phy_id)) { + if (ar8xxx_phy_match(phy_id)) { + found_phys++; + } else if (phy_id) { pr_debug("ar8xxx: unknown PHY at %s:%02x id:%08x\n", dev_name(&bus->dev), i, phy_id); - return false; } } - - return true; + return !!found_phys; } static int