~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/staging/rtl8192e/r8192_pm.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
{
26
26
        struct net_device *dev = pci_get_drvdata(pdev);
27
27
        struct r8192_priv *priv = ieee80211_priv(dev);
28
 
#ifdef RTL8190P
29
 
        u8      ucRegRead;
30
 
#endif
31
28
        u32     ulRegRead;
32
29
 
33
30
        RT_TRACE(COMP_POWER, "============> r8192E suspend call.\n");
36
33
 
37
34
        if (dev->netdev_ops->ndo_stop)
38
35
                dev->netdev_ops->ndo_stop(dev);
39
 
//      dev->stop(dev);
40
 
#if 0
41
 
 
42
 
        netif_carrier_off(dev);
43
 
 
44
 
        ieee80211_softmac_stop_protocol(priv->ieee80211);
45
 
 
46
 
        write_nic_byte(dev,MSR,(read_nic_byte(dev,MSR)&0xfc)|MSR_LINK_NONE);
47
 
        if(!priv->ieee80211->bSupportRemoteWakeUp) {
48
 
                /* disable tx/rx. In 8185 we write 0x10 (Reset bit),
49
 
                 * but here we make reference to WMAC and wirte 0x0.
50
 
                 * 2006.11.21 Emily
51
 
                 */
52
 
                write_nic_byte(dev, CMDR, 0);
53
 
        }
54
 
        //disable interrupt
55
 
        write_nic_dword(dev,INTA_MASK,0);
56
 
        priv->irq_enabled = 0;
57
 
        write_nic_dword(dev,ISR,read_nic_dword(dev, ISR));
58
 
 
59
 
        /* need to  free DM related functions */
60
 
        cancel_work_sync(&priv->reset_wq);
61
 
        del_timer_sync(&priv->fsync_timer);
62
 
        del_timer_sync(&priv->watch_dog_timer);
63
 
        cancel_delayed_work(&priv->watch_dog_wq);
64
 
        cancel_delayed_work(&priv->update_beacon_wq);
65
 
        cancel_work_sync(&priv->qos_activate);
66
 
 
67
 
        /* TODO
68
 
#if ((DEV_BUS_TYPE == PCI_INTERFACE) && (HAL_CODE_BASE == RTL8192))
69
 
pHalData->bHwRfOffAction = 2;
70
 
#endif
71
 
*/
72
 
#endif
 
36
 
73
37
        // Call MgntActSet_RF_State instead to prevent RF config race condition.
74
 
        // By Bruce, 2008-01-17.
75
 
        //
76
38
        if(!priv->ieee80211->bSupportRemoteWakeUp) {
77
 
                MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_INIT);
 
39
                MgntActSet_RF_State(priv, eRfOff, RF_CHANGE_BY_INIT);
78
40
                // 2006.11.30. System reset bit
79
 
                ulRegRead = read_nic_dword(dev, CPU_GEN);
 
41
                ulRegRead = read_nic_dword(priv, CPU_GEN);
80
42
                ulRegRead|=CPU_GEN_SYSTEM_RESET;
81
 
                write_nic_dword(dev, CPU_GEN, ulRegRead);
 
43
                write_nic_dword(priv, CPU_GEN, ulRegRead);
82
44
        } else {
83
45
                //2008.06.03 for WOL
84
 
                write_nic_dword(dev, WFCRC0, 0xffffffff);
85
 
                write_nic_dword(dev, WFCRC1, 0xffffffff);
86
 
                write_nic_dword(dev, WFCRC2, 0xffffffff);
87
 
#ifdef RTL8190P
88
 
                //GPIO 0 = TRUE
89
 
                ucRegRead = read_nic_byte(dev, GPO);
90
 
                ucRegRead |= BIT0;
91
 
                write_nic_byte(dev, GPO, ucRegRead);
92
 
#endif
 
46
                write_nic_dword(priv, WFCRC0, 0xffffffff);
 
47
                write_nic_dword(priv, WFCRC1, 0xffffffff);
 
48
                write_nic_dword(priv, WFCRC2, 0xffffffff);
93
49
                //Write PMR register
94
 
                write_nic_byte(dev, PMR, 0x5);
 
50
                write_nic_byte(priv, PMR, 0x5);
95
51
                //Disable tx, enanble rx
96
 
                write_nic_byte(dev, MacBlkCtrl, 0xa);
 
52
                write_nic_byte(priv, MacBlkCtrl, 0xa);
97
53
        }
98
54
 
99
55
out_pci_suspend:
114
70
int rtl8192E_resume (struct pci_dev *pdev)
115
71
{
116
72
        struct net_device *dev = pci_get_drvdata(pdev);
117
 
        //struct r8192_priv *priv = ieee80211_priv(dev);
118
 
        //union iwreq_data wrqu;
119
73
        int err;
120
74
        u32 val;
121
75
 
122
 
        RT_TRACE(COMP_POWER, "================>r8192E resume call.");
 
76
        RT_TRACE(COMP_POWER, "================>r8192E resume call.\n");
123
77
 
124
78
        pci_set_power_state(pdev, PCI_D0);
125
79
 
155
109
        if (dev->netdev_ops->ndo_open)
156
110
                dev->netdev_ops->ndo_open(dev);
157
111
 
158
 
//      dev->open(dev);
159
112
out:
160
113
        RT_TRACE(COMP_POWER, "<================r8192E resume call.\n");
161
114
        return 0;