3 int InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
11 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL");
15 if (psIntfAdapter->psAdapter->device_removed == TRUE) {
16 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed");
20 if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) {
21 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus");
25 if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) {
26 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed..");
29 psIntfAdapter->psAdapter->DeviceAccess = TRUE;
31 bytes = usb_control_msg(psIntfAdapter->udev,
32 usb_rcvctrlpipe(psIntfAdapter->udev, 0),
36 ((addr >> 16) & 0xFFFF),
42 psIntfAdapter->psAdapter->device_removed = TRUE;
45 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d", bytes);
47 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", bytes);
49 psIntfAdapter->psAdapter->DeviceAccess = FALSE;
53 int InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter,
59 unsigned short usRetries = 0;
62 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL");
66 if (psIntfAdapter->psAdapter->device_removed == TRUE) {
67 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed");
71 if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) {
72 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus...");
76 if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) {
77 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed..");
81 psIntfAdapter->psAdapter->DeviceAccess = TRUE;
84 retval = usb_control_msg(psIntfAdapter->udev,
85 usb_sndctrlpipe(psIntfAdapter->udev, 0),
89 ((addr >> 16) & 0xFFFF),
95 if (-ENODEV == retval) {
96 psIntfAdapter->psAdapter->device_removed = TRUE;
100 } while ((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES));
103 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM failed status :%d, retires :%d", retval, usRetries);
104 psIntfAdapter->psAdapter->DeviceAccess = FALSE;
107 psIntfAdapter->psAdapter->DeviceAccess = FALSE;
108 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM sent %d", retval);
109 return STATUS_SUCCESS;
113 int BcmRDM(void *arg,
118 return InterfaceRDM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
121 int BcmWRM(void *arg,
126 return InterfaceWRM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
129 int Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter)
131 PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter);
132 int status = STATUS_SUCCESS;
135 * usb_clear_halt - tells device to clear endpoint halt/stall condition
136 * @dev: device whose endpoint is halted
137 * @pipe: endpoint "pipe" being cleared
138 * @ Context: !in_interrupt ()
140 * usb_clear_halt is the synchrnous call and returns 0 on success else returns with error code.
141 * This is used to clear halt conditions for bulk and interrupt endpoints only.
142 * Control and isochronous endpoints never halts.
144 * Any URBs queued for such an endpoint should normally be unlinked by the driver
145 * before clearing the halt condition.
149 /* Killing all the submitted urbs to different end points. */
150 Bcm_kill_all_URBs(psIntfAdapter);
152 /* clear the halted/stalled state for every end point */
153 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sIntrIn.int_in_pipe);
154 if (status != STATUS_SUCCESS)
155 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Interrupt IN end point. :%d ", status);
157 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sBulkIn.bulk_in_pipe);
158 if (status != STATUS_SUCCESS)
159 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk IN end point. :%d ", status);
161 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sBulkOut.bulk_out_pipe);
162 if (status != STATUS_SUCCESS)
163 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk OUT end point. :%d ", status);
168 void Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter)
170 struct urb *tempUrb = NULL;
174 * usb_kill_urb - cancel a transfer request and wait for it to finish
175 * @urb: pointer to URB describing a previously submitted request,
176 * returns nothing as it is void returned API.
178 * This routine cancels an in-progress request. It is guaranteed that
179 * upon return all completion handlers will have finished and the URB
180 * will be totally idle and available for reuse
182 * This routine may not be used in an interrupt context (such as a bottom
183 * half or a completion handler), or when holding a spinlock, or in other
184 * situations where the caller can't schedule().
188 /* Cancel submitted Interrupt-URB's */
189 if (psIntfAdapter->psInterruptUrb) {
190 if (psIntfAdapter->psInterruptUrb->status == -EINPROGRESS)
191 usb_kill_urb(psIntfAdapter->psInterruptUrb);
194 /* Cancel All submitted TX URB's */
195 for (i = 0; i < MAXIMUM_USB_TCB; i++) {
196 tempUrb = psIntfAdapter->asUsbTcb[i].urb;
198 if (tempUrb->status == -EINPROGRESS)
199 usb_kill_urb(tempUrb);
203 for (i = 0; i < MAXIMUM_USB_RCB; i++) {
204 tempUrb = psIntfAdapter->asUsbRcb[i].urb;
206 if (tempUrb->status == -EINPROGRESS)
207 usb_kill_urb(tempUrb);
211 atomic_set(&psIntfAdapter->uNumTcbUsed, 0);
212 atomic_set(&psIntfAdapter->uCurrTcb, 0);
214 atomic_set(&psIntfAdapter->uNumRcbUsed, 0);
215 atomic_set(&psIntfAdapter->uCurrRcb, 0);
218 void putUsbSuspend(struct work_struct *work)
220 PS_INTERFACE_ADAPTER psIntfAdapter = NULL;
221 struct usb_interface *intf = NULL;
222 psIntfAdapter = container_of(work, S_INTERFACE_ADAPTER, usbSuspendWork);
223 intf = psIntfAdapter->interface;
225 if (psIntfAdapter->bSuspended == FALSE)
226 usb_autopm_put_interface(intf);