From patchwork Sat Jul 6 15:18:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 1128477 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=solid-run.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=jm0.eu header.i=@jm0.eu header.b="o5YsGGR1"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45gwfg6yFBz9sPG for ; Sun, 7 Jul 2019 01:31:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726922AbfGFPbN (ORCPT ); Sat, 6 Jul 2019 11:31:13 -0400 Received: from mo4-p05-ob.smtp.rzone.de ([85.215.255.130]:29948 "EHLO mo4-p05-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726887AbfGFPbN (ORCPT ); Sat, 6 Jul 2019 11:31:13 -0400 X-Greylist: delayed 717 seconds by postgrey-1.27 at vger.kernel.org; Sat, 06 Jul 2019 11:31:12 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1562427071; s=strato-dkim-0002; d=jm0.eu; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=6ZpbWk6c/a+q3XFLVvoxD8tk7MslyJIN8F03pvj5GTo=; b=o5YsGGR10DzdQO8lxWe7F8tJOh9nqSzpUhXhv+Btp1Uo9xcVHcmEexuYRuUByXBOt1 yHxoIsxVthYEIwfCpGmYD5WZQvUuUXxCCeT4GFnVlXsDOUhyeesNz/qIH8+wdlbvjMKE zShPw9WqZuqGf5ftMlY4PfSzyL7VUCqP96FQCfFNLee/RkDL8fqgymQGnXcafah258Eb wEkNeY+gjgPJZwQ+CYqOmqkXovRAJKWuQZA0yOXbEcGEmK6aAFm28j0kEUvSzDc4O/lY 2U1dXsfLZsGR2KunP0/YErnDcN0spZJV/nEpni+7EFF7BsnskTszOU6RhfnMF5HUBMK1 6oEQ== X-RZG-AUTH: ":JmMXYEHmdv4HaV2cbPh7iS0wbr/uKIfGM0EPWe8EZQbw/dDJ/fVPBaXaSiaF5/mu26zWKwNU" X-RZG-CLASS-ID: mo05 Received: from linux-1tvp.lan by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id h0a328v66FJ96MV (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 6 Jul 2019 17:19:09 +0200 (CEST) From: josua@solid-run.com To: netdev@vger.kernel.org Cc: Josua Mayer , stable@vger.kernel.org, "David S. Miller" , Rob Herring , Mark Rutland Subject: [PATCH 1/4] dt-bindings: allow up to four clocks for orion-mdio Date: Sat, 6 Jul 2019 17:18:57 +0200 Message-Id: <20190706151900.14355-2-josua@solid-run.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190706151900.14355-1-josua@solid-run.com> References: <20190706151900.14355-1-josua@solid-run.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Josua Mayer Armada 8040 needs four clocks to be enabled for MDIO accesses to work. Update the binding to allow the extra clock to be specified. Cc: stable@vger.kernel.org Fixes: 6d6a331f44a1 ("dt-bindings: allow up to three clocks for orion-mdio") Signed-off-by: Josua Mayer Reviewed-by: Andrew Lunn --- Documentation/devicetree/bindings/net/marvell-orion-mdio.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt b/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt index 42cd81090a2c..3f3cfc1d8d4d 100644 --- a/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt +++ b/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt @@ -16,7 +16,7 @@ Required properties: Optional properties: - interrupts: interrupt line number for the SMI error/done interrupt -- clocks: phandle for up to three required clocks for the MDIO instance +- clocks: phandle for up to four required clocks for the MDIO instance The child nodes of the MDIO driver are the individual PHY devices connected to this MDIO bus. They must have a "reg" property given the From patchwork Sat Jul 6 15:18:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 1128478 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=solid-run.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=jm0.eu header.i=@jm0.eu header.b="J4mI5LQL"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45gwfh4JRDz9sNf for ; Sun, 7 Jul 2019 01:31:24 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726978AbfGFPbS (ORCPT ); Sat, 6 Jul 2019 11:31:18 -0400 Received: from mo4-p05-ob.smtp.rzone.de ([85.215.255.130]:34980 "EHLO mo4-p05-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbfGFPbS (ORCPT ); Sat, 6 Jul 2019 11:31:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1562427076; s=strato-dkim-0002; d=jm0.eu; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=+SpY4xus7eP4MPcA3lgfvlER9kX2n6MRDtKqhf0ITkk=; b=J4mI5LQLhuSWuosVTBvx5niBFYzKBa8lyhqmdXOLvR6D78cxXslDP9VqvcPrPYgCJq fwma0KVIVkVF/Ighq3Ka9mTQVHiZsxahO3QI4ysOz3/t3c3BDO50IKmBBCrVoEHCsXAD lWpdktg626r3wq6kqWT8Kpzny7+7UQ8/J6oVES1ucO0M9u03IT8h70f92krftiszDwLe 5z/xCxySMpKA8GvcuJMzNaybBrypev87TH+93Ic+0Gls6n3QgkF1hoLd40R63bm/q5ox SPk5KCLcev4KbEOGBvD1Jh06DdtH48tJjNlI2gClwZQqbdUmkU+U2W1nABTeLUv9jadO kbpw== X-RZG-AUTH: ":JmMXYEHmdv4HaV2cbPh7iS0wbr/uKIfGM0EPWe8EZQbw/dDJ/fVPBaXaSiaF5/mu26zWKwNU" X-RZG-CLASS-ID: mo05 Received: from linux-1tvp.lan by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id h0a328v66FJB6MW (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 6 Jul 2019 17:19:11 +0200 (CEST) From: josua@solid-run.com To: netdev@vger.kernel.org Cc: Josua Mayer , stable@vger.kernel.org, "David S. Miller" Subject: [PATCH 2/4] net: mvmdio: allow up to four clocks to be specified for orion-mdio Date: Sat, 6 Jul 2019 17:18:58 +0200 Message-Id: <20190706151900.14355-3-josua@solid-run.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190706151900.14355-1-josua@solid-run.com> References: <20190706151900.14355-1-josua@solid-run.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Josua Mayer Allow up to four clocks to be specified and enabled for the orion-mdio interface, which are required by the Armada 8k and defined in armada-cp110.dtsi. Fixes a hang in probing the mvmdio driver that was encountered on the Clearfog GT 8K with all drivers built as modules, but also affects other boards such as the MacchiatoBIN. Cc: stable@vger.kernel.org Fixes: 96cb43423822 ("net: mvmdio: allow up to three clocks to be specified for orion-mdio") Signed-off-by: Josua Mayer Reviewed-by: Andrew Lunn --- drivers/net/ethernet/marvell/mvmdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c index c5dac6bd2be4..e17d563e97a6 100644 --- a/drivers/net/ethernet/marvell/mvmdio.c +++ b/drivers/net/ethernet/marvell/mvmdio.c @@ -64,7 +64,7 @@ struct orion_mdio_dev { void __iomem *regs; - struct clk *clk[3]; + struct clk *clk[4]; /* * If we have access to the error interrupt pin (which is * somewhat misnamed as it not only reflects internal errors From patchwork Sat Jul 6 15:18:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 1128484 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=solid-run.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=jm0.eu header.i=@jm0.eu header.b="VlqsRyxY"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45gxH44w13z9sNH for ; Sun, 7 Jul 2019 01:59:28 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726887AbfGFP71 (ORCPT ); Sat, 6 Jul 2019 11:59:27 -0400 Received: from mo4-p05-ob.smtp.rzone.de ([85.215.255.130]:15726 "EHLO mo4-p05-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726446AbfGFP71 (ORCPT ); Sat, 6 Jul 2019 11:59:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1562428765; s=strato-dkim-0002; d=jm0.eu; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=4CSxubuFF22g+ZCX8fQKkWTlLw2BxrkpqwCwq+JllT0=; b=VlqsRyxY7JJAKk9+KDfCngC1X4szGpIPtQ5hki1Q9144FxMvaYdmt2rcW4Pc3Puy4A cMZq9qNrjZLIVi7V1WVp5dBG34HwRItU2uldpt6IQtoExLqUE0wDlf5IBqbEXXGyOfOU eEl+2hKuipPctKKVxx2HerrcHUs0FadL54sZZGvzG8XfFkvpE5YY2OoqGQdlal3kFL98 MXv5GxiKmc5ErKQfEw0Ifh5MI7aiERAyj+lPWQF/jVJmVyjmbsDpO2uZytUzx37RPukr 1RRRVBPI4YstbS1BCh1ElYhQa0UCa1p1qfj75WajQyfeCv9UwWYwTm1wGEOKErXSQmtL nvYA== X-RZG-AUTH: ":JmMXYEHmdv4HaV2cbPh7iS0wbr/uKIfGM0EPWe8EZQbw/dDJ/fVPBaXaSiaF5/mu26zWKwNU" X-RZG-CLASS-ID: mo05 Received: from linux-1tvp.lan by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id h0a328v66FJD6MX (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 6 Jul 2019 17:19:13 +0200 (CEST) From: josua@solid-run.com To: netdev@vger.kernel.org Cc: Josua Mayer , "David S. Miller" Subject: [PATCH 3/4] net: mvmdio: print warning when orion-mdio has too many clocks Date: Sat, 6 Jul 2019 17:18:59 +0200 Message-Id: <20190706151900.14355-4-josua@solid-run.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190706151900.14355-1-josua@solid-run.com> References: <20190706151900.14355-1-josua@solid-run.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Josua Mayer Print a warning when device tree specifies more than the maximum of four clocks supported by orion-mdio. Because reading from mdio can lock up the Armada 8k when a required clock is not initialized, it is important to notify the user when a specified clock is ignored. Signed-off-by: Josua Mayer --- drivers/net/ethernet/marvell/mvmdio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c index e17d563e97a6..89a99bf8e87b 100644 --- a/drivers/net/ethernet/marvell/mvmdio.c +++ b/drivers/net/ethernet/marvell/mvmdio.c @@ -326,6 +326,10 @@ static int orion_mdio_probe(struct platform_device *pdev) clk_prepare_enable(dev->clk[i]); } + if (!IS_ERR(of_clk_get(pdev->dev.of_node, i))) + dev_warn(dev, "unsupported number of clocks, limiting to the first " + __stringify(ARRAY_SIZE(dev->clk)) "\n"); + dev->err_interrupt = platform_get_irq(pdev, 0); if (dev->err_interrupt > 0 && resource_size(r) < MVMDIO_ERR_INT_MASK + 4) { From patchwork Sat Jul 6 15:19:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 1128476 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=solid-run.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=jm0.eu header.i=@jm0.eu header.b="MI1QETPS"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45gwfg0Fz6z9sPF for ; Sun, 7 Jul 2019 01:31:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726908AbfGFPbK (ORCPT ); Sat, 6 Jul 2019 11:31:10 -0400 Received: from mo4-p05-ob.smtp.rzone.de ([85.215.255.131]:25374 "EHLO mo4-p05-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726887AbfGFPbK (ORCPT ); Sat, 6 Jul 2019 11:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1562427069; s=strato-dkim-0002; d=jm0.eu; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=TDT9sxXhvLoNnEX3mNdqO9PUoFgyTAhRMUVAZRcGM7A=; b=MI1QETPSMx0oT9ueQJp+8Y9G67ZnUfdo5GB86BHY4OqTGCWRtFOjX+q2JObMmUi/dE cxAvg4PqxcDK+U7f+tHp8LrP+eAhy4DDO2wT7CYrOvcCdglHS6MGpHqP2e5cHNUh03cC RP4DquuSdHJpm6wZ043a+OTSR61HKtBYPR/rJZHbYyLn3cVXwRxkLT28dNd4YohYNvhL KNq+tKAGFRWNBPK2icvyMS/UPV7rfv8FhCkJbbZCDr8DE/oQBAOumhA9v8uO9jW7W3NX 12tJIAECbUro51Lbo5oFvKGacmvC2Aw6nob4/cc+Yebwo+KH4GuIkB4p0Ba33Jrdc+OJ TjMw== X-RZG-AUTH: ":JmMXYEHmdv4HaV2cbPh7iS0wbr/uKIfGM0EPWe8EZQbw/dDJ/fVPBaXaSiaF5/mu26zWKwNU" X-RZG-CLASS-ID: mo05 Received: from linux-1tvp.lan by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id h0a328v66FJF6MY (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 6 Jul 2019 17:19:15 +0200 (CEST) From: josua@solid-run.com To: netdev@vger.kernel.org Cc: Josua Mayer , "David S. Miller" Subject: [PATCH 4/4] net: mvmdio: defer probe of orion-mdio if a clock is not ready Date: Sat, 6 Jul 2019 17:19:00 +0200 Message-Id: <20190706151900.14355-5-josua@solid-run.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190706151900.14355-1-josua@solid-run.com> References: <20190706151900.14355-1-josua@solid-run.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Josua Mayer Defer probing of the orion-mdio interface when enabling of either of the clocks defer probing. This avoids locking up the Armada 8k SoC when mdio is used before all clocks have been enabled. Signed-off-by: Josua Mayer Reviewed-by: Andrew Lunn --- drivers/net/ethernet/marvell/mvmdio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c index 89a99bf8e87b..1034013426ad 100644 --- a/drivers/net/ethernet/marvell/mvmdio.c +++ b/drivers/net/ethernet/marvell/mvmdio.c @@ -321,6 +321,10 @@ static int orion_mdio_probe(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(dev->clk); i++) { dev->clk[i] = of_clk_get(pdev->dev.of_node, i); + if (dev->clk[i] == PTR_ERR(-EPROBE_DEFER)) { + ret = -EPROBE_DEFER; + goto out_clk; + } if (IS_ERR(dev->clk[i])) break; clk_prepare_enable(dev->clk[i]); @@ -366,6 +370,7 @@ static int orion_mdio_probe(struct platform_device *pdev) if (dev->err_interrupt > 0) writel(0, dev->regs + MVMDIO_ERR_INT_MASK); +out_clk: for (i = 0; i < ARRAY_SIZE(dev->clk); i++) { if (IS_ERR(dev->clk[i])) break;