4 Function: InterfaceIdleModeWakeup
6 Description: This is the hardware specific Function for
7 waking up HW device from Idle mode.
8 A software abort pattern is written to the
9 device to wake it and necessary power state
10 transitions from host are performed here.
12 Input parameters: IN struct bcm_mini_adapter *Adapter
13 - Miniport Adapter Context
15 Return: BCM_STATUS_SUCCESS - If Wakeup of the HW Interface
17 Other - If an error occurred.
21 Function: InterfaceIdleModeRespond
23 Description: This is the hardware specific Function for
24 responding to Idle mode request from target.
25 Necessary power state transitions from host for
26 idle mode or other device specific initializations
29 Input parameters: IN struct bcm_mini_adapter * Adapter
30 - Miniport Adapter Context
32 Return: BCM_STATUS_SUCCESS - If Idle mode response related
33 HW configuration was successful.
34 Other - If an error occurred.
38 "dmem bfc02f00 100" tells how many time device went in Idle mode.
39 this value will be at address bfc02fa4.just before value d0ea1dle.
41 Set time value by writing at bfc02f98 7d0
43 checking the Ack timer expire on kannon by running command
44 d qcslog .. if it shows e means host has not send response
45 to f/w with in 200 ms. Response should be
46 send to f/w with in 200 ms after the Idle/Shutdown req issued
51 int InterfaceIdleModeRespond(struct bcm_mini_adapter
*Adapter
,
52 unsigned int *puiBuffer
)
54 int status
= STATUS_SUCCESS
;
55 unsigned int uiRegRead
= 0;
58 if (ntohl(*puiBuffer
) == GO_TO_IDLE_MODE_PAYLOAD
) {
59 if (ntohl(*(puiBuffer
+1)) == 0) {
61 status
= wrmalt(Adapter
, SW_ABORT_IDLEMODE_LOC
,
62 &uiRegRead
, sizeof(uiRegRead
));
66 if (Adapter
->ulPowerSaveMode
==
67 DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING
) {
68 uiRegRead
= 0x00000000;
69 status
= wrmalt(Adapter
,
70 DEBUG_INTERRUPT_GENERATOR_REGISTOR
,
71 &uiRegRead
, sizeof(uiRegRead
));
75 /* Below Register should not br read in case of
76 * Manual and Protocol Idle mode */
77 else if (Adapter
->ulPowerSaveMode
!=
78 DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
) {
79 /* clear on read Register */
80 bytes
= rdmalt(Adapter
, DEVICE_INT_OUT_EP_REG0
,
81 &uiRegRead
, sizeof(uiRegRead
));
86 /* clear on read Register */
87 bytes
= rdmalt(Adapter
, DEVICE_INT_OUT_EP_REG1
,
88 &uiRegRead
, sizeof(uiRegRead
));
95 /* Set Idle Mode Flag to False and
96 * Clear IdleMode reg. */
97 Adapter
->IdleMode
= false;
98 Adapter
->bTriedToWakeUpFromlowPowerMode
= false;
100 wake_up(&Adapter
->lowpower_mode_wait_queue
);
103 if (TRUE
== Adapter
->IdleMode
)
108 if (Adapter
->chip_id
== BCS220_2
||
109 Adapter
->chip_id
== BCS220_2BC
||
110 Adapter
->chip_id
== BCS250_BC
||
111 Adapter
->chip_id
== BCS220_3
) {
113 bytes
= rdmalt(Adapter
, HPM_CONFIG_MSW
,
114 &uiRegRead
, sizeof(uiRegRead
));
121 uiRegRead
|= (1<<17);
123 status
= wrmalt(Adapter
, HPM_CONFIG_MSW
,
124 &uiRegRead
, sizeof(uiRegRead
));
128 SendIdleModeResponse(Adapter
);
130 } else if (ntohl(*puiBuffer
) == IDLE_MODE_SF_UPDATE_MSG
) {
131 OverrideServiceFlowParams(Adapter
, puiBuffer
);
136 static int InterfaceAbortIdlemode(struct bcm_mini_adapter
*Adapter
,
137 unsigned int Pattern
)
139 int status
= STATUS_SUCCESS
;
141 unsigned int chip_id
;
142 unsigned long timeout
= 0, itr
= 0;
145 unsigned char aucAbortPattern
[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
147 struct bcm_interface_adapter
*psInterfaceAdapter
=
148 Adapter
->pvInterfaceAdapter
;
150 /* Abort Bus suspend if its already suspended */
151 if ((TRUE
== psInterfaceAdapter
->bSuspended
) &&
152 (TRUE
== Adapter
->bDoSuspend
))
153 status
= usb_autopm_get_interface(
154 psInterfaceAdapter
->interface
);
156 if ((Adapter
->ulPowerSaveMode
==
157 DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING
) ||
158 (Adapter
->ulPowerSaveMode
==
159 DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
)) {
160 /* write the SW abort pattern. */
161 status
= wrmalt(Adapter
, SW_ABORT_IDLEMODE_LOC
,
162 &Pattern
, sizeof(Pattern
));
167 if (Adapter
->ulPowerSaveMode
==
168 DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING
) {
170 status
= wrmalt(Adapter
,
171 DEBUG_INTERRUPT_GENERATOR_REGISTOR
,
172 &value
, sizeof(value
));
175 } else if (Adapter
->ulPowerSaveMode
!=
176 DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
) {
178 * Get a Interrupt Out URB and send 8 Bytes Down
179 * To be Done in Thread Context.
180 * Not using Asynchronous Mechanism.
182 status
= usb_interrupt_msg(psInterfaceAdapter
->udev
,
183 usb_sndintpipe(psInterfaceAdapter
->udev
,
184 psInterfaceAdapter
->sIntrOut
.int_out_endpointAddr
),
192 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
,
193 IDLE_MODE
, DBG_LVL_ALL
,
194 "NOB Sent down :%d", lenwritten
);
198 timeout
= jiffies
+ msecs_to_jiffies(50);
199 while (time_after(timeout
, jiffies
)) {
201 rdmalt(Adapter
, CHIP_ID_REG
, &chip_id
, sizeof(UINT
));
202 if (0xbece3200 == (chip_id
&~(0xF0)))
203 chip_id
= chip_id
&~(0xF0);
204 if (chip_id
== Adapter
->chip_id
)
207 if (time_before(timeout
, jiffies
))
208 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
,
209 IDLE_MODE
, DBG_LVL_ALL
,
210 "Not able to read chip-id even after 25 msec");
212 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
,
213 IDLE_MODE
, DBG_LVL_ALL
,
214 "Number of completed iteration to"
215 "read chip-id :%lu", itr
);
217 status
= wrmalt(Adapter
, SW_ABORT_IDLEMODE_LOC
,
218 &Pattern
, sizeof(status
));
224 int InterfaceIdleModeWakeup(struct bcm_mini_adapter
*Adapter
)
227 if (Adapter
->bTriedToWakeUpFromlowPowerMode
) {
228 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
,
229 IDLE_MODE
, DBG_LVL_ALL
,
230 "Wake up already attempted.. ignoring\n");
232 Adapter
->bTriedToWakeUpFromlowPowerMode
= TRUE
;
233 InterfaceAbortIdlemode(Adapter
, Adapter
->usIdleModePattern
);
239 void InterfaceHandleShutdownModeWakeup(struct bcm_mini_adapter
*Adapter
)
241 unsigned int uiRegVal
= 0;
245 if (Adapter
->ulPowerSaveMode
==
246 DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING
) {
247 /* clear idlemode interrupt. */
249 Status
= wrmalt(Adapter
,
250 DEBUG_INTERRUPT_GENERATOR_REGISTOR
,
251 &uiRegVal
, sizeof(uiRegVal
));
258 /* clear Interrupt EP registers. */
259 bytes
= rdmalt(Adapter
,
260 DEVICE_INT_OUT_EP_REG0
,
261 &uiRegVal
, sizeof(uiRegVal
));
267 bytes
= rdmalt(Adapter
,
268 DEVICE_INT_OUT_EP_REG1
,
269 &uiRegVal
, sizeof(uiRegVal
));