[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171105231909.5599-2-linus.walleij@linaro.org>
Date: Mon, 6 Nov 2017 00:19:06 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
Florian Fainelli <f.fainelli@...il.com>
Cc: netdev@...r.kernel.org, Linus Walleij <linus.walleij@...aro.org>,
Antti Seppälä <a.seppala@...il.com>,
Roman Yeryomin <roman@...em.lv>,
Colin Leitner <colin.leitner@...glemail.com>,
Gabor Juhos <juhosg@...nwrt.org>
Subject: [PATCH 1/4] RFC: net/dsa: Allow DSA PHYs to define link IRQs
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ä <a.seppala@...il.com>
Cc: Roman Yeryomin <roman@...em.lv>
Cc: Colin Leitner <colin.leitner@...glemail.com>
Cc: Gabor Juhos <juhosg@...nwrt.org>
Cc: Florian Fainelli <f.fainelli@...il.com>
Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
---
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 <linux/phy_fixed.h>
#include <linux/of_net.h>
#include <linux/of_mdio.h>
+#include <linux/of_irq.h>
#include <linux/mdio.h>
#include <linux/list.h>
#include <net/rtnetlink.h>
@@ -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
Powered by blists - more mailing lists