From patchwork Fri Mar 11 16:47:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 8567771 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DB186C0553 for ; Fri, 11 Mar 2016 16:49:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE2EE201B4 for ; Fri, 11 Mar 2016 16:49:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0FAC520268 for ; Fri, 11 Mar 2016 16:49:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aeQEO-0002jl-Eo; Fri, 11 Mar 2016 16:48:04 +0000 Received: from mail-pa0-x242.google.com ([2607:f8b0:400e:c03::242]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aeQDr-00029Y-SP for linux-arm-kernel@lists.infradead.org; Fri, 11 Mar 2016 16:47:33 +0000 Received: by mail-pa0-x242.google.com with SMTP id fl4so8894542pad.2 for ; Fri, 11 Mar 2016 08:47:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n3w2Yg4GzERQLlbwedM/Qm+H1SDTVWCTKkeW7f+xeqo=; b=mnDWBgtTA/1dStO6qY2VHNOHgFC1FDwPuUrGfSrDi+PGMhOwIKmxJIk3Em/+ChO5h3 L2dDK3by+ZiMpeQ1Nc/vhy7KOy2el8ncCyZs2KdoOL39ziRyW/cAVUMeHlE406JjQIPi JGKzzN3Dz2IKy+HGP8nJ6+cDGTAt0CHyeUVQrtbAl57s8Rl59JT46qNnzcou8w2Gq/EX 7ZOZxlcOwz/bIWnfi+ePKInODsNHQoLBC8Y/wY0VeBwdc/Wy9gI93Rhnae/ka9kl/eFh 0BxKbJJBs/vrYR6VFibmWJD12tZnMWXL4XW5S4hZ5wqcd/q25OXNLlNkc5KTJs2nznvR ryKA== 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=n3w2Yg4GzERQLlbwedM/Qm+H1SDTVWCTKkeW7f+xeqo=; b=jOO/bWlX6iNQBlE1y9jvpUMB6ZUTMfF6Hr273y1faPSohMv2SktfMBxin91Z/shgfz 9+yFyH3Z/J+6QiNaQwhd/w7lYn2Js/DgVaP/YAR324J7ACQbNTAFxSOem07aDasKV/7w RE2cdMyG+i/YcAVhenGN0Vx3Sc3CnGj2kdLMlkcJqkM5kqQ2to94brubXLxuIt0ZPRc4 zBY9F4lLfszOAWG2zSucLewl/BDMT1FEgoyVAHOpImqUVgLeX82uvVI6sTeSTcd7+fXV f+bf7FvGTHcTyuwoJRVS0R26QNfufui1eyfd2NGwJ9uZX4InwAR6P0MyoF7X4zzb4SpU bUoQ== X-Gm-Message-State: AD7BkJIvyDkLgYL0fmfQM3aSX+Rix/YSW6aAlUx/mWD0qz+oqUpNTa9r+2SsScXewjk/Qw== X-Received: by 10.66.250.199 with SMTP id ze7mr17009529pac.103.1457714830932; Fri, 11 Mar 2016 08:47:10 -0800 (PST) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id o7sm14129064pfa.37.2016.03.11.08.47.07 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 11 Mar 2016 08:47:07 -0800 (PST) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id u2BGl6g8005803; Fri, 11 Mar 2016 08:47:06 -0800 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u2BGl6gN005801; Fri, 11 Mar 2016 08:47:06 -0800 From: David Daney To: "David S. Miller" , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , Robert Richter , Sunil Goutham , Kumar Gala , Ian Campbell , Mark Rutland , Pawel Moll , Rob Herring Subject: [PATCH 1/3] net: thunderx: Cleanup PHY probing code. Date: Fri, 11 Mar 2016 08:47:00 -0800 Message-Id: <1457714822-5754-2-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1457714822-5754-1-git-send-email-ddaney.cavm@gmail.com> References: <1457714822-5754-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160311_084732_062873_20E91DEB X-CRM114-Status: GOOD ( 15.47 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Radha Mohan Chintakuntla , linux-kernel@vger.kernel.org, David Daney MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Daney Remove the call to force the octeon-mdio driver to be loaded. Allow the standard driver loading mechanisms to load the PHY drivers, and use -EPROBE_DEFER to cause the BGX driver to be probed only after the PHY drivers are available. Reorder the setting of MAC addresses and PHY probing to allow BGX LMACs with no attached PHY to still be assigned a MAC address. Signed-off-by: David Daney --- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 31 ++++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index f8abdff..928c02b 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -978,27 +978,31 @@ static int bgx_init_of_phy(struct bgx *bgx) const char *mac; device_for_each_child_node(&bgx->pdev->dev, fwn) { + struct phy_device *pd; struct device_node *phy_np; struct device_node *node = to_of_node(fwn); - /* If it is not an OF node we cannot handle it yet, so - * exit the loop. - */ - if (!node) - break; - - phy_np = of_parse_phandle(node, "phy-handle", 0); - if (!phy_np) - continue; - - bgx->lmac[lmac].phydev = of_phy_find_device(phy_np); - mac = of_get_mac_address(node); if (mac) ether_addr_copy(bgx->lmac[lmac].mac, mac); SET_NETDEV_DEV(&bgx->lmac[lmac].netdev, &bgx->pdev->dev); bgx->lmac[lmac].lmacid = lmac; + + phy_np = of_parse_phandle(node, "phy-handle", 0); + /* If there is no phy or defective firmware presents + * this cortina phy, for which there is no driver + * support, ignore it. + */ + if (phy_np && + !of_device_is_compatible(phy_np, "cortina,cs4223-slice")) { + /* Wait until the phy drivers are available */ + pd = of_phy_find_device(phy_np); + if (!pd) + return -EPROBE_DEFER; + bgx->lmac[lmac].phydev = pd; + } + lmac++; if (lmac == MAX_LMAC_PER_BGX) { of_node_put(node); @@ -1032,9 +1036,6 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct bgx *bgx = NULL; u8 lmac; - /* Load octeon mdio driver */ - octeon_mdiobus_force_mod_depencency(); - bgx = devm_kzalloc(dev, sizeof(*bgx), GFP_KERNEL); if (!bgx) return -ENOMEM;