66e731dac112d4e945511476c2187a8c9d95e613
[openwrt.git] / target / linux / rb532 / patches / 100-check_media.patch
1 --- a/drivers/net/korina.c
2 +++ b/drivers/net/korina.c
3 @@ -133,6 +133,7 @@ struct korina_private {
4 int dma_halt_cnt;
5 int dma_run_cnt;
6 struct napi_struct napi;
7 + struct timer_list media_check_timer;
8 struct mii_if_info mii_if;
9 struct net_device *dev;
10 int phy_addr;
11 @@ -664,6 +665,15 @@ static void korina_check_media(struct ne
12 &lp->eth_regs->ethmac2);
13 }
14
15 +static void korina_poll_media(unsigned long data)
16 +{
17 + struct net_device *dev = (struct net_device *) data;
18 + struct korina_private *lp = netdev_priv(dev);
19 +
20 + korina_check_media(dev, 0);
21 + mod_timer(&lp->media_check_timer, jiffies + HZ);
22 +}
23 +
24 static void korina_set_carrier(struct mii_if_info *mii)
25 {
26 if (mii->force_media) {
27 @@ -1034,6 +1044,7 @@ static int korina_open(struct net_device
28 dev->name, lp->und_irq);
29 goto err_free_ovr_irq;
30 }
31 + mod_timer(&lp->media_check_timer, jiffies + 1);
32 out:
33 return ret;
34
35 @@ -1053,6 +1064,8 @@ static int korina_close(struct net_devic
36 struct korina_private *lp = netdev_priv(dev);
37 u32 tmp;
38
39 + del_timer(&lp->media_check_timer);
40 +
41 /* Disable interrupts */
42 disable_irq(lp->rx_irq);
43 disable_irq(lp->tx_irq);
44 @@ -1176,6 +1189,7 @@ static int korina_probe(struct platform_
45 ": cannot register net device %d\n", rc);
46 goto probe_err_register;
47 }
48 + setup_timer(&lp->media_check_timer, korina_poll_media, (unsigned long) dev);
49 out:
50 return rc;
51
This page took 0.040287 seconds and 3 git commands to generate.