3 int InterfaceRDM(PS_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(PS_INTERFACE_ADAPTER psIntfAdapter,
59 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL");
63 if (psIntfAdapter->psAdapter->device_removed == TRUE) {
64 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed");
68 if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) {
69 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus...");
73 if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) {
74 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed..");
78 psIntfAdapter->psAdapter->DeviceAccess = TRUE;
80 retval = usb_control_msg(psIntfAdapter->udev,
81 usb_sndctrlpipe(psIntfAdapter->udev, 0),
85 ((addr >> 16) & 0xFFFF),
90 if (-ENODEV == retval)
91 psIntfAdapter->psAdapter->device_removed = TRUE;
94 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM failed status :%d", retval);
95 psIntfAdapter->psAdapter->DeviceAccess = FALSE;
98 psIntfAdapter->psAdapter->DeviceAccess = FALSE;
99 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM sent %d", retval);
100 return STATUS_SUCCESS;
104 int BcmRDM(void *arg,
109 return InterfaceRDM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
112 int BcmWRM(void *arg,
117 return InterfaceWRM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
120 int Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter)
122 PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter);
123 int status = STATUS_SUCCESS;
126 * usb_clear_halt - tells device to clear endpoint halt/stall condition
127 * @dev: device whose endpoint is halted
128 * @pipe: endpoint "pipe" being cleared
129 * @ Context: !in_interrupt ()
131 * usb_clear_halt is the synchrnous call and returns 0 on success else returns with error code.
132 * This is used to clear halt conditions for bulk and interrupt endpoints only.
133 * Control and isochronous endpoints never halts.
135 * Any URBs queued for such an endpoint should normally be unlinked by the driver
136 * before clearing the halt condition.
140 /* Killing all the submitted urbs to different end points. */
141 Bcm_kill_all_URBs(psIntfAdapter);
143 /* clear the halted/stalled state for every end point */
144 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sIntrIn.int_in_pipe);
145 if (status != STATUS_SUCCESS)
146 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Interrupt IN end point. :%d ", status);
148 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sBulkIn.bulk_in_pipe);
149 if (status != STATUS_SUCCESS)
150 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk IN end point. :%d ", status);
152 status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sBulkOut.bulk_out_pipe);
153 if (status != STATUS_SUCCESS)
154 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk OUT end point. :%d ", status);
159 void Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter)
161 struct urb *tempUrb = NULL;
165 * usb_kill_urb - cancel a transfer request and wait for it to finish
166 * @urb: pointer to URB describing a previously submitted request,
167 * returns nothing as it is void returned API.
169 * This routine cancels an in-progress request. It is guaranteed that
170 * upon return all completion handlers will have finished and the URB
171 * will be totally idle and available for reuse
173 * This routine may not be used in an interrupt context (such as a bottom
174 * half or a completion handler), or when holding a spinlock, or in other
175 * situations where the caller can't schedule().
179 /* Cancel submitted Interrupt-URB's */
180 if (psIntfAdapter->psInterruptUrb) {
181 if (psIntfAdapter->psInterruptUrb->status == -EINPROGRESS)
182 usb_kill_urb(psIntfAdapter->psInterruptUrb);
185 /* Cancel All submitted TX URB's */
186 for (i = 0; i < MAXIMUM_USB_TCB; i++) {
187 tempUrb = psIntfAdapter->asUsbTcb[i].urb;
189 if (tempUrb->status == -EINPROGRESS)
190 usb_kill_urb(tempUrb);
194 for (i = 0; i < MAXIMUM_USB_RCB; i++) {
195 tempUrb = psIntfAdapter->asUsbRcb[i].urb;
197 if (tempUrb->status == -EINPROGRESS)
198 usb_kill_urb(tempUrb);
202 atomic_set(&psIntfAdapter->uNumTcbUsed, 0);
203 atomic_set(&psIntfAdapter->uCurrTcb, 0);
205 atomic_set(&psIntfAdapter->uNumRcbUsed, 0);
206 atomic_set(&psIntfAdapter->uCurrRcb, 0);
209 void putUsbSuspend(struct work_struct *work)
211 PS_INTERFACE_ADAPTER psIntfAdapter = NULL;
212 struct usb_interface *intf = NULL;
213 psIntfAdapter = container_of(work, S_INTERFACE_ADAPTER, usbSuspendWork);
214 intf = psIntfAdapter->interface;
216 if (psIntfAdapter->bSuspended == FALSE)
217 usb_autopm_put_interface(intf);