-/* $OpenBSD: mtwreg.h,v 1.1 2021/12/20 13:59:02 hastings Exp $ */
+/* $OpenBSD: mtwreg.h,v 1.2 2022/07/27 06:41:04 hastings Exp $ */
/*
* Copyright (c) 2007 Damien Bergamini <damien.bergamini@free.fr>
* Copyright (c) 2021 James Hastings
#define MTW_RXQ_MCU 1
#define MTW_TXQ_MCU 5
+enum mtw_phy_mode {
+ MTW_PHY_CCK,
+ MTW_PHY_OFDM,
+ MTW_PHY_HT,
+ MTW_PHY_HT_GF,
+ MTW_PHY_VHT,
+};
+
/* RT2860 TX descriptor */
struct rt2860_txd {
uint32_t sdp0; /* Segment Data Pointer 0 */
#define MTW_TX_TXOP_BACKOFF 3
uint16_t phy;
-#define MTW_PHY_MODE 0xe000
-#define MTW_PHY_CCK (0 << 13)
-#define MTW_PHY_OFDM (1 << 13)
-#define MTW_PHY_HT (2 << 13)
-#define MTW_PHY_HT_GF (3 << 13)
-#define MTW_PHY_VHT (4 << 13)
-#define MTW_PHY_STBC (1 << 10)
-#define MTW_PHY_SGI (1 << 9)
+#define MT7650_PHY_MODE 0xe000
+#define MT7601_PHY_MODE 0xc000
+#define MT7601_PHY_SHIFT 14
+#define MT7650_PHY_SHIFT 13
+#define MT7650_PHY_SGI (1 << 9)
+#define MT7601_PHY_SGI (1 << 8)
#define MTW_PHY_BW20 (0 << 7)
#define MTW_PHY_BW40 (1 << 7)
#define MTW_PHY_BW80 (2 << 7)
-/* $OpenBSD: if_mtw.c,v 1.5 2022/04/21 21:03:03 stsp Exp $ */
+/* $OpenBSD: if_mtw.c,v 1.6 2022/07/27 06:41:22 hastings Exp $ */
/*
* Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr>
* Copyright (c) 2013-2014 Kevin Lo
tap->wr_dbm_antsignal = mtw_rssi2dbm(sc, rssi, ant);
tap->wr_rate = 2; /* in case it can't be found below */
phy = letoh16(rxwi->phy);
- switch (phy & MTW_PHY_MODE) {
+ switch (phy >> MT7601_PHY_SHIFT) {
case MTW_PHY_CCK:
switch ((phy & MTW_PHY_MCS) & ~MTW_PHY_SHPRE) {
case 0: tap->wr_rate = 2; break;
txwi->txop = MTW_TX_TXOP_BACKOFF;
if (rt2860_rates[ridx].phy == IEEE80211_T_DS) {
- txwi->phy = htole16(MTW_PHY_CCK);
+ txwi->phy = htole16(MTW_PHY_CCK << MT7601_PHY_SHIFT);
if (ridx != MTW_RIDX_CCK1 &&
(ic->ic_flags & IEEE80211_F_SHPREAMBLE))
mcs |= MTW_PHY_SHPRE;
} else if (rt2860_rates[ridx].phy == IEEE80211_T_OFDM)
- txwi->phy = htole16(MTW_PHY_OFDM);
+ txwi->phy = htole16(MTW_PHY_OFDM << MT7601_PHY_SHIFT);
txwi->phy |= htole16(mcs);
if (!IEEE80211_IS_MULTICAST(wh->i_addr1) &&