lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1234817631-7981-2-git-send-email-agust@denx.de>
Date:	Mon, 16 Feb 2009 21:53:50 +0100
From:	Anatolij Gustschin <agust@...x.de>
To:	netdev@...r.kernel.org
Cc:	Anatolij Gustschin <agust@...x.de>
Subject: [PATCH 2/3] phylib: add support for shared PHY interrupts

Marvell 88E1121R PHY device can be hardware-configured
to use shared interrupt pin for both PHY ports. This
patch adds support for shared PHY interrupts to the PHY
framework to enable support for such PHY configurations.

Signed-off-by: Anatolij Gustschin <agust@...x.de>
---
 drivers/net/phy/phy.c        |   13 +++++++++++++
 drivers/net/phy/phy_device.c |    2 ++
 include/linux/phy.h          |    4 ++++
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index df4e625..93d387e 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -657,9 +657,17 @@ EXPORT_SYMBOL(phy_stop_interrupts);
 static void phy_change(struct work_struct *work)
 {
 	int err;
+	int src;
 	struct phy_device *phydev =
 		container_of(work, struct phy_device, phy_queue);
 
+	if (phydev->drv->flags & PHY_INTERRUPTS_SHARED
+	    && phydev->drv->interrupt_src) {
+		src = phydev->drv->interrupt_src(phydev);
+		if ((src == -1) || (src != phydev->addr))
+			goto ignore;
+	}
+
 	err = phy_disable_interrupts(phydev);
 
 	if (err)
@@ -688,6 +696,11 @@ static void phy_change(struct work_struct *work)
 
 	return;
 
+ignore:
+	atomic_dec(&phydev->irq_disable);
+	enable_irq(phydev->irq);
+	return;
+
 irq_enable_err:
 	disable_irq(phydev->irq);
 	atomic_inc(&phydev->irq_disable);
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index e11b03b..dccc445 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -401,6 +401,8 @@ void phy_detach(struct phy_device *phydev)
 	 * real driver could be loaded */
 	if (phydev->dev.driver == &genphy_driver.driver)
 		device_release_driver(&phydev->dev);
+	else if (phydev->drv->remove)
+		phydev->drv->remove(phydev);
 }
 EXPORT_SYMBOL(phy_detach);
 
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 77c4ed6..a844c2a 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -49,6 +49,7 @@
 
 #define PHY_HAS_INTERRUPT	0x00000001
 #define PHY_HAS_MAGICANEG	0x00000002
+#define PHY_INTERRUPTS_SHARED	0x00000004
 
 /* Interface Mode definitions */
 typedef enum {
@@ -389,6 +390,9 @@ struct phy_driver {
 	/* Enables or disables interrupts */
 	int (*config_intr)(struct phy_device *phydev);
 
+	/* Returns interrupt source if interrupt pin is shared */
+	int (*interrupt_src)(struct phy_device *phydev);
+
 	/* Clears up any memory if needed */
 	void (*remove)(struct phy_device *phydev);
 
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ