Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp725420imm; Thu, 13 Sep 2018 06:53:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZthJOpMm//7zCWLk7G1x38S0VVi0hoNoyjB9msgziH+ShitTrPXuG9hOTzVd9d6EV2YmEZ X-Received: by 2002:a62:c182:: with SMTP id i124-v6mr7598567pfg.248.1536846796644; Thu, 13 Sep 2018 06:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846796; cv=none; d=google.com; s=arc-20160816; b=fO1jg9xDZf1AvrYpXMGp7EemJwvlCS0Woz8A5ki3ntZUG7DM+CS8MWKxJSrD7RwGG6 fA3bV6aUh/56k1CFwM2QOk72RlCT9bKATysSzYpGMBr66ctd7kWe3fb98kGDXIBaU/R9 6KNeG6lsk+kNmz4QfT/n3rBVTFY7aFQ9pPKJEQIgbRZctnPk26K0Zuw0fD3HD3NFa0KF 3mgbzwZIMjhgHQknxzD+s/fZmsloX1kbMLyBnCl732G4dru3R6sG4X2xHG0HjiMY7f+h CjKokXIvUAW3phpySei8gYF6BsWcy3fV11p29ifEw3LF+TNLfsg8rXbDawhkrnHk0pFF o5wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=8qxfuiEXUPZGIgNRjwYREXGMb7OwDZxQJ2m5c2tA/Io=; b=yr86oat0ykK7Tm9CnEnax9ig4uu/sdueLy4mYbml5GCVzXlM19bk28vBPxDCmGsIgH MpccyZJJLbNk+b/chKOzncBkBxlUL7oOHcqzVcYNtQNG7cqHjKsS0bysm2ddMSjTpChN BygmLVJ4+T+3FuMhtf/vWIMpDf1D8/okhWrWHJ12vxrguERCI5h8+gy7+iV4hoIH2xDq 5gZC4VZWQOyPAGXNSRgelH2NawYz3SCUF+9qTS/PGCD5QVrdIfH/hI0wFwwQIFuqIz9J KWYLgLORCs1Lcm/ZgxwZBBU4B1xVbv0KGedqAmZgdcJYziHBD5s+X1j8ZtHRF2fw5xM1 yI5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11-v6si4264111pgh.564.2018.09.13.06.53.01; Thu, 13 Sep 2018 06:53:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730806AbeIMTA4 (ORCPT + 99 others); Thu, 13 Sep 2018 15:00:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33280 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbeIMTAz (ORCPT ); Thu, 13 Sep 2018 15:00:55 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9F1F6D10; Thu, 13 Sep 2018 13:51:20 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ahmad Fatoum , "David S. Miller" Subject: [PATCH 4.18 022/197] net: macb: Fix regression breaking non-MDIO fixed-link PHYs Date: Thu, 13 Sep 2018 15:29:31 +0200 Message-Id: <20180913131842.454065227@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ahmad Fatoum [ Upstream commit ab5f11055fdf8dfc3ddbd89e8e3cc550de41d1d3 ] commit 739de9a1563a ("net: macb: Reorganize macb_mii bringup") broke initializing macb on the EVB-KSZ9477 eval board. There, of_mdiobus_register was called even for the fixed-link representing the RGMII-link to the switch with the result that the driver attempts to enumerate PHYs on a non-existent MDIO bus: libphy: MACB_mii_bus: probed mdio_bus f0028000.ethernet-ffffffff: fixed-link has invalid PHY address mdio_bus f0028000.ethernet-ffffffff: scan phy fixed-link at address 0 [snip] mdio_bus f0028000.ethernet-ffffffff: scan phy fixed-link at address 31 The "MDIO" bus registration succeeds regardless, having claimed the reset GPIO, and calling of_phy_register_fixed_link later on fails because it tries to claim the same GPIO: macb f0028000.ethernet: broken fixed-link specification Fix this by registering the fixed-link before calling mdiobus_register. Fixes: 739de9a1563a ("net: macb: Reorganize macb_mii bringup") Signed-off-by: Ahmad Fatoum Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/cadence/macb_main.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -481,11 +481,6 @@ static int macb_mii_probe(struct net_dev if (np) { if (of_phy_is_fixed_link(np)) { - if (of_phy_register_fixed_link(np) < 0) { - dev_err(&bp->pdev->dev, - "broken fixed-link specification\n"); - return -ENODEV; - } bp->phy_node = of_node_get(np); } else { bp->phy_node = of_parse_phandle(np, "phy-handle", 0); @@ -568,7 +563,7 @@ static int macb_mii_init(struct macb *bp { struct macb_platform_data *pdata; struct device_node *np; - int err; + int err = -ENXIO; /* Enable management port */ macb_writel(bp, NCR, MACB_BIT(MPE)); @@ -591,12 +586,23 @@ static int macb_mii_init(struct macb *bp dev_set_drvdata(&bp->dev->dev, bp->mii_bus); np = bp->pdev->dev.of_node; - if (pdata) - bp->mii_bus->phy_mask = pdata->phy_mask; + if (np && of_phy_is_fixed_link(np)) { + if (of_phy_register_fixed_link(np) < 0) { + dev_err(&bp->pdev->dev, + "broken fixed-link specification %pOF\n", np); + goto err_out_free_mdiobus; + } + + err = mdiobus_register(bp->mii_bus); + } else { + if (pdata) + bp->mii_bus->phy_mask = pdata->phy_mask; + + err = of_mdiobus_register(bp->mii_bus, np); + } - err = of_mdiobus_register(bp->mii_bus, np); if (err) - goto err_out_free_mdiobus; + goto err_out_free_fixed_link; err = macb_mii_probe(bp->dev); if (err) @@ -606,6 +612,7 @@ static int macb_mii_init(struct macb *bp err_out_unregister_bus: mdiobus_unregister(bp->mii_bus); +err_out_free_fixed_link: if (np && of_phy_is_fixed_link(np)) of_phy_deregister_fixed_link(np); err_out_free_mdiobus: