17 static int debug = -1;
21 static const u32 default_msg =
43 while (psIntfAdapter->
psAdapter->DeviceAccess) {
45 "Device is being accessed.\n");
72 unsigned long ulReg = 0;
99 bytes =
rdmalt(Adapter, 0x0F0110F8, (
u32 *)&ulReg,
sizeof(
u32));
102 "reading of Tx EP failed\n");
107 ulReg =
ntohl(ulReg);
129 if ((ulReg&0x00FF0000)>>16 > 0x30) {
130 ulReg = (ulReg&0xFF00FFFF)|(0x30<<16);
134 if ((ulReg&0x00FF0000)>>16 > 0x30) {
135 ulReg = (ulReg&0xFF00FFFF)|(0x30<<16);
146 struct usb_device *
udev = interface_to_usbdev(intf);
161 psAdapter = netdev_priv(ndev);
194 if (psIntfAdapter ==
NULL) {
205 usb_set_intfdata(intf, psIntfAdapter);
208 "psIntfAdapter 0x%p\n", psIntfAdapter);
209 retval = InterfaceAdapterInit(psIntfAdapter);
217 "File Not Found. Use app to download.\n");
221 "InterfaceAdapterInit failed.\n");
222 usb_set_intfdata(intf,
NULL);
223 udev = interface_to_usbdev(intf);
225 InterfaceAdapterFree(psIntfAdapter);
242 intf->needs_remote_wakeup = 1;
243 usb_enable_autosuspend(udev);
247 "Enabling USB Auto-Suspend\n");
250 intf->needs_remote_wakeup = 0;
251 usb_disable_autosuspend(udev);
263 struct usb_device *udev = interface_to_usbdev(intf);
265 if (psIntfAdapter ==
NULL)
272 intf->needs_remote_wakeup = 0;
275 usb_set_intfdata(intf,
NULL);
276 InterfaceAdapterFree(psIntfAdapter);
289 "Can't allocate Tx urb for index %d\n", i);
299 "Can't allocate Rx urb for index %d\n", i);
307 "Can't allocate Rx buffer for index %d\n", i);
328 "Cannot send interrupt in URB\n");
337 psIntfAdapter->
psAdapter->waiting_to_fw_download_done, 5*
HZ);
397 return bcm_usb_endpoint_xfer_bulk(epd) && bcm_usb_endpoint_dir_in(epd);
402 return bcm_usb_endpoint_xfer_bulk(epd) && bcm_usb_endpoint_dir_out(epd);
407 return bcm_usb_endpoint_xfer_int(epd) && bcm_usb_endpoint_dir_in(epd);
412 return bcm_usb_endpoint_xfer_int(epd) && bcm_usb_endpoint_dir_out(epd);
417 return bcm_usb_endpoint_xfer_isoc(epd) && bcm_usb_endpoint_dir_in(epd);
422 return bcm_usb_endpoint_xfer_isoc(epd) && bcm_usb_endpoint_dir_out(epd);
427 struct usb_host_interface *iface_desc;
432 int usedIntOutForBulkTransfer = 0 ;
452 if (0xbece3200 == (psIntfAdapter->
psAdapter->chip_id & ~(0xF0)))
453 psIntfAdapter->
psAdapter->chip_id &= ~0xF0;
455 dev_info(&psIntfAdapter->
udev->dev,
"RDM Chip ID 0x%lx\n",
458 iface_desc = psIntfAdapter->
interface->cur_altsetting;
466 dev_info(&psIntfAdapter->
udev->dev,
"number of alternate setting %d\n",
467 psIntfAdapter->
interface->num_altsetting);
469 if (bBcm16 ==
TRUE) {
474 "BCM16 is applicable on this dongle\n");
476 usedIntOutForBulkTransfer =
EP2 ;
477 endpoint = &iface_desc->endpoint[
EP2].desc;
479 "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n");
487 "Configuring the EEPROM\n");
489 ConfigureEndPointTypesThroughEEPROM(psIntfAdapter->
psAdapter);
499 "reset failed. Re-enumerating the device.\n");
508 "Reverting Bulk to INT as it is in Full Speed mode.\n");
512 usedIntOutForBulkTransfer =
EP4 ;
513 endpoint = &iface_desc->endpoint[
EP4].desc;
515 "Choosing AltSetting as a default setting.\n");
516 if (bcm_usb_endpoint_is_int_out(endpoint) ==
FALSE) {
518 "Dongle does not have BCM16 Fix.\n");
520 ConfigureEndPointTypesThroughEEPROM(psIntfAdapter->
psAdapter);
530 "reset failed. Re-enumerating the device.\n");
539 iface_desc = psIntfAdapter->
interface->cur_altsetting;
541 for (value = 0; value < iface_desc->desc.bNumEndpoints; ++
value) {
542 endpoint = &iface_desc->endpoint[
value].desc;
549 usb_rcvbulkpipe(psIntfAdapter->
udev,
556 usb_sndbulkpipe(psIntfAdapter->
udev,
569 "could not allocate interrupt_in_buffer\n");
576 (psIntfAdapter->
psAdapter->chip_id ==
T3B) && (value == usedIntOutForBulkTransfer)) {
584 }
else if (value ==
EP6) {
592 "could not allocate interrupt_out_buffer\n");
599 usb_set_intfdata(psIntfAdapter->
interface, psIntfAdapter);
602 psIntfAdapter->
psAdapter->bcm_file_readback_from_chip =
610 "Cannot create interrupt urb\n");
614 retval = AllocUsbCb(psIntfAdapter);
618 return device_run(psIntfAdapter);
633 "Host Entered in PMU Idle Mode.\n");
637 "Host Entered in PMU Shutdown Mode.\n");
660 static struct usb_driver usbbcm_driver = {
662 .probe = usbbcm_device_probe,
663 .disconnect = usbbcm_disconnect,
664 .suspend = InterfaceSuspend,
665 .resume = InterfaceResume,
666 .id_table = InterfaceUsbtable,
667 .supports_autosuspend = 1,
672 static __init int bcm_init(
void)
680 if (IS_ERR(bcm_class)) {
682 return PTR_ERR(bcm_class);
685 retval = usb_register(&usbbcm_driver);
694 static __exit void bcm_exit(
void)