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,
61 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL");
65 if (psIntfAdapter->psAdapter->device_removed == TRUE) {
66 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed");
70 if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) {
71 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus...");
75 if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) {
76 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed..");
80 psIntfAdapter->psAdapter->DeviceAccess = TRUE;
82 retval = usb_control_msg(psIntfAdapter->udev,
83 usb_sndctrlpipe(psIntfAdapter->udev, 0),
87 ((addr >> 16) & 0xFFFF),
92 if (-ENODEV == retval)
93 psIntfAdapter->psAdapter->device_removed = TRUE;
96 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM failed status :%d", retval);
97 psIntfAdapter->psAdapter->DeviceAccess = FALSE;
100 psIntfAdapter->psAdapter->DeviceAccess = FALSE;
101 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM sent %d", retval);
102 return STATUS_SUCCESS;
106 int BcmRDM(void *arg,
111 return InterfaceRDM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
114 int BcmWRM(void *arg,
119 return InterfaceWRM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
122 int Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter)
124 PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter);
125 int status = STATUS_SUCCESS;
128 * usb_clear_halt - tells device to clear endpoint halt/stall condition
129 * @dev: device whose endpoint is halted
130 * @pipe: endpoint "pipe" being cleared
131 * @ Context: !in_interrupt ()
133 * usb_clear_halt is the synchrnous call and returns 0 on success else returns with error code.
134 * This is used to clear halt conditions for bulk and interrupt endpoints only.
135 * Control and isochronous endpoints never halts.
137 * Any URBs queued for such an endpoint should normally be unlinked by the driver
138 * before clearing the halt condition.
142 /* Killing all the submitted urbs to different end points. */
143 Bcm_kill_all_URBs(psIntfAdapter);
145 /* clear the halted/stalled state for every end point */
146 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sIntrIn.int_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 Interrupt IN end point. :%d ", status);
150 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sBulkIn.bulk_in_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 IN end point. :%d ", status);
154 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sBulkOut.bulk_out_pipe);
155 if (status != STATUS_SUCCESS)
156 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk OUT end point. :%d ", status);
161 void Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter)
163 struct urb *tempUrb = NULL;
167 * usb_kill_urb - cancel a transfer request and wait for it to finish
168 * @urb: pointer to URB describing a previously submitted request,
169 * returns nothing as it is void returned API.
171 * This routine cancels an in-progress request. It is guaranteed that
172 * upon return all completion handlers will have finished and the URB
173 * will be totally idle and available for reuse
175 * This routine may not be used in an interrupt context (such as a bottom
176 * half or a completion handler), or when holding a spinlock, or in other
177 * situations where the caller can't schedule().
181 /* Cancel submitted Interrupt-URB's */
182 if (psIntfAdapter->psInterruptUrb) {
183 if (psIntfAdapter->psInterruptUrb->status == -EINPROGRESS)
184 usb_kill_urb(psIntfAdapter->psInterruptUrb);
187 /* Cancel All submitted TX URB's */
188 for (i = 0; i < MAXIMUM_USB_TCB; i++) {
189 tempUrb = psIntfAdapter->asUsbTcb[i].urb;
191 if (tempUrb->status == -EINPROGRESS)
192 usb_kill_urb(tempUrb);
196 for (i = 0; i < MAXIMUM_USB_RCB; i++) {
197 tempUrb = psIntfAdapter->asUsbRcb[i].urb;
199 if (tempUrb->status == -EINPROGRESS)
200 usb_kill_urb(tempUrb);
204 atomic_set(&psIntfAdapter->uNumTcbUsed, 0);
205 atomic_set(&psIntfAdapter->uCurrTcb, 0);
207 atomic_set(&psIntfAdapter->uNumRcbUsed, 0);
208 atomic_set(&psIntfAdapter->uCurrRcb, 0);
211 void putUsbSuspend(struct work_struct *work)
213 PS_INTERFACE_ADAPTER psIntfAdapter = NULL;
214 struct usb_interface *intf = NULL;
215 psIntfAdapter = container_of(work, S_INTERFACE_ADAPTER, usbSuspendWork);
216 intf = psIntfAdapter->interface;
218 if (psIntfAdapter->bSuspended == FALSE)
219 usb_autopm_put_interface(intf);