Staging: Beceem: white space changes to InterfaceInit.c

This patch only changes:
1) spaces, tabs, and newline characters.
2) comment styles.

The compiled object file is the same before and after except for line
number changes.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Dan Carpenter 2010-12-06 10:02:11 +03:00 committed by Greg Kroah-Hartman
parent 2a314742d3
commit c2a0b162db

View File

@ -26,42 +26,39 @@ static int InterfaceAdapterInit(PS_INTERFACE_ADAPTER Adapter);
static void InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter) static void InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter)
{ {
int i = 0; int i = 0;
// Wake up the wait_queue...
if(psIntfAdapter->psAdapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) /* Wake up the wait_queue... */
{ if (psIntfAdapter->psAdapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) {
psIntfAdapter->psAdapter->DriverState = DRIVER_HALT; psIntfAdapter->psAdapter->DriverState = DRIVER_HALT;
wake_up(&psIntfAdapter->psAdapter->LEDInfo.notify_led_event); wake_up(&psIntfAdapter->psAdapter->LEDInfo.notify_led_event);
} }
reset_card_proc(psIntfAdapter->psAdapter); reset_card_proc(psIntfAdapter->psAdapter);
//worst case time taken by the RDM/WRM will be 5 sec. will check after every 100 ms /*
//to accertain the device is not being accessed. After this No RDM/WRM should be made. * worst case time taken by the RDM/WRM will be 5 sec. will check after every 100 ms
while(psIntfAdapter->psAdapter->DeviceAccess) * to accertain the device is not being accessed. After this No RDM/WRM should be made.
{ */
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,"Device is being Accessed \n"); while (psIntfAdapter->psAdapter->DeviceAccess) {
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
"Device is being Accessed \n");
msleep(100); msleep(100);
} }
/* Free interrupt URB */ /* Free interrupt URB */
//psIntfAdapter->psAdapter->device_removed = TRUE; /* psIntfAdapter->psAdapter->device_removed = TRUE; */
if(psIntfAdapter->psInterruptUrb) if (psIntfAdapter->psInterruptUrb) {
{
usb_free_urb(psIntfAdapter->psInterruptUrb); usb_free_urb(psIntfAdapter->psInterruptUrb);
} }
/* Free transmit URBs */ /* Free transmit URBs */
for(i = 0; i < MAXIMUM_USB_TCB; i++) for (i = 0; i < MAXIMUM_USB_TCB; i++) {
{ if (psIntfAdapter->asUsbTcb[i].urb != NULL) {
if(psIntfAdapter->asUsbTcb[i].urb != NULL)
{
usb_free_urb(psIntfAdapter->asUsbTcb[i].urb); usb_free_urb(psIntfAdapter->asUsbTcb[i].urb);
psIntfAdapter->asUsbTcb[i].urb = NULL; psIntfAdapter->asUsbTcb[i].urb = NULL;
} }
} }
/* Free receive URB and buffers */ /* Free receive URB and buffers */
for(i = 0; i < MAXIMUM_USB_RCB; i++) for (i = 0; i < MAXIMUM_USB_RCB; i++) {
{ if (psIntfAdapter->asUsbRcb[i].urb != NULL) {
if (psIntfAdapter->asUsbRcb[i].urb != NULL)
{
kfree(psIntfAdapter->asUsbRcb[i].urb->transfer_buffer); kfree(psIntfAdapter->asUsbRcb[i].urb->transfer_buffer);
usb_free_urb(psIntfAdapter->asUsbRcb[i].urb); usb_free_urb(psIntfAdapter->asUsbRcb[i].urb);
psIntfAdapter->asUsbRcb[i].urb = NULL; psIntfAdapter->asUsbRcb[i].urb = NULL;
@ -74,7 +71,7 @@ static void ConfigureEndPointTypesThroughEEPROM(PMINI_ADAPTER Adapter)
{ {
unsigned long ulReg = 0; unsigned long ulReg = 0;
// Program EP2 MAX_PKT_SIZE /* Program EP2 MAX_PKT_SIZE */
ulReg = ntohl(EP2_MPS_REG); ulReg = ntohl(EP2_MPS_REG);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x128, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x128, 4, TRUE);
ulReg = ntohl(EP2_MPS); ulReg = ntohl(EP2_MPS);
@ -82,28 +79,23 @@ static void ConfigureEndPointTypesThroughEEPROM(PMINI_ADAPTER Adapter)
ulReg = ntohl(EP2_CFG_REG); ulReg = ntohl(EP2_CFG_REG);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x132, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x132, 4, TRUE);
if(((PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter))->bHighSpeedDevice == TRUE) if (((PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter))->bHighSpeedDevice == TRUE) {
{
ulReg = ntohl(EP2_CFG_INT); ulReg = ntohl(EP2_CFG_INT);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x136, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x136, 4, TRUE);
} } else {
else /* USE BULK EP as TX in FS mode. */
{
// USE BULK EP as TX in FS mode.
ulReg = ntohl(EP2_CFG_BULK); ulReg = ntohl(EP2_CFG_BULK);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x136, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x136, 4, TRUE);
} }
/* Program EP4 MAX_PKT_SIZE. */
// Program EP4 MAX_PKT_SIZE.
ulReg = ntohl(EP4_MPS_REG); ulReg = ntohl(EP4_MPS_REG);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x13C, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x13C, 4, TRUE);
ulReg = ntohl(EP4_MPS); ulReg = ntohl(EP4_MPS);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x140, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x140, 4, TRUE);
// Program TX EP as interrupt (Alternate Setting) /* Program TX EP as interrupt(Alternate Setting) */
if( rdmalt(Adapter,0x0F0110F8, (PUINT)&ulReg,4)) if (rdmalt(Adapter, 0x0F0110F8, (PUINT)&ulReg, 4)) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "reading of Tx EP is failing"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "reading of Tx EP is failing");
return; return;
} }
@ -114,30 +106,29 @@ static void ConfigureEndPointTypesThroughEEPROM(PMINI_ADAPTER Adapter)
ulReg = ntohl(EP4_CFG_REG); ulReg = ntohl(EP4_CFG_REG);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1C8, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1C8, 4, TRUE);
// Program ISOCHRONOUS EP size to zero. /* Program ISOCHRONOUS EP size to zero. */
ulReg = ntohl(ISO_MPS_REG); ulReg = ntohl(ISO_MPS_REG);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1D2, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1D2, 4, TRUE);
ulReg = ntohl(ISO_MPS); ulReg = ntohl(ISO_MPS);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1D6, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1D6, 4, TRUE);
// Update EEPROM Version. /*
// Read 4 bytes from 508 and modify 511 and 510. * Update EEPROM Version.
// * Read 4 bytes from 508 and modify 511 and 510.
*/
ReadBeceemEEPROM(Adapter, 0x1FC, (PUINT)&ulReg); ReadBeceemEEPROM(Adapter, 0x1FC, (PUINT)&ulReg);
ulReg &= 0x0101FFFF; ulReg &= 0x0101FFFF;
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1FC, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1FC, 4, TRUE);
//
//Update length field if required. Also make the string NULL terminated. /* Update length field if required. Also make the string NULL terminated. */
//
ReadBeceemEEPROM(Adapter, 0xA8, (PUINT)&ulReg); ReadBeceemEEPROM(Adapter, 0xA8, (PUINT)&ulReg);
if((ulReg&0x00FF0000)>>16 > 0x30) if ((ulReg&0x00FF0000)>>16 > 0x30) {
{
ulReg = (ulReg&0xFF00FFFF)|(0x30<<16); ulReg = (ulReg&0xFF00FFFF)|(0x30<<16);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0xA8, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0xA8, 4, TRUE);
} }
ReadBeceemEEPROM(Adapter, 0x148, (PUINT)&ulReg); ReadBeceemEEPROM(Adapter, 0x148, (PUINT)&ulReg);
if((ulReg&0x00FF0000)>>16 > 0x30) if ((ulReg&0x00FF0000)>>16 > 0x30) {
{
ulReg = (ulReg&0xFF00FFFF)|(0x30<<16); ulReg = (ulReg&0xFF00FFFF)|(0x30<<16);
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x148, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x148, 4, TRUE);
} }
@ -145,7 +136,6 @@ static void ConfigureEndPointTypesThroughEEPROM(PMINI_ADAPTER Adapter)
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x122, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x122, 4, TRUE);
ulReg = 0; ulReg = 0;
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1C2, 4, TRUE); BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1C2, 4, TRUE);
} }
static int static int
@ -175,7 +165,8 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
psAdapter->stDebugState.debug_level = DBG_LVL_CURR; psAdapter->stDebugState.debug_level = DBG_LVL_CURR;
psAdapter->stDebugState.type = DBG_TYPE_INITEXIT; psAdapter->stDebugState.type = DBG_TYPE_INITEXIT;
/* Technically, one can start using BCM_DEBUG_PRINT after this point. /*
* Technically, one can start using BCM_DEBUG_PRINT after this point.
* However, realize that by default the Type/Subtype bitmaps are all zero now; * However, realize that by default the Type/Subtype bitmaps are all zero now;
* so no prints will actually appear until the TestApp turns on debug paths via * so no prints will actually appear until the TestApp turns on debug paths via
* the ioctl(); so practically speaking, in early init, no logging happens. * the ioctl(); so practically speaking, in early init, no logging happens.
@ -190,8 +181,7 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
BCM_SHOW_DEBUG_BITMAP(psAdapter); BCM_SHOW_DEBUG_BITMAP(psAdapter);
retval = InitAdapter(psAdapter); retval = InitAdapter(psAdapter);
if(retval) if (retval) {
{
dev_err(&udev->dev, DRV_NAME ": InitAdapter Failed\n"); dev_err(&udev->dev, DRV_NAME ": InitAdapter Failed\n");
AdapterFree(psAdapter); AdapterFree(psAdapter);
return retval; return retval;
@ -199,8 +189,7 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
/* Allocate interface adapter structure */ /* Allocate interface adapter structure */
psIntfAdapter = kzalloc(sizeof(S_INTERFACE_ADAPTER), GFP_KERNEL); psIntfAdapter = kzalloc(sizeof(S_INTERFACE_ADAPTER), GFP_KERNEL);
if (psIntfAdapter == NULL) if (psIntfAdapter == NULL) {
{
dev_err(&udev->dev, DRV_NAME ": no memory for Interface adapter\n"); dev_err(&udev->dev, DRV_NAME ": no memory for Interface adapter\n");
AdapterFree(psAdapter); AdapterFree(psAdapter);
return -ENOMEM; return -ENOMEM;
@ -215,8 +204,7 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "psIntfAdapter 0x%p", psIntfAdapter); BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "psIntfAdapter 0x%p", psIntfAdapter);
retval = InterfaceAdapterInit(psIntfAdapter); retval = InterfaceAdapterInit(psIntfAdapter);
if(retval) if (retval) {
{
/* If the Firmware/Cfg File is not present /* If the Firmware/Cfg File is not present
* then return success, let the application * then return success, let the application
* download the files. * download the files.
@ -232,21 +220,18 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
InterfaceAdapterFree(psIntfAdapter); InterfaceAdapterFree(psIntfAdapter);
return retval; return retval;
} }
if(psAdapter->chip_id > T3) if (psAdapter->chip_id > T3) {
{
uint32_t uiNackZeroLengthInt = 4; uint32_t uiNackZeroLengthInt = 4;
if(wrmalt(psAdapter, DISABLE_USB_ZERO_LEN_INT, &uiNackZeroLengthInt, sizeof(uiNackZeroLengthInt)))
{ if (wrmalt(psAdapter, DISABLE_USB_ZERO_LEN_INT, &uiNackZeroLengthInt, sizeof(uiNackZeroLengthInt))) {
return -EIO; return -EIO;
} }
} }
/* Check whether the USB-Device Supports remote Wake-Up */ /* Check whether the USB-Device Supports remote Wake-Up */
if(USB_CONFIG_ATT_WAKEUP & udev->actconfig->desc.bmAttributes) if (USB_CONFIG_ATT_WAKEUP & udev->actconfig->desc.bmAttributes) {
{
/* If Suspend then only support dynamic suspend */ /* If Suspend then only support dynamic suspend */
if(psAdapter->bDoSuspend) if (psAdapter->bDoSuspend) {
{
#ifdef CONFIG_PM #ifdef CONFIG_PM
udev->autosuspend_delay = 0; udev->autosuspend_delay = 0;
intf->needs_remote_wakeup = 1; intf->needs_remote_wakeup = 1;
@ -262,9 +247,7 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
INIT_WORK(&psIntfAdapter->usbSuspendWork, putUsbSuspend); INIT_WORK(&psIntfAdapter->usbSuspendWork, putUsbSuspend);
BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Enabling USB Auto-Suspend\n"); BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Enabling USB Auto-Suspend\n");
#endif #endif
} } else {
else
{
intf->needs_remote_wakeup = 0; intf->needs_remote_wakeup = 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
udev->autosuspend_disabled = 1; udev->autosuspend_disabled = 1;
@ -302,27 +285,23 @@ static void usbbcm_disconnect (struct usb_interface *intf)
static int AllocUsbCb(PS_INTERFACE_ADAPTER psIntfAdapter) static int AllocUsbCb(PS_INTERFACE_ADAPTER psIntfAdapter)
{ {
int i = 0; int i = 0;
for(i = 0; i < MAXIMUM_USB_TCB; i++)
{ for (i = 0; i < MAXIMUM_USB_TCB; i++) {
if ((psIntfAdapter->asUsbTcb[i].urb = if ((psIntfAdapter->asUsbTcb[i].urb =
usb_alloc_urb(0, GFP_KERNEL)) == NULL) usb_alloc_urb(0, GFP_KERNEL)) == NULL) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Cant allocate Tx urb for index %d", i); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Cant allocate Tx urb for index %d", i);
return -ENOMEM; return -ENOMEM;
} }
} }
for(i = 0; i < MAXIMUM_USB_RCB; i++) for (i = 0; i < MAXIMUM_USB_RCB; i++) {
{
if ((psIntfAdapter->asUsbRcb[i].urb = if ((psIntfAdapter->asUsbRcb[i].urb =
usb_alloc_urb(0, GFP_KERNEL)) == NULL) usb_alloc_urb(0, GFP_KERNEL)) == NULL) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Cant allocate Rx urb for index %d", i); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Cant allocate Rx urb for index %d", i);
return -ENOMEM; return -ENOMEM;
} }
if ((psIntfAdapter->asUsbRcb[i].urb->transfer_buffer = if ((psIntfAdapter->asUsbRcb[i].urb->transfer_buffer =
kmalloc(MAX_DATA_BUFFER_SIZE, GFP_KERNEL)) == NULL) kmalloc(MAX_DATA_BUFFER_SIZE, GFP_KERNEL)) == NULL) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Cant allocate Rx buffer for index %d", i); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Cant allocate Rx buffer for index %d", i);
return -ENOMEM; return -ENOMEM;
} }
@ -331,28 +310,25 @@ static int AllocUsbCb(PS_INTERFACE_ADAPTER psIntfAdapter)
return 0; return 0;
} }
static int device_run(PS_INTERFACE_ADAPTER psIntfAdapter) static int device_run(PS_INTERFACE_ADAPTER psIntfAdapter)
{ {
int value = 0; int value = 0;
UINT status = STATUS_SUCCESS; UINT status = STATUS_SUCCESS;
status = InitCardAndDownloadFirmware(psIntfAdapter->psAdapter); status = InitCardAndDownloadFirmware(psIntfAdapter->psAdapter);
if(status != STATUS_SUCCESS) if (status != STATUS_SUCCESS) {
{
pr_err(DRV_NAME "InitCardAndDownloadFirmware failed.\n"); pr_err(DRV_NAME "InitCardAndDownloadFirmware failed.\n");
return status; return status;
} }
if(TRUE == psIntfAdapter->psAdapter->fw_download_done) if (TRUE == psIntfAdapter->psAdapter->fw_download_done) {
{ if (StartInterruptUrb(psIntfAdapter)) {
if(StartInterruptUrb(psIntfAdapter))
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Cannot send interrupt in URB"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Cannot send interrupt in URB");
} }
//now register the cntrl interface.
//after downloading the f/w waiting for 5 sec to get the mailbox interrupt.
/*
* now register the cntrl interface.
* after downloading the f/w waiting for 5 sec to get the mailbox interrupt.
*/
psIntfAdapter->psAdapter->waiting_to_fw_download_done = FALSE; psIntfAdapter->psAdapter->waiting_to_fw_download_done = FALSE;
value = wait_event_timeout(psIntfAdapter->psAdapter->ioctl_fw_dnld_wait_queue, value = wait_event_timeout(psIntfAdapter->psAdapter->ioctl_fw_dnld_wait_queue,
psIntfAdapter->psAdapter->waiting_to_fw_download_done, 5*HZ); psIntfAdapter->psAdapter->waiting_to_fw_download_done, 5*HZ);
@ -360,8 +336,7 @@ static int device_run(PS_INTERFACE_ADAPTER psIntfAdapter)
if (value == 0) if (value == 0)
pr_err(DRV_NAME ": Mailbox Interrupt has not reached to Driver..\n"); pr_err(DRV_NAME ": Mailbox Interrupt has not reached to Driver..\n");
if(register_control_device_interface(psIntfAdapter->psAdapter) < 0) if (register_control_device_interface(psIntfAdapter->psAdapter) < 0) {
{
pr_err(DRV_NAME ": Register Control Device failed...\n"); pr_err(DRV_NAME ": Register Control Device failed...\n");
return -EIO; return -EIO;
} }
@ -462,8 +437,7 @@ static int InterfaceAdapterInit(PS_INTERFACE_ADAPTER psIntfAdapter)
psIntfAdapter->psAdapter->interface_rdm = BcmRDM; psIntfAdapter->psAdapter->interface_rdm = BcmRDM;
psIntfAdapter->psAdapter->interface_wrm = BcmWRM; psIntfAdapter->psAdapter->interface_wrm = BcmWRM;
if(rdmalt(psIntfAdapter->psAdapter, CHIP_ID_REG, (PUINT)&(psIntfAdapter->psAdapter->chip_id), sizeof(UINT)) < 0) if (rdmalt(psIntfAdapter->psAdapter, CHIP_ID_REG, (PUINT)&(psIntfAdapter->psAdapter->chip_id), sizeof(UINT)) < 0) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "CHIP ID Read Failed\n"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "CHIP ID Read Failed\n");
return STATUS_FAILURE; return STATUS_FAILURE;
} }
@ -476,11 +450,8 @@ static int InterfaceAdapterInit(PS_INTERFACE_ADAPTER psIntfAdapter)
iface_desc = psIntfAdapter->interface->cur_altsetting; iface_desc = psIntfAdapter->interface->cur_altsetting;
if(psIntfAdapter->psAdapter->chip_id == T3B) if (psIntfAdapter->psAdapter->chip_id == T3B) {
{ /* T3B device will have EEPROM, check if EEPROM is proper and BCM16 can be done or not. */
//
//T3B device will have EEPROM,check if EEPROM is proper and BCM16 can be done or not.
//
BeceemEEPROMBulkRead(psIntfAdapter->psAdapter, &uiData, 0x0, 4); BeceemEEPROMBulkRead(psIntfAdapter->psAdapter, &uiData, 0x0, 4);
if (uiData == BECM) if (uiData == BECM)
bBcm16 = TRUE; bBcm16 = TRUE;
@ -488,66 +459,59 @@ static int InterfaceAdapterInit(PS_INTERFACE_ADAPTER psIntfAdapter)
dev_info(&psIntfAdapter->udev->dev, "number of alternate setting %d\n", dev_info(&psIntfAdapter->udev->dev, "number of alternate setting %d\n",
psIntfAdapter->interface->num_altsetting); psIntfAdapter->interface->num_altsetting);
if(bBcm16 == TRUE) if (bBcm16 == TRUE) {
{ /* selecting alternate setting one as a default setting for High Speed modem. */
//selecting alternate setting one as a default setting for High Speed modem.
if (psIntfAdapter->bHighSpeedDevice) if (psIntfAdapter->bHighSpeedDevice)
retval= usb_set_interface(psIntfAdapter->udev, DEFAULT_SETTING_0, ALTERNATE_SETTING_1); retval= usb_set_interface(psIntfAdapter->udev, DEFAULT_SETTING_0, ALTERNATE_SETTING_1);
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM16 is Applicable on this dongle"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM16 is Applicable on this dongle");
if(retval || (psIntfAdapter->bHighSpeedDevice == FALSE)) if (retval || (psIntfAdapter->bHighSpeedDevice == FALSE)) {
{
usedIntOutForBulkTransfer = EP2 ; usedIntOutForBulkTransfer = EP2 ;
endpoint = &iface_desc->endpoint[EP2].desc; endpoint = &iface_desc->endpoint[EP2].desc;
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Interface altsetting got failed or Moemd is configured to FS.hence will work on default setting 0 \n"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Interface altsetting got failed or Moemd is configured to FS.hence will work on default setting 0 \n");
/* /*
If Modem is high speed device EP2 should be INT OUT End point * If Modem is high speed device EP2 should be INT OUT End point
If Mode is FS then EP2 should be bulk end point * If Mode is FS then EP2 should be bulk end point
*/ */
if (((psIntfAdapter->bHighSpeedDevice == TRUE) && (bcm_usb_endpoint_is_int_out(endpoint) == FALSE)) if (((psIntfAdapter->bHighSpeedDevice == TRUE) && (bcm_usb_endpoint_is_int_out(endpoint) == FALSE))
||((psIntfAdapter->bHighSpeedDevice == FALSE)&& (bcm_usb_endpoint_is_bulk_out(endpoint)== FALSE))) || ((psIntfAdapter->bHighSpeedDevice == FALSE) && (bcm_usb_endpoint_is_bulk_out(endpoint) == FALSE))) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Configuring the EEPROM "); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Configuring the EEPROM ");
//change the EP2, EP4 to INT OUT end point /* change the EP2, EP4 to INT OUT end point */
ConfigureEndPointTypesThroughEEPROM(psIntfAdapter->psAdapter); ConfigureEndPointTypesThroughEEPROM(psIntfAdapter->psAdapter);
/* /*
It resets the device and if any thing gets changed in USB descriptor it will show fail and * It resets the device and if any thing gets changed
re-enumerate the device * in USB descriptor it will show fail and re-enumerate
* the device
*/ */
retval = usb_reset_device(psIntfAdapter->udev); retval = usb_reset_device(psIntfAdapter->udev);
if(retval) if (retval) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "reset got failed. hence Re-enumerating the device \n"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "reset got failed. hence Re-enumerating the device \n");
return retval ; return retval ;
} }
} }
if((psIntfAdapter->bHighSpeedDevice == FALSE) && bcm_usb_endpoint_is_bulk_out(endpoint)) if ((psIntfAdapter->bHighSpeedDevice == FALSE) && bcm_usb_endpoint_is_bulk_out(endpoint)) {
{ /* Once BULK is selected in FS mode. Revert it back to INT. Else USB_IF will fail. */
// Once BULK is selected in FS mode. Revert it back to INT. Else USB_IF will fail.
UINT _uiData = ntohl(EP2_CFG_INT); UINT _uiData = ntohl(EP2_CFG_INT);
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Reverting Bulk to INT as it is FS MODE"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Reverting Bulk to INT as it is FS MODE");
BeceemEEPROMBulkWrite(psIntfAdapter->psAdapter, (PUCHAR)&_uiData, 0x136, 4, TRUE); BeceemEEPROMBulkWrite(psIntfAdapter->psAdapter, (PUCHAR)&_uiData, 0x136, 4, TRUE);
} }
} } else {
else
{
usedIntOutForBulkTransfer = EP4 ; usedIntOutForBulkTransfer = EP4 ;
endpoint = &iface_desc->endpoint[EP4].desc; endpoint = &iface_desc->endpoint[EP4].desc;
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Choosing AltSetting as a default setting"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Choosing AltSetting as a default setting");
if( bcm_usb_endpoint_is_int_out(endpoint) == FALSE) if (bcm_usb_endpoint_is_int_out(endpoint) == FALSE) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, " Dongle does not have BCM16 Fix"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, " Dongle does not have BCM16 Fix");
//change the EP2, EP4 to INT OUT end point and use EP4 in altsetting /* change the EP2, EP4 to INT OUT end point and use EP4 in altsetting */
ConfigureEndPointTypesThroughEEPROM(psIntfAdapter->psAdapter); ConfigureEndPointTypesThroughEEPROM(psIntfAdapter->psAdapter);
/* /*
It resets the device and if any thing gets changed in USB descriptor it will show fail and * It resets the device and if any thing gets changed in
re-enumerate the device * USB descriptor it will show fail and re-enumerate the
* device
*/ */
retval = usb_reset_device(psIntfAdapter->udev); retval = usb_reset_device(psIntfAdapter->udev);
if(retval) if (retval) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "reset got failed. hence Re-enumerating the device \n"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "reset got failed. hence Re-enumerating the device \n");
return retval; return retval;
} }
@ -559,37 +523,29 @@ static int InterfaceAdapterInit(PS_INTERFACE_ADAPTER psIntfAdapter)
iface_desc = psIntfAdapter->interface->cur_altsetting; iface_desc = psIntfAdapter->interface->cur_altsetting;
for (value = 0; value < iface_desc->desc.bNumEndpoints; ++value) for (value = 0; value < iface_desc->desc.bNumEndpoints; ++value) {
{
endpoint = &iface_desc->endpoint[value].desc; endpoint = &iface_desc->endpoint[value].desc;
if (!psIntfAdapter->sBulkIn.bulk_in_endpointAddr && bcm_usb_endpoint_is_bulk_in(endpoint)) if (!psIntfAdapter->sBulkIn.bulk_in_endpointAddr && bcm_usb_endpoint_is_bulk_in(endpoint)) {
{
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
psIntfAdapter->sBulkIn.bulk_in_size = buffer_size; psIntfAdapter->sBulkIn.bulk_in_size = buffer_size;
psIntfAdapter->sBulkIn.bulk_in_endpointAddr = psIntfAdapter->sBulkIn.bulk_in_endpointAddr = endpoint->bEndpointAddress;
endpoint->bEndpointAddress;
psIntfAdapter->sBulkIn.bulk_in_pipe = psIntfAdapter->sBulkIn.bulk_in_pipe =
usb_rcvbulkpipe(psIntfAdapter->udev, usb_rcvbulkpipe(psIntfAdapter->udev,
psIntfAdapter->sBulkIn.bulk_in_endpointAddr); psIntfAdapter->sBulkIn.bulk_in_endpointAddr);
} }
if (!psIntfAdapter->sBulkOut.bulk_out_endpointAddr && bcm_usb_endpoint_is_bulk_out(endpoint)) if (!psIntfAdapter->sBulkOut.bulk_out_endpointAddr && bcm_usb_endpoint_is_bulk_out(endpoint)) {
{ psIntfAdapter->sBulkOut.bulk_out_endpointAddr = endpoint->bEndpointAddress;
psIntfAdapter->sBulkOut.bulk_out_endpointAddr =
endpoint->bEndpointAddress;
psIntfAdapter->sBulkOut.bulk_out_pipe = psIntfAdapter->sBulkOut.bulk_out_pipe =
usb_sndbulkpipe(psIntfAdapter->udev, usb_sndbulkpipe(psIntfAdapter->udev,
psIntfAdapter->sBulkOut.bulk_out_endpointAddr); psIntfAdapter->sBulkOut.bulk_out_endpointAddr);
} }
if (!psIntfAdapter->sIntrIn.int_in_endpointAddr && bcm_usb_endpoint_is_int_in(endpoint)) if (!psIntfAdapter->sIntrIn.int_in_endpointAddr && bcm_usb_endpoint_is_int_in(endpoint)) {
{
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
psIntfAdapter->sIntrIn.int_in_size = buffer_size; psIntfAdapter->sIntrIn.int_in_size = buffer_size;
psIntfAdapter->sIntrIn.int_in_endpointAddr = psIntfAdapter->sIntrIn.int_in_endpointAddr = endpoint->bEndpointAddress;
endpoint->bEndpointAddress;
psIntfAdapter->sIntrIn.int_in_interval = endpoint->bInterval; psIntfAdapter->sIntrIn.int_in_interval = endpoint->bInterval;
psIntfAdapter->sIntrIn.int_in_buffer = psIntfAdapter->sIntrIn.int_in_buffer =
kmalloc(buffer_size, GFP_KERNEL); kmalloc(buffer_size, GFP_KERNEL);
@ -600,35 +556,23 @@ static int InterfaceAdapterInit(PS_INTERFACE_ADAPTER psIntfAdapter)
} }
} }
if (!psIntfAdapter->sIntrOut.int_out_endpointAddr && bcm_usb_endpoint_is_int_out(endpoint)) if (!psIntfAdapter->sIntrOut.int_out_endpointAddr && bcm_usb_endpoint_is_int_out(endpoint)) {
{
if (!psIntfAdapter->sBulkOut.bulk_out_endpointAddr && if (!psIntfAdapter->sBulkOut.bulk_out_endpointAddr &&
(psIntfAdapter->psAdapter->chip_id == T3B) && (value == usedIntOutForBulkTransfer)) (psIntfAdapter->psAdapter->chip_id == T3B) && (value == usedIntOutForBulkTransfer)) {
{ /* use first intout end point as a bulk out end point */
//use first intout end point as a bulk out end point
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
psIntfAdapter->sBulkOut.bulk_out_size = buffer_size; psIntfAdapter->sBulkOut.bulk_out_size = buffer_size;
//printk("\nINT OUT Endpoing buffer size :%x endpoint :%x\n", buffer_size, value +1); psIntfAdapter->sBulkOut.bulk_out_endpointAddr = endpoint->bEndpointAddress;
psIntfAdapter->sBulkOut.bulk_out_endpointAddr = psIntfAdapter->sBulkOut.bulk_out_pipe = usb_sndintpipe(psIntfAdapter->udev,
endpoint->bEndpointAddress;
psIntfAdapter->sBulkOut.bulk_out_pipe =
usb_sndintpipe(psIntfAdapter->udev,
psIntfAdapter->sBulkOut.bulk_out_endpointAddr); psIntfAdapter->sBulkOut.bulk_out_endpointAddr);
psIntfAdapter->sBulkOut.int_out_interval = endpoint->bInterval; psIntfAdapter->sBulkOut.int_out_interval = endpoint->bInterval;
} else if (value == EP6) {
}
else if(value == EP6)
{
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
psIntfAdapter->sIntrOut.int_out_size = buffer_size; psIntfAdapter->sIntrOut.int_out_size = buffer_size;
psIntfAdapter->sIntrOut.int_out_endpointAddr = psIntfAdapter->sIntrOut.int_out_endpointAddr = endpoint->bEndpointAddress;
endpoint->bEndpointAddress;
psIntfAdapter->sIntrOut.int_out_interval = endpoint->bInterval; psIntfAdapter->sIntrOut.int_out_interval = endpoint->bInterval;
psIntfAdapter->sIntrOut.int_out_buffer= kmalloc(buffer_size, psIntfAdapter->sIntrOut.int_out_buffer= kmalloc(buffer_size, GFP_KERNEL);
GFP_KERNEL); if (!psIntfAdapter->sIntrOut.int_out_buffer) {
if (!psIntfAdapter->sIntrOut.int_out_buffer)
{
dev_err(&psIntfAdapter->udev->dev, dev_err(&psIntfAdapter->udev->dev,
"could not allocate interrupt_out_buffer\n"); "could not allocate interrupt_out_buffer\n");
return -EINVAL; return -EINVAL;
@ -636,6 +580,7 @@ static int InterfaceAdapterInit(PS_INTERFACE_ADAPTER psIntfAdapter)
} }
} }
} }
usb_set_intfdata(psIntfAdapter->interface, psIntfAdapter); usb_set_intfdata(psIntfAdapter->interface, psIntfAdapter);
psIntfAdapter->psAdapter->bcm_file_download = InterfaceFileDownload; psIntfAdapter->psAdapter->bcm_file_download = InterfaceFileDownload;
@ -645,19 +590,16 @@ static int InterfaceAdapterInit(PS_INTERFACE_ADAPTER psIntfAdapter)
retval = CreateInterruptUrb(psIntfAdapter); retval = CreateInterruptUrb(psIntfAdapter);
if(retval) if (retval) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Cannot create interrupt urb"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Cannot create interrupt urb");
return retval; return retval;
} }
retval = AllocUsbCb(psIntfAdapter); retval = AllocUsbCb(psIntfAdapter);
if(retval) if (retval) {
{
return retval; return retval;
} }
return device_run(psIntfAdapter); return device_run(psIntfAdapter);
} }
@ -667,24 +609,20 @@ static int InterfaceSuspend (struct usb_interface *intf, pm_message_t message)
psIntfAdapter->bSuspended = TRUE; psIntfAdapter->bSuspended = TRUE;
if(TRUE == psIntfAdapter->bPreparingForBusSuspend) if (TRUE == psIntfAdapter->bPreparingForBusSuspend) {
{
psIntfAdapter->bPreparingForBusSuspend = FALSE; psIntfAdapter->bPreparingForBusSuspend = FALSE;
if(psIntfAdapter->psAdapter->LinkStatus == LINKUP_DONE) if (psIntfAdapter->psAdapter->LinkStatus == LINKUP_DONE) {
{
psIntfAdapter->psAdapter->IdleMode = TRUE ; psIntfAdapter->psAdapter->IdleMode = TRUE ;
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Host Entered in PMU Idle Mode.."); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Host Entered in PMU Idle Mode..");
} } else {
else
{
psIntfAdapter->psAdapter->bShutStatus = TRUE; psIntfAdapter->psAdapter->bShutStatus = TRUE;
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Host Entered in PMU Shutdown Mode.."); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Host Entered in PMU Shutdown Mode..");
} }
} }
psIntfAdapter->psAdapter->bPreparingForLowPowerMode = FALSE; psIntfAdapter->psAdapter->bPreparingForLowPowerMode = FALSE;
//Signaling the control pkt path /* Signaling the control pkt path */
wake_up(&psIntfAdapter->psAdapter->lowpower_mode_wait_queue); wake_up(&psIntfAdapter->psAdapter->lowpower_mode_wait_queue);
return 0; return 0;
@ -717,7 +655,6 @@ static struct usb_driver usbbcm_driver = {
struct class *bcm_class; struct class *bcm_class;
static __init int bcm_init(void) static __init int bcm_init(void)
{ {
printk(KERN_INFO "%s: %s, %s\n", DRV_NAME, DRV_DESCRIPTION, DRV_VERSION); printk(KERN_INFO "%s: %s, %s\n", DRV_NAME, DRV_DESCRIPTION, DRV_VERSION);