3 int InterfaceRDM(struct bcm_interface_adapter
*psIntfAdapter
,
13 if (psIntfAdapter
->psAdapter
->device_removed
== TRUE
) {
14 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
, DBG_TYPE_PRINTK
, 0, 0, "Device got removed");
18 if ((psIntfAdapter
->psAdapter
->StopAllXaction
== TRUE
) && (psIntfAdapter
->psAdapter
->chip_id
>= T3LPB
)) {
19 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
, DBG_TYPE_OTHERS
, RDM
, DBG_LVL_ALL
, "Currently Xaction is not allowed on the bus");
23 if (psIntfAdapter
->bSuspended
== TRUE
|| psIntfAdapter
->bPreparingForBusSuspend
== TRUE
) {
24 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
, DBG_TYPE_OTHERS
, RDM
, DBG_LVL_ALL
, "Bus is in suspended states hence RDM not allowed..");
27 psIntfAdapter
->psAdapter
->DeviceAccess
= TRUE
;
29 bytes
= usb_control_msg(psIntfAdapter
->udev
,
30 usb_rcvctrlpipe(psIntfAdapter
->udev
, 0),
34 ((addr
>> 16) & 0xFFFF),
40 psIntfAdapter
->psAdapter
->device_removed
= TRUE
;
43 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
, DBG_TYPE_OTHERS
, RDM
, DBG_LVL_ALL
, "RDM failed status :%d", bytes
);
45 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
, DBG_TYPE_OTHERS
, RDM
, DBG_LVL_ALL
, "RDM sent %d", bytes
);
47 psIntfAdapter
->psAdapter
->DeviceAccess
= FALSE
;
51 int InterfaceWRM(struct bcm_interface_adapter
*psIntfAdapter
,
61 if (psIntfAdapter
->psAdapter
->device_removed
== TRUE
) {
62 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
, DBG_TYPE_PRINTK
, 0, 0, "Device got removed");
66 if ((psIntfAdapter
->psAdapter
->StopAllXaction
== TRUE
) && (psIntfAdapter
->psAdapter
->chip_id
>= T3LPB
)) {
67 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
, DBG_TYPE_OTHERS
, WRM
, DBG_LVL_ALL
, "Currently Xaction is not allowed on the bus...");
71 if (psIntfAdapter
->bSuspended
== TRUE
|| psIntfAdapter
->bPreparingForBusSuspend
== TRUE
) {
72 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
, DBG_TYPE_OTHERS
, WRM
, DBG_LVL_ALL
, "Bus is in suspended states hence RDM not allowed..");
76 psIntfAdapter
->psAdapter
->DeviceAccess
= TRUE
;
78 retval
= usb_control_msg(psIntfAdapter
->udev
,
79 usb_sndctrlpipe(psIntfAdapter
->udev
, 0),
83 ((addr
>> 16) & 0xFFFF),
88 if (-ENODEV
== retval
)
89 psIntfAdapter
->psAdapter
->device_removed
= TRUE
;
92 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
, DBG_TYPE_OTHERS
, WRM
, DBG_LVL_ALL
, "WRM failed status :%d", retval
);
93 psIntfAdapter
->psAdapter
->DeviceAccess
= FALSE
;
96 psIntfAdapter
->psAdapter
->DeviceAccess
= FALSE
;
97 BCM_DEBUG_PRINT(psIntfAdapter
->psAdapter
, DBG_TYPE_OTHERS
, WRM
, DBG_LVL_ALL
, "WRM sent %d", retval
);
98 return STATUS_SUCCESS
;
102 int BcmRDM(void *arg
,
107 return InterfaceRDM((struct bcm_interface_adapter
*)arg
, addr
, buff
, len
);
110 int BcmWRM(void *arg
,
115 return InterfaceWRM((struct bcm_interface_adapter
*)arg
, addr
, buff
, len
);
118 int Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter
*Adapter
)
120 struct bcm_interface_adapter
*psIntfAdapter
= (struct bcm_interface_adapter
*)(Adapter
->pvInterfaceAdapter
);
121 int status
= STATUS_SUCCESS
;
124 * usb_clear_halt - tells device to clear endpoint halt/stall condition
125 * @dev: device whose endpoint is halted
126 * @pipe: endpoint "pipe" being cleared
127 * @ Context: !in_interrupt ()
129 * usb_clear_halt is the synchrnous call and returns 0 on success else returns with error code.
130 * This is used to clear halt conditions for bulk and interrupt endpoints only.
131 * Control and isochronous endpoints never halts.
133 * Any URBs queued for such an endpoint should normally be unlinked by the driver
134 * before clearing the halt condition.
138 /* Killing all the submitted urbs to different end points. */
139 Bcm_kill_all_URBs(psIntfAdapter
);
141 /* clear the halted/stalled state for every end point */
142 status
= usb_clear_halt(psIntfAdapter
->udev
, psIntfAdapter
->sIntrIn
.int_in_pipe
);
143 if (status
!= STATUS_SUCCESS
)
144 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, INTF_INIT
, DBG_LVL_ALL
, "Unable to Clear Halt of Interrupt IN end point. :%d ", status
);
146 status
= usb_clear_halt(psIntfAdapter
->udev
, psIntfAdapter
->sBulkIn
.bulk_in_pipe
);
147 if (status
!= STATUS_SUCCESS
)
148 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, INTF_INIT
, DBG_LVL_ALL
, "Unable to Clear Halt of Bulk IN end point. :%d ", status
);
150 status
= usb_clear_halt(psIntfAdapter
->udev
, psIntfAdapter
->sBulkOut
.bulk_out_pipe
);
151 if (status
!= STATUS_SUCCESS
)
152 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, INTF_INIT
, DBG_LVL_ALL
, "Unable to Clear Halt of Bulk OUT end point. :%d ", status
);
157 void Bcm_kill_all_URBs(struct bcm_interface_adapter
*psIntfAdapter
)
159 struct urb
*tempUrb
= NULL
;
163 * usb_kill_urb - cancel a transfer request and wait for it to finish
164 * @urb: pointer to URB describing a previously submitted request,
165 * returns nothing as it is void returned API.
167 * This routine cancels an in-progress request. It is guaranteed that
168 * upon return all completion handlers will have finished and the URB
169 * will be totally idle and available for reuse
171 * This routine may not be used in an interrupt context (such as a bottom
172 * half or a completion handler), or when holding a spinlock, or in other
173 * situations where the caller can't schedule().
177 /* Cancel submitted Interrupt-URB's */
178 if (psIntfAdapter
->psInterruptUrb
) {
179 if (psIntfAdapter
->psInterruptUrb
->status
== -EINPROGRESS
)
180 usb_kill_urb(psIntfAdapter
->psInterruptUrb
);
183 /* Cancel All submitted TX URB's */
184 for (i
= 0; i
< MAXIMUM_USB_TCB
; i
++) {
185 tempUrb
= psIntfAdapter
->asUsbTcb
[i
].urb
;
187 if (tempUrb
->status
== -EINPROGRESS
)
188 usb_kill_urb(tempUrb
);
192 for (i
= 0; i
< MAXIMUM_USB_RCB
; i
++) {
193 tempUrb
= psIntfAdapter
->asUsbRcb
[i
].urb
;
195 if (tempUrb
->status
== -EINPROGRESS
)
196 usb_kill_urb(tempUrb
);
200 atomic_set(&psIntfAdapter
->uNumTcbUsed
, 0);
201 atomic_set(&psIntfAdapter
->uCurrTcb
, 0);
203 atomic_set(&psIntfAdapter
->uNumRcbUsed
, 0);
204 atomic_set(&psIntfAdapter
->uCurrRcb
, 0);
207 void putUsbSuspend(struct work_struct
*work
)
209 struct bcm_interface_adapter
*psIntfAdapter
= NULL
;
210 struct usb_interface
*intf
= NULL
;
211 psIntfAdapter
= container_of(work
, struct bcm_interface_adapter
, usbSuspendWork
);
212 intf
= psIntfAdapter
->interface
;
214 if (psIntfAdapter
->bSuspended
== FALSE
)
215 usb_autopm_put_interface(intf
);