From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Walleij Subject: [PATCH 1/4] RFC: net/dsa: Allow DSA PHYs to define link IRQs Date: Mon, 6 Nov 2017 00:19:06 +0100 Message-ID: <20171105231909.5599-2-linus.walleij@linaro.org> References: <20171105231909.5599-1-linus.walleij@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: netdev@vger.kernel.org, Linus Walleij , =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= , Roman Yeryomin , Colin Leitner , Gabor Juhos To: Andrew Lunn , Vivien Didelot , Florian Fainelli Return-path: Received: from mail-lf0-f66.google.com ([209.85.215.66]:45050 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750724AbdKEXXN (ORCPT ); Sun, 5 Nov 2017 18:23:13 -0500 Received: by mail-lf0-f66.google.com with SMTP id 75so8630805lfx.1 for ; Sun, 05 Nov 2017 15:23:12 -0800 (PST) In-Reply-To: <20171105231909.5599-1-linus.walleij@linaro.org> Sender: netdev-owner@vger.kernel.org List-ID: PHYs attached to DSAs may provide IRQs from GPIOs or other interrupt controllers in the device tree. For these cases, we need to go and grab the IRQ before registering the slave so the PHY core can grab and enable this IRQ. Cc: Antti Seppälä Cc: Roman Yeryomin Cc: Colin Leitner Cc: Gabor Juhos Cc: Florian Fainelli Signed-off-by: Linus Walleij --- net/dsa/slave.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 2afa99506f8b..9909d7fe80b1 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1119,6 +1120,13 @@ static int dsa_slave_phy_connect(struct dsa_slave_priv *p, return -ENODEV; } + /* + * If the PHY has a link IRQ associated with it in the device tree, + * then assign it so it can be claimed by the core. + */ + if (of_irq_count(p->dp->dn)) + p->phy->irq = irq_of_parse_and_map(p->dp->dn, 0); + /* Use already configured phy mode */ if (p->phy_interface == PHY_INTERFACE_MODE_NA) p->phy_interface = p->phy->interface; -- 2.13.6