1
/******************************************************************************
2
* Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
4
* Based on the r8180 driver, which is:
5
* Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al.
6
* This program is free software; you can redistribute it and/or modify it
7
* under the terms of version 2 of the GNU General Public License as
8
* published by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15
* You should have received a copy of the GNU General Public License along with
16
* this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19
* The full GNU General Public License is included in this distribution in the
20
* file called LICENSE.
22
* Contact Information:
23
* wlanfae <wlanfae@realtek.com>
24
*****************************************************************************/
28
#include "rtl8192c/r8192C_phy.h"
29
#include "rtl8192c/r8192C_phyreg.h"
30
#include "rtl8192c/r8192C_rtl6052.h"
31
#include "rtl8192c/r8192C_Efuse.h"
32
#elif defined RTL8192SE
33
#include "rtl8192s/r8192S_phy.h"
34
#include "rtl8192s/r8192S_phyreg.h"
35
#include "rtl8192s/r8192S_rtl6052.h"
36
#include "rtl8192s/r8192S_Efuse.h"
38
#include "rtl8192e/r8192E_phy.h"
39
#include "rtl8192e/r8192E_phyreg.h"
40
#include "rtl8192e/r8190P_rtl8256.h" /* RTL8225 Radio frontend */
41
#include "rtl8192e/r8192E_cmdpkt.h"
44
#if defined(RTL8192E) || defined(RTL8192SE) || defined RTL8192CE
45
void rtl8192_hw_sleep_down(struct net_device *dev)
47
struct r8192_priv *priv = rtllib_priv(dev);
48
unsigned long flags = 0;
49
#ifdef CONFIG_ASPM_OR_D3
50
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
52
spin_lock_irqsave(&priv->rf_ps_lock,flags);
53
if (priv->RFChangeInProgress) {
54
spin_unlock_irqrestore(&priv->rf_ps_lock,flags);
55
RT_TRACE(COMP_RF, "rtl8192_hw_sleep_down(): RF Change in progress! \n");
56
printk("rtl8192_hw_sleep_down(): RF Change in progress!\n");
59
spin_unlock_irqrestore(&priv->rf_ps_lock,flags);
60
RT_TRACE(COMP_PS, "%s()============>come to sleep down\n", __FUNCTION__);
62
#ifdef CONFIG_RTLWIFI_DEBUGFS
63
if(priv->debug->hw_holding) {
67
MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS);
68
#ifdef CONFIG_ASPM_OR_D3
69
if(pPSC->RegRfPsLevel & RT_RF_LPS_LEVEL_ASPM)
72
RT_SET_PS_LEVEL(pPSC, RT_RF_LPS_LEVEL_ASPM);
77
void rtl8192_hw_sleep_wq(void *data)
79
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
80
struct rtllib_device *ieee = container_of_dwork_rsl(data,struct rtllib_device,hw_sleep_wq);
81
struct net_device *dev = ieee->dev;
83
struct net_device *dev = (struct net_device *)data;
85
rtl8192_hw_sleep_down(dev);
88
void rtl8192_hw_wakeup(struct net_device* dev)
90
struct r8192_priv *priv = rtllib_priv(dev);
91
unsigned long flags = 0;
92
#ifdef CONFIG_ASPM_OR_D3
93
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
95
spin_lock_irqsave(&priv->rf_ps_lock,flags);
96
if (priv->RFChangeInProgress) {
97
spin_unlock_irqrestore(&priv->rf_ps_lock,flags);
98
RT_TRACE(COMP_RF, "rtl8192_hw_wakeup(): RF Change in progress! \n");
99
printk("rtl8192_hw_wakeup(): RF Change in progress! schedule wake up task again\n");
100
queue_delayed_work_rsl(priv->rtllib->wq,&priv->rtllib->hw_wakeup_wq,MSECS(10));
103
spin_unlock_irqrestore(&priv->rf_ps_lock,flags);
104
#ifdef CONFIG_ASPM_OR_D3
105
if (pPSC->RegRfPsLevel & RT_RF_LPS_LEVEL_ASPM) {
106
RT_DISABLE_ASPM(dev);
107
RT_CLEAR_PS_LEVEL(pPSC, RT_RF_LPS_LEVEL_ASPM);
110
RT_TRACE(COMP_PS, "%s()============>come to wake up\n", __FUNCTION__);
111
MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS);
114
void rtl8192_hw_wakeup_wq(void *data)
116
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
117
struct rtllib_device *ieee = container_of_dwork_rsl(data,struct rtllib_device,hw_wakeup_wq);
118
struct net_device *dev = ieee->dev;
120
struct net_device *dev = (struct net_device *)data;
122
rtl8192_hw_wakeup(dev);
126
#define MIN_SLEEP_TIME 50
127
#define MAX_SLEEP_TIME 10000
128
void rtl8192_hw_to_sleep(struct net_device *dev, u32 th, u32 tl)
130
#ifdef _RTL8192_EXT_PATCH_
131
struct r8192_priv *priv = rtllib_priv(dev);
132
u32 rb = jiffies, sleep_cost = MSECS(8+16+7), delta = 0;
135
if((tl > rb) && (th > 0))
138
spin_lock_irqsave(&priv->ps_lock,flags);
140
if (tl >= sleep_cost)
143
tl = 0xffffffff - sleep_cost + tl;
146
spin_unlock_irqrestore(&priv->ps_lock,flags);
153
delta = 0xffffffff - rb + tl;
156
spin_unlock_irqrestore(&priv->ps_lock,flags);
160
if (delta <= MSECS(MIN_SLEEP_TIME)) {
161
spin_unlock_irqrestore(&priv->ps_lock,flags);
162
printk("too short to sleep::%x, %x, %lx\n",tl, rb, MSECS(MIN_SLEEP_TIME));
166
if(delta > MSECS(MAX_SLEEP_TIME)) {
167
spin_unlock_irqrestore(&priv->ps_lock,flags);
168
printk("========>too long to sleep:%x, %x, %lx\n", tl, rb, MSECS(MAX_SLEEP_TIME));
172
RT_TRACE(COMP_LPS, "==============>%s(): wake up time is %d,%d\n",__FUNCTION__,delta,jiffies_to_msecs(delta));
173
queue_delayed_work_rsl(priv->rtllib->wq,&priv->rtllib->hw_wakeup_wq,delta);
174
queue_delayed_work_rsl(priv->rtllib->wq, (void *)&priv->rtllib->hw_sleep_wq,0);
176
spin_unlock_irqrestore(&priv->ps_lock,flags);
178
struct r8192_priv *priv = rtllib_priv(dev);
183
spin_lock_irqsave(&priv->ps_lock,flags);
187
if(((tl>=rb)&& (tl-rb) <= MSECS(MIN_SLEEP_TIME))
188
||((rb>tl)&& (rb-tl) < MSECS(MIN_SLEEP_TIME))) {
189
spin_unlock_irqrestore(&priv->ps_lock,flags);
190
printk("too short to sleep::%x, %x, %lx\n",tl, rb, MSECS(MIN_SLEEP_TIME));
194
if(((tl > rb) && ((tl-rb) > MSECS(MAX_SLEEP_TIME)))||
195
((tl < rb) && (tl>MSECS(69)) && ((rb-tl) > MSECS(MAX_SLEEP_TIME)))||
196
((tl<rb)&&(tl<MSECS(69))&&((tl+0xffffffff-rb)>MSECS(MAX_SLEEP_TIME)))) {
197
printk("========>too long to sleep:%x, %x, %lx\n", tl, rb, MSECS(MAX_SLEEP_TIME));
198
spin_unlock_irqrestore(&priv->ps_lock,flags);
202
u32 tmp = (tl>rb)?(tl-rb):(rb-tl);
203
queue_delayed_work_rsl(priv->rtllib->wq,
204
&priv->rtllib->hw_wakeup_wq,tmp);
206
queue_delayed_work_rsl(priv->rtllib->wq,
207
(void *)&priv->rtllib->hw_sleep_wq,0);
208
spin_unlock_irqrestore(&priv->ps_lock,flags);
214
void InactivePsWorkItemCallback(struct net_device *dev)
216
struct r8192_priv *priv = rtllib_priv(dev);
217
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
219
RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() ---------> \n");
220
pPSC->bSwRfProcessing = true;
222
RT_TRACE(COMP_PS, "InactivePsWorkItemCallback(): Set RF to %s.\n", \
223
pPSC->eInactivePowerState == eRfOff?"OFF":"ON");
224
#ifdef CONFIG_ASPM_OR_D3
225
if(pPSC->eInactivePowerState == eRfOn)
228
if((pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM) && RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM))
230
RT_DISABLE_ASPM(dev);
231
RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
234
else if((pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_PCI_D3) && RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3))
236
RT_LEAVE_D3(dev, false);
237
RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3);
242
MgntActSet_RF_State(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS);
244
#ifdef CONFIG_ASPM_OR_D3
245
if(pPSC->eInactivePowerState == eRfOff)
247
if(pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM)
250
RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
253
else if(pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_PCI_D3)
255
RT_ENTER_D3(dev, false);
256
RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3);
263
if(pPSC->eInactivePowerState == eRfOn)
267
if( ( pMgntInfo->SecurityInfo.PairwiseEncAlgorithm == WEP104_Encryption ) ||
268
(pMgntInfo->SecurityInfo.PairwiseEncAlgorithm == WEP40_Encryption) )
270
if( pMgntInfo->SecurityInfo.KeyLen[index] != 0)
271
pAdapter->HalFunc.SetKeyHandler(pAdapter, index, 0, false, pMgntInfo->SecurityInfo.PairwiseEncAlgorithm, true, false);
278
pPSC->bSwRfProcessing = false;
279
RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() <--------- \n");
283
IPSEnter(struct net_device *dev)
285
struct r8192_priv *priv = rtllib_priv(dev);
286
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
287
RT_RF_POWER_STATE rtState;
289
if (pPSC->bInactivePs)
291
rtState = priv->rtllib->eRFPowerState;
292
if (rtState == eRfOn && !pPSC->bSwRfProcessing &&\
293
(priv->rtllib->state != RTLLIB_LINKED)&&\
294
(priv->rtllib->iw_mode != IW_MODE_MASTER))
296
RT_TRACE(COMP_PS,"IPSEnter(): Turn off RF.\n");
297
pPSC->eInactivePowerState = eRfOff;
298
priv->isRFOff = true;
299
priv->bInPowerSaveMode = true;
300
InactivePsWorkItemCallback(dev);
306
IPSLeave(struct net_device *dev)
308
struct r8192_priv *priv = rtllib_priv(dev);
309
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
310
RT_RF_POWER_STATE rtState;
312
if (pPSC->bInactivePs)
314
rtState = priv->rtllib->eRFPowerState;
315
if (rtState != eRfOn && !pPSC->bSwRfProcessing && priv->rtllib->RfOffReason <= RF_CHANGE_BY_IPS)
317
RT_TRACE(COMP_PS, "IPSLeave(): Turn on RF.\n");
318
pPSC->eInactivePowerState = eRfOn;
319
priv->bInPowerSaveMode = false;
320
InactivePsWorkItemCallback(dev);
324
void IPSLeave_wq(void *data)
326
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
327
struct rtllib_device *ieee = container_of_work_rsl(data,struct rtllib_device,ips_leave_wq);
328
struct net_device *dev = ieee->dev;
330
struct net_device *dev = (struct net_device *)data;
332
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
333
down(&priv->rtllib->ips_sem);
335
up(&priv->rtllib->ips_sem);
337
void rtllib_ips_leave_wq(struct net_device *dev)
339
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
340
RT_RF_POWER_STATE rtState;
341
rtState = priv->rtllib->eRFPowerState;
343
if(priv->rtllib->PowerSaveControl.bInactivePs){
344
if(rtState == eRfOff){
345
if(priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS)
347
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__FUNCTION__);
351
printk("=========>%s(): IPSLeave\n",__FUNCTION__);
352
queue_work_rsl(priv->rtllib->wq,&priv->rtllib->ips_leave_wq);
357
void rtllib_ips_leave(struct net_device *dev)
359
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
360
down(&priv->rtllib->ips_sem);
362
up(&priv->rtllib->ips_sem);
367
bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev, u8 rtPsMode)
369
struct r8192_priv *priv = rtllib_priv(dev);
371
#ifdef _RTL8192_EXT_PATCH_
372
if((priv->rtllib->iw_mode == IW_MODE_ADHOC) || (priv->rtllib->iw_mode == IW_MODE_MASTER)
373
|| (priv->rtllib->iw_mode == IW_MODE_MESH))
375
if(priv->rtllib->iw_mode == IW_MODE_ADHOC)
382
RT_TRACE(COMP_LPS,"%s(): set ieee->ps = %x\n",__FUNCTION__,rtPsMode);
383
if(!priv->ps_force) {
384
priv->rtllib->ps = rtPsMode;
387
priv->rtllib->dot11PowerSaveMode = rtPsMode;
389
if(priv->rtllib->dot11PowerSaveMode == eMaxPs)
396
if(priv->rtllib->sta_sleep != 0 && rtPsMode == RTLLIB_PS_DISABLED)
400
rtl8192_hw_wakeup(dev);
401
priv->rtllib->sta_sleep = 0;
403
spin_lock_irqsave(&(priv->rtllib->mgmt_tx_lock), flags);
404
printk("LPS leave: notify AP we are awaked ++++++++++ SendNullFunctionData\n");
405
rtllib_sta_ps_send_null_frame(priv->rtllib, 0);
406
spin_unlock_irqrestore(&(priv->rtllib->mgmt_tx_lock), flags);
410
if((pPSC->bFwCtrlLPS) && (pPSC->bLeisurePs))
412
if(priv->rtllib->dot11PowerSaveMode == eActive)
415
FwPwrMode = FW_PS_ACTIVE_MODE;
416
Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_SET_RPWM, (pu1Byte)(&RpwmVal));
417
Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_H2C_FW_PWRMODE, (pu1Byte)(&FwPwrMode));
421
if(GetFwLPS_Doze(Adapter))
424
Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_H2C_FW_PWRMODE, (pu1Byte)(&pPSC->FWCtrlPSMode));
425
Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_SET_RPWM, (pu1Byte)(&RpwmVal));
429
pMgntInfo->dot11PowerSaveMode = eActive;
430
Adapter->bInPowerSaveMode = false;
439
void LeisurePSEnter(struct net_device *dev)
441
struct r8192_priv *priv = rtllib_priv(dev);
442
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
444
RT_TRACE(COMP_PS, "LeisurePSEnter()...\n");
445
RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d,pPSC->LpsIdleCount is %d,RT_CHECK_FOR_HANG_PERIOD is %d\n",
446
pPSC->bLeisurePs, priv->rtllib->ps,pPSC->LpsIdleCount,RT_CHECK_FOR_HANG_PERIOD);
448
#ifdef _RTL8192_EXT_PATCH_
449
if(!((priv->rtllib->iw_mode == IW_MODE_INFRA) && (priv->rtllib->state == RTLLIB_LINKED))
450
|| (priv->rtllib->iw_mode == IW_MODE_ADHOC) || (priv->rtllib->iw_mode == IW_MODE_MASTER)
451
|| (priv->rtllib->iw_mode == IW_MODE_MESH))
453
if(!((priv->rtllib->iw_mode == IW_MODE_INFRA) && (priv->rtllib->state == RTLLIB_LINKED))
454
|| (priv->rtllib->iw_mode == IW_MODE_ADHOC) || (priv->rtllib->iw_mode == IW_MODE_MASTER))
458
if (pPSC->bLeisurePs)
460
if(pPSC->LpsIdleCount >= RT_CHECK_FOR_HANG_PERIOD)
463
if(priv->rtllib->ps == RTLLIB_PS_DISABLED)
466
RT_TRACE(COMP_LPS, "LeisurePSEnter(): Enter 802.11 power save mode...\n");
468
if(!pPSC->bFwCtrlLPS)
470
if (priv->rtllib->SetFwCmdHandler)
472
priv->rtllib->SetFwCmdHandler(dev, FW_CMD_LPS_ENTER);
475
MgntActSet_802_11_PowerSaveMode(dev, RTLLIB_PS_MBCAST|RTLLIB_PS_UNICAST);
477
/*if(pPSC->RegRfPsLevel & RT_RF_LPS_LEVEL_ASPM)
479
RT_ENABLE_ASPM(pAdapter);
480
RT_SET_PS_LEVEL(pAdapter, RT_RF_LPS_LEVEL_ASPM);
486
pPSC->LpsIdleCount++;
491
void LeisurePSLeave(struct net_device *dev)
493
struct r8192_priv *priv = rtllib_priv(dev);
494
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
497
RT_TRACE(COMP_PS, "LeisurePSLeave()...\n");
498
RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d\n",
499
pPSC->bLeisurePs, priv->rtllib->ps);
501
if (pPSC->bLeisurePs)
503
if(priv->rtllib->ps != RTLLIB_PS_DISABLED)
505
#ifdef CONFIG_ASPM_OR_D3
506
if(pPSC->RegRfPsLevel & RT_RF_LPS_LEVEL_ASPM && RT_IN_PS_LEVEL(pPSC, RT_RF_LPS_LEVEL_ASPM))
508
RT_DISABLE_ASPM(dev);
509
RT_CLEAR_PS_LEVEL(pPSC, RT_RF_LPS_LEVEL_ASPM);
512
RT_TRACE(COMP_LPS, "LeisurePSLeave(): Busy Traffic , Leave 802.11 power save..\n");
513
MgntActSet_802_11_PowerSaveMode(dev, RTLLIB_PS_DISABLED);
515
if(!pPSC->bFwCtrlLPS)
517
if (priv->rtllib->SetFwCmdHandler)
519
priv->rtllib->SetFwCmdHandler(dev, FW_CMD_LPS_LEAVE);
527
#ifdef CONFIG_ASPM_OR_D3
528
bool PlatformSwitchDevicePciASPM(struct net_device *dev, u8 value)
530
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
531
bool bResult = false;
533
pci_write_config_byte(priv->pdev, priv->ASPMRegOffset, value);
539
bool PlatformSwitchClkReq(struct net_device *dev, u8 value)
541
bool bResult = false;
542
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
547
pci_write_config_byte(priv->pdev,priv->ClkReqOffset,value);
551
priv->ClkReqState = true;
553
priv->ClkReqState = false;
561
PlatformDisableASPM(struct net_device *dev)
563
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
564
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
567
u16 PciBridgeLinkCtrlReg, ASPMLevel=0;
569
LinkCtrlReg = priv->LinkCtrlReg;
570
ASPMLevel |= BIT0|BIT1;
571
LinkCtrlReg &=~ASPMLevel;
573
PciBridgeLinkCtrlReg = priv->PciBridgeLinkCtrlReg;
574
PciBridgeLinkCtrlReg &=~(BIT0|BIT1);
576
if (priv->aspm_clkreq_enable) {
578
pci_write_config_byte(priv->bridge_pdev,priv->PciBridgeASPMRegOffset,PciBridgeLinkCtrlReg);
579
RT_TRACE(COMP_POWER, "Write reg[%x]=%x\n", (priv->PciBridgeASPMRegOffset), PciBridgeLinkCtrlReg);
583
PlatformSwitchDevicePciASPM(dev, priv->LinkCtrlReg);
585
PlatformSwitchClkReq(dev, 0x0);
586
if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_CLK_REQ)
587
RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_CLK_REQ);
591
void PlatformEnableASPM(struct net_device *dev)
593
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
594
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
597
if (!priv->aspm_clkreq_enable) {
598
RT_TRACE(COMP_INIT, "%s: Fail to enable ASPM. Cannot find the Bus of PCI(Bridge).\n",\
603
ASPMLevel |= priv->RegDevicePciASPMSetting;
604
PlatformSwitchDevicePciASPM(dev, (priv->LinkCtrlReg | ASPMLevel));
606
if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_CLK_REQ) {
607
PlatformSwitchClkReq(dev,(pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_CLK_REQ) ? 1 : 0);
608
RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_CLK_REQ);
612
pci_write_config_byte(priv->bridge_pdev,priv->PciBridgeASPMRegOffset,\
613
((priv->PciBridgeLinkCtrlReg | priv->RegHostPciASPMSetting)&~BIT0)&0xff);
614
RT_TRACE(COMP_INIT, "Write reg[%x] = %x\n",
615
priv->PciBridgeASPMRegOffset,
616
(priv->PciBridgeLinkCtrlReg|priv->RegHostPciASPMSetting));
620
u32 PlatformResetPciSpace(struct net_device *dev,u8 Value)
622
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
624
pci_write_config_byte(priv->pdev,0x04,Value);
629
bool PlatformSetPMCSR(struct net_device *dev,u8 value,bool bTempSetting)
631
bool bResult = false;
632
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
634
bool bActuallySet=false, bSetFunc=false;
638
spin_lock_irqsave(&priv->D3_lock,flag);
654
if(priv->LeaveD3Cnt == 0)
669
PlatformSwitchClkReq(dev, 0x01);
671
PlatformSwitchClkReq(dev, 0x00);
674
pci_write_config_byte(priv->pdev,0x44,Buffer);
675
RT_TRACE(COMP_POWER, "PlatformSetPMCSR(): D3(value: %d)\n", Buffer);
679
PlatformResetPciSpace(dev, 0x06);
680
PlatformResetPciSpace(dev, 0x07);
687
RT_DISABLE_FUNC(Adapter, DF_IO_D3_BIT);
691
RT_ENABLE_FUNC(Adapter, DF_IO_D3_BIT);
697
spin_unlock_irqrestore(&priv->D3_lock,flag);