Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Handle the Linksys USB100H1 like the other Links...
details: https://anonhg.NetBSD.org/src/rev/49de33da57d0
branches: trunk
changeset: 485828:49de33da57d0
user: augustss <augustss%NetBSD.org@localhost>
date: Sat May 06 20:38:59 2000 +0000
description:
Handle the Linksys USB100H1 like the other Linksys adapters.
Restructure the code a little.
diffstat:
sys/dev/usb/if_aue.c | 71 ++++++++++++++++++++++++++++--------------------
sys/dev/usb/if_auereg.h | 9 ++----
2 files changed, 44 insertions(+), 36 deletions(-)
diffs (158 lines):
diff -r eb74e30657e0 -r 49de33da57d0 sys/dev/usb/if_aue.c
--- a/sys/dev/usb/if_aue.c Sat May 06 19:03:39 2000 +0000
+++ b/sys/dev/usb/if_aue.c Sat May 06 20:38:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aue.c,v 1.40 2000/05/06 18:28:01 augustss Exp $ */
+/* $NetBSD: if_aue.c,v 1.41 2000/05/06 20:38:59 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul%ee.columbia.edu@localhost>. All rights reserved.
@@ -178,23 +178,31 @@
/*
* Various supported device vendors/products.
*/
+struct aue_type {
+ u_int16_t aue_vid;
+ u_int16_t aue_did;
+ char aue_linksys;
+};
+
Static struct aue_type aue_devs[] = {
- { USB_VENDOR_BILLIONTON, USB_PRODUCT_BILLIONTON_USB100 },
- { USB_VENDOR_MELCO, USB_PRODUCT_MELCO_LUATX },
- { USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB100TX },
- { USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB100H1 },
- { USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB10TA },
- { USB_VENDOR_ADMTEK, USB_PRODUCT_ADMTEK_PEGASUS },
- { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX },
- { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX_PNA },
- { USB_VENDOR_SMC, USB_PRODUCT_SMC_2202USB },
- { USB_VENDOR_COREGA, USB_PRODUCT_COREGA_FETHER_USB_TX },
- { USB_VENDOR_IODATA, USB_PRODUCT_IODATA_USBETTX },
- { 0, 0 }
+ { USB_VENDOR_BILLIONTON, USB_PRODUCT_BILLIONTON_USB100, 0 },
+ { USB_VENDOR_MELCO, USB_PRODUCT_MELCO_LUATX, 0 },
+ { USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB100TX, 1 },
+ { USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB100H1, 1 },
+ { USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB10TA, 1 },
+ { USB_VENDOR_ADMTEK, USB_PRODUCT_ADMTEK_PEGASUS, 0 },
+ { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX, 1 },
+ { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX_PNA, 0 },
+ { USB_VENDOR_SMC, USB_PRODUCT_SMC_2202USB, 0 },
+ { USB_VENDOR_COREGA, USB_PRODUCT_COREGA_FETHER_USB_TX, 0 },
+ { USB_VENDOR_IODATA, USB_PRODUCT_IODATA_USBETTX, 0 },
+ { 0, 0, 0 }
};
USB_DECLARE_DRIVER(aue);
+Static struct aue_type *aue_lookup __P((u_int16_t vendor, u_int16_t product));
+
Static int aue_tx_list_init __P((struct aue_softc *));
Static int aue_rx_list_init __P((struct aue_softc *));
Static int aue_newbuf __P((struct aue_softc *, struct aue_chain *,
@@ -585,12 +593,8 @@
* This turns on the 'dual link LED' bin in the auxmode
* register of the Broadcom PHY.
*/
- if ((sc->aue_vendor == USB_VENDOR_LINKSYS &&
- (sc->aue_product == USB_PRODUCT_LINKSYS_USB100TX ||
- sc->aue_product == USB_PRODUCT_LINKSYS_USB10TA)) ||
- (sc->aue_vendor == USB_VENDOR_DLINK &&
- sc->aue_product == USB_PRODUCT_DLINK_DSB650TX)) {
- u_int16_t auxmode;
+ if (sc->aue_linksys) {
+ u_int16_t auxmode;
auxmode = aue_miibus_readreg(dev, 0, 0x1b);
aue_miibus_writereg(dev, 0, 0x1b, auxmode | 0x04);
}
@@ -708,11 +712,7 @@
AUE_GPIO_OUT0 | AUE_GPIO_SEL0 | AUE_GPIO_SEL1);
/* Grrr. LinkSys has to be different from everyone else. */
- if ((sc->aue_vendor == USB_VENDOR_LINKSYS &&
- (sc->aue_product == USB_PRODUCT_LINKSYS_USB100TX ||
- sc->aue_product == USB_PRODUCT_LINKSYS_USB10TA)) ||
- (sc->aue_vendor == USB_VENDOR_DLINK &&
- sc->aue_product == USB_PRODUCT_DLINK_DSB650TX)) {
+ if (sc->aue_linksys) {
aue_csr_write_1(sc, AUE_GPIO0,
AUE_GPIO_SEL0 | AUE_GPIO_SEL1);
aue_csr_write_1(sc, AUE_GPIO0,
@@ -723,22 +723,31 @@
delay(10000); /* XXX */
}
+Static struct aue_type *
+aue_lookup(vendor, product)
+ u_int16_t vendor;
+ u_int16_t product;
+{
+ struct aue_type *t;
+
+ for (t = aue_devs; t->aue_vid != 0; t++)
+ if (vendor == t->aue_vid && product == t->aue_did)
+ return (t);
+ return (NULL);
+}
+
/*
* Probe for a Pegasus chip.
*/
USB_MATCH(aue)
{
USB_MATCH_START(aue, uaa);
- struct aue_type *t;
if (uaa->iface != NULL)
return (UMATCH_NONE);
- for (t = aue_devs; t->aue_vid != 0; t++)
- if (uaa->vendor == t->aue_vid && uaa->product == t->aue_did)
- return (UMATCH_VENDOR_PRODUCT);
-
- return (UMATCH_NONE);
+ return (aue_lookup(uaa->vendor, uaa->product) != NULL ?
+ UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
/*
@@ -784,6 +793,8 @@
USB_ATTACH_ERROR_RETURN;
}
+ sc->aue_linksys = aue_lookup(uaa->vendor, uaa->product)->aue_linksys;
+
sc->aue_udev = dev;
sc->aue_iface = iface;
sc->aue_product = uaa->product;
diff -r eb74e30657e0 -r 49de33da57d0 sys/dev/usb/if_auereg.h
--- a/sys/dev/usb/if_auereg.h Sat May 06 19:03:39 2000 +0000
+++ b/sys/dev/usb/if_auereg.h Sat May 06 20:38:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_auereg.h,v 1.12 2000/04/04 20:16:19 augustss Exp $ */
+/* $NetBSD: if_auereg.h,v 1.13 2000/05/06 20:38:59 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul%ee.columbia.edu@localhost>. All rights reserved.
@@ -197,11 +197,6 @@
/*************** The rest belongs in if_auevar.h *************/
-struct aue_type {
- u_int16_t aue_vid;
- u_int16_t aue_did;
-};
-
#define AUE_TX_LIST_CNT 1
#define AUE_RX_LIST_CNT 1
@@ -263,6 +258,8 @@
int aue_if_flags;
struct aue_cdata aue_cdata;
+ char aue_linksys;
+
char aue_dying;
char aue_attached;
u_int aue_rx_errs;
Home |
Main Index |
Thread Index |
Old Index