diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2013-05-20 02:53:42 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-21 01:13:08 +0400 |
commit | 2c7b49212a86f13697281a4dace2cb96aec71d6b (patch) | |
tree | 315bc489f7c0ee3a9c55ae86041bc1846acc2a05 /include/linux/phy.h | |
parent | 45e983414334f217c60bd04d39d6f5ec2d8d7bb4 (diff) | |
download | linux-2c7b49212a86f13697281a4dace2cb96aec71d6b.tar.xz |
phy: fix the use of PHY_IGNORE_INTERRUPT
When a PHY device is registered with the special IRQ value
PHY_IGNORE_INTERRUPT (-2) it will not properly be handled by the PHY
library:
- it continues to poll its register, while we do not want this
because such PHY link events or register changes are serviced by an
Ethernet MAC
- it will still try to configure PHY interrupts at the PHY level, such
interrupts do not exist at the PHY but at the MAC level
- the state machine only handles PHY_POLL, but should also handle
PHY_IGNORE_INTERRUPT similarly
This patch updates the PHY state machine and initialization paths to
account for the specific PHY_IGNORE_INTERRUPT. Based on an earlier patch
by Thomas Petazzoni, and reworked to add the missing bits. Add a helper
phy_interrupt_is_valid() which specifically tests for a PHY interrupt
not to be PHY_POLL or PHY_IGNORE_INTERRUPT and use it throughout the
code.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/phy.h')
-rw-r--r-- | include/linux/phy.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index 9e11039dd7a3..8e4bc8ab692d 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -508,6 +508,18 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val) return mdiobus_write(phydev->bus, phydev->addr, regnum, val); } +/** + * phy_interrupt_is_valid - Convenience function for testing a given PHY irq + * @phydev: the phy_device struct + * + * NOTE: must be kept in sync with addition/removal of PHY_POLL and + * PHY_IGNORE_INTERRUPT + */ +static inline bool phy_interrupt_is_valid(struct phy_device *phydev) +{ + return phydev->irq != PHY_POLL && phydev->irq != PHY_IGNORE_INTERRUPT; +} + struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, bool is_c45, struct phy_c45_device_ids *c45_ids); struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); |