Hi Greg,
this is syncing 2.4 pegasus driver with recent 2.5
changes. Since it is fixing a few bugs i hope the
patch will be applied in 2.4 tree as well.
I tested it on my system and it seems ok.
Petko
PS: The diff is generated against 2.4.17 but as long as
there is no changes in both files until 2.4.18-pre7
the patch should apply cleanly.
--- linux-2.4.17/drivers/usb/pegasus.c.orig Mon Jan 21 15:43:18 2002
+++ linux/drivers/usb/pegasus.c Fri Feb 1 17:54:03 2002
@@ -53,7 +53,7 @@
/*
* Version Information
*/
-#define DRIVER_VERSION "v0.4.22 (2001/12/07)"
+#define DRIVER_VERSION "v0.4.23 (2002/02/01)"
#define DRIVER_AUTHOR "Petko Manolov <[EMAIL PROTECTED]>"
#define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver"
@@ -94,7 +94,7 @@
static int update_eth_regs_async( pegasus_t * );
/* Aargh!!! I _really_ hate such tweaks */
-static void ctrl_callback( urb_t *urb )
+static void ctrl_callback( struct urb *urb )
{
pegasus_t *pegasus = urb->context;
@@ -102,7 +102,7 @@
return;
switch ( urb->status ) {
- case USB_ST_NOERROR:
+ case 0:
if ( pegasus->flags & ETH_REGS_CHANGE ) {
pegasus->flags &= ~ETH_REGS_CHANGE;
pegasus->flags |= ETH_REGS_CHANGED;
@@ -110,12 +110,12 @@
return;
}
break;
- case USB_ST_URB_PENDING:
+ case -EINPROGRESS:
return;
- case USB_ST_URB_KILLED:
+ case -ENOENT:
break;
default:
- warn( __FUNCTION__ " status %d", urb->status);
+ warn("%s: status %d", __FUNCTION__, urb->status);
}
pegasus->flags &= ~ETH_REGS_CHANGED;
wake_up(&pegasus->ctrl_wait );
@@ -147,9 +147,9 @@
pegasus->dr.value = cpu_to_le16 (0);
pegasus->dr.index = cpu_to_le16p(&indx);
pegasus->dr.length = cpu_to_le16p(&size);
- pegasus->ctrl_urb.transfer_buffer_length = size;
+ pegasus->ctrl_urb->transfer_buffer_length = size;
- FILL_CONTROL_URB( &pegasus->ctrl_urb, pegasus->usb,
+ FILL_CONTROL_URB( pegasus->ctrl_urb, pegasus->usb,
usb_rcvctrlpipe(pegasus->usb,0),
(char *)&pegasus->dr,
buffer, size, ctrl_callback, pegasus );
@@ -157,8 +157,8 @@
add_wait_queue( &pegasus->ctrl_wait, &wait );
set_current_state( TASK_UNINTERRUPTIBLE );
- if ( (ret = usb_submit_urb( &pegasus->ctrl_urb )) ) {
- err( __FUNCTION__ " BAD CTRLs %d", ret);
+ if ( (ret = usb_submit_urb( pegasus->ctrl_urb )) ) {
+ err("%s: BAD CTRLs %d", __FUNCTION__, ret);
goto out;
}
@@ -197,9 +197,9 @@
pegasus->dr.value = cpu_to_le16 (0);
pegasus->dr.index = cpu_to_le16p( &indx );
pegasus->dr.length = cpu_to_le16p( &size );
- pegasus->ctrl_urb.transfer_buffer_length = size;
+ pegasus->ctrl_urb->transfer_buffer_length = size;
- FILL_CONTROL_URB( &pegasus->ctrl_urb, pegasus->usb,
+ FILL_CONTROL_URB( pegasus->ctrl_urb, pegasus->usb,
usb_sndctrlpipe(pegasus->usb,0),
(char *)&pegasus->dr,
buffer, size, ctrl_callback, pegasus );
@@ -207,8 +207,8 @@
add_wait_queue( &pegasus->ctrl_wait, &wait );
set_current_state( TASK_UNINTERRUPTIBLE );
- if ( (ret = usb_submit_urb( &pegasus->ctrl_urb )) ) {
- err( __FUNCTION__ " BAD CTRL %d", ret);
+ if ( (ret = usb_submit_urb( pegasus->ctrl_urb )) ) {
+ err("%s: BAD CTRL %d", __FUNCTION__, ret);
goto out;
}
@@ -247,9 +247,9 @@
pegasus->dr.value = cpu_to_le16p( &dat);
pegasus->dr.index = cpu_to_le16p( &indx );
pegasus->dr.length = cpu_to_le16( 1 );
- pegasus->ctrl_urb.transfer_buffer_length = 1;
+ pegasus->ctrl_urb->transfer_buffer_length = 1;
- FILL_CONTROL_URB( &pegasus->ctrl_urb, pegasus->usb,
+ FILL_CONTROL_URB( pegasus->ctrl_urb, pegasus->usb,
usb_sndctrlpipe(pegasus->usb,0),
(char *)&pegasus->dr,
buffer, 1, ctrl_callback, pegasus );
@@ -257,8 +257,8 @@
add_wait_queue( &pegasus->ctrl_wait, &wait );
set_current_state( TASK_UNINTERRUPTIBLE );
- if ( (ret = usb_submit_urb( &pegasus->ctrl_urb )) ) {
- err( __FUNCTION__ " BAD CTRL %d", ret);
+ if ( (ret = usb_submit_urb( pegasus->ctrl_urb )) ) {
+ err("%s: BAD CTRL %d", __FUNCTION__, ret);
goto out;
}
@@ -280,15 +280,15 @@
pegasus->dr.value = 0;
pegasus->dr.index = cpu_to_le16(EthCtrl0);
pegasus->dr.length = cpu_to_le16(3);
- pegasus->ctrl_urb.transfer_buffer_length = 3;
+ pegasus->ctrl_urb->transfer_buffer_length = 3;
- FILL_CONTROL_URB( &pegasus->ctrl_urb, pegasus->usb,
+ FILL_CONTROL_URB( pegasus->ctrl_urb, pegasus->usb,
usb_sndctrlpipe(pegasus->usb,0),
(char *)&pegasus->dr,
pegasus->eth_regs, 3, ctrl_callback, pegasus );
- if ( (ret = usb_submit_urb( &pegasus->ctrl_urb )) )
- err( __FUNCTION__ " BAD CTRL %d, flags %x",ret,pegasus->flags );
+ if ( (ret = usb_submit_urb( pegasus->ctrl_urb )) )
+ err("%s: BAD CTRL %d, flgs %x",__FUNCTION__,ret,pegasus->flags);
return ret;
}
@@ -313,7 +313,7 @@
*regd = le16_to_cpu(regdi);
return 0;
}
- warn( __FUNCTION__ " failed" );
+ warn("%s: failed", __FUNCTION__);
return 1;
}
@@ -335,7 +335,7 @@
}
if ( i < REG_TIMEOUT )
return 0;
- warn( __FUNCTION__ " failed" );
+ warn("%s: failed", __FUNCTION__);
return 1;
}
@@ -361,7 +361,7 @@
*retdata = le16_to_cpu (retdatai);
return 0;
}
- warn( __FUNCTION__ " failed" );
+ warn("%s: failed", __FUNCTION__);
return -1;
}
@@ -405,7 +405,7 @@
disable_eprom_write( pegasus );
if ( i < REG_TIMEOUT )
return 0;
- warn( __FUNCTION__ " failed" );
+ warn("%s: failed", __FUNCTION__);
return -1;
}
#endif /* PEGASUS_WRITE_EEPROM */
@@ -526,9 +526,9 @@
pegasus->flags |= PEGASUS_RX_BUSY;
switch ( urb->status ) {
- case USB_ST_NOERROR:
+ case 0:
break;
- case USB_ST_NORESPONSE:
+ case -ETIMEDOUT:
dbg( "reset MAC" );
pegasus->flags &= ~PEGASUS_RX_BUSY;
break;
@@ -569,12 +569,12 @@
pegasus->stats.rx_bytes += pkt_len;
goon:
- FILL_BULK_URB( &pegasus->rx_urb, pegasus->usb,
+ FILL_BULK_URB( pegasus->rx_urb, pegasus->usb,
usb_rcvbulkpipe(pegasus->usb, 1),
pegasus->rx_buff, PEGASUS_MAX_MTU,
read_bulk_callback, pegasus );
- if ( (res = usb_submit_urb(&pegasus->rx_urb)) )
- warn( __FUNCTION__ " failed submint rx_urb %d", res);
+ if ( (res = usb_submit_urb(pegasus->rx_urb)) )
+ warn("%s: failed submint rx_urb %d", __FUNCTION__, res);
pegasus->flags &= ~PEGASUS_RX_BUSY;
}
@@ -607,9 +607,9 @@
return;
switch ( urb->status ) {
- case USB_ST_NOERROR:
+ case 0:
break;
- case USB_ST_URB_KILLED:
+ case -ENOENT:
return;
default:
info("intr status %d", urb->status);
@@ -639,8 +639,8 @@
return;
warn("%s: Tx timed out.", net->name);
- pegasus->tx_urb.transfer_flags |= USB_ASYNC_UNLINK;
- usb_unlink_urb( &pegasus->tx_urb );
+ pegasus->tx_urb->transfer_flags |= USB_ASYNC_UNLINK;
+ usb_unlink_urb( pegasus->tx_urb );
pegasus->stats.tx_errors++;
}
@@ -656,12 +656,12 @@
((__u16 *)pegasus->tx_buff)[0] = cpu_to_le16( l16 );
memcpy(pegasus->tx_buff+2, skb->data, skb->len);
- FILL_BULK_URB( &pegasus->tx_urb, pegasus->usb,
+ FILL_BULK_URB( pegasus->tx_urb, pegasus->usb,
usb_sndbulkpipe(pegasus->usb, 2),
pegasus->tx_buff, PEGASUS_MAX_MTU,
write_bulk_callback, pegasus );
- pegasus->tx_urb.transfer_buffer_length = count;
- if ((res = usb_submit_urb(&pegasus->tx_urb))) {
+ pegasus->tx_urb->transfer_buffer_length = count;
+ if ((res = usb_submit_urb(pegasus->tx_urb))) {
warn("failed tx_urb %d", res);
pegasus->stats.tx_errors++;
netif_start_queue( net );
@@ -717,19 +717,19 @@
err("can't enable_net_traffic() - %d", res);
return -EIO;
}
- FILL_BULK_URB( &pegasus->rx_urb, pegasus->usb,
+ FILL_BULK_URB( pegasus->rx_urb, pegasus->usb,
usb_rcvbulkpipe(pegasus->usb, 1),
pegasus->rx_buff, PEGASUS_MAX_MTU,
read_bulk_callback, pegasus );
- if ( (res = usb_submit_urb(&pegasus->rx_urb)) )
- warn( __FUNCTION__ " failed rx_urb %d", res );
+ if ( (res = usb_submit_urb(pegasus->rx_urb)) )
+ warn("%s: failed rx_urb %d", __FUNCTION__, res);
#ifdef PEGASUS_USE_INTR
- FILL_INT_URB( &pegasus->intr_urb, pegasus->usb,
+ FILL_INT_URB( pegasus->intr_urb, pegasus->usb,
usb_rcvintpipe(pegasus->usb, 3),
pegasus->intr_buff, sizeof(pegasus->intr_buff),
intr_callback, pegasus, pegasus->intr_interval );
- if ( (res = usb_submit_urb(&pegasus->intr_urb)) )
- warn( __FUNCTION__ " failed intr_urb %d", res);
+ if ( (res = usb_submit_urb(pegasus->intr_urb)) )
+ warn("%s: failed intr_urb %d", __FUNCTION__, res);
#endif
netif_start_queue( net );
pegasus->flags |= PEGASUS_RUNNING;
@@ -747,11 +747,11 @@
if ( !(pegasus->flags & PEGASUS_UNPLUG) )
disable_net_traffic( pegasus );
- usb_unlink_urb( &pegasus->rx_urb );
- usb_unlink_urb( &pegasus->tx_urb );
- usb_unlink_urb( &pegasus->ctrl_urb );
+ usb_unlink_urb( pegasus->rx_urb );
+ usb_unlink_urb( pegasus->tx_urb );
+ usb_unlink_urb( pegasus->ctrl_urb );
#ifdef PEGASUS_USE_INTR
- usb_unlink_urb( &pegasus->intr_urb );
+ usb_unlink_urb( pegasus->intr_urb );
#endif
return 0;
@@ -800,7 +800,7 @@
}
pegasus->flags |= ETH_REGS_CHANGE;
- ctrl_callback( &pegasus->ctrl_urb );
+ ctrl_callback( pegasus->ctrl_urb );
netif_wake_queue(net);
}
@@ -856,8 +856,38 @@
pegasus->dev_index = dev_index;
init_waitqueue_head( &pegasus->ctrl_wait );
+ pegasus->ctrl_urb = usb_alloc_urb(0);
+ if (!pegasus->ctrl_urb) {
+ kfree (pegasus);
+ return NULL;
+ }
+ pegasus->rx_urb = usb_alloc_urb(0);
+ if (!pegasus->rx_urb) {
+ usb_free_urb (pegasus->ctrl_urb);
+ kfree (pegasus);
+ return NULL;
+ }
+ pegasus->tx_urb = usb_alloc_urb(0);
+ if (!pegasus->tx_urb) {
+ usb_free_urb (pegasus->rx_urb);
+ usb_free_urb (pegasus->ctrl_urb);
+ kfree (pegasus);
+ return NULL;
+ }
+ pegasus->intr_urb = usb_alloc_urb(0);
+ if (!pegasus->intr_urb) {
+ usb_free_urb (pegasus->tx_urb);
+ usb_free_urb (pegasus->rx_urb);
+ usb_free_urb (pegasus->ctrl_urb);
+ kfree (pegasus);
+ return NULL;
+ }
+
net = init_etherdev( NULL, 0 );
if ( !net ) {
+ usb_free_urb (pegasus->tx_urb);
+ usb_free_urb (pegasus->rx_urb);
+ usb_free_urb (pegasus->ctrl_urb);
kfree( pegasus );
return NULL;
}
@@ -883,6 +913,10 @@
if ( reset_mac(pegasus) ) {
err("can't reset MAC");
unregister_netdev( pegasus->net );
+ usb_free_urb (pegasus->tx_urb);
+ usb_free_urb (pegasus->rx_urb);
+ usb_free_urb (pegasus->ctrl_urb);
+ kfree(pegasus->net);
kfree(pegasus);
pegasus = NULL;
return NULL;
@@ -919,6 +953,15 @@
pegasus->flags |= PEGASUS_UNPLUG;
unregister_netdev( pegasus->net );
usb_dec_dev_use( dev );
+ usb_unlink_urb(pegasus->intr_urb);
+ usb_unlink_urb(pegasus->tx_urb);
+ usb_unlink_urb(pegasus->rx_urb);
+ usb_unlink_urb(pegasus->ctrl_urb);
+ usb_free_urb(pegasus->intr_urb);
+ usb_free_urb(pegasus->tx_urb);
+ usb_free_urb(pegasus->rx_urb);
+ usb_free_urb(pegasus->ctrl_urb);
+ kfree( pegasus->net );
kfree( pegasus );
pegasus = NULL;
}
--- linux-2.4.17/drivers/usb/pegasus.h.orig Mon Jan 21 14:55:55 2002
+++ linux/drivers/usb/pegasus.h Fri Feb 1 17:45:34 2002
@@ -107,7 +107,7 @@
unsigned features;
int dev_index;
int intr_interval;
- struct urb ctrl_urb, rx_urb, tx_urb, intr_urb;
+ struct urb *ctrl_urb, *rx_urb, *tx_urb, *intr_urb;
devrequest dr;
wait_queue_head_t ctrl_wait;
struct semaphore ctrl_sem;
@@ -134,9 +134,11 @@
#define VENDOR_ALLIEDTEL 0x07c9
#define VENDOR_BELKIN 0x050d
#define VENDOR_BILLIONTON 0x08dd
+#define VENDOR_COMPAQ 0x049f
#define VENDOR_COREGA 0x07aa
#define VENDOR_DLINK 0x2001
#define VENDOR_ELSA 0x05cc
+#define VENDOR_HAWKING 0x0e66
#define VENDOR_IODATA 0x04bb
#define VENDOR_KINGSTON 0x0951
#define VENDOR_LANEED 0x056e
@@ -145,6 +147,7 @@
#define VENDOR_SMARTBRIDGES 0x08d1
#define VENDOR_SMC 0x0707
#define VENDOR_SOHOWARE 0x15e8
+#define VENDOR_SIEMENS 0x067c
#else /* PEGASUS_DEV */
@@ -173,6 +176,8 @@
DEFAULT_GPIO_RESET | PEGASUS_II )
PEGASUS_DEV( "Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046,
DEFAULT_GPIO_RESET )
+PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046,
+ DEFAULT_GPIO_RESET )
PEGASUS_DEV( "ADMtek ADM8511 \"Pegasus II\" USB Ethernet",
VENDOR_ADMTEK, 0x8511,
DEFAULT_GPIO_RESET | PEGASUS_II )
@@ -187,6 +192,8 @@
DEFAULT_GPIO_RESET )
PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987,
DEFAULT_GPIO_RESET | HAS_HOME_PNA )
+PEGASUS_DEV( "iPAQ Networking 10/100 USB", VENDOR_COMPAQ, 0x8511,
+ DEFAULT_GPIO_RESET | PEGASUS_II )
PEGASUS_DEV( "Billionton USBEL-100", VENDOR_BILLIONTON, 0x0988,
DEFAULT_GPIO_RESET )
PEGASUS_DEV( "Billionton USBE-100", VENDOR_BILLIONTON, 0x8511,
@@ -209,8 +216,12 @@
DEFAULT_GPIO_RESET )
PEGASUS_DEV( "Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000,
DEFAULT_GPIO_RESET )
+PEGASUS_DEV( "Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c,
+ DEFAULT_GPIO_RESET | PEGASUS_II )
PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
DEFAULT_GPIO_RESET )
+PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
+ DEFAULT_GPIO_RESET | PEGASUS_II )
PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a,
DEFAULT_GPIO_RESET)
PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
@@ -244,6 +255,8 @@
PEGASUS_DEV( "SMC 202 USB Ethernet", VENDOR_SMC, 0x0200,
DEFAULT_GPIO_RESET )
PEGASUS_DEV( "SOHOware NUB100 Ethernet", VENDOR_SOHOWARE, 0x9100,
+ DEFAULT_GPIO_RESET )
+PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_SIEMENS, 0x1001,
DEFAULT_GPIO_RESET )