Commit 7d976376 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: of_mdio: do not overwrite PHY interrupt configuration

If irq_of_parse_and_map fails to find an interrupt line for a given PHY,
we will force the PHY interrupt to be PHY_POLL, completely overriding
the previous value that the MDIO bus may have set for us (e.g:
PHY_IGNORE_INTERRUPT). In case of failure, just restore the previous
value.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bed2f9ed
...@@ -27,7 +27,7 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi ...@@ -27,7 +27,7 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi
{ {
struct phy_device *phy; struct phy_device *phy;
bool is_c45; bool is_c45;
int rc; int rc, prev_irq;
is_c45 = of_device_is_compatible(child, is_c45 = of_device_is_compatible(child,
"ethernet-phy-ieee802.3-c45"); "ethernet-phy-ieee802.3-c45");
...@@ -37,10 +37,11 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi ...@@ -37,10 +37,11 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi
return 1; return 1;
if (mdio->irq) { if (mdio->irq) {
prev_irq = mdio->irq[addr];
mdio->irq[addr] = mdio->irq[addr] =
irq_of_parse_and_map(child, 0); irq_of_parse_and_map(child, 0);
if (!mdio->irq[addr]) if (!mdio->irq[addr])
mdio->irq[addr] = PHY_POLL; mdio->irq[addr] = prev_irq;
} }
/* Associate the OF node with the device structure so it /* Associate the OF node with the device structure so it
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment