summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2006-07-18 20:54:16 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2006-07-18 20:54:16 +0000
commit61f6ba0b666edbc9af66295f9063b491d6d36211 (patch)
treeca4de5891ffefab8e62b8ebc767e026ecc164b7e /sys
parente03b66b7d217ac8791eae7d6d5464be80941f808 (diff)
mountroothooks don't return a value, so don't use USB_ATTACH_ERROR_RETURN
(even if it's defined as return; under OpenBSD, it's just confusing). kill all soft tabs while i'm here.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/if_rum.c156
-rw-r--r--sys/dev/usb/if_rumreg.h404
2 files changed, 278 insertions, 282 deletions
diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c
index 984cbd930dd..17f6a4b664c 100644
--- a/sys/dev/usb/if_rum.c
+++ b/sys/dev/usb/if_rum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rum.c,v 1.11 2006/07/18 20:37:44 damien Exp $ */
+/* $OpenBSD: if_rum.c,v 1.12 2006/07/18 20:54:15 damien Exp $ */
/*-
* Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini@free.fr>
* Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org>
@@ -173,7 +173,7 @@ static const struct {
uint32_t reg;
uint32_t val;
} rum_def_mac[] = {
- RT2573_DEF_MAC
+ RT2573_DEF_MAC
};
static const struct {
@@ -199,25 +199,22 @@ void
rum_attachhook(void *xsc)
{
struct rum_softc *sc = xsc;
- u_char *ucode;
- char *name;
- size_t size;
- int err;
-
- name = "ral-rt2573";
+ const char *name = "ral-rt2573";
+ u_char *ucode;
+ size_t size;
+ int error;
- if ((err = loadfirmware(name, &ucode, &size)) != 0) {
- printf("%s: failed loadfirmware of file %s: errno %d\n",
- USBDEVNAME(sc->sc_dev), name, err);
- USB_ATTACH_ERROR_RETURN;
+ if ((error = loadfirmware(name, &ucode, &size)) != 0) {
+ printf("%s: failed loadfirmware of file %s (error %d)\n",
+ USBDEVNAME(sc->sc_dev), name, error);
+ return;
}
if (rum_load_microcode(sc, ucode, size) != 0) {
printf("%s: could not load 8051 microcode\n",
USBDEVNAME(sc->sc_dev));
- free(ucode, M_DEVBUF);
- USB_ATTACH_ERROR_RETURN;
}
+
free(ucode, M_DEVBUF);
}
@@ -323,7 +320,6 @@ USB_ATTACH(rum)
else
rum_attachhook(sc);
-
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */
ic->ic_state = IEEE80211_S_INIT;
@@ -1569,24 +1565,24 @@ rum_rf_write(struct rum_softc *sc, uint8_t reg, uint32_t val)
void
rum_set_chan(struct rum_softc *sc, struct ieee80211_channel *c)
{
- struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bbp94 = RT2573_BBPR94_DEFAULT;
- int8_t power;
- u_int chan;
-
- chan = ieee80211_chan2ieee(ic, c);
- if (chan == 0 || chan == IEEE80211_CHAN_ANY)
- return;
-
- power = sc->txpow[chan - 1];
- if (power < 0) {
- bbp94 += power;
- power = 0;
- } else if (power > 31) {
- bbp94 += power - 31;
- power = 31;
- }
- sc->sc_curchan = c;
+ struct ieee80211com *ic = &sc->sc_ic;
+ uint8_t bbp94 = RT2573_BBPR94_DEFAULT;
+ int8_t power;
+ u_int chan;
+
+ chan = ieee80211_chan2ieee(ic, c);
+ if (chan == 0 || chan == IEEE80211_CHAN_ANY)
+ return;
+
+ power = sc->txpow[chan - 1];
+ if (power < 0) {
+ bbp94 += power;
+ power = 0;
+ } else if (power > 31) {
+ bbp94 += power - 31;
+ power = 31;
+ }
+ sc->sc_curchan = c;
rum_rf_write(sc, RT2573_RF1, 0xb03);
rum_rf_write(sc, RT2573_RF2, rum_rf2528_r2[chan - 1]);
@@ -1605,8 +1601,8 @@ rum_set_chan(struct rum_softc *sc, struct ieee80211_channel *c)
DELAY(10);
- if (bbp94 != RT2573_BBPR94_DEFAULT)
- rum_bbp_write(sc, 94, bbp94);
+ if (bbp94 != RT2573_BBPR94_DEFAULT)
+ rum_bbp_write(sc, 94, bbp94);
}
/*
@@ -1617,26 +1613,26 @@ void
rum_enable_tsf_sync(struct rum_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;
- uint32_t tmp;
+ uint32_t tmp;
- if (ic->ic_opmode != IEEE80211_M_STA) {
- /*
- * Change default 16ms TBTT adjustment to 8ms.
- * Must be done before enabling beacon generation.
- */
- rum_write(sc, RT2573_TXRX_CSR10, 1 << 12 | 8);
- }
+ if (ic->ic_opmode != IEEE80211_M_STA) {
+ /*
+ * Change default 16ms TBTT adjustment to 8ms.
+ * Must be done before enabling beacon generation.
+ */
+ rum_write(sc, RT2573_TXRX_CSR10, 1 << 12 | 8);
+ }
- tmp = rum_read(sc, RT2573_TXRX_CSR9) & 0xff000000;
+ tmp = rum_read(sc, RT2573_TXRX_CSR9) & 0xff000000;
- /* set beacon interval (in 1/16ms unit) */
- tmp |= ic->ic_bss->ni_intval * 16;
+ /* set beacon interval (in 1/16ms unit) */
+ tmp |= ic->ic_bss->ni_intval * 16;
- tmp |= RT2573_TSF_TICKING | RT2573_ENABLE_TBTT;
- if (ic->ic_opmode == IEEE80211_M_STA)
- tmp |= RT2573_TSF_MODE(1);
- else
- tmp |= RT2573_TSF_MODE(2) | RT2573_GENERATE_BEACON;
+ tmp |= RT2573_TSF_TICKING | RT2573_ENABLE_TBTT;
+ if (ic->ic_opmode == IEEE80211_M_STA)
+ tmp |= RT2573_TSF_MODE(1);
+ else
+ tmp |= RT2573_TSF_MODE(2) | RT2573_GENERATE_BEACON;
rum_write(sc, RT2573_TXRX_CSR9, tmp);
@@ -2046,21 +2042,21 @@ rum_activate(device_ptr_t self, enum devact act)
int
rum_led_write(struct rum_softc *sc, uint16_t reg, uint8_t strength)
{
- usb_device_request_t req;
- usbd_status error;
-
- req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
- req.bRequest = RT2573_WRITE_LED;
- USETW(req.wValue, reg);
- USETW(req.wIndex, strength);
- USETW(req.wLength, 0);
-
- error = usbd_do_request(sc->sc_udev, &req, NULL);
- if (error != 0) {
- printf("%s: could not write LED register: %s\n",
- USBDEVNAME(sc->sc_dev), usbd_errstr(error));
+ usb_device_request_t req;
+ usbd_status error;
+
+ req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
+ req.bRequest = RT2573_WRITE_LED;
+ USETW(req.wValue, reg);
+ USETW(req.wIndex, strength);
+ USETW(req.wLength, 0);
+
+ error = usbd_do_request(sc->sc_udev, &req, NULL);
+ if (error != 0) {
+ printf("%s: could not write LED register: %s\n",
+ USBDEVNAME(sc->sc_dev), usbd_errstr(error));
return (-1);
- }
+ }
return (0);
}
@@ -2068,19 +2064,19 @@ rum_led_write(struct rum_softc *sc, uint16_t reg, uint8_t strength)
int
rum_firmware_run(struct rum_softc *sc)
{
- usb_device_request_t req;
- usbd_status error;
-
- req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
- req.bRequest = RT2573_FIRMWARE_RUN;
- USETW(req.wValue, 0x8);
- USETW(req.wIndex, 0);
- USETW(req.wLength, 0);
-
- error = usbd_do_request(sc->sc_udev, &req, NULL);
- if (error != 0) {
- printf("%s: could not run firmware: %s\n",
- USBDEVNAME(sc->sc_dev), usbd_errstr(error));
+ usb_device_request_t req;
+ usbd_status error;
+
+ req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
+ req.bRequest = RT2573_FIRMWARE_RUN;
+ USETW(req.wValue, 0x8);
+ USETW(req.wIndex, 0);
+ USETW(req.wLength, 0);
+
+ error = usbd_do_request(sc->sc_udev, &req, NULL);
+ if (error != 0) {
+ printf("%s: could not run firmware: %s\n",
+ USBDEVNAME(sc->sc_dev), usbd_errstr(error));
return (-1);
}
return (0);
@@ -2096,12 +2092,12 @@ rum_load_microcode(struct rum_softc *sc, const u_char *ucode, size_t size)
(ucode[i+1] << 8) | ucode[i]);
}
/* run the firmware */
- if (rum_firmware_run(sc) < 0) {
+ if (rum_firmware_run(sc) < 0) {
return (-1);
}
DELAY(1000);
- return (0);
+ return (0);
}
int
diff --git a/sys/dev/usb/if_rumreg.h b/sys/dev/usb/if_rumreg.h
index f1e70c358e1..6e42414f33d 100644
--- a/sys/dev/usb/if_rumreg.h
+++ b/sys/dev/usb/if_rumreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rumreg.h,v 1.3 2006/07/18 20:12:15 damien Exp $ */
+/* $OpenBSD: if_rumreg.h,v 1.4 2006/07/18 20:54:15 damien Exp $ */
/*-
* Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini@free.fr>
* Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org>
@@ -41,12 +41,12 @@
#define RT2573_RESET_ASIC (1 << 0)
#define RT2573_RESET_BBP (1 << 1)
-#define RT2573_ENABLE_TSF (1 << 0)
-#define RT2573_ENABLE_TSF_SYNC(x) (((x) & 0x3) << 1)
-#define RT2573_ENABLE_TBCN (1 << 3)
+#define RT2573_ENABLE_TSF (1 << 0)
+#define RT2573_ENABLE_TSF_SYNC(x) (((x) & 0x3) << 1)
+#define RT2573_ENABLE_TBCN (1 << 3)
#define RT2573_ENABLE_BEACON_GENERATOR (1 << 4)
-#define RT2573_RF_AWAKE (3 << 7)
+#define RT2573_RF_AWAKE (3 << 7)
#define RT2573_BBP_AWAKE (3 << 5)
#define RT2573_BBP_WRITE (1 << 15)
@@ -65,45 +65,45 @@
#define RT2573_RF_2528 0x00
#define RT2573_BBP_VERSION 0
-#define RT2573_BBP_TX 2
-#define RT2573_BBP_RX 14
+#define RT2573_BBP_TX 2
+#define RT2573_BBP_RX 14
#define RT2573_BBP_ANTA 0x00
#define RT2573_BBP_DIVERSITY 0x01
#define RT2573_BBP_ANTB 0x02
-#define RT2573_BBP_ANTMASK 0x03
-#define RT2573_BBP_FLIPIQ 0x04
+#define RT2573_BBP_ANTMASK 0x03
+#define RT2573_BBP_FLIPIQ 0x04
#define RT2573_JAPAN_FILTER 0x08
struct rum_tx_desc {
uint32_t flags;
#define RT2573_TX_RETRY(x) ((x) << 4)
-#define RT2573_TX_MORE_FRAG (1 << 8)
-#define RT2573_TX_ACK (1 << 9)
-#define RT2573_TX_TIMESTAMP (1 << 10)
-#define RT2573_TX_OFDM (1 << 11)
+#define RT2573_TX_MORE_FRAG (1 << 8)
+#define RT2573_TX_ACK (1 << 9)
+#define RT2573_TX_TIMESTAMP (1 << 10)
+#define RT2573_TX_OFDM (1 << 11)
#define RT2573_TX_NEWSEQ (1 << 12)
#define RT2573_TX_IFS_MASK 0x00006000
-#define RT2573_TX_IFS_BACKOFF (0 << 13)
+#define RT2573_TX_IFS_BACKOFF (0 << 13)
#define RT2573_TX_IFS_SIFS (1 << 13)
#define RT2573_TX_IFS_NEWBACKOFF (2 << 13)
#define RT2573_TX_IFS_NONE (3 << 13)
uint16_t wme;
-#define RT2573_QID(v) (v)
-#define RT2573_AIFSN(v) ((v) << 4)
-#define RT2573_LOGCWMAX(x) (((x) & 0xf) << 12)
-#define RT2573_LOGCWMIN(x) (((x) & 0xf) << 8)
-#define RT2573_IVOFFSET(x) (((x) & 0x3f))
+#define RT2573_QID(v) (v)
+#define RT2573_AIFSN(v) ((v) << 4)
+#define RT2573_LOGCWMAX(x) (((x) & 0xf) << 12)
+#define RT2573_LOGCWMIN(x) (((x) & 0xf) << 8)
+#define RT2573_IVOFFSET(x) (((x) & 0x3f))
uint16_t xflags;
uint16_t reserved;
uint8_t plcp_signal;
uint8_t plcp_service;
#define RT2573_PLCP_LENGEXT 0x80
-#define RT2573_TX_HWSEQ (1 << 12)
+#define RT2573_TX_HWSEQ (1 << 12)
uint8_t plcp_length_lo;
uint8_t plcp_length_hi;
@@ -111,7 +111,7 @@ struct rum_tx_desc {
uint32_t eiv;
uint8_t offset;
uint8_t qid;
-#define RT2573_QID_MGT 13
+#define RT2573_QID_MGT 13
} __packed;
struct rum_rx_desc {
@@ -119,11 +119,11 @@ struct rum_rx_desc {
#define RT2573_RX_CRC_ERROR (1 << 5)
#define RT2573_RX_OFDM (1 << 6)
#define RT2573_RX_PHY_ERROR (1 << 7)
-#define RT2573_TX_BUSY (1 << 0)
-#define RT2573_TX_VALID (1 << 1)
-#define RT2573_TX_IFS (1 << 6)
-#define RT2573_TX_LONG_RETRY (1 << 7)
-#define RT2573_TX_BURST (1 << 28)
+#define RT2573_TX_BUSY (1 << 0)
+#define RT2573_TX_VALID (1 << 1)
+#define RT2573_TX_IFS (1 << 6)
+#define RT2573_TX_LONG_RETRY (1 << 7)
+#define RT2573_TX_BURST (1 << 28)
uint8_t rate;
uint8_t rssi;
@@ -134,8 +134,8 @@ struct rum_rx_desc {
} __packed;
#define RT2573_RF_LOBUSY (1 << 15)
-#define RT2573_RF_BUSY (1 << 31)
-#define RT2573_RF_20BIT (20 << 24)
+#define RT2573_RF_BUSY (1 << 31)
+#define RT2573_RF_20BIT (20 << 24)
#define RT2573_RF1 0
#define RT2573_RF2 2
@@ -150,203 +150,203 @@ struct rum_rx_desc {
#define RT2573_EEPROM_VERSION 0x0002
#define RT2573_EEPROM_ADDRESS 0x0004
-#define RT2573_EEPROM_TXPOWER_RT70 0x003c
-#define RT2573_EEPROM_TXPOWER_RT71 0x0046
-#define RT2573_EEPROM_CONFIG0_RT70 0x0016
-#define RT2573_EEPROM_CONFIG0_RT71 0x0020
+#define RT2573_EEPROM_TXPOWER_RT70 0x003c
+#define RT2573_EEPROM_TXPOWER_RT71 0x0046
+#define RT2573_EEPROM_CONFIG0_RT70 0x0016
+#define RT2573_EEPROM_CONFIG0_RT71 0x0020
#define RT2573_EEPROM_BBP_BASE_RT70 0x001c
#define RT2573_EEPROM_BBP_BASE_RT71 0x0026
-#define RT2573_MCU_CODE_BASE 0x800
-#define RT2573_TX_RING_COUNT 32
-#define RT2573_MGT_RING_COUNT 32
-#define RT2573_RX_RING_COUNT 64
+#define RT2573_MCU_CODE_BASE 0x800
+#define RT2573_TX_RING_COUNT 32
+#define RT2573_MGT_RING_COUNT 32
+#define RT2573_RX_RING_COUNT 64
-#define RT2573_TX_DESC_SIZE (sizeof (struct rum_tx_desc))
-#define RT2573_TX_DESC_WSIZE (RT2661_TX_DESC_SIZE / 4)
-#define RT2573_RX_DESC_SIZE (sizeof (struct rum_rx_desc))
-#define RT2573_RX_DESC_WSIZE (RT2661_RX_DESC_SIZE / 4)
+#define RT2573_TX_DESC_SIZE (sizeof (struct rum_tx_desc))
+#define RT2573_TX_DESC_WSIZE (RT2661_TX_DESC_SIZE / 4)
+#define RT2573_RX_DESC_SIZE (sizeof (struct rum_rx_desc))
+#define RT2573_RX_DESC_WSIZE (RT2661_RX_DESC_SIZE / 4)
-#define RT2573_MAX_SCATTER 5
+#define RT2573_MAX_SCATTER 5
/*
* Control and status registers.
*/
-#define RT2573_HOST_CMD_CSR 0x0008
-#define RT2573_MCU_CNTL_CSR 0x000c
-#define RT2573_SOFT_RESET_CSR 0x0010
-#define RT2573_MCU_INT_SOURCE_CSR 0x0014
-#define RT2573_MCU_INT_MASK_CSR 0x0018
-#define RT2573_PCI_USEC_CSR 0x001c
-#define RT2573_H2M_MAILBOX_CSR 0x2100
-#define RT2573_M2H_CMD_DONE_CSR 0x2104
-#define RT2573_HW_BEACON_BASE0 0x2400
-#define RT2573_MAC_CSR0 0x3000
-#define RT2573_MAC_CSR1 0x3004
-#define RT2573_MAC_CSR2 0x3008
-#define RT2573_MAC_CSR3 0x300c
-#define RT2573_MAC_CSR4 0x3010
-#define RT2573_MAC_CSR5 0x3014
-#define RT2573_MAC_CSR6 0x3018
-#define RT2573_MAC_CSR7 0x301c
-#define RT2573_MAC_CSR8 0x3020
-#define RT2573_MAC_CSR9 0x3024
-#define RT2573_MAC_CSR10 0x3028
-#define RT2573_MAC_CSR11 0x302c
-#define RT2573_MAC_CSR12 0x3030
-#define RT2573_MAC_CSR13 0x3034
-#define RT2573_MAC_CSR14 0x3038
-#define RT2573_MAC_CSR15 0x303c
-#define RT2573_TXRX_CSR0 0x3040
-#define RT2573_TXRX_CSR1 0x3044
-#define RT2573_TXRX_CSR2 0x3048
-#define RT2573_TXRX_CSR3 0x304c
-#define RT2573_TXRX_CSR4 0x3050
-#define RT2573_TXRX_CSR5 0x3054
-#define RT2573_TXRX_CSR6 0x3058
-#define RT2573_TXRX_CSR7 0x305c
-#define RT2573_TXRX_CSR8 0x3060
-#define RT2573_TXRX_CSR9 0x3064
-#define RT2573_TXRX_CSR10 0x3068
-#define RT2573_TXRX_CSR11 0x306c
-#define RT2573_TXRX_CSR12 0x3070
-#define RT2573_TXRX_CSR13 0x3074
-#define RT2573_TXRX_CSR14 0x3078
-#define RT2573_TXRX_CSR15 0x307c
-#define RT2573_PHY_CSR0 0x3080
-#define RT2573_PHY_CSR1 0x3084
-#define RT2573_PHY_CSR2 0x3088
-#define RT2573_PHY_CSR3 0x308c
-#define RT2573_PHY_CSR4 0x3090
-#define RT2573_PHY_CSR5 0x3094
-#define RT2573_PHY_CSR6 0x3098
-#define RT2573_PHY_CSR7 0x309c
-#define RT2573_SEC_CSR0 0x30a0
-#define RT2573_SEC_CSR1 0x30a4
-#define RT2573_SEC_CSR2 0x30a8
-#define RT2573_SEC_CSR3 0x30ac
-#define RT2573_SEC_CSR4 0x30b0
-#define RT2573_SEC_CSR5 0x30b4
-#define RT2573_STA_CSR0 0x30c0
-#define RT2573_STA_CSR1 0x30c4
-#define RT2573_STA_CSR2 0x30c8
-#define RT2573_STA_CSR3 0x30cc
-#define RT2573_STA_CSR4 0x30d0
-#define RT2573_AC0_BASE_CSR 0x3400
-#define RT2573_AC1_BASE_CSR 0x3404
-#define RT2573_AC2_BASE_CSR 0x3408
-#define RT2573_AC3_BASE_CSR 0x340c
-#define RT2573_MGT_BASE_CSR 0x3410
-#define RT2573_TX_RING_CSR0 0x3418
-#define RT2573_TX_RING_CSR1 0x341c
-#define RT2573_AIFSN_CSR 0x3420
-#define RT2573_CWMIN_CSR 0x3424
-#define RT2573_CWMAX_CSR 0x3428
-#define RT2573_TX_DMA_DST_CSR 0x342c
-#define RT2573_TX_CNTL_CSR 0x3430
-#define RT2573_LOAD_TX_RING_CSR 0x3434
-#define RT2573_RX_BASE_CSR 0x3450
-#define RT2573_RX_RING_CSR 0x3454
-#define RT2573_RX_CNTL_CSR 0x3458
-#define RT2573_PCI_CFG_CSR 0x3460
-#define RT2573_INT_SOURCE_CSR 0x3468
-#define RT2573_INT_MASK_CSR 0x346c
-#define RT2573_E2PROM_CSR 0x3470
-#define RT2573_AC_TXOP_CSR0 0x3474
-#define RT2573_AC_TXOP_CSR1 0x3478
-#define RT2573_TEST_MODE_CSR 0x3484
-#define RT2573_IO_CNTL_CSR 0x3498
+#define RT2573_HOST_CMD_CSR 0x0008
+#define RT2573_MCU_CNTL_CSR 0x000c
+#define RT2573_SOFT_RESET_CSR 0x0010
+#define RT2573_MCU_INT_SOURCE_CSR 0x0014
+#define RT2573_MCU_INT_MASK_CSR 0x0018
+#define RT2573_PCI_USEC_CSR 0x001c
+#define RT2573_H2M_MAILBOX_CSR 0x2100
+#define RT2573_M2H_CMD_DONE_CSR 0x2104
+#define RT2573_HW_BEACON_BASE0 0x2400
+#define RT2573_MAC_CSR0 0x3000
+#define RT2573_MAC_CSR1 0x3004
+#define RT2573_MAC_CSR2 0x3008
+#define RT2573_MAC_CSR3 0x300c
+#define RT2573_MAC_CSR4 0x3010
+#define RT2573_MAC_CSR5 0x3014
+#define RT2573_MAC_CSR6 0x3018
+#define RT2573_MAC_CSR7 0x301c
+#define RT2573_MAC_CSR8 0x3020
+#define RT2573_MAC_CSR9 0x3024
+#define RT2573_MAC_CSR10 0x3028
+#define RT2573_MAC_CSR11 0x302c
+#define RT2573_MAC_CSR12 0x3030
+#define RT2573_MAC_CSR13 0x3034
+#define RT2573_MAC_CSR14 0x3038
+#define RT2573_MAC_CSR15 0x303c
+#define RT2573_TXRX_CSR0 0x3040
+#define RT2573_TXRX_CSR1 0x3044
+#define RT2573_TXRX_CSR2 0x3048
+#define RT2573_TXRX_CSR3 0x304c
+#define RT2573_TXRX_CSR4 0x3050
+#define RT2573_TXRX_CSR5 0x3054
+#define RT2573_TXRX_CSR6 0x3058
+#define RT2573_TXRX_CSR7 0x305c
+#define RT2573_TXRX_CSR8 0x3060
+#define RT2573_TXRX_CSR9 0x3064
+#define RT2573_TXRX_CSR10 0x3068
+#define RT2573_TXRX_CSR11 0x306c
+#define RT2573_TXRX_CSR12 0x3070
+#define RT2573_TXRX_CSR13 0x3074
+#define RT2573_TXRX_CSR14 0x3078
+#define RT2573_TXRX_CSR15 0x307c
+#define RT2573_PHY_CSR0 0x3080
+#define RT2573_PHY_CSR1 0x3084
+#define RT2573_PHY_CSR2 0x3088
+#define RT2573_PHY_CSR3 0x308c
+#define RT2573_PHY_CSR4 0x3090
+#define RT2573_PHY_CSR5 0x3094
+#define RT2573_PHY_CSR6 0x3098
+#define RT2573_PHY_CSR7 0x309c
+#define RT2573_SEC_CSR0 0x30a0
+#define RT2573_SEC_CSR1 0x30a4
+#define RT2573_SEC_CSR2 0x30a8
+#define RT2573_SEC_CSR3 0x30ac
+#define RT2573_SEC_CSR4 0x30b0
+#define RT2573_SEC_CSR5 0x30b4
+#define RT2573_STA_CSR0 0x30c0
+#define RT2573_STA_CSR1 0x30c4
+#define RT2573_STA_CSR2 0x30c8
+#define RT2573_STA_CSR3 0x30cc
+#define RT2573_STA_CSR4 0x30d0
+#define RT2573_AC0_BASE_CSR 0x3400
+#define RT2573_AC1_BASE_CSR 0x3404
+#define RT2573_AC2_BASE_CSR 0x3408
+#define RT2573_AC3_BASE_CSR 0x340c
+#define RT2573_MGT_BASE_CSR 0x3410
+#define RT2573_TX_RING_CSR0 0x3418
+#define RT2573_TX_RING_CSR1 0x341c
+#define RT2573_AIFSN_CSR 0x3420
+#define RT2573_CWMIN_CSR 0x3424
+#define RT2573_CWMAX_CSR 0x3428
+#define RT2573_TX_DMA_DST_CSR 0x342c
+#define RT2573_TX_CNTL_CSR 0x3430
+#define RT2573_LOAD_TX_RING_CSR 0x3434
+#define RT2573_RX_BASE_CSR 0x3450
+#define RT2573_RX_RING_CSR 0x3454
+#define RT2573_RX_CNTL_CSR 0x3458
+#define RT2573_PCI_CFG_CSR 0x3460
+#define RT2573_INT_SOURCE_CSR 0x3468
+#define RT2573_INT_MASK_CSR 0x346c
+#define RT2573_E2PROM_CSR 0x3470
+#define RT2573_AC_TXOP_CSR0 0x3474
+#define RT2573_AC_TXOP_CSR1 0x3478
+#define RT2573_TEST_MODE_CSR 0x3484
+#define RT2573_IO_CNTL_CSR 0x3498
/* possible flags for register HOST_CMD_CSR */
-#define RT2573_KICK_CMD (1 << 7)
+#define RT2573_KICK_CMD (1 << 7)
/* Host to MCU (8051) command identifiers */
-#define RT2573_MCU_CMD_SLEEP 0x30
-#define RT2573_MCU_CMD_WAKEUP 0x31
-#define RT2573_MCU_SET_LED 0x50
-#define RT2573_MCU_SET_RSSI_LED 0x52
+#define RT2573_MCU_CMD_SLEEP 0x30
+#define RT2573_MCU_CMD_WAKEUP 0x31
+#define RT2573_MCU_SET_LED 0x50
+#define RT2573_MCU_SET_RSSI_LED 0x52
/* possible flags for register MCU_CNTL_CSR */
-#define RT2573_MCU_SEL (1 << 0)
-#define RT2573_MCU_RESET (1 << 1)
-#define RT2573_MCU_READY (1 << 2)
+#define RT2573_MCU_SEL (1 << 0)
+#define RT2573_MCU_RESET (1 << 1)
+#define RT2573_MCU_READY (1 << 2)
/* possible flags for register MCU_INT_SOURCE_CSR */
-#define RT2573_MCU_CMD_DONE 0xff
-#define RT2573_MCU_WAKEUP (1 << 8)
-#define RT2573_MCU_BEACON_EXPIRE (1 << 9)
+#define RT2573_MCU_CMD_DONE 0xff
+#define RT2573_MCU_WAKEUP (1 << 8)
+#define RT2573_MCU_BEACON_EXPIRE (1 << 9)
/* possible flags for register H2M_MAILBOX_CSR */
-#define RT2573_H2M_BUSY (1 << 24)
-#define RT2573_TOKEN_NO_INTR 0xff
+#define RT2573_H2M_BUSY (1 << 24)
+#define RT2573_TOKEN_NO_INTR 0xff
/* possible flags for register MAC_CSR5 */
-#define RT2573_ONE_BSSID 3
+#define RT2573_ONE_BSSID 3
/* possible flags for register TXRX_CSR0 */
/* Tx filter flags are in the low 16 bits */
-#define RT2573_AUTO_TX_SEQ (1 << 15)
+#define RT2573_AUTO_TX_SEQ (1 << 15)
/* Rx filter flags are in the high 16 bits */
-#define RT2573_DISABLE_RX (1 << 16)
-#define RT2573_DROP_CRC_ERROR (1 << 17)
-#define RT2573_DROP_PHY_ERROR (1 << 18)
-#define RT2573_DROP_CTL (1 << 19)
-#define RT2573_DROP_NOT_TO_ME (1 << 20)
-#define RT2573_DROP_TODS (1 << 21)
-#define RT2573_DROP_VER_ERROR (1 << 22)
-#define RT2573_DROP_MULTICAST (1 << 23)
-#define RT2573_DROP_BROADCAST (1 << 24)
-#define RT2573_DROP_ACKCTS (1 << 25)
+#define RT2573_DISABLE_RX (1 << 16)
+#define RT2573_DROP_CRC_ERROR (1 << 17)
+#define RT2573_DROP_PHY_ERROR (1 << 18)
+#define RT2573_DROP_CTL (1 << 19)
+#define RT2573_DROP_NOT_TO_ME (1 << 20)
+#define RT2573_DROP_TODS (1 << 21)
+#define RT2573_DROP_VER_ERROR (1 << 22)
+#define RT2573_DROP_MULTICAST (1 << 23)
+#define RT2573_DROP_BROADCAST (1 << 24)
+#define RT2573_DROP_ACKCTS (1 << 25)
#define RT2573_DROP_VERSION_ERROR (1 << 6)
/* possible flags for register TXRX_CSR4 */
-#define RT2573_SHORT_PREAMBLE (1 << 19)
-#define RT2573_MRR_ENABLED (1 << 20)
-#define RT2573_MRR_CCK_FALLBACK (1 << 23)
+#define RT2573_SHORT_PREAMBLE (1 << 19)
+#define RT2573_MRR_ENABLED (1 << 20)
+#define RT2573_MRR_CCK_FALLBACK (1 << 23)
/* possible flags for register TXRX_CSR9 */
-#define RT2573_TSF_TICKING (1 << 16)
-#define RT2573_TSF_MODE(x) (((x) & 0x3) << 17)
+#define RT2573_TSF_TICKING (1 << 16)
+#define RT2573_TSF_MODE(x) (((x) & 0x3) << 17)
/* TBTT stands for Target Beacon Transmission Time */
-#define RT2573_ENABLE_TBTT (1 << 19)
-#define RT2573_GENERATE_BEACON (1 << 20)
+#define RT2573_ENABLE_TBTT (1 << 19)
+#define RT2573_GENERATE_BEACON (1 << 20)
/* possible flags for register PHY_CSR0 */
-#define RT2573_PA_PE_2GHZ (1 << 16)
-#define RT2573_PA_PE_5GHZ (1 << 17)
+#define RT2573_PA_PE_2GHZ (1 << 16)
+#define RT2573_PA_PE_5GHZ (1 << 17)
/* possible flags for register PHY_CSR3 */
-#define RT2573_BBP_READ (1 << 15)
-#define RT2573_BBP_BUSY (1 << 16)
+#define RT2573_BBP_READ (1 << 15)
+#define RT2573_BBP_BUSY (1 << 16)
/* possible flags for register PHY_CSR4 */
#define RT2573_RF_20BIT (20 << 24)
#define RT2573_RF_BUSY (1 << 31)
/* possible values for register STA_CSR4 */
-#define RT2573_TX_STAT_VALID (1 << 0)
-#define RT2573_TX_RESULT(v) (((v) >> 1) & 0x7)
-#define RT2573_TX_RETRYCNT(v) (((v) >> 4) & 0xf)
-#define RT2573_TX_QID(v) (((v) >> 8) & 0xf)
-#define RT2573_TX_SUCCESS 0
-#define RT2573_TX_RETRY_FAIL 6
+#define RT2573_TX_STAT_VALID (1 << 0)
+#define RT2573_TX_RESULT(v) (((v) >> 1) & 0x7)
+#define RT2573_TX_RETRYCNT(v) (((v) >> 4) & 0xf)
+#define RT2573_TX_QID(v) (((v) >> 8) & 0xf)
+#define RT2573_TX_SUCCESS 0
+#define RT2573_TX_RETRY_FAIL 6
/* possible flags for register TX_CNTL_CSR */
-#define RT2573_KICK_MGT (1 << 4)
+#define RT2573_KICK_MGT (1 << 4)
/* possible flags for register INT_SOURCE_CSR */
-#define RT2573_TX_DONE (1 << 0)
-#define RT2573_RX_DONE (1 << 1)
-#define RT2573_TX0_DMA_DONE (1 << 16)
-#define RT2573_TX1_DMA_DONE (1 << 17)
-#define RT2573_TX2_DMA_DONE (1 << 18)
-#define RT2573_TX3_DMA_DONE (1 << 19)
-#define RT2573_MGT_DONE (1 << 20)
+#define RT2573_TX_DONE (1 << 0)
+#define RT2573_RX_DONE (1 << 1)
+#define RT2573_TX0_DMA_DONE (1 << 16)
+#define RT2573_TX1_DMA_DONE (1 << 17)
+#define RT2573_TX2_DMA_DONE (1 << 18)
+#define RT2573_TX3_DMA_DONE (1 << 19)
+#define RT2573_MGT_DONE (1 << 20)
/* possible flags for register E2PROM_CSR */
-#define RT2573_C (1 << 1)
-#define RT2573_S (1 << 2)
-#define RT2573_D (1 << 3)
-#define RT2573_Q (1 << 4)
-#define RT2573_93C46 (1 << 5)
+#define RT2573_C (1 << 1)
+#define RT2573_S (1 << 2)
+#define RT2573_D (1 << 3)
+#define RT2573_Q (1 << 4)
+#define RT2573_93C46 (1 << 5)
/* LED values */
#define RT2573_LED_RADIO (1 << 8)
@@ -360,28 +360,28 @@ struct rum_rx_desc {
* Default values for MAC registers; values taken from the reference driver.
*/
#define RT2573_DEF_MAC \
- { RT2573_TXRX_CSR0, 0x025fb032 }, \
- { RT2573_TXRX_CSR1, 0x9eaa9eaf }, \
- { RT2573_TXRX_CSR2, 0x8a8b8c8d }, \
- { RT2573_TXRX_CSR3, 0x00858687 }, \
- { RT2573_TXRX_CSR7, 0x2e31353b }, \
- { RT2573_TXRX_CSR8, 0x2a2a2a2c }, \
- { RT2573_TXRX_CSR15, 0x0000000f }, \
- { RT2573_MAC_CSR6, 0x00000fff }, \
- { RT2573_MAC_CSR8, 0x016c030a }, \
- { RT2573_MAC_CSR10, 0x00000718 }, \
- { RT2573_MAC_CSR12, 0x00000004 }, \
- { RT2573_MAC_CSR13, 0x00007f00 }, \
- { RT2573_SEC_CSR0, 0x00000000 }, \
- { RT2573_SEC_CSR1, 0x00000000 }, \
- { RT2573_SEC_CSR5, 0x00000000 }, \
- { RT2573_PHY_CSR1, 0x000023b0 }, \
- { RT2573_PHY_CSR5, 0x00040a06 }, \
- { RT2573_PHY_CSR6, 0x00080606 }, \
- { RT2573_PHY_CSR7, 0x00000408 }, \
- { RT2573_AIFSN_CSR, 0x00002273 }, \
- { RT2573_CWMIN_CSR, 0x00002344 }, \
- { RT2573_CWMAX_CSR, 0x000034aa }
+ { RT2573_TXRX_CSR0, 0x025fb032 }, \
+ { RT2573_TXRX_CSR1, 0x9eaa9eaf }, \
+ { RT2573_TXRX_CSR2, 0x8a8b8c8d }, \
+ { RT2573_TXRX_CSR3, 0x00858687 }, \
+ { RT2573_TXRX_CSR7, 0x2e31353b }, \
+ { RT2573_TXRX_CSR8, 0x2a2a2a2c }, \
+ { RT2573_TXRX_CSR15, 0x0000000f }, \
+ { RT2573_MAC_CSR6, 0x00000fff }, \
+ { RT2573_MAC_CSR8, 0x016c030a }, \
+ { RT2573_MAC_CSR10, 0x00000718 }, \
+ { RT2573_MAC_CSR12, 0x00000004 }, \
+ { RT2573_MAC_CSR13, 0x00007f00 }, \
+ { RT2573_SEC_CSR0, 0x00000000 }, \
+ { RT2573_SEC_CSR1, 0x00000000 }, \
+ { RT2573_SEC_CSR5, 0x00000000 }, \
+ { RT2573_PHY_CSR1, 0x000023b0 }, \
+ { RT2573_PHY_CSR5, 0x00040a06 }, \
+ { RT2573_PHY_CSR6, 0x00080606 }, \
+ { RT2573_PHY_CSR7, 0x00000408 }, \
+ { RT2573_AIFSN_CSR, 0x00002273 }, \
+ { RT2573_CWMIN_CSR, 0x00002344 }, \
+ { RT2573_CWMAX_CSR, 0x000034aa }
/*
* Default values for BBP registers; values taken from the reference driver.