diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2009-06-04 21:21:16 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2009-06-04 21:21:16 +0000 |
commit | e3a617cf1d8c94ab1f8da86bf0b8d4e71ff7e51e (patch) | |
tree | b3ce392ab3b7fd05568925cf65492f4576b85501 /sys/dev/usb | |
parent | 493210897221d7a7520ed88494339623a8d0cbb9 (diff) |
detect & print the revision (rev. d, b) of rtl8187l chip using the
tx_conf register. if you get "not supported" in your dmesg; it's
actually an (early) rtl8187b that's using rtl8187l id; so you
should test the diff on tech@.
otherwise; rtl8187b devices not matched yet.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_urtw.c | 36 | ||||
-rw-r--r-- | sys/dev/usb/if_urtwreg.h | 8 |
2 files changed, 39 insertions, 5 deletions
diff --git a/sys/dev/usb/if_urtw.c b/sys/dev/usb/if_urtw.c index a26a6226d99..3c90ad13da9 100644 --- a/sys/dev/usb/if_urtw.c +++ b/sys/dev/usb/if_urtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtw.c,v 1.16 2009/06/04 21:06:52 martynas Exp $ */ +/* $OpenBSD: if_urtw.c,v 1.17 2009/06/04 21:21:15 martynas Exp $ */ /*- * Copyright (c) 2008 Weongyo Jeong <weongyo@FreeBSD.org> @@ -501,9 +501,38 @@ urtw_attach(struct device *parent, struct device *self, void *aux) usbd_status error; uint32_t data; int i; + const char *urtw_name = NULL; sc->sc_udev = uaa->device; + sc->sc_hwrev = urtw_lookup(uaa->vendor, uaa->product)->rev; + + if (sc->sc_hwrev & URTW_HWREV_8187) { + urtw_read32_m(sc, URTW_TX_CONF, &data); + data &= URTW_TX_HWREV_MASK; + switch (data) { + case URTW_TX_HWREV_8187_D: + sc->sc_hwrev |= URTW_HWREV_8187_D; + urtw_name = "RTL8187 rev. D"; + break; + case URTW_TX_HWREV_8187B_D: + /* + * Detect Realtek RTL8187B devices that use + * USB IDs of RTL8187. + */ + urtw_name = "RTL8187B rev. B (not supported)"; + break; + default: + sc->sc_hwrev |= URTW_HWREV_8187_B; + urtw_name = "RTL8187 rev. B (default)"; + break; + } + } else { + urtw_name = "RTL8187B (not supported)"; + } + + printf("%s: %s", sc->sc_dev.dv_xname, urtw_name); + urtw_read32_m(sc, URTW_RX, &data); sc->sc_epromtype = (data & URTW_RX_9356SEL) ? URTW_EEPROM_93C56 : URTW_EEPROM_93C46; @@ -591,12 +620,11 @@ urtw_attach(struct device *parent, struct device *self, void *aux) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, &sc->sc_dev); - printf("%s: address %s\n", - sc->sc_dev.dv_xname, ether_sprintf(ic->ic_myaddr)); + printf(", address %s\n", ether_sprintf(ic->ic_myaddr)); return; fail: - printf("%s: %s failed!\n", sc->sc_dev.dv_xname, __func__); + printf(": %s failed!\n", __func__); } int diff --git a/sys/dev/usb/if_urtwreg.h b/sys/dev/usb/if_urtwreg.h index e4da5fc53f6..939027fee17 100644 --- a/sys/dev/usb/if_urtwreg.h +++ b/sys/dev/usb/if_urtwreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtwreg.h,v 1.7 2009/06/04 21:06:52 martynas Exp $ */ +/* $OpenBSD: if_urtwreg.h,v 1.8 2009/06/04 21:21:15 martynas Exp $ */ /*- * Copyright (c) 2008 Weongyo Jeong <weongyo@FreeBSD.org> @@ -23,6 +23,8 @@ * Known hardware revisions. */ #define URTW_HWREV_8187 0x01 +#define URTW_HWREV_8187_B 0x02 +#define URTW_HWREV_8187_D 0x04 /* * Registers specific to RTL8187 and RTL8187B. @@ -46,6 +48,9 @@ #define URTW_CMD_RX_ENABLE (0x8) #define URTW_CMD_RST (0x10) #define URTW_TX_CONF 0x0040 /* 4 byte */ +#define URTW_TX_HWREV_MASK (7 << 25) +#define URTW_TX_HWREV_8187_D (5 << 25) +#define URTW_TX_HWREV_8187B_D (6 << 25) #define URTW_TX_LOOPBACK_SHIFT (17) #define URTW_TX_LOOPBACK_NONE (0 << URTW_TX_LOOPBACK_SHIFT) #define URTW_TX_LOOPBACK_MAC (1 << URTW_TX_LOOPBACK_SHIFT) @@ -276,6 +281,7 @@ struct urtw_softc { usbd_interface_handle sc_iface; int sc_if_flags; + uint8_t sc_hwrev; int sc_flags; #define URTW_INIT_ONCE (1 << 1) struct usb_task sc_task; |