From patchwork Mon Jul 10 12:35:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 9832865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2FC5160318 for ; Mon, 10 Jul 2017 12:36:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D74C27FB3 for ; Mon, 10 Jul 2017 12:36:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E7AD282EC; Mon, 10 Jul 2017 12:36:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D913727FB3 for ; Mon, 10 Jul 2017 12:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=O1aRNw2SlgO15JyWfZubsayDe90SjxxQHfpcoFMzDZw=; b=ClL FsDaqSGdUaOk+THBWDjScLRnmaEPs7uvBsXFKlNCjx6bXeB4rxOYcguvWbctq0spJETG4EqdgXWsP 9Rqs/qS8B1EmPCqXsuqS9Xt/95i8YVSLcfmI8jP4h/rF5qxfQXuhsHyD7wO7qNlk31ySuLaucq6g3 lGGyQFND96oG/Ygq9C7M8wPfgnEY4KA2FWJ8y57dF9Tmypro31XhWKvwPtkh/I//x743mQUkp7CLf R4oZAupQpuIkXEfTfWjgqoaH5lEFc/vhOkRy/g3QzZNo/fF5tr4k+ylXTF3x2d0Fspp79B0sfXUSA fmm4yung6R4FelYCwNvF79vhQ8tZgRw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dUXv0-0001tP-8D; Mon, 10 Jul 2017 12:36:02 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dUXuw-0001sJ-Md for linux-amlogic@lists.infradead.org; Mon, 10 Jul 2017 12:36:00 +0000 Received: by mail-wr0-x243.google.com with SMTP id k67so24601942wrc.1 for ; Mon, 10 Jul 2017 05:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=XstmhzNCQ3hUB3L+mW/n6ofuvogn8fqwFHtL0wF7Pb4=; b=ki3/N2o9F2ZmQWsOIpA6zw7oI10qIL/sajUPK208AnGfx/6mC2jx2FXHxzxVvLAlDb rLCCNb1BfR84HvX+GYYiM4eGc1x9NC+0bjaagXTkXXhnn1YhyrNISl21QHYzye2asBxb scVc9w5mp76HJY9d0Fo2BB+vfZ5Xsj8x7UmHUnERnbSMKiaX70G4nIZU+SP41HGRGDQU 00BoO8luI1NbnHGx9babEwdZdu3bcTD4P/7IuSU0VRHnwTgkPmC0fFzbh/iN8O5a3she 2+WIB2YnyJUzxLU6/e3QNL8k68+cN/kXdGZp8g1iWnRpMycg4E0antcbhWqDtDLkfNX/ rN6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XstmhzNCQ3hUB3L+mW/n6ofuvogn8fqwFHtL0wF7Pb4=; b=bw7RcXB5GRCXMkWsHtS8e4M0CHl6n3gt1EZR0pzfk+C3uwR8DSf8ww0HAxW1HJvbQe EabvkOncOQyhT7Vbe2FkhXUbUplbuCoMkVrWJw9X2gtPfm34G7tszu21pZCYcWBtOobB 9cN7pr9V/UcMf9ctkaJ2jW3gYMayyDmT5LVXvk8XgI/SiJeFxJb6X6fF37gYinTdYA6S Lx7vZRnmPQaySrb+YkfCoMv4cRICBq8RhqibL+E98d1bHJKW7GMz9W3ttkQ4Mo/dKsbK Kohjn33Xm8tsTeRp2LZBFNgXZ2V01fH3KZxS6C7Pd/lmkQhyRArssV0W8ra6O2AC/9Mi ogFg== X-Gm-Message-State: AIVw110u/ArsA1WoVDkeOCN/D6IsTl3EFv+yDbDjRY/IetSLmJO80upz HvtwqluY/yjc6A== X-Received: by 10.223.150.89 with SMTP id c25mr7247672wra.15.1499690136431; Mon, 10 Jul 2017 05:35:36 -0700 (PDT) Received: from blackbox.darklights.net (p5B056560.dip0.t-ipconnect.de. [91.5.101.96]) by smtp.googlemail.com with ESMTPSA id d1sm13077344wra.43.2017.07.10.05.35.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 05:35:35 -0700 (PDT) From: Martin Blumenstingl To: andrew@lunn.ch, f.fainelli@gmail.com, netdev@vger.kernel.org, davem@davemloft.net Subject: [PATCH net] mdio: mux: fix parsing mux registers outside of the PHY address range Date: Mon, 10 Jul 2017 14:35:23 +0200 Message-Id: <20170710123523.6625-1-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.13.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170710_053558_888166_A1524703 X-CRM114-Status: GOOD ( 12.30 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martin Blumenstingl , linux-amlogic@lists.infradead.org, jon.mason@broadcom.com MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP mdio_mux_init parses the child nodes of the MDIO mux. When using "mdio-mux-mmioreg" the child nodes are describing the register value that is written to switch between the MDIO busses. The change which makes the error messages more verbose changed the parsing of the "reg" property from a simple of_property_read_u32 call to of_mdio_parse_addr. On a Khadas VIM (based on the Meson GXL SoC, which uses mdio-mux-mmioreg) this prevents registering the MDIO mux (because the "reg" values on the MDIO mux child nodes are 0x2009087f and 0xe40908ff) and leads to the following errors: mdio-mux-mmioreg c883455c.eth-phy-mux: /soc/periphs@c8834000/eth-phy-mux/mdio@e40908ff PHY address -469169921 is too large mdio-mux-mmioreg c883455c.eth-phy-mux: Error: Failed to find reg for child /soc/periphs@c8834000/eth-phy-mux/mdio@e40908ff mdio-mux-mmioreg c883455c.eth-phy-mux: /soc/periphs@c8834000/eth-phy-mux/mdio@2009087f PHY address 537462911 is too large mdio-mux-mmioreg c883455c.eth-phy-mux: Error: Failed to find reg for child /soc/periphs@c8834000/eth-phy-mux/mdio@2009087f mdio-mux-mmioreg c883455c.eth-phy-mux: Error: No acceptable child buses found mdio-mux-mmioreg c883455c.eth-phy-mux: failed to register mdio-mux bus /soc/periphs@c8834000/eth-phy-mux (as a result of that ethernet is not working, because the PHY which is connected through the mux' child MDIO bus, which is not being registered). Fix this by reverting the change from of_mdio_parse_addr to of_mdio_parse_addr. Fixes: 342fa1964439 ("mdio: mux: make child bus walking more permissive and errors more verbose") Signed-off-by: Martin Blumenstingl Acked-by: Neil Armstrong Reviewed-by: Andrew Lunn --- drivers/net/phy/mdio-mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c index 00755b6a42cf..c608e1dfaf09 100644 --- a/drivers/net/phy/mdio-mux.c +++ b/drivers/net/phy/mdio-mux.c @@ -135,8 +135,8 @@ int mdio_mux_init(struct device *dev, for_each_available_child_of_node(dev->of_node, child_bus_node) { int v; - v = of_mdio_parse_addr(dev, child_bus_node); - if (v < 0) { + r = of_property_read_u32(child_bus_node, "reg", &v); + if (r) { dev_err(dev, "Error: Failed to find reg for child %s\n", of_node_full_name(child_bus_node));