Add in "The Tivo patch" for USB wonkyness.

This commit is contained in:
solomon 2002-05-14 18:23:07 +00:00
parent 79fef1e21e
commit b0b8bc0aa8
4 changed files with 76 additions and 24 deletions

View file

@ -43,6 +43,8 @@
* --------------------------------------------------------------------
0.1.14
-pre3
- Applied Mike Klar's USB patch that adds support for the MIPS
target and should, among other things, fix WEP under USB.
- Added Remy Cool's patch to add the Dynalink prism2 card ids.
- Tim Miller's pcmcia script install path patch
- Applied Tim Fletcher's patch to allow compilation against

1
THANKS
View file

@ -83,6 +83,7 @@ Josh Wyatt <Josh.Wyatt@hcssystems.com>
Tim Fletcher <tim@parrswood.manchester.sch.uk>
Tim Miller <tim.miller@vanderbilt.edu>
Remy Cool <remy.cool@smartology.nl>
Mike Klar <mfklar@tivo.com>
[Many, many more. If I've overlooked you and you want to be listed here,
send me e-mail and I'll fix it. I _know_ a bunch of linux-wlan contributors

View file

@ -58,12 +58,14 @@
#define WLAN_Ix96 3
#define WLAN_ARM 4
#define WLAN_ALPHA 5
#define WLAN_MIPS 6
/* WLAN_CPU_CORE */
#define WLAN_I386CORE 1
#define WLAN_PPCCORE 2
#define WLAN_I296 3
#define WLAN_ARMCORE 4
#define WLAN_ALPHACORE 5
#define WLAN_MIPSCORE 6
/* WLAN_CPU_PART */
#define WLAN_I386PART 1
#define WLAN_MPC860 2
@ -72,6 +74,7 @@
#define WLAN_PPCPART 5
#define WLAN_ARMPART 6
#define WLAN_ALPHAPART 7
#define WLAN_MIPSPART 8
/* WLAN_SYSARCH */
#define WLAN_PCAT 1
#define WLAN_MBX 2
@ -81,6 +84,7 @@
#define WLAN_SKIFF 6
#define WLAN_BITSY 7
#define WLAN_ALPHAARCH 7
#define WLAN_MIPSARCH 9
/* WLAN_OS */
#define WLAN_LINUX_KERNEL 1
#define WLAN_LINUX_USER 2
@ -145,6 +149,11 @@
#define WLAN_CPU_CORE WLAN_ALPHACORE
#define WLAN_CPU_PART WLAN_ALPHAPART
#define WLAN_SYSARCH WLAN_ALPHAARCH
#elif defined(__mips__)
#define WLAN_CPU_FAMILY WLAN_MIPS
#define WLAN_CPU_CORE WLAN_MIPSCORE
#define WLAN_CPU_PART WLAN_MIPSPART
#define WLAN_SYSARCH WLAN_MIPSARCH
#else
#error "No CPU identified!"
#endif
@ -174,6 +183,11 @@
#define WLAN_CPU_CORE WLAN_ARMCORE
#define WLAN_CPU_PART WLAN_ARM_PART
#define WLAN_SYSARCH WLAN_SKIFF
#elif defined(__mips__)
#define WLAN_CPU_FAMILY WLAN_MIPS
#define WLAN_CPU_CORE WLAN_MIPSCORE
#define WLAN_CPU_PART WLAN_MIPSPART
#define WLAN_SYSARCH WLAN_MIPSARCH
#else
#error "No CPU identified!"
#endif
@ -654,6 +668,22 @@ typedef signed int INT;
#define wlan_inl_le32_to_cpu(a) inl((a))
#define wlan_inl_be32_to_cpu(a) (__be32_to_cpu(inl((a))))
#define wlan_outb(v,a) outb((v),(a))
#define wlan_outw(v,a) outw((v),(a))
#define wlan_outw_cpu_to_le16(v,a) outw((v),(a))
#define wlan_outw_cpu_to_be16(v,a) outw(__cpu_to_be16((v)), (a))
#define wlan_outl(v,a) outl((v),(a))
#define wlan_outl_cpu_to_le32(v,a) outl((v),(a))
#define wlan_outl_cpu_to_be32(v,a) outl(__cpu_to_be32((v)), (a))
#elif (WLAN_OS == WLAN_LINUX_KERNEL && WLAN_CPU_FAMILY == WLAN_MIPS)
#define wlan_inb(a) inb((a))
#define wlan_inw(a) inw((a))
#define wlan_inw_le16_to_cpu(a) inw((a))
#define wlan_inw_be16_to_cpu(a) (__be16_to_cpu(inw((a))))
#define wlan_inl(a) inl((a))
#define wlan_inl_le32_to_cpu(a) inl((a))
#define wlan_inl_be32_to_cpu(a) (__be32_to_cpu(inl((a))))
#define wlan_outb(v,a) outb((v),(a))
#define wlan_outw(v,a) outw((v),(a))
#define wlan_outw_cpu_to_le16(v,a) outw((v),(a))

View file

@ -160,7 +160,7 @@
/*================================================================*/
/* Local Macros */
#define ROUNDUP64(a) (((a)%64)?((((a)/64)*64)+64):(a))
#define ROUNDUP64(a) (((a)+63)&~63)
/*================================================================*/
/* Local Types */
@ -1167,7 +1167,7 @@ hfa384x_docmd(
usb_sndbulkpipe(hw->usb, 2),
&(ctlx->outbuf), ROUNDUP64(sizeof(ctlx->outbuf.cmdreq)),
hfa384x_usbout_callback, hw->usbcontext);
ctlx->outurb.transfer_flags |= USB_ASYNC_UNLINK;
ctlx->outurb.transfer_flags |= USB_ASYNC_UNLINK | USB_QUEUE_BULK;
if ( wait ) {
hfa384x_usbctlx_submit_wait(hw, ctlx);
@ -1298,7 +1298,7 @@ hfa384x_dorrid(
usb_sndbulkpipe(hw->usb, 2),
&(ctlx->outbuf), ROUNDUP64(sizeof(ctlx->outbuf.rridreq)),
hfa384x_usbout_callback, hw->usbcontext);
ctlx->outurb.transfer_flags |= USB_ASYNC_UNLINK;
ctlx->outurb.transfer_flags |= USB_ASYNC_UNLINK | USB_QUEUE_BULK;
/* Submit the CTLX */
if ( wait ) {
@ -1417,8 +1417,8 @@ hfa384x_dowrid(
/* Initialize the command */
ctlx->outbuf.wridreq.type = host2hfa384x_16(HFA384x_USB_WRIDREQ);
ctlx->outbuf.wridreq.frmlen = host2hfa384x_16(
sizeof(ctlx->outbuf.rridreq.rid) +
riddatalen);
(sizeof(ctlx->outbuf.rridreq.rid) +
riddatalen + 1) / 2);
ctlx->outbuf.wridreq.rid = host2hfa384x_16(rid);
memcpy(ctlx->outbuf.wridreq.data, riddata, riddatalen);
@ -1432,7 +1432,7 @@ hfa384x_dowrid(
riddatalen),
hfa384x_usbout_callback,
hw->usbcontext);
ctlx->outurb.transfer_flags |= USB_ASYNC_UNLINK;
ctlx->outurb.transfer_flags |= USB_ASYNC_UNLINK | USB_QUEUE_BULK;
/* Submit the CTLX */
if ( wait ) {
@ -1567,7 +1567,7 @@ hfa384x_dormem(
usb_sndbulkpipe(hw->usb, 2),
&(ctlx->outbuf), ROUNDUP64(sizeof(ctlx->outbuf.rmemreq)),
hfa384x_usbout_callback, hw->usbcontext);
ctlx->outurb.transfer_flags |= USB_ASYNC_UNLINK;
ctlx->outurb.transfer_flags |= USB_ASYNC_UNLINK | USB_QUEUE_BULK;
if ( wait ) {
hfa384x_usbctlx_submit_wait(hw, ctlx);
@ -1700,7 +1700,7 @@ hfa384x_dowmem(
len),
hfa384x_usbout_callback,
hw->usbcontext);
ctlx->outurb.transfer_flags |= USB_ASYNC_UNLINK;
ctlx->outurb.transfer_flags |= USB_ASYNC_UNLINK | USB_QUEUE_BULK;
if ( wait ) {
hfa384x_usbctlx_submit_wait(hw, ctlx);
@ -2964,6 +2964,15 @@ int hfa384x_drvr_start(hfa384x_t *hw)
int result = 0;
DBFENTER;
if (usb_clear_halt(hw->usb, usb_rcvbulkpipe(hw->usb, 1))) {
WLAN_LOG_ERROR0(__FUNCTION__
": Failed to reset bulk in endpoint.\n");
}
if (usb_clear_halt(hw->usb, usb_sndbulkpipe(hw->usb, 2))) {
WLAN_LOG_ERROR0(__FUNCTION__
": Failed to reset bulk out endpoint.\n");
}
/* Post the IN urb */
if (!hw->rxurb_posted) {
/* Post the rx urb */
@ -3046,6 +3055,8 @@ hfa384x_drvr_stop(hfa384x_t *hw)
/* TODO: Make sure there aren't any layabout tx urbs or ctlx urbs
* for now, we assume there aren't.
* XXXXX fixme?
* MFK: that's apparently what's causing panic on hot-unplug...
*/
DBFEXIT;
return result;
@ -3136,10 +3147,12 @@ int hfa384x_drvr_txframe(hfa384x_t *hw, wlan_pb_t *pb )
hw->txbuff.type = host2hfa384x_16(HFA384x_USB_TXFRM);
/* Set up the sw_support field to identify this frame */
hw->txbuff.txfrm.desc.sw_support = 0x0123;
hw->txbuff.txfrm.desc.sw_support = host2hfa384x_32(0x0123);
/* Tx complete and Tx exception disable per dleach. Might be causing
* buf depletion
* XXXX fixme?
* MFK: on USB, it will also eat up the USB bus bandwidth...
*/
#if 0
hw->txbuff.txfrm.desc.tx_control =
@ -3180,6 +3193,7 @@ int hfa384x_drvr_txframe(hfa384x_t *hw, wlan_pb_t *pb )
usb_sndbulkpipe(hw->usb, 2),
&(hw->txbuff), ROUNDUP64(usbpktlen),
hfa384x_usbout_callback, hw->usbcontext);
hw->tx_urb.transfer_flags |= USB_QUEUE_BULK;
if ( (result = usb_submit_urb(&hw->tx_urb)) ) {
WLAN_LOG_ERROR1(__FUNCTION__
@ -3423,7 +3437,7 @@ void hfa384x_usbctlx_complete(hfa384x_usbctlx_t *ctlx)
if ( ! ctlx->is_async ) {
wake_up_interruptible(&ctlx->waitq);
} else {
switch(ctlx->outbuf.type) {
switch(hfa384x2host_16(ctlx->outbuf.type)) {
case HFA384x_USB_CMDREQ:
hfa384x_cbcmd(hw, ctlx);
break;
@ -3669,6 +3683,7 @@ void hfa384x_usbin_callback(struct urb *urb)
hfa384x_t *hw = priv->hw;
hfa384x_usbin_t *usbin = urb->transfer_buffer;
int result;
UINT16 type;
#if 0
{
@ -3688,9 +3703,12 @@ void hfa384x_usbin_callback(struct urb *urb)
case -EPIPE:
WLAN_LOG_DEBUG0(3,
"status=-EPIPE, assuming stall, try to clear\n");
/* XXXX FIXME */
#if 0 /* usb_clear_halt cannot be called from interrupt context, it blocks */
if (usb_clear_halt(hw->usb, usb_rcvbulkpipe(hw->usb, 1))) {
WLAN_LOG_DEBUG0(3,"usb_clear_halt() failed.\n");
}
#endif
goto resubmit;
break;
case -EILSEQ:
@ -3720,17 +3738,18 @@ handle:
* Note2: The txframe function is not currently setting the TxCompl
* or TxExc bits so we should never get TXFRM type IN URBs.
*/
if (HFA384x_USB_ISTXFRM(usbin->type) ||
usbin->txfrm.desc.sw_support == 0x0123) {
type = hfa384x2host_16(usbin->type);
if (HFA384x_USB_ISTXFRM(type) ||
usbin->txfrm.desc.sw_support == host2hfa384x_32(0x0123)) {
hfa384x_usbin_txcompl(wlandev, usbin);
goto resubmit;
}
if (HFA384x_USB_ISRXFRM(usbin->type)) {
if (HFA384x_USB_ISRXFRM(type)) {
hfa384x_usbin_rx(wlandev, usbin);
goto resubmit;
}
switch (usbin->type) {
switch (type) {
case HFA384x_USB_INFOFRM:
hfa384x_usbin_info(wlandev, usbin);
goto resubmit;
@ -3807,7 +3826,7 @@ void hfa384x_usbin_ctlx(wlandevice_t *wlandev, struct urb *urb)
DBFENTER;
/* If the queue is empty or type doesn't match head ctlx */
if ( hw->ctlxq.head == NULL ||
hw->ctlxq.head->outbuf.type != (usbin->type&~0x8000) ) {
hw->ctlxq.head->outbuf.type != (usbin->type&~host2hfa384x_16(0x8000)) ) {
/* else, type doesn't match */
/* ignore it */
WLAN_LOG_WARNING0(
@ -4065,10 +4084,9 @@ done:
----------------------------------------------------------------*/
void hfa384x_usbin_info(wlandevice_t *wlandev, hfa384x_usbin_t *usbin)
{
hfa384x_InfFrame_t inf;
DBFENTER;
usbin->infofrm.info.framelen = hfa384x2host_16(inf.framelen);
usbin->infofrm.info.framelen = hfa384x2host_16(usbin->infofrm.info.framelen);
prism2sta_ev_info(wlandev, &usbin->infofrm.info);
DBFEXIT;
@ -4109,7 +4127,7 @@ void hfa384x_usbout_callback(struct urb *urb)
#endif
/* Handle a successful usbout packet */
switch (usbout->type) {
switch (hfa384x2host_16(usbout->type)) {
case HFA384x_USB_TXFRM:
hfa384x_usbout_tx(wlandev, usbout);
break;
@ -4190,6 +4208,8 @@ void hfa384x_usbout_callback(struct urb *urb)
/* Set state to REQ_FAILED */
ctlx->state = HFA384x_USBCTLX_REQ_FAILED;
/* fall through */
case HFA384x_USBCTLX_REQ_TIMEOUT:
/* Call the completion handler */
hfa384x_usbctlx_complete(ctlx);
break;
@ -4198,7 +4218,6 @@ void hfa384x_usbout_callback(struct urb *urb)
case HFA384x_USBCTLX_REQ_COMPLETE:
case HFA384x_USBCTLX_START:
case HFA384x_USBCTLX_QUEUED:
case HFA384x_USBCTLX_REQ_TIMEOUT:
case HFA384x_USBCTLX_REQ_FAILED:
case HFA384x_USBCTLX_RESP_TIMEOUT:
case HFA384x_USBCTLX_REQSUBMIT_FAIL:
@ -4274,6 +4293,11 @@ hfa384x_usbctlx_reqtimerfn(unsigned long data)
/* Unlink the OUT URB */
if ( ctlx->outurb.status == -EINPROGRESS ) {
/* Set the state to REQ_TIMEOUT */
ctlx->state = HFA384x_USBCTLX_REQ_TIMEOUT;
/* This will invoke the usbout callback, */
/* which will call ctlx_complete */
usb_unlink_urb(&ctlx->outurb);
} else {
WLAN_LOG_ERROR0(__FUNCTION__
@ -4282,11 +4306,6 @@ hfa384x_usbctlx_reqtimerfn(unsigned long data)
goto done;
}
/* Set the state to REQ_TIMEOUT */
ctlx->state = HFA384x_USBCTLX_REQ_TIMEOUT;
/* Call ctlx_complete */
hfa384x_usbctlx_complete(ctlx);
done:
DBFEXIT;
return;