[Zrouter-src-freebsd] [rt2860-in-ral] push by bschm... at techwires.net - more reg shuffle on 2012-03-14 13:43 GMT

rt2860-in-ral at googlecode.com rt2860-in-ral at googlecode.com
Wed Mar 14 13:44:42 UTC 2012


Revision: 03d7557451b5
Author:   Bernhard Schmidt <bschmidt at techwires.net>
Date:     Wed Mar 14 06:43:30 2012
Log:      more reg shuffle
http://code.google.com/p/rt2860-in-ral/source/detail?r=03d7557451b5

Modified:
  /sys/dev/ral/rt2860.c
  /sys/dev/ral/rt2860reg.h

=======================================
--- /sys/dev/ral/rt2860.c	Wed Mar 14 04:46:02 2012
+++ /sys/dev/ral/rt2860.c	Wed Mar 14 06:43:30 2012
@@ -1109,7 +1109,7 @@
  	RAL_WRITE(sc, RT2860_REG_H2M_MAILBOX, 0);

  	rt2860_io_mcu_cmd(sc, RT2860_IO_MCU_CMD_BOOT,
-		RT2860_REG_H2M_TOKEN_NO_INTR, 0);
+		RT2860_TOKEN_NO_INTR, 0);

  	DELAY(1000);

@@ -1227,11 +1227,11 @@

  	/* send LEDs operating mode to microcontroller */
  	rt2860_io_mcu_cmd(sc, RT2860_IO_MCU_CMD_LED1,
-		RT2860_REG_H2M_TOKEN_NO_INTR, sc->led_off[0]);
+		RT2860_TOKEN_NO_INTR, sc->led_off[0]);
  	rt2860_io_mcu_cmd(sc, RT2860_IO_MCU_CMD_LED2,
-		RT2860_REG_H2M_TOKEN_NO_INTR, sc->led_off[1]);
+		RT2860_TOKEN_NO_INTR, sc->led_off[1]);
  	rt2860_io_mcu_cmd(sc, RT2860_IO_MCU_CMD_LED3,
-		RT2860_REG_H2M_TOKEN_NO_INTR, sc->led_off[2]);
+		RT2860_TOKEN_NO_INTR, sc->led_off[2]);

  	/* turn radio LED on */

@@ -1255,12 +1255,12 @@
  		tmp = RAL_READ(sc, RT2860_REG_SCHDMA_GPIO_CTRL_CFG);
  	        if (tmp & (1 << 2)) {
  			rt2860_io_mcu_cmd(sc, RT2860_IO_MCU_CMD_SLEEP,
-				RT2860_REG_H2M_TOKEN_RADIOOFF, 0x02ff);
-			rt2860_io_mcu_cmd_check(sc, RT2860_REG_H2M_TOKEN_RADIOOFF);
+				RT2860_TOKEN_RADIOOFF, 0x02ff);
+			rt2860_io_mcu_cmd_check(sc, RT2860_TOKEN_RADIOOFF);

  			rt2860_io_mcu_cmd(sc, RT2860_IO_MCU_CMD_WAKEUP,
-				RT2860_REG_H2M_TOKEN_WAKEUP, 0);
-			rt2860_io_mcu_cmd_check(sc, RT2860_REG_H2M_TOKEN_WAKEUP);
+				RT2860_TOKEN_WAKEUP, 0);
+			rt2860_io_mcu_cmd_check(sc, RT2860_TOKEN_WAKEUP);
  		}
  	}

@@ -2033,15 +2033,15 @@
  	switch (k->wk_cipher->ic_cipher) {
  	case IEEE80211_CIPHER_WEP:
  		if(k->wk_keylen < 8)
-			mode = RT2860_REG_CIPHER_MODE_WEP40;
+			mode = RT2860_MODE_WEP40;
  		else
-			mode = RT2860_REG_CIPHER_MODE_WEP104;
+			mode = RT2860_MODE_WEP104;
  		break;
  	case IEEE80211_CIPHER_TKIP:
-		mode = RT2860_REG_CIPHER_MODE_TKIP;
+		mode = RT2860_MODE_TKIP;
  		break;
  	case IEEE80211_CIPHER_AES_CCM:
-		mode = RT2860_REG_CIPHER_MODE_AES_CCMP;
+		mode = RT2860_MODE_AES_CCMP;
  		break;
  	default:
  		printf("Wrong key CIPHER (%d)\n", k->wk_cipher->ic_cipher);
@@ -2117,8 +2117,8 @@
  		} else {
  			RAL_WRITE_REGION_1(sc, key_base, k->wk_key, k->wk_keylen);
  		}
-		tmp = ((vapid & RT2860_REG_VAP_MASK) << RT2860_REG_VAP_SHIFT) |
-			(mode << RT2860_REG_CIPHER_MODE_SHIFT) | RT2860_REG_PKEY_ENABLE;
+		tmp = (vapid << RT2860_VAP_SHIFT) |
+			(mode << RT2860_MODE_SHIFT) | RT2860_RX_PKEY_EN;

  		RAL_WRITE(sc, RT2860_REG_WCID_ATTR(wcid), tmp);
  	}
@@ -2185,8 +2185,8 @@

  			RAL_WRITE_REGION_1(sc, RT2860_REG_IVEIV(wcid), iv, 8);

-			tmp = ((vapid & RT2860_REG_VAP_MASK) << RT2860_REG_VAP_SHIFT) |
-				(mode << RT2860_REG_CIPHER_MODE_SHIFT);
+			tmp = (vapid << RT2860_VAP_SHIFT) |
+				(mode << RT2860_MODE_SHIFT);

  			RAL_WRITE(sc, RT2860_REG_WCID_ATTR(wcid), tmp);
  		}
@@ -2225,13 +2225,13 @@
  		tmp = RAL_READ(sc, RT2860_REG_SKEY_MODE(vapid));

  		tmp &= ~(0xf << (k->wk_keyix * 4 + 16 * (vapid % 2)));
-		tmp |= (RT2860_REG_CIPHER_MODE_NONE << (k->wk_keyix * 4 + 16 * (vapid %  
2)));
+		tmp |= (RT2860_MODE_NOSEC << (k->wk_keyix * 4 + 16 * (vapid % 2)));

  		RAL_WRITE(sc, RT2860_REG_SKEY_MODE(vapid), tmp);

  		if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
-			tmp = ((vapid & RT2860_REG_VAP_MASK) << RT2860_REG_VAP_SHIFT) |
-				(RT2860_REG_CIPHER_MODE_NONE << RT2860_REG_CIPHER_MODE_SHIFT) |  
RT2860_REG_PKEY_ENABLE;
+			tmp = (vapid << RT2860_VAP_SHIFT) |
+				RT2860_RX_PKEY_EN;

  			RAL_WRITE(sc, RT2860_REG_WCID_ATTR(wcid), tmp);
  		}
@@ -2326,8 +2326,8 @@
  		vapid = 0;
  		wcid = rni->staid;

-		tmp = ((vapid & RT2860_REG_VAP_MASK) << RT2860_REG_VAP_SHIFT) |
-			(RT2860_REG_CIPHER_MODE_NONE << RT2860_REG_CIPHER_MODE_SHIFT) |  
RT2860_REG_PKEY_ENABLE;
+		tmp = (vapid << RT2860_VAP_SHIFT) |
+			RT2860_RX_PKEY_EN;

  		RAL_WRITE(sc, RT2860_REG_WCID_ATTR(wcid), tmp);

@@ -3317,10 +3317,10 @@

  	tmp = RAL_READ(sc, RT2860_AUTO_RSP_CFG);

-	tmp &= ~RT2860_REG_CCK_SHORT_ENABLE;
+	tmp &= ~RT2860_CCK_SHORT_EN;

  	if (ic->ic_flags & IEEE80211_F_SHPREAMBLE)
-		tmp |= RT2860_REG_CCK_SHORT_ENABLE;
+		tmp |= RT2860_CCK_SHORT_EN;

  	RAL_WRITE(sc, RT2860_AUTO_RSP_CFG, tmp);
  }
@@ -3454,10 +3454,10 @@

  	tmp = RAL_READ(sc, RT2860_REG_RX_FILTER_CFG);

-	tmp &= ~RT2860_REG_RX_FILTER_DROP_UC_NOME;
+	tmp &= ~RT2860_DROP_UC_NOME;

  	if (!(ifp->if_flags & IFF_PROMISC))
-		tmp |= RT2860_REG_RX_FILTER_DROP_UC_NOME;
+		tmp |= RT2860_DROP_UC_NOME;

  	RAL_WRITE(sc, RT2860_REG_RX_FILTER_CFG, tmp);
  }
@@ -3480,8 +3480,8 @@

  	/* CCK frame protection */

-	cck_prot = RT2860_REG_RTSTH_ENABLE | RT2860_REG_PROT_NAV_SHORT |
-		RT2860_REG_TXOP_ALLOW_ALL | RT2860_REG_PROT_CTRL_NONE;
+	cck_prot = RT2860_RTSTH_EN | RT2860_PROT_NAV_SHORT |
+		RT2860_TXOP_ALLOW_ALL;

  	/* set up protection frame phy mode and rate (MCS code) */

@@ -3496,8 +3496,8 @@

  	/* OFDM frame protection */

-	ofdm_prot = RT2860_REG_RTSTH_ENABLE | RT2860_REG_PROT_NAV_SHORT |
-		RT2860_REG_TXOP_ALLOW_ALL;
+	ofdm_prot = RT2860_REG_RTSTH_ENABLE | RT2860_PROT_NAV_SHORT |
+		RT2860_TXOP_ALLOW_ALL;

  	if (ic->ic_flags & IEEE80211_F_USEPROT) {
  		RT2860_DPRINTF(sc, RT2860_DEBUG_PROT,
@@ -3507,17 +3507,13 @@
  				((ic->ic_protmode ==  
IEEE80211_PROT_CTSONLY) ? "CTS-to-self" : "none"));

  		if (ic->ic_protmode == IEEE80211_PROT_RTSCTS)
-			ofdm_prot |= RT2860_REG_PROT_CTRL_RTS_CTS;
+			ofdm_prot |= RT2860_PROT_CTRL_RTS_CTS;
  		else if (ic->ic_protmode == IEEE80211_PROT_CTSONLY)
-			ofdm_prot |= RT2860_REG_PROT_CTRL_CTS;
-		else
-			ofdm_prot |= RT2860_REG_PROT_CTRL_NONE;
+			ofdm_prot |= RT2860_PROT_CTRL_CTS;
  	} else {
  		RT2860_DPRINTF(sc, RT2860_DEBUG_PROT,
  			"%s: updating protection mode: b/g protection mode=%s\n",
  			device_get_nameunit(sc->sc_dev), "none");
-
-		ofdm_prot |= RT2860_REG_PROT_CTRL_NONE;
  	}

  	RAL_WRITE(sc, RT2860_OFDM_PROT_CFG, ofdm_prot);
@@ -3552,33 +3548,31 @@
  	switch (htopmode & IEEE80211_HTINFO_OPMODE) {
  	/* IEEE80211_HTINFO_OPMODE_HT20PR */
  	case IEEE80211_HTINFO_OPMODE_HT20PR:
-		mm20_prot = RT2860_REG_PROT_NAV_SHORT | RT2860_REG_PROT_CTRL_NONE |
-			RT2860_REG_TXOP_ALLOW_CCK | RT2860_REG_TXOP_ALLOW_OFDM |
-			RT2860_REG_TXOP_ALLOW_MM20 | RT2860_REG_TXOP_ALLOW_GF20 |
+		mm20_prot = RT2860_PROT_NAV_SHORT |
+			RT2860_TXOP_ALLOW_CCK | RT2860_TXOP_ALLOW_OFDM |
+			RT2860_TXOP_ALLOW_MM20 | RT2860_TXOP_ALLOW_GF20 |
  			(RT2860_REG_PROT_PHYMODE_OFDM << RT2860_REG_PROT_PHYMODE_SHIFT) |
  			(4 << RT2860_REG_PROT_MCS_SHIFT);

  		gf20_prot = mm20_prot;

-		mm40_prot = RT2860_REG_PROT_NAV_SHORT | RT2860_REG_TXOP_ALLOW_ALL |
+		mm40_prot = RT2860_PROT_NAV_SHORT | RT2860_TXOP_ALLOW_ALL |
  			(RT2860_REG_PROT_PHYMODE_OFDM << RT2860_REG_PROT_PHYMODE_SHIFT) |
  			(0x84 << RT2860_REG_PROT_MCS_SHIFT);

  		if (htprotmode == IEEE80211_PROT_RTSCTS)
-			mm40_prot |= RT2860_REG_PROT_CTRL_RTS_CTS;
+			mm40_prot |= RT2860_PROT_CTRL_RTS_CTS;
  		else if (htprotmode == IEEE80211_PROT_CTSONLY)
-			mm40_prot |= RT2860_REG_PROT_CTRL_CTS;
-		else
-			mm40_prot |= RT2860_REG_PROT_CTRL_NONE;
+			mm40_prot |= RT2860_PROT_CTRL_CTS;

  		gf40_prot = mm40_prot;
  		break;

  	/* IEEE80211_HTINFO_OPMODE_MIXED */
  	case IEEE80211_HTINFO_OPMODE_MIXED:
-		mm20_prot = RT2860_REG_PROT_NAV_SHORT |
-			RT2860_REG_TXOP_ALLOW_CCK | RT2860_REG_TXOP_ALLOW_OFDM |
-			RT2860_REG_TXOP_ALLOW_MM20 | RT2860_REG_TXOP_ALLOW_GF20;
+		mm20_prot = RT2860_PROT_NAV_SHORT |
+			RT2860_TXOP_ALLOW_CCK | RT2860_TXOP_ALLOW_OFDM |
+			RT2860_TXOP_ALLOW_MM20 | RT2860_TXOP_ALLOW_GF20;

  		if (ic->ic_flags & IEEE80211_F_USEPROT)
  			mm20_prot |= (RT2860_REG_PROT_PHYMODE_CCK <<  
RT2860_REG_PROT_PHYMODE_SHIFT) |
@@ -3588,15 +3582,13 @@
  				(4 << RT2860_REG_PROT_MCS_SHIFT);

  		if (htprotmode == IEEE80211_PROT_RTSCTS)
-			mm20_prot |= RT2860_REG_PROT_CTRL_RTS_CTS;
+			mm20_prot |= RT2860_PROT_CTRL_RTS_CTS;
  		else if (htprotmode == IEEE80211_PROT_CTSONLY)
-			mm20_prot |= RT2860_REG_PROT_CTRL_CTS;
-		else
-			mm20_prot |= RT2860_REG_PROT_CTRL_NONE;
+			mm20_prot |= RT2860_PROT_CTRL_CTS;

  		gf20_prot = mm20_prot;

-		mm40_prot = RT2860_REG_PROT_NAV_SHORT | RT2860_REG_TXOP_ALLOW_ALL;
+		mm40_prot = RT2860_PROT_NAV_SHORT | RT2860_TXOP_ALLOW_ALL;

  		if (ic->ic_flags & IEEE80211_F_USEPROT)
  			mm40_prot |= (RT2860_REG_PROT_PHYMODE_CCK <<  
RT2860_REG_PROT_PHYMODE_SHIFT) |
@@ -3606,11 +3598,9 @@
  				(0x84 << RT2860_REG_PROT_MCS_SHIFT);

  		if (htprotmode == IEEE80211_PROT_RTSCTS)
-			mm40_prot |= RT2860_REG_PROT_CTRL_RTS_CTS;
+			mm40_prot |= RT2860_PROT_CTRL_RTS_CTS;
  		else if (htprotmode == IEEE80211_PROT_CTSONLY)
-			mm40_prot |= RT2860_REG_PROT_CTRL_CTS;
-		else
-			mm40_prot |= RT2860_REG_PROT_CTRL_NONE;
+			mm40_prot |= RT2860_PROT_CTRL_CTS;

  		gf40_prot = mm40_prot;
  		break;
@@ -3622,16 +3612,16 @@
  	case IEEE80211_HTINFO_OPMODE_PURE:
  	case IEEE80211_HTINFO_OPMODE_PROTOPT:
  	default:
-		mm20_prot = RT2860_REG_PROT_NAV_SHORT | RT2860_REG_PROT_CTRL_NONE |
-			RT2860_REG_TXOP_ALLOW_CCK | RT2860_REG_TXOP_ALLOW_OFDM |
-			RT2860_REG_TXOP_ALLOW_MM20 | RT2860_REG_TXOP_ALLOW_GF20 |
+		mm20_prot = RT2860_PROT_NAV_SHORT |
+			RT2860_TXOP_ALLOW_CCK | RT2860_TXOP_ALLOW_OFDM |
+			RT2860_TXOP_ALLOW_MM20 | RT2860_TXOP_ALLOW_GF20 |
  			(RT2860_REG_PROT_PHYMODE_OFDM << RT2860_REG_PROT_PHYMODE_SHIFT) |
  			(4 << RT2860_REG_PROT_MCS_SHIFT);

  		gf20_prot = mm20_prot;

-		mm40_prot = RT2860_REG_PROT_NAV_SHORT | RT2860_REG_PROT_CTRL_NONE |
-			RT2860_REG_TXOP_ALLOW_ALL |
+		mm40_prot = RT2860_PROT_NAV_SHORT |
+			RT2860_TXOP_ALLOW_ALL |
  			(RT2860_REG_PROT_PHYMODE_OFDM << RT2860_REG_PROT_PHYMODE_SHIFT) |
  			(0x84 << RT2860_REG_PROT_MCS_SHIFT);

@@ -3794,7 +3784,7 @@

  	/* clear WCID attribute table (entries = 256, entry size = 4) */

-	RAL_SET_REGION_4(sc, RT2860_REG_WCID_ATTR(0), RT2860_REG_PKEY_ENABLE,  
256);
+	RAL_SET_REGION_4(sc, RT2860_REG_WCID_ATTR(0), RT2860_RX_PKEY_EN, 256);

  	/* clear IV/EIV table (entries = 256, entry size = 8) */

@@ -4672,7 +4662,7 @@
  		"ampdu=%d (density=%d, winsize=%d), mimops=%d, DMA len=%d, ndmasegs=%d,  
DMA ds_len=%d/%d/%d/%d/%d\n",
  		device_get_nameunit(sc->sc_dev),
  		qid, hdrsize, hdrspace, m->m_pkthdr.len + hdrsize,
-		bw, stbc, shortgi, mcs, wcid, ampdu, mpdu_density, bawin_size, mimops,  
dmalen, ndmasegs,
+		ni->ni_chw, stbc, shortgi, mcs, wcid, ampdu, mpdu_density, bawin_size,  
mimops, dmalen, ndmasegs,
  		(int) dma_seg[0].ds_len, (int) dma_seg[1].ds_len, (int)  
dma_seg[2].ds_len, (int) dma_seg[3].ds_len, (int) dma_seg[4].ds_len);

  	bus_dmamap_sync(ring->seg0_dma_tag, ring->seg0_dma_map,
@@ -5643,9 +5633,6 @@
  	rt2860_drain_fifo_stats(sc);

  	/* read and clear Tx statistic registers */
-	RAL_READ(sc, RT2860_REG_TX_STA_CNT0)
-		stacnt, sizeof(stacnt));
-
  	stacnt[0] = le32toh(RAL_READ(sc, RT2860_REG_TX_STA_CNT0));
  	stacnt[1] = le32toh(RAL_READ(sc, RT2860_REG_TX_STA_CNT1));
  	stacnt[2] = le32toh(RAL_READ(sc, RT2860_REG_TX_STA_CNT2));
@@ -5800,24 +5787,21 @@
  	/* drain Tx status FIFO (maxsize = 16) */

  	while ((stats = RAL_READ(sc, RT2860_REG_TX_STA_FIFO)) &
-		RT2860_REG_TX_STA_FIFO_VALID) {
-
-		wcid = (stats >> RT2860_REG_TX_STA_FIFO_WCID_SHIFT) &
-			RT2860_REG_TX_STA_FIFO_WCID_MASK;
+		RT2860_TXQ_VLD) {
+
+		wcid = (stats >> RT2860_TXQ_WCID_SHIFT);

  		/* if no ACK was requested, no feedback is available */

-		if (!(stats & RT2860_REG_TX_STA_FIFO_ACK_REQ) || wcid ==  
RT2860_WCID_RESERVED)
+		if (!(stats & RT2860_TXQ_ACKREQ) || wcid == RT2860_WCID_RESERVED)
  			continue;

  		/* update AMRR statistic */

-		ok = (stats & RT2860_REG_TX_STA_FIFO_TX_OK) ? 1 : 0;
-		agg = (stats & RT2860_REG_TX_STA_FIFO_AGG) ? 1 : 0;
-		mcs = (stats >> RT2860_REG_TX_STA_FIFO_MCS_SHIFT) &
-			RT2860_REG_TX_STA_FIFO_MCS_MASK;
-		pid = (stats >> RT2860_REG_TX_STA_FIFO_PID_SHIFT) &
-			RT2860_REG_TX_STA_FIFO_PID_MASK;
+		ok = (stats & RT2860_TXQ_OK) ? 1 : 0;
+		agg = (stats & RT2860_TXQ_AGG) ? 1 : 0;
+		mcs = (stats >> RT2860_TXQ_MCS_SHIFT);
+		pid = (stats >> RT2860_TXQ_PID_SHIFT);
  		retrycnt = (mcs < 0xf) ? (pid - mcs - 1) : 0;

  		RT2860_DPRINTF(sc, RT2860_DEBUG_STATS,
@@ -5966,25 +5950,25 @@

  	/* set Rx filter */

-	tmp = RT2860_REG_RX_FILTER_DROP_CRC_ERR |
-		RT2860_REG_RX_FILTER_DROP_PHY_ERR;
+	tmp = RT2860_DROP_CRC_ERR |
+		RT2860_DROP_PHY_ERR;

  	if (ic->ic_opmode != IEEE80211_M_MONITOR) {
-		tmp |= RT2860_REG_RX_FILTER_DROP_DUPL |
-			RT2860_REG_RX_FILTER_DROP_CTS |
-			RT2860_REG_RX_FILTER_DROP_BA |
-			RT2860_REG_RX_FILTER_DROP_ACK |
-			RT2860_REG_RX_FILTER_DROP_VER_ERR |
-			RT2860_REG_RX_FILTER_DROP_CTRL_RSV |
-			RT2860_REG_RX_FILTER_DROP_CFACK |
-			RT2860_REG_RX_FILTER_DROP_CFEND;
+		tmp |= RT2860_DROP_DUPL |
+			RT2860_DROP_CTS |
+			RT2860_DROP_BA |
+			RT2860_DROP_ACK |
+			RT2860_DROP_VER_ERR |
+			RT2860_DROP_CTRL_RSV |
+			RT2860_DROP_CFACK |
+			RT2860_DROP_CFEND;

  		if (ic->ic_opmode == IEEE80211_M_STA)
-			tmp |= RT2860_REG_RX_FILTER_DROP_RTS |
-				RT2860_REG_RX_FILTER_DROP_PSPOLL;
+			tmp |= RT2860_DROP_RTS |
+				RT2860_DROP_PSPOLL;

  		if (!(ifp->if_flags & IFF_PROMISC))
-			tmp |= RT2860_REG_RX_FILTER_DROP_UC_NOME;
+			tmp |= RT2860_DROP_UC_NOME;
  	}

  	RAL_WRITE(sc, RT2860_REG_RX_FILTER_CFG, tmp);
@@ -7149,7 +7133,7 @@
  	RAL_WRITE(sc, RT2860_REG_H2M_MAILBOX_BBP_AGENT, tmp);

  	rt2860_io_mcu_cmd(sc, RT2860_IO_MCU_CMD_BBP,
-		RT2860_REG_H2M_TOKEN_NO_INTR, 0);
+		RT2860_TOKEN_NO_INTR, 0);

  	DELAY(1000);

@@ -7218,7 +7202,7 @@
  	RAL_WRITE(sc, RT2860_REG_H2M_MAILBOX_BBP_AGENT, tmp);

  	rt2860_io_mcu_cmd(sc, RT2860_IO_MCU_CMD_BBP,
-		RT2860_REG_H2M_TOKEN_NO_INTR, 0);
+		RT2860_TOKEN_NO_INTR, 0);

  	DELAY(1000);
  }
@@ -7329,7 +7313,7 @@

  	for (ntries = 0; ntries < 100; ntries++) {
  		if (!(RAL_READ(sc, RT2860_REG_H2M_MAILBOX) &
-			RT2860_REG_H2M_BUSY))
+			RT2860_H2M_BUSY))
  			break;

  		DELAY(2);
@@ -7341,7 +7325,7 @@
  		return;
  	}

-	tmp = RT2860_REG_H2M_BUSY | (token << 16) | arg;
+	tmp = RT2860_H2M_BUSY | (token << 16) | arg;

  	RAL_WRITE(sc, RT2860_REG_H2M_MAILBOX, tmp);
  	RAL_WRITE(sc, RT2860_REG_H2M_HOST_CMD, cmd);
@@ -7463,7 +7447,7 @@
  	tmp = (polarity << 8) | brightness;

  	rt2860_io_mcu_cmd(sc, RT2860_IO_MCU_CMD_LED_BRIGHTNESS,
-		RT2860_REG_H2M_TOKEN_NO_INTR, tmp);
+		RT2860_TOKEN_NO_INTR, tmp);
  }

  /*
@@ -7476,7 +7460,7 @@
  	tmp = (cmd << 8) | (sc->led_cntl & RT2860_EEPROM_LED_MODE_MASK);

  	rt2860_io_mcu_cmd(sc, RT2860_IO_MCU_CMD_LEDS,
-		RT2860_REG_H2M_TOKEN_NO_INTR, tmp);
+		RT2860_TOKEN_NO_INTR, tmp);
  }

  /*
=======================================
--- /sys/dev/ral/rt2860reg.h	Wed Mar 14 04:46:02 2012
+++ /sys/dev/ral/rt2860reg.h	Wed Mar 14 06:43:30 2012
@@ -212,69 +212,6 @@
  #define RT3070_EFSROM_MODE_MASK				0x000000c0
  #define RT3070_EFUSE_AOUT_MASK				0x0000003f

-/* possible flags for RT3020 RF register 1 */
-#define RT3070_RF_BLOCK					(1 << 0)
-#define RT3070_RX0_PD					(1 << 2)
-#define RT3070_TX0_PD					(1 << 3)
-#define RT3070_RX1_PD					(1 << 4)
-#define RT3070_TX1_PD					(1 << 5)
-#define RT3070_RX2_PD					(1 << 6)
-#define RT3070_TX2_PD					(1 << 7)
-
-/* possible flags for RT3020 RF register 1 */
-#define RT3070_RF_BLOCK					(1 << 0)
-#define RT3070_RX0_PD					(1 << 2)
-#define RT3070_TX0_PD					(1 << 3)
-#define RT3070_RX1_PD					(1 << 4)
-#define RT3070_TX1_PD					(1 << 5)
-#define RT3070_RX2_PD					(1 << 6)
-#define RT3070_TX2_PD					(1 << 7)
-
-/* possible flags for RT3020 RF register 7 */
-#define RT3070_TUNE					(1 << 0)
-
-/* possible flags for RT3020 RF register 15 */
-#define RT3070_TX_LO2					(1 << 3)
-
-/* possible flags for RT3020 RF register 17 */
-#define RT3070_TX_LO1					(1 << 3)
-
-/* possible flags for RT3020 RF register 20 */
-#define RT3070_RX_LO1					(1 << 3)
-
-/* possible flags for RT3020 RF register 21 */
-#define RT3070_RX_LO2					(1 << 3)
-#define RT3070_RX_CTB					(1 << 7)
-
-/* possible flags for RT3020 RF register 22 */
-#define RT3070_BB_LOOPBACK				(1 << 0)
-
-/* possible flags for RT3053 RF register 1 */
-#define RT3593_VCO					(1 << 0)
-
-/* possible flags for RT3053 RF register 2 */
-#define RT3593_RESCAL					(1 << 7)
-
-/* possible flags for RT3053 RF register 3 */
-#define RT3593_VCOCAL					(1 << 7)
-
-/* possible flags for RT3053 RF register 6 */
-#define RT3593_VCO_IC					(1 << 6)
-
-/* possible flags for RT3053 RF register 20 */
-#define RT3593_LDO_PLL_VC_MASK				0x0e
-#define RT3593_LDO_RF_VC_MASK				0xe0
-
-/* possible flags for RT3053 RF register 22 */
-#define RT3593_CP_IC_MASK				0xe0
-#define RT3593_CP_IC_SHIFT				5
-
-/* possible flags for RT3053 RF register 46 */
-#define RT3593_RX_CTB					(1 << 5)
-
-#define RT3090_DEF_LNA					10
-
-
  #define RT2860_REG_RF_R1				0
  #define RT2860_REG_RF_R2				1
  #define RT2860_REG_RF_R3				2
@@ -454,19 +391,6 @@
   * RT2860_REG_TX_GF40_PROT_CFG flags
   */
  #define RT2860_REG_RTSTH_ENABLE						(1 << 26)
-#define RT2860_REG_TXOP_ALLOW_GF40					(1 << 25)
-#define RT2860_REG_TXOP_ALLOW_GF20					(1 << 24)
-#define RT2860_REG_TXOP_ALLOW_MM40					(1 << 23)
-#define RT2860_REG_TXOP_ALLOW_MM20					(1 << 22)
-#define RT2860_REG_TXOP_ALLOW_OFDM					(1 << 21)
-#define RT2860_REG_TXOP_ALLOW_CCK					(1 << 20)
-#define RT2860_REG_TXOP_ALLOW_ALL					(0x3f << 20)
-#define RT2860_REG_PROT_NAV_NONE					(0 << 18)
-#define RT2860_REG_PROT_NAV_SHORT					(1 << 18)
-#define RT2860_REG_PROT_NAV_LONG					(2 << 18)
-#define RT2860_REG_PROT_CTRL_NONE					(0 << 16)
-#define RT2860_REG_PROT_CTRL_RTS_CTS				(1 << 16)
-#define RT2860_REG_PROT_CTRL_CTS					(2 << 16)
  #define RT2860_REG_PROT_PHYMODE_SHIFT				14
  #define RT2860_REG_PROT_PHYMODE_MASK				0x3
  #define RT2860_REG_PROT_PHYMODE_CCK					0
@@ -474,71 +398,6 @@
  #define RT2860_REG_PROT_MCS_SHIFT					0
  #define RT2860_REG_PROT_MCS_MASK					0x7f

-/*
- * RT2860_REG_RX_FILTER_CFG flags
- */
-#define RT2860_REG_RX_FILTER_DROP_CTRL_RSV			(1 << 16)
-#define RT2860_REG_RX_FILTER_DROP_BAR				(1 << 15)
-#define RT2860_REG_RX_FILTER_DROP_BA				(1 << 14)
-#define RT2860_REG_RX_FILTER_DROP_PSPOLL			(1 << 13)
-#define RT2860_REG_RX_FILTER_DROP_RTS				(1 << 12)
-#define RT2860_REG_RX_FILTER_DROP_CTS				(1 << 11)
-#define RT2860_REG_RX_FILTER_DROP_ACK				(1 << 10)
-#define RT2860_REG_RX_FILTER_DROP_CFEND				(1 << 9)
-#define RT2860_REG_RX_FILTER_DROP_CFACK				(1 << 8)
-#define RT2860_REG_RX_FILTER_DROP_DUPL				(1 << 7)
-#define RT2860_REG_RX_FILTER_DROP_BCAST				(1 << 6)
-#define RT2860_REG_RX_FILTER_DROP_MCAST				(1 << 5)
-#define RT2860_REG_RX_FILTER_DROP_VER_ERR			(1 << 4)
-#define RT2860_REG_RX_FILTER_DROP_NOT_MYBSS			(1 << 3)
-#define RT2860_REG_RX_FILTER_DROP_UC_NOME			(1 << 2)
-#define RT2860_REG_RX_FILTER_DROP_PHY_ERR			(1 << 1)
-#define RT2860_REG_RX_FILTER_DROP_CRC_ERR			(1 << 0)
-
-/*
- * RT2860_REG_AUTO_RSP_CFG flags
- */
-#define RT2860_REG_CCK_SHORT_ENABLE					(1 << 4)
-
-/*
- * RT2860_REG_TX_STA_FIFO flags
- */
-#define RT2860_REG_TX_STA_FIFO_MCS_SHIFT			16
-#define RT2860_REG_TX_STA_FIFO_MCS_MASK				0x7f
-#define RT2860_REG_TX_STA_FIFO_WCID_SHIFT			8
-#define RT2860_REG_TX_STA_FIFO_WCID_MASK			0xff
-#define RT2860_REG_TX_STA_FIFO_PID_SHIFT			1
-#define RT2860_REG_TX_STA_FIFO_PID_MASK				0xf
-#define RT2860_REG_TX_STA_FIFO_ACK_REQ				(1 << 7)
-#define RT2860_REG_TX_STA_FIFO_AGG					(1 << 6)
-#define RT2860_REG_TX_STA_FIFO_TX_OK				(1 << 5)
-#define RT2860_REG_TX_STA_FIFO_VALID				(1 << 0)
-
-/*
- * RT2860_REG_WCID_ATTR flags
- */
-#define RT2860_REG_VAP_SHIFT						4
-#define RT2860_REG_VAP_MASK							0x7
-#define RT2860_REG_CIPHER_MODE_SHIFT				1
-#define RT2860_REG_CIPHER_MODE_MASK					0x7
-#define RT2860_REG_CIPHER_MODE_NONE					0
-#define RT2860_REG_CIPHER_MODE_WEP40				1
-#define RT2860_REG_CIPHER_MODE_WEP104				2
-#define RT2860_REG_CIPHER_MODE_TKIP					3
-#define RT2860_REG_CIPHER_MODE_AES_CCMP				4
-#define RT2860_REG_CIPHER_MODE_CKIP40				5
-#define RT2860_REG_CIPHER_MODE_CKIP104				6
-#define RT2860_REG_CIPHER_MODE_CKIP128				7
-#define RT2860_REG_PKEY_ENABLE						(1 << 0)
-
-/*
- * RT2860_REG_H2M_MAILBOX flags
- */
-#define RT2860_REG_H2M_BUSY							(1 << 24)
-#define RT2860_REG_H2M_TOKEN_POWERSAVE				1
-#define RT2860_REG_H2M_TOKEN_RADIOOFF				2
-#define RT2860_REG_H2M_TOKEN_WAKEUP					3
-#define RT2860_REG_H2M_TOKEN_NO_INTR				0xff

  /*
   * RT2860_REG_H2M_MAILBOX_CID flags
@@ -557,6 +416,153 @@
  #define RT2860_Q	(1 << 3)
  #define RT2860_SHIFT_Q	3

+/* possible flags for registers *_PROT_CFG */
+#define RT2860_RTSTH_EN			(1 << 26)
+#define RT2860_TXOP_ALLOW_GF40		(1 << 25)
+#define RT2860_TXOP_ALLOW_GF20		(1 << 24)
+#define RT2860_TXOP_ALLOW_MM40		(1 << 23)
+#define RT2860_TXOP_ALLOW_MM20		(1 << 22)
+#define RT2860_TXOP_ALLOW_OFDM		(1 << 21)
+#define RT2860_TXOP_ALLOW_CCK		(1 << 20)
+#define RT2860_TXOP_ALLOW_ALL		(0x3f << 20)
+#define RT2860_PROT_NAV_SHORT		(1 << 18)
+#define RT2860_PROT_NAV_LONG		(2 << 18)
+#define RT2860_PROT_CTRL_RTS_CTS	(1 << 16)
+#define RT2860_PROT_CTRL_CTS		(2 << 16)
+
+/* possible flags for registers EXP_{CTS,ACK}_TIME */
+#define RT2860_EXP_OFDM_TIME_SHIFT	16
+#define RT2860_EXP_CCK_TIME_SHIFT	0
+
+/* possible flags for register RX_FILTR_CFG */
+#define RT2860_DROP_CTRL_RSV	(1 << 16)
+#define RT2860_DROP_BAR		(1 << 15)
+#define RT2860_DROP_BA		(1 << 14)
+#define RT2860_DROP_PSPOLL	(1 << 13)
+#define RT2860_DROP_RTS		(1 << 12)
+#define RT2860_DROP_CTS		(1 << 11)
+#define RT2860_DROP_ACK		(1 << 10)
+#define RT2860_DROP_CFEND	(1 <<  9)
+#define RT2860_DROP_CFACK	(1 <<  8)
+#define RT2860_DROP_DUPL	(1 <<  7)
+#define RT2860_DROP_BC		(1 <<  6)
+#define RT2860_DROP_MC		(1 <<  5)
+#define RT2860_DROP_VER_ERR	(1 <<  4)
+#define RT2860_DROP_NOT_MYBSS	(1 <<  3)
+#define RT2860_DROP_UC_NOME	(1 <<  2)
+#define RT2860_DROP_PHY_ERR	(1 <<  1)
+#define RT2860_DROP_CRC_ERR	(1 <<  0)
+
+/* possible flags for register AUTO_RSP_CFG */
+#define RT2860_CTRL_PWR_BIT	(1 << 7)
+#define RT2860_BAC_ACK_POLICY	(1 << 6)
+#define RT2860_CCK_SHORT_EN	(1 << 4)
+#define RT2860_CTS_40M_REF_EN	(1 << 3)
+#define RT2860_CTS_40M_MODE_EN	(1 << 2)
+#define RT2860_BAC_ACKPOLICY_EN	(1 << 1)
+#define RT2860_AUTO_RSP_EN	(1 << 0)
+
+/* possible flags for register SIFS_COST_CFG */
+#define RT2860_OFDM_SIFS_COST_SHIFT	8
+#define RT2860_CCK_SIFS_COST_SHIFT	0
+
+/* possible flags for register TXOP_HLDR_ET */
+#define RT2860_TXOP_ETM1_EN		(1 << 25)
+#define RT2860_TXOP_ETM0_EN		(1 << 24)
+#define RT2860_TXOP_ETM_THRES_SHIFT	16
+#define RT2860_TXOP_ETO_EN		(1 <<  8)
+#define RT2860_TXOP_ETO_THRES_SHIFT	1
+#define RT2860_PER_RX_RST_EN		(1 <<  0)
+
+/* possible flags for register TX_STAT_FIFO */
+#define RT2860_TXQ_MCS_SHIFT	16
+#define RT2860_TXQ_WCID_SHIFT	8
+#define RT2860_TXQ_ACKREQ	(1 << 7)
+#define RT2860_TXQ_AGG		(1 << 6)
+#define RT2860_TXQ_OK		(1 << 5)
+#define RT2860_TXQ_PID_SHIFT	1
+#define RT2860_TXQ_VLD		(1 << 0)
+
+/* possible flags for register WCID_ATTR */
+#define RT2860_VAP_SHIFT	4
+#define RT2860_MODE_SHIFT	1
+#define RT2860_MODE_NOSEC	0
+#define RT2860_MODE_WEP40	1
+#define RT2860_MODE_WEP104	2
+#define RT2860_MODE_TKIP	3
+#define RT2860_MODE_AES_CCMP	4
+#define RT2860_MODE_CKIP40	5
+#define RT2860_MODE_CKIP104	6
+#define RT2860_MODE_CKIP128	7
+#define RT2860_RX_PKEY_EN	(1 << 0)
+
+/* possible flags for register H2M_MAILBOX */
+#define RT2860_H2M_BUSY		(1 << 24)
+#define RT2860_TOKEN_POWERSAVE	1
+#define RT2860_TOKEN_RADIOOFF	2
+#define RT2860_TOKEN_WAKEUP	3
+#define RT2860_TOKEN_NO_INTR	0xff
+
+
+/* possible flags for MCU command RT2860_MCU_CMD_LEDS */
+#define RT2860_LED_RADIO	(1 << 13)
+#define RT2860_LED_LINK_2GHZ	(1 << 14)
+#define RT2860_LED_LINK_5GHZ	(1 << 15)
+
+
+/* possible flags for RT3020 RF register 1 */
+#define RT3070_RF_BLOCK	(1 << 0)
+#define RT3070_RX0_PD	(1 << 2)
+#define RT3070_TX0_PD	(1 << 3)
+#define RT3070_RX1_PD	(1 << 4)
+#define RT3070_TX1_PD	(1 << 5)
+#define RT3070_RX2_PD	(1 << 6)
+#define RT3070_TX2_PD	(1 << 7)
+
+/* possible flags for RT3020 RF register 7 */
+#define RT3070_TUNE	(1 << 0)
+
+/* possible flags for RT3020 RF register 15 */
+#define RT3070_TX_LO2	(1 << 3)
+
+/* possible flags for RT3020 RF register 17 */
+#define RT3070_TX_LO1	(1 << 3)
+
+/* possible flags for RT3020 RF register 20 */
+#define RT3070_RX_LO1	(1 << 3)
+
+/* possible flags for RT3020 RF register 21 */
+#define RT3070_RX_LO2	(1 << 3)
+#define RT3070_RX_CTB	(1 << 7)
+
+/* possible flags for RT3020 RF register 22 */
+#define RT3070_BB_LOOPBACK	(1 << 0)
+
+/* possible flags for RT3053 RF register 1 */
+#define RT3593_VCO	(1 << 0)
+
+/* possible flags for RT3053 RF register 2 */
+#define RT3593_RESCAL	(1 << 7)
+
+/* possible flags for RT3053 RF register 3 */
+#define RT3593_VCOCAL	(1 << 7)
+
+/* possible flags for RT3053 RF register 6 */
+#define RT3593_VCO_IC	(1 << 6)
+
+/* possible flags for RT3053 RF register 20 */
+#define RT3593_LDO_PLL_VC_MASK	0x0e
+#define RT3593_LDO_RF_VC_MASK	0xe0
+
+/* possible flags for RT3053 RF register 22 */
+#define RT3593_CP_IC_MASK	0xe0
+#define RT3593_CP_IC_SHIFT	5
+
+/* possible flags for RT3053 RF register 46 */
+#define RT3593_RX_CTB	(1 << 5)
+
+#define RT3090_DEF_LNA					10
+
  /* RT2860 TX descriptor */
  struct rt2860_txd {
  	uint32_t	sdp0;		/* Segment Data Pointer 0 */


More information about the Zrouter-src-freebsd mailing list