diff options
author | Joachim Eastwood <manabian@gmail.com> | 2012-11-11 08:56:27 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-14 18:51:02 -0500 |
commit | 2dbfdbb912c4b53f022649a7affb0691da1e9bc4 (patch) | |
tree | 3e772bcda25a1e8adbeeb8f97e7c1dab477a2d57 /drivers/net/ethernet/cadence/macb.c | |
parent | 63f71dd026cc6b2cc1cc26299720d763269f65b6 (diff) |
net/macb: add support for phy irq via gpio pin
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cadence/macb.c')
-rw-r--r-- | drivers/net/ethernet/cadence/macb.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 1fac769989ad..ca34efc62bae 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/gpio.h> | ||
19 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
20 | #include <linux/netdevice.h> | 21 | #include <linux/netdevice.h> |
21 | #include <linux/etherdevice.h> | 22 | #include <linux/etherdevice.h> |
@@ -261,7 +262,9 @@ static void macb_handle_link_change(struct net_device *dev) | |||
261 | static int macb_mii_probe(struct net_device *dev) | 262 | static int macb_mii_probe(struct net_device *dev) |
262 | { | 263 | { |
263 | struct macb *bp = netdev_priv(dev); | 264 | struct macb *bp = netdev_priv(dev); |
265 | struct macb_platform_data *pdata; | ||
264 | struct phy_device *phydev; | 266 | struct phy_device *phydev; |
267 | int phy_irq; | ||
265 | int ret; | 268 | int ret; |
266 | 269 | ||
267 | phydev = phy_find_first(bp->mii_bus); | 270 | phydev = phy_find_first(bp->mii_bus); |
@@ -270,7 +273,14 @@ static int macb_mii_probe(struct net_device *dev) | |||
270 | return -1; | 273 | return -1; |
271 | } | 274 | } |
272 | 275 | ||
273 | /* TODO : add pin_irq */ | 276 | pdata = dev_get_platdata(&bp->pdev->dev); |
277 | if (pdata && gpio_is_valid(pdata->phy_irq_pin)) { | ||
278 | ret = devm_gpio_request(&bp->pdev->dev, pdata->phy_irq_pin, "phy int"); | ||
279 | if (!ret) { | ||
280 | phy_irq = gpio_to_irq(pdata->phy_irq_pin); | ||
281 | phydev->irq = (phy_irq < 0) ? PHY_POLL : phy_irq; | ||
282 | } | ||
283 | } | ||
274 | 284 | ||
275 | /* attach the mac to the phy */ | 285 | /* attach the mac to the phy */ |
276 | ret = phy_connect_direct(dev, phydev, &macb_handle_link_change, 0, | 286 | ret = phy_connect_direct(dev, phydev, &macb_handle_link_change, 0, |