From patchwork Wed Oct 5 12:53:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 678428 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 3spwmK4VLjz9ryv for ; Wed, 5 Oct 2016 23:57:21 +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=TkUxUKEY; 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 1brlhn-00087G-Dz; Wed, 05 Oct 2016 12:53:51 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1brlhW-00080Z-Vj for lede-dev@lists.infradead.org; Wed, 05 Oct 2016 12:53:36 +0000 Received: by mail-wm0-x244.google.com with SMTP id f193so19826118wmg.2 for ; Wed, 05 Oct 2016 05:53:14 -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; bh=AxxUwSUYMNSyrWRCinkLNyBVoBLZmJOcBy1BOLXY/bM=; b=TkUxUKEYKf26MkB7GOybFIWy/as32nVeYIoHeyyjgWgsPaTwOe3EMODobYIG7MllS6 GZnmbT5XgkSl7UlKUJhuXNEe8z78AiNZz5QszRLSfZF+nUL9Cd1KD8Q6JtJJesJnb2xD PjC+hdSkkrp6IqFSeMWwScPCq/geIFAU8DOpkc0SdkkQmh0NkhNFL6EvxuuNJZ9Bq9Fc jSkj3Kdx+nJ+JdpfbQomfeBcGVRmTzNifZte/QGzwW4Rs5xAk7pn1GXsqrFVT3wk7y0I e8JZsLKH/baREaAd5CIHp/qWnpIdizYaQtOfI+7jZmGD8piVJZY3iCl1tP8+uuvcuRCf xN7Q== 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=AxxUwSUYMNSyrWRCinkLNyBVoBLZmJOcBy1BOLXY/bM=; b=XK5WBkmbueDS4X6Tol3KJSyCKB6OXPVGfkB3MFDTTZpEvW5eoN/r6rk2W7x19TdZx7 7vgSSNLcTsIWL9QhrdrBxeLYhAv5iEZu9QBm9cYPGlAVyyTCCZJFeGAd3lMlzigl6NRG lF2oUupJDek4MINLPbGCX9bc882mgfaltedVjx60ii/zFbk93VMbL1+IeC/0mvkRPlZ6 XInyPMFFbuRlUyjMvmNLM0z/qnxTtHTyXwYGhxSZ1yA66EVuIABLcXt7bbLWiRxa/QtA amYp1rx27qBEuKC/BQcGd0Vk7h9Y6n26yUvP97Dubl/nykmRTQ0bkYJ5aR6m+RStkCbi ECJg== X-Gm-Message-State: AA6/9RmhepCq1bw7I4kOWlzO9jmDsJg90wyFmsqoFlxrtWtdVQRvkZSmkZ7IZ9reC8dAGw== X-Received: by 10.194.62.212 with SMTP id a20mr9375429wjs.180.1475671993096; Wed, 05 Oct 2016 05:53:13 -0700 (PDT) Received: from debian64.daheim (pD9F8ACE2.dip0.t-ipconnect.de. [217.248.172.226]) by smtp.gmail.com with ESMTPSA id h3sm8876690wjp.45.2016.10.05.05.53.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Oct 2016 05:53:12 -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 1brlh9-0003vi-KV; Wed, 05 Oct 2016 14:53:11 +0200 To: lede-dev@lists.infradead.org Date: Wed, 5 Oct 2016 14:53:10 +0200 Message-Id: <9bc4b077c8a9cc3bd99f4cf8d38222b352dd9a70.1475671799.git.chunkeey@gmail.com> X-Mailer: git-send-email 2.9.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161005_055335_321294_586891BE X-CRM114-Status: GOOD ( 13.79 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:244 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/2] 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 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 --- target/linux/generic/files/drivers/net/phy/ar8216.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 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..3f1e151 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -2113,19 +2113,22 @@ 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; } } + if (found_phys == 0) + return false; return true; }