Fix meta-bsp structure.
[vuplus_openvuplus_3.0] / meta-bsp / recipes-kernel / linux / linux-vuplus-3.13.5 / vusolose / brcm_s3_wol.patch
1 diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
2 index c23156a..9ae22a9 100644
3 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
4 +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
5 @@ -3115,6 +3115,34 @@ static int bcmgenet_set_wol(struct net_device *dev,
6                 umac->mpd_pw_ls = get_unaligned_be32(&wol->sopass[2]);
7                 umac->mpd_ctrl |= MPD_PW_EN;
8         }
9 +        if (pDevCtrl->phyType == BRCM_PHY_TYPE_EXT_RGMII)
10 +        {
11 +                if(wol->wolopts & WAKE_MAGIC)
12 +                {
13 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x1f, 0x0007);
14 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x1e, 0x006e);
15 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x15, dev->dev_addr[1]<<8 | dev->dev_addr[0]);
16 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x16, dev->dev_addr[3]<<8 | dev->dev_addr[2]);
17 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x17, dev->dev_addr[5]<<8 | dev->dev_addr[4]);
18 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x1f, 0x0007);
19 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x1e, 0x006d);
20 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x16, 0x9fff);
21 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x15, 0x1000);
22 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x1e, 0x006d);
23 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x19, 0x0001);
24 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x1f, 0x0000);
25 +
26 +                }
27 +                else
28 +                {
29 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x1f, 0x0007);
30 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x1e, 0x006d);
31 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x16, 0x9fff);
32 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x15, 0x0000);
33 +                        pDevCtrl->mii.mdio_write(dev, pDevCtrl->phyAddr, 0x1f, 0x0000);
34 +                }
35 +        }
36 +
37  
38         device_set_wakeup_enable(&dev->dev, wol->wolopts);
39         pDevCtrl->wolopts = wol->wolopts;
40 diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
41 index 62ee437..ffd0bb5 100644
42 --- a/kernel/power/suspend.c
43 +++ b/kernel/power/suspend.c
44 @@ -167,6 +167,15 @@ void __attribute__ ((weak)) arch_suspend_enable_irqs(void)
45         local_irq_enable();
46  }
47  
48 +void (*brcm_s3_cb)(void);
49 +
50 +
51 +void register_brcm_s3_cb(void (*cb)(void))
52 +{
53 +        brcm_s3_cb = cb;
54 +}
55 +EXPORT_SYMBOL(register_brcm_s3_cb);
56 +
57  /**
58   * suspend_enter - Make the system enter the given sleep state.
59   * @state: System sleep state to enter.
60 @@ -211,6 +220,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
61         }
62  
63         ftrace_stop();
64 +       if(brcm_s3_cb) brcm_s3_cb();
65         error = disable_nonboot_cpus();
66         if (error || suspend_test(TEST_CPUS))
67                 goto Enable_cpus;