summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-05-11 00:34:15 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-05-11 00:34:15 +0000
commit5f1ef3ab83f0270bd78262e62b56dd6405eb8534 (patch)
tree33bd6f2b934744fbc2444ec484d9b626372594c1 /target/linux
parent599564913e69ea848a0c50a9d59789e20a1bd462 (diff)
downloadmtk-20170518-5f1ef3ab83f0270bd78262e62b56dd6405eb8534.zip
mtk-20170518-5f1ef3ab83f0270bd78262e62b56dd6405eb8534.tar.gz
mtk-20170518-5f1ef3ab83f0270bd78262e62b56dd6405eb8534.tar.bz2
rb532: check the link status with a timer
SVN-Revision: 15765
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/rb532/patches-2.6.28/100-check_media.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/target/linux/rb532/patches-2.6.28/100-check_media.patch b/target/linux/rb532/patches-2.6.28/100-check_media.patch
new file mode 100644
index 0000000..4180c62
--- /dev/null
+++ b/target/linux/rb532/patches-2.6.28/100-check_media.patch
@@ -0,0 +1,51 @@
+--- 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;
+@@ -663,6 +664,15 @@ static void korina_check_media(struct ne
+ &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->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_devic
+ 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);
+@@ -1177,6 +1190,7 @@ static int korina_probe(struct platform_
+ ": 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;
+