From a15321bfbad253eb0449d4ca5850721a1278f64b Mon Sep 17 00:00:00 2001 From: Pedro Martelletto Date: Tue, 21 Mar 2006 11:19:23 +0000 Subject: Make ural(4) read and show real MAC/BBP rev instead of hardcoded RT2570 "Go ahead" damien@ via jsg@ --- sys/dev/usb/if_ral.c | 12 ++++++++---- sys/dev/usb/if_ralreg.h | 3 ++- sys/dev/usb/if_ralvar.h | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index 9eabe32b4e5..6a9311e000b 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.65 2006/02/19 08:44:17 damien Exp $ */ +/* $OpenBSD: if_ral.c,v 1.66 2006/03/21 11:19:22 pedro Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -430,9 +430,9 @@ USB_ATTACH(ural) /* retrieve MAC address and various other things from EEPROM */ ural_read_eeprom(sc); - printf("%s: MAC/BBP RT2570 (rev 0x%02x), RF %s, address %s\n", - USBDEVNAME(sc->sc_dev), sc->asic_rev, ural_get_rf(sc->rf_rev), - ether_sprintf(ic->ic_myaddr)); + printf("%s: MAC/BBP RT%02x (rev 0x%02x), RF %s, address %s\n", + USBDEVNAME(sc->sc_dev), sc->macbbp_rev, sc->asic_rev, + ural_get_rf(sc->rf_rev), ether_sprintf(ic->ic_myaddr)); ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */ @@ -1997,6 +1997,10 @@ ural_read_eeprom(struct ural_softc *sc) struct ieee80211com *ic = &sc->sc_ic; uint16_t val; + /* retrieve MAC/BBP type */ + ural_eeprom_read(sc, RAL_EEPROM_MACBBP, &val, 2); + sc->macbbp_rev = letoh16(val); + ural_eeprom_read(sc, RAL_EEPROM_CONFIG0, &val, 2); val = letoh16(val); sc->rf_rev = (val >> 11) & 0x7; diff --git a/sys/dev/usb/if_ralreg.h b/sys/dev/usb/if_ralreg.h index 871c1e5acb0..6ae5fbc3d4b 100644 --- a/sys/dev/usb/if_ralreg.h +++ b/sys/dev/usb/if_ralreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ralreg.h,v 1.8 2006/01/14 12:40:39 damien Exp $ */ +/* $OpenBSD: if_ralreg.h,v 1.9 2006/03/21 11:19:22 pedro Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -200,6 +200,7 @@ struct ural_rx_desc { #define RAL_RF3 1 #define RAL_RF4 3 +#define RAL_EEPROM_MACBBP 0x0000 #define RAL_EEPROM_ADDRESS 0x0004 #define RAL_EEPROM_TXPOWER 0x003c #define RAL_EEPROM_CONFIG0 0x0016 diff --git a/sys/dev/usb/if_ralvar.h b/sys/dev/usb/if_ralvar.h index b3f5ba8b0de..ae72dd050dd 100644 --- a/sys/dev/usb/if_ralvar.h +++ b/sys/dev/usb/if_ralvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ralvar.h,v 1.4 2006/01/14 12:40:39 damien Exp $ */ +/* $OpenBSD: if_ralvar.h,v 1.5 2006/03/21 11:19:22 pedro Exp $ */ /*- * Copyright (c) 2005 @@ -90,6 +90,7 @@ struct ural_softc { int sc_tx_no; uint32_t asic_rev; + uint16_t macbbp_rev; uint8_t rf_rev; usbd_xfer_handle amrr_xfer; -- cgit v1.2.3