diff options
| -rw-r--r-- | drivers/staging/winbond/linux/wb35rx.c | 161 | ||||
| -rw-r--r-- | drivers/staging/winbond/linux/wb35tx.c | 130 | ||||
| -rw-r--r-- | drivers/staging/winbond/linux/wbusb.c | 161 | ||||
| -rw-r--r-- | drivers/staging/winbond/wblinux.c | 188 |
4 files changed, 313 insertions, 327 deletions
diff --git a/drivers/staging/winbond/linux/wb35rx.c b/drivers/staging/winbond/linux/wb35rx.c index c5c331773db9..b4b9f5f371d9 100644 --- a/drivers/staging/winbond/linux/wb35rx.c +++ b/drivers/staging/winbond/linux/wb35rx.c | |||
| @@ -35,51 +35,50 @@ void Wb35Rx( phw_data_t pHwData ) | |||
| 35 | // | 35 | // |
| 36 | // Issuing URB | 36 | // Issuing URB |
| 37 | // | 37 | // |
| 38 | do { | 38 | if (pHwData->SurpriseRemove || pHwData->HwStop) |
| 39 | if (pHwData->SurpriseRemove || pHwData->HwStop) | 39 | goto error; |
| 40 | break; | ||
| 41 | 40 | ||
| 42 | if (pWb35Rx->rx_halt) | 41 | if (pWb35Rx->rx_halt) |
| 43 | break; | 42 | goto error; |
| 44 | 43 | ||
| 45 | // Get RxBuffer's ID | 44 | // Get RxBuffer's ID |
| 46 | RxBufferId = pWb35Rx->RxBufferId; | 45 | RxBufferId = pWb35Rx->RxBufferId; |
| 47 | if (!pWb35Rx->RxOwner[RxBufferId]) { | 46 | if (!pWb35Rx->RxOwner[RxBufferId]) { |
| 48 | // It's impossible to run here. | 47 | // It's impossible to run here. |
| 49 | #ifdef _PE_RX_DUMP_ | 48 | #ifdef _PE_RX_DUMP_ |
| 50 | WBDEBUG(("Rx driver fifo unavailable\n")); | 49 | WBDEBUG(("Rx driver fifo unavailable\n")); |
| 51 | #endif | 50 | #endif |
| 52 | break; | 51 | goto error; |
| 53 | } | 52 | } |
| 54 | 53 | ||
| 55 | // Update buffer point, then start to bulkin the data from USB | 54 | // Update buffer point, then start to bulkin the data from USB |
| 56 | pWb35Rx->RxBufferId++; | 55 | pWb35Rx->RxBufferId++; |
| 57 | pWb35Rx->RxBufferId %= MAX_USB_RX_BUFFER_NUMBER; | 56 | pWb35Rx->RxBufferId %= MAX_USB_RX_BUFFER_NUMBER; |
| 58 | 57 | ||
| 59 | pWb35Rx->CurrentRxBufferId = RxBufferId; | 58 | pWb35Rx->CurrentRxBufferId = RxBufferId; |
| 60 | 59 | ||
| 61 | if (1 != OS_MEMORY_ALLOC((void* *)&pWb35Rx->pDRx, MAX_USB_RX_BUFFER)) { | 60 | if (1 != OS_MEMORY_ALLOC((void* *)&pWb35Rx->pDRx, MAX_USB_RX_BUFFER)) { |
| 62 | printk("w35und: Rx memory alloc failed\n"); | 61 | printk("w35und: Rx memory alloc failed\n"); |
| 63 | break; | 62 | goto error; |
| 64 | } | 63 | } |
| 65 | pRxBufferAddress = pWb35Rx->pDRx; | 64 | pRxBufferAddress = pWb35Rx->pDRx; |
| 66 | 65 | ||
| 67 | usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev, | 66 | usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev, |
| 68 | usb_rcvbulkpipe(pHwData->WbUsb.udev, 3), | 67 | usb_rcvbulkpipe(pHwData->WbUsb.udev, 3), |
| 69 | pRxBufferAddress, MAX_USB_RX_BUFFER, | 68 | pRxBufferAddress, MAX_USB_RX_BUFFER, |
| 70 | Wb35Rx_Complete, pHwData); | 69 | Wb35Rx_Complete, pHwData); |
| 71 | 70 | ||
| 72 | pWb35Rx->EP3vm_state = VM_RUNNING; | 71 | pWb35Rx->EP3vm_state = VM_RUNNING; |
| 73 | 72 | ||
| 74 | retv = wb_usb_submit_urb(pUrb); | 73 | retv = wb_usb_submit_urb(pUrb); |
| 75 | 74 | ||
| 76 | if (retv != 0) { | 75 | if (retv != 0) { |
| 77 | printk("Rx URB sending error\n"); | 76 | printk("Rx URB sending error\n"); |
| 78 | break; | 77 | goto error; |
| 79 | } | 78 | } |
| 80 | return; | 79 | return; |
| 81 | } while(FALSE); | ||
| 82 | 80 | ||
| 81 | error: | ||
| 83 | // VM stop | 82 | // VM stop |
| 84 | pWb35Rx->EP3vm_state = VM_STOP; | 83 | pWb35Rx->EP3vm_state = VM_STOP; |
| 85 | OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Rx->RxFireCounter ); | 84 | OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Rx->RxFireCounter ); |
| @@ -99,65 +98,63 @@ void Wb35Rx_Complete(PURB pUrb) | |||
| 99 | pWb35Rx->EP3vm_state = VM_COMPLETED; | 98 | pWb35Rx->EP3vm_state = VM_COMPLETED; |
| 100 | pWb35Rx->EP3VM_status = pUrb->status;//Store the last result of Irp | 99 | pWb35Rx->EP3VM_status = pUrb->status;//Store the last result of Irp |
| 101 | 100 | ||
| 102 | do { | 101 | RxBufferId = pWb35Rx->CurrentRxBufferId; |
| 103 | RxBufferId = pWb35Rx->CurrentRxBufferId; | ||
| 104 | 102 | ||
| 105 | pRxBufferAddress = pWb35Rx->pDRx; | 103 | pRxBufferAddress = pWb35Rx->pDRx; |
| 106 | BulkLength = (u16)pUrb->actual_length; | 104 | BulkLength = (u16)pUrb->actual_length; |
| 107 | 105 | ||
| 108 | // The IRP is completed | 106 | // The IRP is completed |
| 109 | pWb35Rx->EP3vm_state = VM_COMPLETED; | 107 | pWb35Rx->EP3vm_state = VM_COMPLETED; |
| 110 | 108 | ||
| 111 | if (pHwData->SurpriseRemove || pHwData->HwStop) // Must be here, or RxBufferId is invalid | 109 | if (pHwData->SurpriseRemove || pHwData->HwStop) // Must be here, or RxBufferId is invalid |
| 112 | break; | 110 | goto error; |
| 113 | 111 | ||
| 114 | if (pWb35Rx->rx_halt) | 112 | if (pWb35Rx->rx_halt) |
| 115 | break; | 113 | goto error; |
| 116 | 114 | ||
| 117 | // Start to process the data only in successful condition | 115 | // Start to process the data only in successful condition |
| 118 | pWb35Rx->RxOwner[ RxBufferId ] = 0; // Set the owner to driver | 116 | pWb35Rx->RxOwner[ RxBufferId ] = 0; // Set the owner to driver |
| 119 | R00.value = le32_to_cpu(*(u32 *)pRxBufferAddress); | 117 | R00.value = le32_to_cpu(*(u32 *)pRxBufferAddress); |
| 120 | 118 | ||
| 121 | // The URB is completed, check the result | 119 | // The URB is completed, check the result |
| 122 | if (pWb35Rx->EP3VM_status != 0) { | 120 | if (pWb35Rx->EP3VM_status != 0) { |
| 123 | #ifdef _PE_USB_STATE_DUMP_ | 121 | #ifdef _PE_USB_STATE_DUMP_ |
| 124 | WBDEBUG(("EP3 IoCompleteRoutine return error\n")); | 122 | WBDEBUG(("EP3 IoCompleteRoutine return error\n")); |
| 125 | DebugUsbdStatusInformation( pWb35Rx->EP3VM_status ); | 123 | DebugUsbdStatusInformation( pWb35Rx->EP3VM_status ); |
| 126 | #endif | 124 | #endif |
| 127 | pWb35Rx->EP3vm_state = VM_STOP; | 125 | pWb35Rx->EP3vm_state = VM_STOP; |
| 128 | break; | 126 | goto error; |
| 129 | } | 127 | } |
| 130 | 128 | ||
| 131 | // 20060220 For recovering. check if operating in single USB mode | 129 | // 20060220 For recovering. check if operating in single USB mode |
| 132 | if (!HAL_USB_MODE_BURST(pHwData)) { | 130 | if (!HAL_USB_MODE_BURST(pHwData)) { |
| 133 | SizeCheck = R00.R00_receive_byte_count; //20060926 anson's endian | 131 | SizeCheck = R00.R00_receive_byte_count; //20060926 anson's endian |
| 134 | if ((SizeCheck & 0x03) > 0) | 132 | if ((SizeCheck & 0x03) > 0) |
| 135 | SizeCheck -= 4; | 133 | SizeCheck -= 4; |
| 136 | SizeCheck = (SizeCheck + 3) & ~0x03; | 134 | SizeCheck = (SizeCheck + 3) & ~0x03; |
| 137 | SizeCheck += 12; // 8 + 4 badbeef | 135 | SizeCheck += 12; // 8 + 4 badbeef |
| 138 | if ((BulkLength > 1600) || | 136 | if ((BulkLength > 1600) || |
| 139 | (SizeCheck > 1600) || | 137 | (SizeCheck > 1600) || |
| 140 | (BulkLength != SizeCheck) || | 138 | (BulkLength != SizeCheck) || |
| 141 | (BulkLength == 0)) { // Add for fail Urb | 139 | (BulkLength == 0)) { // Add for fail Urb |
| 142 | pWb35Rx->EP3vm_state = VM_STOP; | 140 | pWb35Rx->EP3vm_state = VM_STOP; |
| 143 | pWb35Rx->Ep3ErrorCount2++; | 141 | pWb35Rx->Ep3ErrorCount2++; |
| 144 | } | ||
| 145 | } | 142 | } |
| 143 | } | ||
| 146 | 144 | ||
| 147 | // Indicating the receiving data | 145 | // Indicating the receiving data |
| 148 | pWb35Rx->ByteReceived += BulkLength; | 146 | pWb35Rx->ByteReceived += BulkLength; |
| 149 | pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength; | 147 | pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength; |
| 150 | |||
| 151 | if (!pWb35Rx->RxOwner[ RxBufferId ]) | ||
| 152 | Wb35Rx_indicate(pHwData); | ||
| 153 | 148 | ||
| 154 | kfree(pWb35Rx->pDRx); | 149 | if (!pWb35Rx->RxOwner[ RxBufferId ]) |
| 155 | // Do the next receive | 150 | Wb35Rx_indicate(pHwData); |
| 156 | Wb35Rx(pHwData); | ||
| 157 | return; | ||
| 158 | 151 | ||
| 159 | } while(FALSE); | 152 | kfree(pWb35Rx->pDRx); |
| 153 | // Do the next receive | ||
| 154 | Wb35Rx(pHwData); | ||
| 155 | return; | ||
| 160 | 156 | ||
| 157 | error: | ||
| 161 | pWb35Rx->RxOwner[ RxBufferId ] = 1; // Set the owner to hardware | 158 | pWb35Rx->RxOwner[ RxBufferId ] = 1; // Set the owner to hardware |
| 162 | OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Rx->RxFireCounter ); | 159 | OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Rx->RxFireCounter ); |
| 163 | pWb35Rx->EP3vm_state = VM_STOP; | 160 | pWb35Rx->EP3vm_state = VM_STOP; |
diff --git a/drivers/staging/winbond/linux/wb35tx.c b/drivers/staging/winbond/linux/wb35tx.c index bcb014a073de..ba9d51244e29 100644 --- a/drivers/staging/winbond/linux/wb35tx.c +++ b/drivers/staging/winbond/linux/wb35tx.c | |||
| @@ -100,25 +100,24 @@ void Wb35Tx_complete(struct urb * pUrb) | |||
| 100 | pWb35Tx->TxSendIndex++; | 100 | pWb35Tx->TxSendIndex++; |
| 101 | pWb35Tx->TxSendIndex %= MAX_USB_TX_BUFFER_NUMBER; | 101 | pWb35Tx->TxSendIndex %= MAX_USB_TX_BUFFER_NUMBER; |
| 102 | 102 | ||
| 103 | do { | 103 | if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove |
| 104 | if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove | 104 | goto error; |
| 105 | break; | ||
| 106 | 105 | ||
| 107 | if (pWb35Tx->tx_halt) | 106 | if (pWb35Tx->tx_halt) |
| 108 | break; | 107 | goto error; |
| 109 | 108 | ||
| 110 | // The URB is completed, check the result | 109 | // The URB is completed, check the result |
| 111 | if (pWb35Tx->EP4VM_status != 0) { | 110 | if (pWb35Tx->EP4VM_status != 0) { |
| 112 | printk("URB submission failed\n"); | 111 | printk("URB submission failed\n"); |
| 113 | pWb35Tx->EP4vm_state = VM_STOP; | 112 | pWb35Tx->EP4vm_state = VM_STOP; |
| 114 | break; // Exit while(FALSE); | 113 | goto error; |
| 115 | } | 114 | } |
| 116 | 115 | ||
| 117 | Mds_Tx(Adapter); | 116 | Mds_Tx(Adapter); |
| 118 | Wb35Tx(pHwData); | 117 | Wb35Tx(pHwData); |
| 119 | return; | 118 | return; |
| 120 | } while(FALSE); | ||
| 121 | 119 | ||
| 120 | error: | ||
| 122 | OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxFireCounter ); | 121 | OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxFireCounter ); |
| 123 | pWb35Tx->EP4vm_state = VM_STOP; | 122 | pWb35Tx->EP4vm_state = VM_STOP; |
| 124 | } | 123 | } |
| @@ -228,33 +227,30 @@ void Wb35Tx_EP2VM(phw_data_t pHwData) | |||
| 228 | u32 * pltmp = (u32 *)pWb35Tx->EP2_buf; | 227 | u32 * pltmp = (u32 *)pWb35Tx->EP2_buf; |
| 229 | int retv; | 228 | int retv; |
| 230 | 229 | ||
| 231 | do { | 230 | if (pHwData->SurpriseRemove || pHwData->HwStop) |
| 232 | if (pHwData->SurpriseRemove || pHwData->HwStop) | 231 | goto error; |
| 233 | break; | ||
| 234 | |||
| 235 | if (pWb35Tx->tx_halt) | ||
| 236 | break; | ||
| 237 | |||
| 238 | // | ||
| 239 | // Issuing URB | ||
| 240 | // | ||
| 241 | usb_fill_int_urb( pUrb, pHwData->WbUsb.udev, usb_rcvintpipe(pHwData->WbUsb.udev,2), | ||
| 242 | pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, pHwData, 32); | ||
| 243 | 232 | ||
| 244 | pWb35Tx->EP2vm_state = VM_RUNNING; | 233 | if (pWb35Tx->tx_halt) |
| 245 | retv = wb_usb_submit_urb( pUrb ); | 234 | goto error; |
| 246 | 235 | ||
| 247 | if(retv < 0) { | 236 | // |
| 248 | #ifdef _PE_TX_DUMP_ | 237 | // Issuing URB |
| 249 | WBDEBUG(("EP2 Tx Irp sending error\n")); | 238 | // |
| 250 | #endif | 239 | usb_fill_int_urb( pUrb, pHwData->WbUsb.udev, usb_rcvintpipe(pHwData->WbUsb.udev,2), |
| 251 | break; | 240 | pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, pHwData, 32); |
| 252 | } | ||
| 253 | 241 | ||
| 254 | return; | 242 | pWb35Tx->EP2vm_state = VM_RUNNING; |
| 243 | retv = wb_usb_submit_urb( pUrb ); | ||
| 255 | 244 | ||
| 256 | } while(FALSE); | 245 | if (retv < 0) { |
| 246 | #ifdef _PE_TX_DUMP_ | ||
| 247 | WBDEBUG(("EP2 Tx Irp sending error\n")); | ||
| 248 | #endif | ||
| 249 | goto error; | ||
| 250 | } | ||
| 257 | 251 | ||
| 252 | return; | ||
| 253 | error: | ||
| 258 | pWb35Tx->EP2vm_state = VM_STOP; | 254 | pWb35Tx->EP2vm_state = VM_STOP; |
| 259 | OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxResultCount ); | 255 | OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxResultCount ); |
| 260 | } | 256 | } |
| @@ -275,38 +271,36 @@ void Wb35Tx_EP2VM_complete(struct urb * pUrb) | |||
| 275 | pWb35Tx->EP2vm_state = VM_COMPLETED; | 271 | pWb35Tx->EP2vm_state = VM_COMPLETED; |
| 276 | pWb35Tx->EP2VM_status = pUrb->status; | 272 | pWb35Tx->EP2VM_status = pUrb->status; |
| 277 | 273 | ||
| 278 | do { | 274 | // For Linux 2.4. Interrupt will always trigger |
| 279 | // For Linux 2.4. Interrupt will always trigger | 275 | if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove |
| 280 | if( pHwData->SurpriseRemove || pHwData->HwStop ) // Let WbWlanHalt to handle surprise remove | 276 | goto error; |
| 281 | break; | 277 | |
| 282 | 278 | if (pWb35Tx->tx_halt) | |
| 283 | if( pWb35Tx->tx_halt ) | 279 | goto error; |
| 284 | break; | 280 | |
| 285 | 281 | //The Urb is completed, check the result | |
| 286 | //The Urb is completed, check the result | 282 | if (pWb35Tx->EP2VM_status != 0) { |
| 287 | if (pWb35Tx->EP2VM_status != 0) { | 283 | WBDEBUG(("EP2 IoCompleteRoutine return error\n")); |
| 288 | WBDEBUG(("EP2 IoCompleteRoutine return error\n")); | 284 | pWb35Tx->EP2vm_state= VM_STOP; |
| 289 | pWb35Tx->EP2vm_state= VM_STOP; | 285 | goto error; |
| 290 | break; // Exit while(FALSE); | 286 | } |
| 291 | } | ||
| 292 | |||
| 293 | // Update the Tx result | ||
| 294 | InterruptInLength = pUrb->actual_length; | ||
| 295 | // Modify for minimum memory access and DWORD alignment. | ||
| 296 | T02.value = cpu_to_le32(pltmp[0]) >> 8; // [31:8] -> [24:0] | ||
| 297 | InterruptInLength -= 1;// 20051221.1.c Modify the follow for more stable | ||
| 298 | InterruptInLength >>= 2; // InterruptInLength/4 | ||
| 299 | for (i=1; i<=InterruptInLength; i++) { | ||
| 300 | T02.value |= ((cpu_to_le32(pltmp[i]) & 0xff) << 24); | ||
| 301 | |||
| 302 | TSTATUS.value = T02.value; //20061009 anson's endian | ||
| 303 | Mds_SendComplete( Adapter, &TSTATUS ); | ||
| 304 | T02.value = cpu_to_le32(pltmp[i]) >> 8; | ||
| 305 | } | ||
| 306 | |||
| 307 | return; | ||
| 308 | } while(FALSE); | ||
| 309 | 287 | ||
| 288 | // Update the Tx result | ||
| 289 | InterruptInLength = pUrb->actual_length; | ||
| 290 | // Modify for minimum memory access and DWORD alignment. | ||
| 291 | T02.value = cpu_to_le32(pltmp[0]) >> 8; // [31:8] -> [24:0] | ||
| 292 | InterruptInLength -= 1;// 20051221.1.c Modify the follow for more stable | ||
| 293 | InterruptInLength >>= 2; // InterruptInLength/4 | ||
| 294 | for (i = 1; i <= InterruptInLength; i++) { | ||
| 295 | T02.value |= ((cpu_to_le32(pltmp[i]) & 0xff) << 24); | ||
| 296 | |||
| 297 | TSTATUS.value = T02.value; //20061009 anson's endian | ||
| 298 | Mds_SendComplete( Adapter, &TSTATUS ); | ||
| 299 | T02.value = cpu_to_le32(pltmp[i]) >> 8; | ||
| 300 | } | ||
| 301 | |||
| 302 | return; | ||
| 303 | error: | ||
| 310 | OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxResultCount ); | 304 | OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxResultCount ); |
| 311 | pWb35Tx->EP2vm_state = VM_STOP; | 305 | pWb35Tx->EP2vm_state = VM_STOP; |
| 312 | } | 306 | } |
diff --git a/drivers/staging/winbond/linux/wbusb.c b/drivers/staging/winbond/linux/wbusb.c index ee9f47103160..e09b2720850b 100644 --- a/drivers/staging/winbond/linux/wbusb.c +++ b/drivers/staging/winbond/linux/wbusb.c | |||
| @@ -218,114 +218,111 @@ int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table) | |||
| 218 | 218 | ||
| 219 | printk("[w35und]wb35_probe ->\n"); | 219 | printk("[w35und]wb35_probe ->\n"); |
| 220 | 220 | ||
| 221 | do { | 221 | for (i=0; i<(sizeof(Id_Table)/sizeof(struct usb_device_id)); i++ ) { |
| 222 | for (i=0; i<(sizeof(Id_Table)/sizeof(struct usb_device_id)); i++ ) { | 222 | if ((udev->descriptor.idVendor == Id_Table[i].idVendor) && |
| 223 | if ((udev->descriptor.idVendor == Id_Table[i].idVendor) && | 223 | (udev->descriptor.idProduct == Id_Table[i].idProduct)) { |
| 224 | (udev->descriptor.idProduct == Id_Table[i].idProduct)) { | 224 | printk("[w35und]Found supported hardware\n"); |
| 225 | printk("[w35und]Found supported hardware\n"); | 225 | break; |
| 226 | break; | ||
| 227 | } | ||
| 228 | } | ||
| 229 | if ((i == (sizeof(Id_Table)/sizeof(struct usb_device_id)))) { | ||
| 230 | #ifdef _PE_USB_INI_DUMP_ | ||
| 231 | WBDEBUG(("[w35und] This is not the one we are interested about\n")); | ||
| 232 | #endif | ||
| 233 | return -ENODEV; | ||
| 234 | } | 226 | } |
| 227 | } | ||
| 235 | 228 | ||
| 236 | // 20060630.2 Check the device if it already be opened | 229 | if ((i == (sizeof(Id_Table)/sizeof(struct usb_device_id)))) { |
| 237 | ret = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ), | 230 | #ifdef _PE_USB_INI_DUMP_ |
| 238 | 0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN, | 231 | WBDEBUG(("[w35und] This is not the one we are interested about\n")); |
| 239 | 0x0, 0x400, <mp, 4, HZ*100 ); | 232 | #endif |
| 240 | if( ret < 0 ) | 233 | return -ENODEV; |
| 241 | break; | 234 | } |
| 242 | 235 | ||
| 243 | ltmp = cpu_to_le32(ltmp); | 236 | // 20060630.2 Check the device if it already be opened |
| 244 | if (ltmp) // Is already initialized? | 237 | ret = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ), |
| 245 | break; | 238 | 0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN, |
| 239 | 0x0, 0x400, <mp, 4, HZ*100 ); | ||
| 240 | if (ret < 0) | ||
| 241 | goto error; | ||
| 246 | 242 | ||
| 243 | ltmp = cpu_to_le32(ltmp); | ||
| 244 | if (ltmp) // Is already initialized? | ||
| 245 | goto error; | ||
| 247 | 246 | ||
| 248 | Adapter = kzalloc(sizeof(ADAPTER), GFP_KERNEL); | 247 | Adapter = kzalloc(sizeof(ADAPTER), GFP_KERNEL); |
| 249 | 248 | ||
| 250 | my_adapter = Adapter; | 249 | my_adapter = Adapter; |
| 251 | pWbLinux = &Adapter->WbLinux; | 250 | pWbLinux = &Adapter->WbLinux; |
| 252 | pWbUsb = &Adapter->sHwData.WbUsb; | 251 | pWbUsb = &Adapter->sHwData.WbUsb; |
| 253 | pWbUsb->udev = udev; | 252 | pWbUsb->udev = udev; |
| 254 | 253 | ||
| 255 | interface = intf->cur_altsetting; | 254 | interface = intf->cur_altsetting; |
| 256 | endpoint = &interface->endpoint[0].desc; | 255 | endpoint = &interface->endpoint[0].desc; |
| 257 | 256 | ||
| 258 | if (endpoint[2].wMaxPacketSize == 512) { | 257 | if (endpoint[2].wMaxPacketSize == 512) { |
| 259 | printk("[w35und] Working on USB 2.0\n"); | 258 | printk("[w35und] Working on USB 2.0\n"); |
| 260 | pWbUsb->IsUsb20 = 1; | 259 | pWbUsb->IsUsb20 = 1; |
| 261 | } | 260 | } |
| 262 | 261 | ||
| 263 | if (!WbWLanInitialize(Adapter)) { | 262 | if (!WbWLanInitialize(Adapter)) { |
| 264 | printk("[w35und]WbWLanInitialize fail\n"); | 263 | printk("[w35und]WbWLanInitialize fail\n"); |
| 265 | break; | 264 | goto error; |
| 266 | } | 265 | } |
| 267 | 266 | ||
| 268 | { | 267 | { |
| 269 | struct wbsoft_priv *priv; | 268 | struct wbsoft_priv *priv; |
| 270 | struct ieee80211_hw *dev; | 269 | struct ieee80211_hw *dev; |
| 271 | int res; | 270 | int res; |
| 272 | 271 | ||
| 273 | dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops); | 272 | dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops); |
| 274 | 273 | ||
| 275 | if (!dev) { | 274 | if (!dev) { |
| 276 | printk("w35und: ieee80211 alloc failed\n" ); | 275 | printk("w35und: ieee80211 alloc failed\n" ); |
| 277 | BUG(); | 276 | BUG(); |
| 278 | } | 277 | } |
| 279 | 278 | ||
| 280 | my_dev = dev; | 279 | my_dev = dev; |
| 281 | 280 | ||
| 282 | SET_IEEE80211_DEV(dev, &udev->dev); | 281 | SET_IEEE80211_DEV(dev, &udev->dev); |
| 283 | { | 282 | { |
| 284 | phw_data_t pHwData = &Adapter->sHwData; | 283 | phw_data_t pHwData = &Adapter->sHwData; |
| 285 | unsigned char dev_addr[MAX_ADDR_LEN]; | 284 | unsigned char dev_addr[MAX_ADDR_LEN]; |
| 286 | hal_get_permanent_address(pHwData, dev_addr); | 285 | hal_get_permanent_address(pHwData, dev_addr); |
| 287 | SET_IEEE80211_PERM_ADDR(dev, dev_addr); | 286 | SET_IEEE80211_PERM_ADDR(dev, dev_addr); |
| 288 | } | 287 | } |
| 289 | 288 | ||
| 290 | 289 | ||
| 291 | dev->extra_tx_headroom = 12; /* FIXME */ | 290 | dev->extra_tx_headroom = 12; /* FIXME */ |
| 292 | dev->flags = 0; | 291 | dev->flags = 0; |
| 293 | 292 | ||
| 294 | dev->channel_change_time = 1000; | 293 | dev->channel_change_time = 1000; |
| 295 | // dev->max_rssi = 100; | 294 | // dev->max_rssi = 100; |
| 296 | 295 | ||
| 297 | dev->queues = 1; | 296 | dev->queues = 1; |
| 298 | 297 | ||
| 299 | static struct ieee80211_supported_band band; | 298 | static struct ieee80211_supported_band band; |
| 300 | 299 | ||
| 301 | band.channels = wbsoft_channels; | 300 | band.channels = wbsoft_channels; |
| 302 | band.n_channels = ARRAY_SIZE(wbsoft_channels); | 301 | band.n_channels = ARRAY_SIZE(wbsoft_channels); |
| 303 | band.bitrates = wbsoft_rates; | 302 | band.bitrates = wbsoft_rates; |
| 304 | band.n_bitrates = ARRAY_SIZE(wbsoft_rates); | 303 | band.n_bitrates = ARRAY_SIZE(wbsoft_rates); |
| 305 | 304 | ||
| 306 | dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band; | 305 | dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band; |
| 307 | #if 0 | 306 | #if 0 |
| 308 | wbsoft_modes[0].num_channels = 1; | 307 | wbsoft_modes[0].num_channels = 1; |
| 309 | wbsoft_modes[0].channels = wbsoft_channels; | 308 | wbsoft_modes[0].channels = wbsoft_channels; |
| 310 | wbsoft_modes[0].mode = MODE_IEEE80211B; | 309 | wbsoft_modes[0].mode = MODE_IEEE80211B; |
| 311 | wbsoft_modes[0].num_rates = ARRAY_SIZE(wbsoft_rates); | 310 | wbsoft_modes[0].num_rates = ARRAY_SIZE(wbsoft_rates); |
| 312 | wbsoft_modes[0].rates = wbsoft_rates; | 311 | wbsoft_modes[0].rates = wbsoft_rates; |
| 313 | 312 | ||
| 314 | res = ieee80211_register_hwmode(dev, &wbsoft_modes[0]); | 313 | res = ieee80211_register_hwmode(dev, &wbsoft_modes[0]); |
| 315 | BUG_ON(res); | 314 | BUG_ON(res); |
| 316 | #endif | 315 | #endif |
| 317 | 316 | ||
| 318 | res = ieee80211_register_hw(dev); | 317 | res = ieee80211_register_hw(dev); |
| 319 | BUG_ON(res); | 318 | BUG_ON(res); |
| 320 | } | 319 | } |
| 321 | |||
| 322 | usb_set_intfdata( intf, Adapter ); | ||
| 323 | |||
| 324 | printk("[w35und] _probe OK\n"); | ||
| 325 | return 0; | ||
| 326 | 320 | ||
| 327 | } while(FALSE); | 321 | usb_set_intfdata( intf, Adapter ); |
| 328 | 322 | ||
| 323 | printk("[w35und] _probe OK\n"); | ||
| 324 | return 0; | ||
| 325 | error: | ||
| 329 | return -ENOMEM; | 326 | return -ENOMEM; |
| 330 | } | 327 | } |
| 331 | 328 | ||
diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c index 186ad6029c7b..4ed45e488318 100644 --- a/drivers/staging/winbond/wblinux.c +++ b/drivers/staging/winbond/wblinux.c | |||
| @@ -147,114 +147,112 @@ WbWLanInitialize(PADAPTER Adapter) | |||
| 147 | u8 EEPROM_region; | 147 | u8 EEPROM_region; |
| 148 | u8 HwRadioOff; | 148 | u8 HwRadioOff; |
| 149 | 149 | ||
| 150 | do { | 150 | // |
| 151 | // | 151 | // Setting default value for Linux |
| 152 | // Setting default value for Linux | 152 | // |
| 153 | // | 153 | Adapter->sLocalPara.region_INF = REGION_AUTO; |
| 154 | Adapter->sLocalPara.region_INF = REGION_AUTO; | 154 | Adapter->sLocalPara.TxRateMode = RATE_AUTO; |
| 155 | Adapter->sLocalPara.TxRateMode = RATE_AUTO; | 155 | psLOCAL->bMacOperationMode = MODE_802_11_BG; // B/G mode |
| 156 | psLOCAL->bMacOperationMode = MODE_802_11_BG; // B/G mode | 156 | Adapter->Mds.TxRTSThreshold = DEFAULT_RTSThreshold; |
| 157 | Adapter->Mds.TxRTSThreshold = DEFAULT_RTSThreshold; | 157 | Adapter->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; |
| 158 | Adapter->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; | 158 | hal_set_phy_type( &Adapter->sHwData, RF_WB_242_1 ); |
| 159 | hal_set_phy_type( &Adapter->sHwData, RF_WB_242_1 ); | 159 | Adapter->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE; |
| 160 | Adapter->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE; | 160 | psLOCAL->bPreambleMode = AUTO_MODE; |
| 161 | psLOCAL->bPreambleMode = AUTO_MODE; | 161 | Adapter->sLocalPara.RadioOffStatus.boSwRadioOff = FALSE; |
| 162 | Adapter->sLocalPara.RadioOffStatus.boSwRadioOff = FALSE; | 162 | pHwData = &Adapter->sHwData; |
| 163 | pHwData = &Adapter->sHwData; | 163 | hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); |
| 164 | hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); | 164 | |
| 165 | 165 | // | |
| 166 | // | 166 | // Initial each module and variable |
| 167 | // Initial each module and variable | 167 | // |
| 168 | // | 168 | if (!WBLINUX_Initial(Adapter)) { |
| 169 | if (!WBLINUX_Initial(Adapter)) { | ||
| 170 | #ifdef _PE_USB_INI_DUMP_ | 169 | #ifdef _PE_USB_INI_DUMP_ |
| 171 | WBDEBUG(("[w35und]WBNDIS initialization failed\n")); | 170 | WBDEBUG(("[w35und]WBNDIS initialization failed\n")); |
| 172 | #endif | 171 | #endif |
| 173 | break; | 172 | goto error; |
| 174 | } | 173 | } |
| 175 | 174 | ||
| 176 | // Initial Software variable | 175 | // Initial Software variable |
| 177 | Adapter->sLocalPara.ShutDowned = FALSE; | 176 | Adapter->sLocalPara.ShutDowned = FALSE; |
| 178 | 177 | ||
| 179 | //added by ws for wep key error detection | 178 | //added by ws for wep key error detection |
| 180 | Adapter->sLocalPara.bWepKeyError= FALSE; | 179 | Adapter->sLocalPara.bWepKeyError= FALSE; |
| 181 | Adapter->sLocalPara.bToSelfPacketReceived = FALSE; | 180 | Adapter->sLocalPara.bToSelfPacketReceived = FALSE; |
| 182 | Adapter->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds | 181 | Adapter->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds |
| 183 | 182 | ||
| 184 | // Initial USB hal | 183 | // Initial USB hal |
| 185 | InitStep = 1; | 184 | InitStep = 1; |
| 186 | pHwData = &Adapter->sHwData; | 185 | pHwData = &Adapter->sHwData; |
| 187 | if (!hal_init_hardware(pHwData, Adapter)) | 186 | if (!hal_init_hardware(pHwData, Adapter)) |
| 188 | break; | 187 | goto error; |
| 189 | 188 | ||
| 190 | EEPROM_region = hal_get_region_from_EEPROM( pHwData ); | 189 | EEPROM_region = hal_get_region_from_EEPROM( pHwData ); |
| 191 | if (EEPROM_region != REGION_AUTO) | 190 | if (EEPROM_region != REGION_AUTO) |
| 192 | psLOCAL->region = EEPROM_region; | 191 | psLOCAL->region = EEPROM_region; |
| 193 | else { | 192 | else { |
| 194 | if (psLOCAL->region_INF != REGION_AUTO) | 193 | if (psLOCAL->region_INF != REGION_AUTO) |
| 195 | psLOCAL->region = psLOCAL->region_INF; | 194 | psLOCAL->region = psLOCAL->region_INF; |
| 196 | else | 195 | else |
| 197 | psLOCAL->region = REGION_USA; //default setting | 196 | psLOCAL->region = REGION_USA; //default setting |
| 198 | } | 197 | } |
| 199 | 198 | ||
| 200 | // Get Software setting flag from hal | 199 | // Get Software setting flag from hal |
| 201 | Adapter->sLocalPara.boAntennaDiversity = FALSE; | 200 | Adapter->sLocalPara.boAntennaDiversity = FALSE; |
| 202 | if (hal_software_set(pHwData) & 0x00000001) | 201 | if (hal_software_set(pHwData) & 0x00000001) |
| 203 | Adapter->sLocalPara.boAntennaDiversity = TRUE; | 202 | Adapter->sLocalPara.boAntennaDiversity = TRUE; |
| 204 | 203 | ||
| 205 | // | 204 | // |
| 206 | // For TS module | 205 | // For TS module |
| 207 | // | 206 | // |
| 208 | InitStep = 2; | 207 | InitStep = 2; |
| 209 | 208 | ||
| 210 | // For MDS module | 209 | // For MDS module |
| 211 | InitStep = 3; | 210 | InitStep = 3; |
| 212 | Mds_initial(Adapter); | 211 | Mds_initial(Adapter); |
| 213 | 212 | ||
| 214 | //======================================= | 213 | //======================================= |
| 215 | // Initialize the SME, SCAN, MLME, ROAM | 214 | // Initialize the SME, SCAN, MLME, ROAM |
| 216 | //======================================= | 215 | //======================================= |
| 217 | InitStep = 4; | 216 | InitStep = 4; |
| 218 | InitStep = 5; | 217 | InitStep = 5; |
| 219 | InitStep = 6; | 218 | InitStep = 6; |
| 220 | 219 | ||
| 221 | // If no user-defined address in the registry, use the addresss "burned" on the NIC instead. | 220 | // If no user-defined address in the registry, use the addresss "burned" on the NIC instead. |
| 222 | pMacAddr = Adapter->sLocalPara.ThisMacAddress; | 221 | pMacAddr = Adapter->sLocalPara.ThisMacAddress; |
| 223 | pMacAddr2 = Adapter->sLocalPara.PermanentAddress; | 222 | pMacAddr2 = Adapter->sLocalPara.PermanentAddress; |
| 224 | hal_get_permanent_address( pHwData, Adapter->sLocalPara.PermanentAddress );// Reading ethernet address from EEPROM | 223 | hal_get_permanent_address( pHwData, Adapter->sLocalPara.PermanentAddress );// Reading ethernet address from EEPROM |
| 225 | if (OS_MEMORY_COMPARE(pMacAddr, "\x00\x00\x00\x00\x00\x00", MAC_ADDR_LENGTH )) // Is equal | 224 | if (OS_MEMORY_COMPARE(pMacAddr, "\x00\x00\x00\x00\x00\x00", MAC_ADDR_LENGTH )) // Is equal |
| 226 | { | 225 | { |
| 227 | memcpy( pMacAddr, pMacAddr2, MAC_ADDR_LENGTH ); | 226 | memcpy( pMacAddr, pMacAddr2, MAC_ADDR_LENGTH ); |
| 228 | } else { | 227 | } else { |
| 229 | // Set the user define MAC address | 228 | // Set the user define MAC address |
| 230 | hal_set_ethernet_address( pHwData, Adapter->sLocalPara.ThisMacAddress ); | 229 | hal_set_ethernet_address( pHwData, Adapter->sLocalPara.ThisMacAddress ); |
| 231 | } | 230 | } |
| 232 | 231 | ||
| 233 | //get current antenna | 232 | //get current antenna |
| 234 | psLOCAL->bAntennaNo = hal_get_antenna_number(pHwData); | 233 | psLOCAL->bAntennaNo = hal_get_antenna_number(pHwData); |
| 235 | #ifdef _PE_STATE_DUMP_ | 234 | #ifdef _PE_STATE_DUMP_ |
| 236 | WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo)); | 235 | WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo)); |
| 237 | #endif | 236 | #endif |
| 238 | hal_get_hw_radio_off( pHwData ); | 237 | hal_get_hw_radio_off( pHwData ); |
| 239 | 238 | ||
| 240 | // Waiting for HAL setting OK | 239 | // Waiting for HAL setting OK |
| 241 | while (!hal_idle(pHwData)) | 240 | while (!hal_idle(pHwData)) |
| 242 | OS_SLEEP(10000); | 241 | OS_SLEEP(10000); |
| 243 | 242 | ||
| 244 | MTO_Init(Adapter); | 243 | MTO_Init(Adapter); |
| 245 | 244 | ||
| 246 | HwRadioOff = hal_get_hw_radio_off( pHwData ); | 245 | HwRadioOff = hal_get_hw_radio_off( pHwData ); |
| 247 | psLOCAL->RadioOffStatus.boHwRadioOff = !!HwRadioOff; | 246 | psLOCAL->RadioOffStatus.boHwRadioOff = !!HwRadioOff; |
| 248 | 247 | ||
| 249 | hal_set_radio_mode( pHwData, (unsigned char)(psLOCAL->RadioOffStatus.boSwRadioOff || psLOCAL->RadioOffStatus.boHwRadioOff) ); | 248 | hal_set_radio_mode( pHwData, (unsigned char)(psLOCAL->RadioOffStatus.boSwRadioOff || psLOCAL->RadioOffStatus.boHwRadioOff) ); |
| 250 | 249 | ||
| 251 | hal_driver_init_OK(pHwData) = 1; // Notify hal that the driver is ready now. | 250 | hal_driver_init_OK(pHwData) = 1; // Notify hal that the driver is ready now. |
| 252 | //set a tx power for reference..... | 251 | //set a tx power for reference..... |
| 253 | // sme_set_tx_power_level(Adapter, 12); FIXME? | 252 | // sme_set_tx_power_level(Adapter, 12); FIXME? |
| 254 | return TRUE; | 253 | return TRUE; |
| 255 | } | ||
| 256 | while(FALSE); | ||
| 257 | 254 | ||
| 255 | error: | ||
| 258 | switch (InitStep) { | 256 | switch (InitStep) { |
| 259 | case 5: | 257 | case 5: |
| 260 | case 4: | 258 | case 4: |
