diff options
author | Florian Fainelli <florian@openwrt.org> | 2009-05-27 20:58:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-29 04:51:22 -0400 |
commit | 4d5ef9f0f588045d5e53e51816bd619d82385676 (patch) | |
tree | c4f092630705bb0f114f8192d489e97864501278 /drivers/net/korina.c | |
parent | 5d23a1d2a317e272f171d7818f600fde324eaceb (diff) |
korina: periodically poll the media
This patch makes the korina driver poll the media
for link change. This is actually required on
Mikrotik RB532 (not RB532A) for korina to
operate properly.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/korina.c')
-rw-r--r-- | drivers/net/korina.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/korina.c b/drivers/net/korina.c index dc238567cae1..b4cf602c32b0 100644 --- a/drivers/net/korina.c +++ b/drivers/net/korina.c | |||
@@ -133,6 +133,7 @@ struct korina_private { | |||
133 | int dma_halt_cnt; | 133 | int dma_halt_cnt; |
134 | int dma_run_cnt; | 134 | int dma_run_cnt; |
135 | struct napi_struct napi; | 135 | struct napi_struct napi; |
136 | struct timer_list media_check_timer; | ||
136 | struct mii_if_info mii_if; | 137 | struct mii_if_info mii_if; |
137 | struct net_device *dev; | 138 | struct net_device *dev; |
138 | int phy_addr; | 139 | int phy_addr; |
@@ -664,6 +665,15 @@ static void korina_check_media(struct net_device *dev, unsigned int init_media) | |||
664 | &lp->eth_regs->ethmac2); | 665 | &lp->eth_regs->ethmac2); |
665 | } | 666 | } |
666 | 667 | ||
668 | static void korina_poll_media(unsigned long data) | ||
669 | { | ||
670 | struct net_device *dev = (struct net_device *) data; | ||
671 | struct korina_private *lp = netdev_priv(dev); | ||
672 | |||
673 | korina_check_media(dev, 0); | ||
674 | mod_timer(&lp->media_check_timer, jiffies + HZ); | ||
675 | } | ||
676 | |||
667 | static void korina_set_carrier(struct mii_if_info *mii) | 677 | static void korina_set_carrier(struct mii_if_info *mii) |
668 | { | 678 | { |
669 | if (mii->force_media) { | 679 | if (mii->force_media) { |
@@ -1034,6 +1044,7 @@ static int korina_open(struct net_device *dev) | |||
1034 | dev->name, lp->und_irq); | 1044 | dev->name, lp->und_irq); |
1035 | goto err_free_ovr_irq; | 1045 | goto err_free_ovr_irq; |
1036 | } | 1046 | } |
1047 | mod_timer(&lp->media_check_timer, jiffies + 1); | ||
1037 | out: | 1048 | out: |
1038 | return ret; | 1049 | return ret; |
1039 | 1050 | ||
@@ -1053,6 +1064,8 @@ static int korina_close(struct net_device *dev) | |||
1053 | struct korina_private *lp = netdev_priv(dev); | 1064 | struct korina_private *lp = netdev_priv(dev); |
1054 | u32 tmp; | 1065 | u32 tmp; |
1055 | 1066 | ||
1067 | del_timer(&lp->media_check_timer); | ||
1068 | |||
1056 | /* Disable interrupts */ | 1069 | /* Disable interrupts */ |
1057 | disable_irq(lp->rx_irq); | 1070 | disable_irq(lp->rx_irq); |
1058 | disable_irq(lp->tx_irq); | 1071 | disable_irq(lp->tx_irq); |
@@ -1183,6 +1196,7 @@ static int korina_probe(struct platform_device *pdev) | |||
1183 | ": cannot register net device %d\n", rc); | 1196 | ": cannot register net device %d\n", rc); |
1184 | goto probe_err_register; | 1197 | goto probe_err_register; |
1185 | } | 1198 | } |
1199 | setup_timer(&lp->media_check_timer, korina_poll_media, (unsigned long) dev); | ||
1186 | out: | 1200 | out: |
1187 | return rc; | 1201 | return rc; |
1188 | 1202 | ||