3 INT InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
11 if (psIntfAdapter == NULL) {
12 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL");
16 if (psIntfAdapter->psAdapter->device_removed == TRUE) {
17 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed");
21 if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) {
22 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus");
26 if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) {
27 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed..");
30 psIntfAdapter->psAdapter->DeviceAccess = TRUE;
33 bytes = usb_control_msg(psIntfAdapter->udev,
34 usb_rcvctrlpipe(psIntfAdapter->udev, 0),
38 ((addr >> 16) & 0xFFFF),
44 if (-ENODEV == bytes) {
45 psIntfAdapter->psAdapter->device_removed = TRUE;
49 } while ((bytes < 0) && (usRetries < MAX_RDM_WRM_RETIRES));
52 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d, retires :%d", bytes, usRetries);
54 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", bytes);
56 psIntfAdapter->psAdapter->DeviceAccess = FALSE;
60 INT InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter,
68 if (psIntfAdapter == NULL) {
69 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL");
73 if (psIntfAdapter->psAdapter->device_removed == TRUE) {
74 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed");
78 if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) {
79 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus...");
83 if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) {
84 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed..");
88 psIntfAdapter->psAdapter->DeviceAccess = TRUE;
91 retval = usb_control_msg(psIntfAdapter->udev,
92 usb_sndctrlpipe(psIntfAdapter->udev, 0),
96 ((addr >> 16) & 0xFFFF),
102 if (-ENODEV == retval) {
103 psIntfAdapter->psAdapter->device_removed = TRUE;
107 } while ((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES));
110 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM failed status :%d, retires :%d", retval, usRetries);
111 psIntfAdapter->psAdapter->DeviceAccess = FALSE;
114 psIntfAdapter->psAdapter->DeviceAccess = FALSE;
115 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM sent %d", retval);
116 return STATUS_SUCCESS;
120 INT BcmRDM(PVOID arg,
125 return InterfaceRDM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
128 INT BcmWRM(PVOID arg,
133 return InterfaceWRM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
136 INT Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter)
138 PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter);
139 INT status = STATUS_SUCCESS;
142 * usb_clear_halt - tells device to clear endpoint halt/stall condition
143 * @dev: device whose endpoint is halted
144 * @pipe: endpoint "pipe" being cleared
145 * @ Context: !in_interrupt ()
147 * usb_clear_halt is the synchrnous call and returns 0 on success else returns with error code.
148 * This is used to clear halt conditions for bulk and interrupt endpoints only.
149 * Control and isochronous endpoints never halts.
151 * Any URBs queued for such an endpoint should normally be unlinked by the driver
152 * before clearing the halt condition.
156 /* Killing all the submitted urbs to different end points. */
157 Bcm_kill_all_URBs(psIntfAdapter);
159 /* clear the halted/stalled state for every end point */
160 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sIntrIn.int_in_pipe);
161 if (status != STATUS_SUCCESS)
162 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Interrupt IN end point. :%d ", status);
164 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sBulkIn.bulk_in_pipe);
165 if (status != STATUS_SUCCESS)
166 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk IN end point. :%d ", status);
168 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sBulkOut.bulk_out_pipe);
169 if (status != STATUS_SUCCESS)
170 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk OUT end point. :%d ", status);
175 VOID Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter)
177 struct urb *tempUrb = NULL;
181 * usb_kill_urb - cancel a transfer request and wait for it to finish
182 * @urb: pointer to URB describing a previously submitted request,
183 * returns nothing as it is void returned API.
185 * This routine cancels an in-progress request. It is guaranteed that
186 * upon return all completion handlers will have finished and the URB
187 * will be totally idle and available for reuse
189 * This routine may not be used in an interrupt context (such as a bottom
190 * half or a completion handler), or when holding a spinlock, or in other
191 * situations where the caller can't schedule().
195 /* Cancel submitted Interrupt-URB's */
196 if (psIntfAdapter->psInterruptUrb != NULL) {
197 if (psIntfAdapter->psInterruptUrb->status == -EINPROGRESS)
198 usb_kill_urb(psIntfAdapter->psInterruptUrb);
201 /* Cancel All submitted TX URB's */
202 for (i = 0; i < MAXIMUM_USB_TCB; i++) {
203 tempUrb = psIntfAdapter->asUsbTcb[i].urb;
205 if (tempUrb->status == -EINPROGRESS)
206 usb_kill_urb(tempUrb);
210 for (i = 0; i < MAXIMUM_USB_RCB; i++) {
211 tempUrb = psIntfAdapter->asUsbRcb[i].urb;
213 if (tempUrb->status == -EINPROGRESS)
214 usb_kill_urb(tempUrb);
218 atomic_set(&psIntfAdapter->uNumTcbUsed, 0);
219 atomic_set(&psIntfAdapter->uCurrTcb, 0);
221 atomic_set(&psIntfAdapter->uNumRcbUsed, 0);
222 atomic_set(&psIntfAdapter->uCurrRcb, 0);
225 VOID putUsbSuspend(struct work_struct *work)
227 PS_INTERFACE_ADAPTER psIntfAdapter = NULL;
228 struct usb_interface *intf = NULL;
229 psIntfAdapter = container_of(work, S_INTERFACE_ADAPTER, usbSuspendWork);
230 intf = psIntfAdapter->interface;
232 if (psIntfAdapter->bSuspended == FALSE)
233 usb_autopm_put_interface(intf);