summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2009-05-28 00:58:41 +0000
committerDavid S. Miller <davem@davemloft.net>2009-05-29 01:51:22 -0700
commit4d5ef9f0f588045d5e53e51816bd619d82385676 (patch)
treec4f092630705bb0f114f8192d489e97864501278 /drivers
parent5d23a1d2a317e272f171d7818f600fde324eaceb (diff)
downloadop-kernel-dev-4d5ef9f0f588045d5e53e51816bd619d82385676.zip
op-kernel-dev-4d5ef9f0f588045d5e53e51816bd619d82385676.tar.gz
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')
-rw-r--r--drivers/net/korina.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index dc23856..b4cf602 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -133,6 +133,7 @@ struct korina_private {
int dma_halt_cnt;
int dma_run_cnt;
struct napi_struct napi;
+ struct timer_list media_check_timer;
struct mii_if_info mii_if;
struct net_device *dev;
int phy_addr;
@@ -664,6 +665,15 @@ static void korina_check_media(struct net_device *dev, unsigned int init_media)
&lp->eth_regs->ethmac2);
}
+static void korina_poll_media(unsigned long data)
+{
+ struct net_device *dev = (struct net_device *) data;
+ struct korina_private *lp = netdev_priv(dev);
+
+ korina_check_media(dev, 0);
+ mod_timer(&lp->media_check_timer, jiffies + HZ);
+}
+
static void korina_set_carrier(struct mii_if_info *mii)
{
if (mii->force_media) {
@@ -1034,6 +1044,7 @@ static int korina_open(struct net_device *dev)
dev->name, lp->und_irq);
goto err_free_ovr_irq;
}
+ mod_timer(&lp->media_check_timer, jiffies + 1);
out:
return ret;
@@ -1053,6 +1064,8 @@ static int korina_close(struct net_device *dev)
struct korina_private *lp = netdev_priv(dev);
u32 tmp;
+ del_timer(&lp->media_check_timer);
+
/* Disable interrupts */
disable_irq(lp->rx_irq);
disable_irq(lp->tx_irq);
@@ -1183,6 +1196,7 @@ static int korina_probe(struct platform_device *pdev)
": cannot register net device %d\n", rc);
goto probe_err_register;
}
+ setup_timer(&lp->media_check_timer, korina_poll_media, (unsigned long) dev);
out:
return rc;
OpenPOWER on IntegriCloud