4 InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter
,
10 USHORT usRetries
= 0 ;
11 if(psIntfAdapter
== NULL
)
13 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_PRINTK
, 0, 0,"Interface Adapter is NULL");
17 if(psIntfAdapter
->psAdapter
->device_removed
== TRUE
)
19 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_PRINTK
, 0, 0,"Device got removed");
23 if((psIntfAdapter
->psAdapter
->StopAllXaction
== TRUE
) && (psIntfAdapter
->psAdapter
->chip_id
>= T3LPB
))
25 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_OTHERS
, RDM
, DBG_LVL_ALL
,"Currently Xaction is not allowed on the bus");
29 if(psIntfAdapter
->bSuspended
==TRUE
|| psIntfAdapter
->bPreparingForBusSuspend
== TRUE
)
31 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_OTHERS
, RDM
, DBG_LVL_ALL
,"Bus is in suspended states hence RDM not allowed..");
34 psIntfAdapter
->psAdapter
->DeviceAccess
= TRUE
;
36 retval
= usb_control_msg(psIntfAdapter
->udev
,
37 usb_rcvctrlpipe(psIntfAdapter
->udev
,0),
41 ((addr
>> 16) & 0xFFFF),
49 psIntfAdapter
->psAdapter
->device_removed
=TRUE
;
53 }while((retval
< 0) && (usRetries
< MAX_RDM_WRM_RETIRES
) );
57 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_OTHERS
, RDM
, DBG_LVL_ALL
, "RDM failed status :%d, retires :%d", retval
,usRetries
);
58 psIntfAdapter
->psAdapter
->DeviceAccess
= FALSE
;
63 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_OTHERS
, RDM
, DBG_LVL_ALL
, "RDM sent %d", retval
);
64 psIntfAdapter
->psAdapter
->DeviceAccess
= FALSE
;
65 return STATUS_SUCCESS
;
70 InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter
,
76 USHORT usRetries
= 0 ;
78 if(psIntfAdapter
== NULL
)
80 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_PRINTK
, 0, 0, "Interface Adapter is NULL");
83 if(psIntfAdapter
->psAdapter
->device_removed
== TRUE
)
86 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_PRINTK
, 0, 0,"Device got removed");
90 if((psIntfAdapter
->psAdapter
->StopAllXaction
== TRUE
) && (psIntfAdapter
->psAdapter
->chip_id
>= T3LPB
))
92 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_OTHERS
, WRM
, DBG_LVL_ALL
,"Currently Xaction is not allowed on the bus...");
96 if(psIntfAdapter
->bSuspended
==TRUE
|| psIntfAdapter
->bPreparingForBusSuspend
== TRUE
)
98 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_OTHERS
, WRM
, DBG_LVL_ALL
,"Bus is in suspended states hence RDM not allowed..");
101 psIntfAdapter
->psAdapter
->DeviceAccess
= TRUE
;
103 retval
= usb_control_msg(psIntfAdapter
->udev
,
104 usb_sndctrlpipe(psIntfAdapter
->udev
,0),
108 ((addr
>> 16) & 0xFFFF),
114 if(-ENODEV
== retval
)
116 psIntfAdapter
->psAdapter
->device_removed
= TRUE
;
120 }while((retval
< 0) && ( usRetries
< MAX_RDM_WRM_RETIRES
));
124 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_OTHERS
, WRM
, DBG_LVL_ALL
, "WRM failed status :%d, retires :%d", retval
, usRetries
);
125 psIntfAdapter
->psAdapter
->DeviceAccess
= FALSE
;
130 psIntfAdapter
->psAdapter
->DeviceAccess
= FALSE
;
131 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
,DBG_TYPE_OTHERS
, WRM
, DBG_LVL_ALL
, "WRM sent %d", retval
);
132 return STATUS_SUCCESS
;
144 return InterfaceRDM((PS_INTERFACE_ADAPTER
)arg
, addr
, buff
, len
);
153 return InterfaceWRM((PS_INTERFACE_ADAPTER
)arg
, addr
, buff
, len
);
158 INT
Bcm_clear_halt_of_endpoints(PMINI_ADAPTER Adapter
)
160 PS_INTERFACE_ADAPTER psIntfAdapter
= (PS_INTERFACE_ADAPTER
)(Adapter
->pvInterfaceAdapter
);
161 INT status
= STATUS_SUCCESS
;
164 usb_clear_halt - tells device to clear endpoint halt/stall condition
165 @dev: device whose endpoint is halted
166 @pipe: endpoint "pipe" being cleared
167 @ Context: !in_interrupt ()
169 usb_clear_halt is the synchrnous call and returns 0 on success else returns with error code.
170 This is used to clear halt conditions for bulk and interrupt endpoints only.
171 Control and isochronous endpoints never halts.
173 Any URBs queued for such an endpoint should normally be unlinked by the driver
174 before clearing the halt condition.
178 //Killing all the submitted urbs to different end points.
179 Bcm_kill_all_URBs(psIntfAdapter
);
182 //clear the halted/stalled state for every end point
183 status
= usb_clear_halt(psIntfAdapter
->udev
,psIntfAdapter
->sIntrIn
.int_in_pipe
);
184 if(status
!= STATUS_SUCCESS
)
185 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, INTF_INIT
, DBG_LVL_ALL
, "Unable to Clear Halt of Interrupt IN end point. :%d ", status
);
187 status
= usb_clear_halt(psIntfAdapter
->udev
,psIntfAdapter
->sBulkIn
.bulk_in_pipe
);
188 if(status
!= STATUS_SUCCESS
)
189 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, INTF_INIT
, DBG_LVL_ALL
, "Unable to Clear Halt of Bulk IN end point. :%d ", status
);
191 status
= usb_clear_halt(psIntfAdapter
->udev
,psIntfAdapter
->sBulkOut
.bulk_out_pipe
);
192 if(status
!= STATUS_SUCCESS
)
193 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, INTF_INIT
, DBG_LVL_ALL
, "Unable to Clear Halt of Bulk OUT end point. :%d ", status
);
199 VOID
Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter
)
201 struct urb
*tempUrb
= NULL
;
205 * usb_kill_urb - cancel a transfer request and wait for it to finish
206 * @urb: pointer to URB describing a previously submitted request,
207 * returns nothing as it is void returned API.
209 * This routine cancels an in-progress request. It is guaranteed that
210 * upon return all completion handlers will have finished and the URB
211 * will be totally idle and available for reuse
213 * This routine may not be used in an interrupt context (such as a bottom
214 * half or a completion handler), or when holding a spinlock, or in other
215 * situations where the caller can't schedule().
219 /* Cancel submitted Interrupt-URB's */
220 if(psIntfAdapter
->psInterruptUrb
!= NULL
)
222 if(psIntfAdapter
->psInterruptUrb
->status
== -EINPROGRESS
)
223 usb_kill_urb(psIntfAdapter
->psInterruptUrb
);
226 /* Cancel All submitted TX URB's */
227 for(i
= 0; i
< MAXIMUM_USB_TCB
; i
++)
229 tempUrb
= psIntfAdapter
->asUsbTcb
[i
].urb
;
232 if(tempUrb
->status
== -EINPROGRESS
)
233 usb_kill_urb(tempUrb
);
237 for(i
= 0; i
< MAXIMUM_USB_RCB
; i
++)
239 tempUrb
= psIntfAdapter
->asUsbRcb
[i
].urb
;
242 if(tempUrb
->status
== -EINPROGRESS
)
243 usb_kill_urb(tempUrb
);
247 atomic_set(&psIntfAdapter
->uNumTcbUsed
, 0);
248 atomic_set(&psIntfAdapter
->uCurrTcb
, 0);
250 atomic_set(&psIntfAdapter
->uNumRcbUsed
, 0);
251 atomic_set(&psIntfAdapter
->uCurrRcb
, 0);
254 VOID
putUsbSuspend(struct work_struct
*work
)
256 PS_INTERFACE_ADAPTER psIntfAdapter
= NULL
;
257 struct usb_interface
*intf
= NULL
;
258 psIntfAdapter
= container_of(work
, S_INTERFACE_ADAPTER
,usbSuspendWork
);
259 intf
=psIntfAdapter
->interface
;
261 if(psIntfAdapter
->bSuspended
== FALSE
)
262 usb_autopm_put_interface(intf
);