18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef ADM8211_H
38c2ecf20Sopenharmony_ci#define ADM8211_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/* ADM8211 Registers */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/* CR32 (SIG) signature */
88c2ecf20Sopenharmony_ci#define ADM8211_SIG1		0x82011317 /* ADM8211A */
98c2ecf20Sopenharmony_ci#define ADM8211_SIG2		0x82111317 /* ADM8211B/ADM8211C */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define ADM8211_CSR_READ(r) ioread32(&priv->map->r)
128c2ecf20Sopenharmony_ci#define ADM8211_CSR_WRITE(r, val) iowrite32((val), &priv->map->r)
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* CSR (Host Control and Status Registers) */
158c2ecf20Sopenharmony_cistruct adm8211_csr {
168c2ecf20Sopenharmony_ci	__le32 PAR;		/* 0x00 CSR0 */
178c2ecf20Sopenharmony_ci	__le32 FRCTL;		/* 0x04 CSR0A */
188c2ecf20Sopenharmony_ci	__le32 TDR;		/* 0x08 CSR1 */
198c2ecf20Sopenharmony_ci	__le32 WTDP;		/* 0x0C CSR1A */
208c2ecf20Sopenharmony_ci	__le32 RDR;		/* 0x10 CSR2 */
218c2ecf20Sopenharmony_ci	__le32 WRDP;		/* 0x14 CSR2A */
228c2ecf20Sopenharmony_ci	__le32 RDB;		/* 0x18 CSR3 */
238c2ecf20Sopenharmony_ci	__le32 TDBH;		/* 0x1C CSR3A */
248c2ecf20Sopenharmony_ci	__le32 TDBD;		/* 0x20 CSR4 */
258c2ecf20Sopenharmony_ci	__le32 TDBP;		/* 0x24 CSR4A */
268c2ecf20Sopenharmony_ci	__le32 STSR;		/* 0x28 CSR5 */
278c2ecf20Sopenharmony_ci	__le32 TDBB;		/* 0x2C CSR5A */
288c2ecf20Sopenharmony_ci	__le32 NAR;		/* 0x30 CSR6 */
298c2ecf20Sopenharmony_ci	__le32 CSR6A;		/* reserved */
308c2ecf20Sopenharmony_ci	__le32 IER;		/* 0x38 CSR7 */
318c2ecf20Sopenharmony_ci	__le32 TKIPSCEP;	/* 0x3C CSR7A */
328c2ecf20Sopenharmony_ci	__le32 LPC;		/* 0x40 CSR8 */
338c2ecf20Sopenharmony_ci	__le32 CSR_TEST1;	/* 0x44 CSR8A */
348c2ecf20Sopenharmony_ci	__le32 SPR;		/* 0x48 CSR9 */
358c2ecf20Sopenharmony_ci	__le32 CSR_TEST0;	/* 0x4C CSR9A */
368c2ecf20Sopenharmony_ci	__le32 WCSR;		/* 0x50 CSR10 */
378c2ecf20Sopenharmony_ci	__le32 WPDR;		/* 0x54 CSR10A */
388c2ecf20Sopenharmony_ci	__le32 GPTMR;		/* 0x58 CSR11 */
398c2ecf20Sopenharmony_ci	__le32 GPIO;		/* 0x5C CSR11A */
408c2ecf20Sopenharmony_ci	__le32 BBPCTL;		/* 0x60 CSR12 */
418c2ecf20Sopenharmony_ci	__le32 SYNCTL;		/* 0x64 CSR12A */
428c2ecf20Sopenharmony_ci	__le32 PLCPHD;		/* 0x68 CSR13 */
438c2ecf20Sopenharmony_ci	__le32 MMIWA;		/* 0x6C CSR13A */
448c2ecf20Sopenharmony_ci	__le32 MMIRD0;		/* 0x70 CSR14 */
458c2ecf20Sopenharmony_ci	__le32 MMIRD1;		/* 0x74 CSR14A */
468c2ecf20Sopenharmony_ci	__le32 TXBR;		/* 0x78 CSR15 */
478c2ecf20Sopenharmony_ci	__le32 SYNDATA;		/* 0x7C CSR15A */
488c2ecf20Sopenharmony_ci	__le32 ALCS;		/* 0x80 CSR16 */
498c2ecf20Sopenharmony_ci	__le32 TOFS2;		/* 0x84 CSR17 */
508c2ecf20Sopenharmony_ci	__le32 CMDR;		/* 0x88 CSR18 */
518c2ecf20Sopenharmony_ci	__le32 PCIC;		/* 0x8C CSR19 */
528c2ecf20Sopenharmony_ci	__le32 PMCSR;		/* 0x90 CSR20 */
538c2ecf20Sopenharmony_ci	__le32 PAR0;		/* 0x94 CSR21 */
548c2ecf20Sopenharmony_ci	__le32 PAR1;		/* 0x98 CSR22 */
558c2ecf20Sopenharmony_ci	__le32 MAR0;		/* 0x9C CSR23 */
568c2ecf20Sopenharmony_ci	__le32 MAR1;		/* 0xA0 CSR24 */
578c2ecf20Sopenharmony_ci	__le32 ATIMDA0;		/* 0xA4 CSR25 */
588c2ecf20Sopenharmony_ci	__le32 ABDA1;		/* 0xA8 CSR26 */
598c2ecf20Sopenharmony_ci	__le32 BSSID0;		/* 0xAC CSR27 */
608c2ecf20Sopenharmony_ci	__le32 TXLMT;		/* 0xB0 CSR28 */
618c2ecf20Sopenharmony_ci	__le32 MIBCNT;		/* 0xB4 CSR29 */
628c2ecf20Sopenharmony_ci	__le32 BCNT;		/* 0xB8 CSR30 */
638c2ecf20Sopenharmony_ci	__le32 TSFTH;		/* 0xBC CSR31 */
648c2ecf20Sopenharmony_ci	__le32 TSC;		/* 0xC0 CSR32 */
658c2ecf20Sopenharmony_ci	__le32 SYNRF;		/* 0xC4 CSR33 */
668c2ecf20Sopenharmony_ci	__le32 BPLI;		/* 0xC8 CSR34 */
678c2ecf20Sopenharmony_ci	__le32 CAP0;		/* 0xCC CSR35 */
688c2ecf20Sopenharmony_ci	__le32 CAP1;		/* 0xD0 CSR36 */
698c2ecf20Sopenharmony_ci	__le32 RMD;		/* 0xD4 CSR37 */
708c2ecf20Sopenharmony_ci	__le32 CFPP;		/* 0xD8 CSR38 */
718c2ecf20Sopenharmony_ci	__le32 TOFS0;		/* 0xDC CSR39 */
728c2ecf20Sopenharmony_ci	__le32 TOFS1;		/* 0xE0 CSR40 */
738c2ecf20Sopenharmony_ci	__le32 IFST;		/* 0xE4 CSR41 */
748c2ecf20Sopenharmony_ci	__le32 RSPT;		/* 0xE8 CSR42 */
758c2ecf20Sopenharmony_ci	__le32 TSFTL;		/* 0xEC CSR43 */
768c2ecf20Sopenharmony_ci	__le32 WEPCTL;		/* 0xF0 CSR44 */
778c2ecf20Sopenharmony_ci	__le32 WESK;		/* 0xF4 CSR45 */
788c2ecf20Sopenharmony_ci	__le32 WEPCNT;		/* 0xF8 CSR46 */
798c2ecf20Sopenharmony_ci	__le32 MACTEST;		/* 0xFC CSR47 */
808c2ecf20Sopenharmony_ci	__le32 FER;		/* 0x100 */
818c2ecf20Sopenharmony_ci	__le32 FEMR;		/* 0x104 */
828c2ecf20Sopenharmony_ci	__le32 FPSR;		/* 0x108 */
838c2ecf20Sopenharmony_ci	__le32 FFER;		/* 0x10C */
848c2ecf20Sopenharmony_ci} __packed;
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* CSR0 - PAR (PCI Address Register) */
878c2ecf20Sopenharmony_ci#define ADM8211_PAR_MWIE	(1 << 24)
888c2ecf20Sopenharmony_ci#define ADM8211_PAR_MRLE	(1 << 23)
898c2ecf20Sopenharmony_ci#define ADM8211_PAR_MRME	(1 << 21)
908c2ecf20Sopenharmony_ci#define ADM8211_PAR_RAP		((1 << 18) | (1 << 17))
918c2ecf20Sopenharmony_ci#define ADM8211_PAR_CAL		((1 << 15) | (1 << 14))
928c2ecf20Sopenharmony_ci#define ADM8211_PAR_PBL		0x00003f00
938c2ecf20Sopenharmony_ci#define ADM8211_PAR_BLE		(1 << 7)
948c2ecf20Sopenharmony_ci#define ADM8211_PAR_DSL		0x0000007c
958c2ecf20Sopenharmony_ci#define ADM8211_PAR_BAR		(1 << 1)
968c2ecf20Sopenharmony_ci#define ADM8211_PAR_SWR		(1 << 0)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/* CSR1 - FRCTL (Frame Control Register) */
998c2ecf20Sopenharmony_ci#define ADM8211_FRCTL_PWRMGT	(1 << 31)
1008c2ecf20Sopenharmony_ci#define ADM8211_FRCTL_MAXPSP	(1 << 27)
1018c2ecf20Sopenharmony_ci#define ADM8211_FRCTL_DRVPRSP	(1 << 26)
1028c2ecf20Sopenharmony_ci#define ADM8211_FRCTL_DRVBCON	(1 << 25)
1038c2ecf20Sopenharmony_ci#define ADM8211_FRCTL_AID	0x0000ffff
1048c2ecf20Sopenharmony_ci#define ADM8211_FRCTL_AID_ON	0x0000c000
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* CSR5 - STSR (Status Register) */
1078c2ecf20Sopenharmony_ci#define ADM8211_STSR_PCF	(1 << 31)
1088c2ecf20Sopenharmony_ci#define ADM8211_STSR_BCNTC	(1 << 30)
1098c2ecf20Sopenharmony_ci#define ADM8211_STSR_GPINT	(1 << 29)
1108c2ecf20Sopenharmony_ci#define ADM8211_STSR_LinkOff	(1 << 28)
1118c2ecf20Sopenharmony_ci#define ADM8211_STSR_ATIMTC	(1 << 27)
1128c2ecf20Sopenharmony_ci#define ADM8211_STSR_TSFTF	(1 << 26)
1138c2ecf20Sopenharmony_ci#define ADM8211_STSR_TSCZ	(1 << 25)
1148c2ecf20Sopenharmony_ci#define ADM8211_STSR_LinkOn	(1 << 24)
1158c2ecf20Sopenharmony_ci#define ADM8211_STSR_SQL	(1 << 23)
1168c2ecf20Sopenharmony_ci#define ADM8211_STSR_WEPTD	(1 << 22)
1178c2ecf20Sopenharmony_ci#define ADM8211_STSR_ATIME	(1 << 21)
1188c2ecf20Sopenharmony_ci#define ADM8211_STSR_TBTT	(1 << 20)
1198c2ecf20Sopenharmony_ci#define ADM8211_STSR_NISS	(1 << 16)
1208c2ecf20Sopenharmony_ci#define ADM8211_STSR_AISS	(1 << 15)
1218c2ecf20Sopenharmony_ci#define ADM8211_STSR_TEIS	(1 << 14)
1228c2ecf20Sopenharmony_ci#define ADM8211_STSR_FBE	(1 << 13)
1238c2ecf20Sopenharmony_ci#define ADM8211_STSR_REIS	(1 << 12)
1248c2ecf20Sopenharmony_ci#define ADM8211_STSR_GPTT	(1 << 11)
1258c2ecf20Sopenharmony_ci#define ADM8211_STSR_RPS	(1 << 8)
1268c2ecf20Sopenharmony_ci#define ADM8211_STSR_RDU	(1 << 7)
1278c2ecf20Sopenharmony_ci#define ADM8211_STSR_RCI	(1 << 6)
1288c2ecf20Sopenharmony_ci#define ADM8211_STSR_TUF	(1 << 5)
1298c2ecf20Sopenharmony_ci#define ADM8211_STSR_TRT	(1 << 4)
1308c2ecf20Sopenharmony_ci#define ADM8211_STSR_TLT	(1 << 3)
1318c2ecf20Sopenharmony_ci#define ADM8211_STSR_TDU	(1 << 2)
1328c2ecf20Sopenharmony_ci#define ADM8211_STSR_TPS	(1 << 1)
1338c2ecf20Sopenharmony_ci#define ADM8211_STSR_TCI	(1 << 0)
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/* CSR6 - NAR (Network Access Register) */
1368c2ecf20Sopenharmony_ci#define ADM8211_NAR_TXCF	(1 << 31)
1378c2ecf20Sopenharmony_ci#define ADM8211_NAR_HF		(1 << 30)
1388c2ecf20Sopenharmony_ci#define ADM8211_NAR_UTR		(1 << 29)
1398c2ecf20Sopenharmony_ci#define ADM8211_NAR_SQ		(1 << 28)
1408c2ecf20Sopenharmony_ci#define ADM8211_NAR_CFP		(1 << 27)
1418c2ecf20Sopenharmony_ci#define ADM8211_NAR_SF		(1 << 21)
1428c2ecf20Sopenharmony_ci#define ADM8211_NAR_TR		((1 << 15) | (1 << 14))
1438c2ecf20Sopenharmony_ci#define ADM8211_NAR_ST		(1 << 13)
1448c2ecf20Sopenharmony_ci#define ADM8211_NAR_OM		((1 << 11) | (1 << 10))
1458c2ecf20Sopenharmony_ci#define ADM8211_NAR_MM		(1 << 7)
1468c2ecf20Sopenharmony_ci#define ADM8211_NAR_PR		(1 << 6)
1478c2ecf20Sopenharmony_ci#define ADM8211_NAR_EA		(1 << 5)
1488c2ecf20Sopenharmony_ci#define ADM8211_NAR_PB		(1 << 3)
1498c2ecf20Sopenharmony_ci#define ADM8211_NAR_STPDMA	(1 << 2)
1508c2ecf20Sopenharmony_ci#define ADM8211_NAR_SR		(1 << 1)
1518c2ecf20Sopenharmony_ci#define ADM8211_NAR_CTX		(1 << 0)
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci#define ADM8211_IDLE() 							   \
1548c2ecf20Sopenharmony_cido { 									   \
1558c2ecf20Sopenharmony_ci	if (priv->nar & (ADM8211_NAR_SR | ADM8211_NAR_ST)) {		   \
1568c2ecf20Sopenharmony_ci		ADM8211_CSR_WRITE(NAR, priv->nar &			   \
1578c2ecf20Sopenharmony_ci				       ~(ADM8211_NAR_SR | ADM8211_NAR_ST));\
1588c2ecf20Sopenharmony_ci		ADM8211_CSR_READ(NAR);					   \
1598c2ecf20Sopenharmony_ci		msleep(20);						   \
1608c2ecf20Sopenharmony_ci	}								   \
1618c2ecf20Sopenharmony_ci} while (0)
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci#define ADM8211_IDLE_RX() 						\
1648c2ecf20Sopenharmony_cido {									\
1658c2ecf20Sopenharmony_ci	if (priv->nar & ADM8211_NAR_SR) {				\
1668c2ecf20Sopenharmony_ci		ADM8211_CSR_WRITE(NAR, priv->nar & ~ADM8211_NAR_SR);	\
1678c2ecf20Sopenharmony_ci		ADM8211_CSR_READ(NAR);					\
1688c2ecf20Sopenharmony_ci		mdelay(20);						\
1698c2ecf20Sopenharmony_ci	}								\
1708c2ecf20Sopenharmony_ci} while (0)
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci#define ADM8211_RESTORE()					\
1738c2ecf20Sopenharmony_cido {								\
1748c2ecf20Sopenharmony_ci	if (priv->nar & (ADM8211_NAR_SR | ADM8211_NAR_ST))	\
1758c2ecf20Sopenharmony_ci		ADM8211_CSR_WRITE(NAR, priv->nar);		\
1768c2ecf20Sopenharmony_ci} while (0)
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci/* CSR7 - IER (Interrupt Enable Register) */
1798c2ecf20Sopenharmony_ci#define ADM8211_IER_PCFIE	(1 << 31)
1808c2ecf20Sopenharmony_ci#define ADM8211_IER_BCNTCIE	(1 << 30)
1818c2ecf20Sopenharmony_ci#define ADM8211_IER_GPIE	(1 << 29)
1828c2ecf20Sopenharmony_ci#define ADM8211_IER_LinkOffIE	(1 << 28)
1838c2ecf20Sopenharmony_ci#define ADM8211_IER_ATIMTCIE	(1 << 27)
1848c2ecf20Sopenharmony_ci#define ADM8211_IER_TSFTFIE	(1 << 26)
1858c2ecf20Sopenharmony_ci#define ADM8211_IER_TSCZE	(1 << 25)
1868c2ecf20Sopenharmony_ci#define ADM8211_IER_LinkOnIE	(1 << 24)
1878c2ecf20Sopenharmony_ci#define ADM8211_IER_SQLIE	(1 << 23)
1888c2ecf20Sopenharmony_ci#define ADM8211_IER_WEPIE	(1 << 22)
1898c2ecf20Sopenharmony_ci#define ADM8211_IER_ATIMEIE	(1 << 21)
1908c2ecf20Sopenharmony_ci#define ADM8211_IER_TBTTIE	(1 << 20)
1918c2ecf20Sopenharmony_ci#define ADM8211_IER_NIE		(1 << 16)
1928c2ecf20Sopenharmony_ci#define ADM8211_IER_AIE		(1 << 15)
1938c2ecf20Sopenharmony_ci#define ADM8211_IER_TEIE	(1 << 14)
1948c2ecf20Sopenharmony_ci#define ADM8211_IER_FBEIE	(1 << 13)
1958c2ecf20Sopenharmony_ci#define ADM8211_IER_REIE	(1 << 12)
1968c2ecf20Sopenharmony_ci#define ADM8211_IER_GPTIE	(1 << 11)
1978c2ecf20Sopenharmony_ci#define ADM8211_IER_RSIE	(1 << 8)
1988c2ecf20Sopenharmony_ci#define ADM8211_IER_RUIE	(1 << 7)
1998c2ecf20Sopenharmony_ci#define ADM8211_IER_RCIE	(1 << 6)
2008c2ecf20Sopenharmony_ci#define ADM8211_IER_TUIE	(1 << 5)
2018c2ecf20Sopenharmony_ci#define ADM8211_IER_TRTIE	(1 << 4)
2028c2ecf20Sopenharmony_ci#define ADM8211_IER_TLTTIE	(1 << 3)
2038c2ecf20Sopenharmony_ci#define ADM8211_IER_TDUIE	(1 << 2)
2048c2ecf20Sopenharmony_ci#define ADM8211_IER_TPSIE	(1 << 1)
2058c2ecf20Sopenharmony_ci#define ADM8211_IER_TCIE	(1 << 0)
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci/* CSR9 - SPR (Serial Port Register) */
2088c2ecf20Sopenharmony_ci#define ADM8211_SPR_SRS		(1 << 11)
2098c2ecf20Sopenharmony_ci#define ADM8211_SPR_SDO		(1 << 3)
2108c2ecf20Sopenharmony_ci#define ADM8211_SPR_SDI		(1 << 2)
2118c2ecf20Sopenharmony_ci#define ADM8211_SPR_SCLK	(1 << 1)
2128c2ecf20Sopenharmony_ci#define ADM8211_SPR_SCS		(1 << 0)
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci/* CSR9A - CSR_TEST0 */
2158c2ecf20Sopenharmony_ci#define ADM8211_CSR_TEST0_EPNE	(1 << 18)
2168c2ecf20Sopenharmony_ci#define ADM8211_CSR_TEST0_EPSNM	(1 << 17)
2178c2ecf20Sopenharmony_ci#define ADM8211_CSR_TEST0_EPTYP	(1 << 16)
2188c2ecf20Sopenharmony_ci#define ADM8211_CSR_TEST0_EPRLD	(1 << 15)
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci/* CSR10 - WCSR (Wake-up Control/Status Register) */
2218c2ecf20Sopenharmony_ci#define ADM8211_WCSR_CRCT	(1 << 30)
2228c2ecf20Sopenharmony_ci#define ADM8211_WCSR_TSFTWE	(1 << 20)
2238c2ecf20Sopenharmony_ci#define ADM8211_WCSR_TIMWE	(1 << 19)
2248c2ecf20Sopenharmony_ci#define ADM8211_WCSR_ATIMWE	(1 << 18)
2258c2ecf20Sopenharmony_ci#define ADM8211_WCSR_KEYWE	(1 << 17)
2268c2ecf20Sopenharmony_ci#define ADM8211_WCSR_MPRE	(1 << 9)
2278c2ecf20Sopenharmony_ci#define ADM8211_WCSR_LSOE	(1 << 8)
2288c2ecf20Sopenharmony_ci#define ADM8211_WCSR_KEYUP	(1 << 6)
2298c2ecf20Sopenharmony_ci#define ADM8211_WCSR_TSFTW	(1 << 5)
2308c2ecf20Sopenharmony_ci#define ADM8211_WCSR_TIMW	(1 << 4)
2318c2ecf20Sopenharmony_ci#define ADM8211_WCSR_ATIMW	(1 << 3)
2328c2ecf20Sopenharmony_ci#define ADM8211_WCSR_MPR	(1 << 1)
2338c2ecf20Sopenharmony_ci#define ADM8211_WCSR_LSO	(1 << 0)
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci/* CSR11A - GPIO */
2368c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_EN5	(1 << 17)
2378c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_EN4	(1 << 16)
2388c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_EN3	(1 << 15)
2398c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_EN2	(1 << 14)
2408c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_EN1	(1 << 13)
2418c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_EN0	(1 << 12)
2428c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_O5	(1 << 11)
2438c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_O4	(1 << 10)
2448c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_O3	(1 << 9)
2458c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_O2	(1 << 8)
2468c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_O1	(1 << 7)
2478c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_O0	(1 << 6)
2488c2ecf20Sopenharmony_ci#define ADM8211_CSR_GPIO_IN	0x0000003f
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci/* CSR12 - BBPCTL (BBP Control port) */
2518c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_MMISEL	(1 << 31)
2528c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_SPICADD  (0x7F << 24)
2538c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_RF3000	(0x20 << 24)
2548c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_TXCE	(1 << 23)
2558c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_RXCE	(1 << 22)
2568c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_CCAP	(1 << 21)
2578c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_TYPE	0x001c0000
2588c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_WR	(1 << 17)
2598c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_RD	(1 << 16)
2608c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_ADDR	0x0000ff00
2618c2ecf20Sopenharmony_ci#define ADM8211_BBPCTL_DATA	0x000000ff
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci/* CSR12A - SYNCTL (Synthesizer Control port) */
2648c2ecf20Sopenharmony_ci#define ADM8211_SYNCTL_WR	(1 << 31)
2658c2ecf20Sopenharmony_ci#define ADM8211_SYNCTL_RD	(1 << 30)
2668c2ecf20Sopenharmony_ci#define ADM8211_SYNCTL_CS0	(1 << 29)
2678c2ecf20Sopenharmony_ci#define ADM8211_SYNCTL_CS1	(1 << 28)
2688c2ecf20Sopenharmony_ci#define ADM8211_SYNCTL_CAL	(1 << 27)
2698c2ecf20Sopenharmony_ci#define ADM8211_SYNCTL_SELCAL	(1 << 26)
2708c2ecf20Sopenharmony_ci#define ADM8211_SYNCTL_RFtype	((1 << 24) | (1 << 23) | (1 << 22))
2718c2ecf20Sopenharmony_ci#define ADM8211_SYNCTL_RFMD	(1 << 22)
2728c2ecf20Sopenharmony_ci#define ADM8211_SYNCTL_GENERAL	(0x7 << 22)
2738c2ecf20Sopenharmony_ci/* SYNCTL 21:0 Data (Si4126: 18-bit data, 4-bit address) */
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci/* CSR18 - CMDR (Command Register) */
2768c2ecf20Sopenharmony_ci#define ADM8211_CMDR_PM		(1 << 19)
2778c2ecf20Sopenharmony_ci#define ADM8211_CMDR_APM	(1 << 18)
2788c2ecf20Sopenharmony_ci#define ADM8211_CMDR_RTE	(1 << 4)
2798c2ecf20Sopenharmony_ci#define ADM8211_CMDR_DRT	((1 << 3) | (1 << 2))
2808c2ecf20Sopenharmony_ci#define ADM8211_CMDR_DRT_8DW	(0x0 << 2)
2818c2ecf20Sopenharmony_ci#define ADM8211_CMDR_DRT_16DW	(0x1 << 2)
2828c2ecf20Sopenharmony_ci#define ADM8211_CMDR_DRT_SF	(0x2 << 2)
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci/* CSR33 - SYNRF (SYNRF direct control) */
2858c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_SELSYN	(1 << 31)
2868c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_SELRF	(1 << 30)
2878c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_LERF	(1 << 29)
2888c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_LEIF	(1 << 28)
2898c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_SYNCLK	(1 << 27)
2908c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_SYNDATA	(1 << 26)
2918c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_PE1	(1 << 25)
2928c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_PE2	(1 << 24)
2938c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_PA_PE	(1 << 23)
2948c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_TR_SW	(1 << 22)
2958c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_TR_SWN	(1 << 21)
2968c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_RADIO	(1 << 20)
2978c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_CAL_EN	(1 << 19)
2988c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_PHYRST	(1 << 18)
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_IF_SELECT_0 	(1 << 31)
3018c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_IF_SELECT_1 	((1 << 31) | (1 << 28))
3028c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_WRITE_SYNDATA_0	(1 << 31)
3038c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_WRITE_SYNDATA_1	((1 << 31) | (1 << 26))
3048c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_WRITE_CLOCK_0	(1 << 31)
3058c2ecf20Sopenharmony_ci#define ADM8211_SYNRF_WRITE_CLOCK_1	((1 << 31) | (1 << 27))
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci/* CSR44 - WEPCTL (WEP Control) */
3088c2ecf20Sopenharmony_ci#define ADM8211_WEPCTL_WEPENABLE   (1 << 31)
3098c2ecf20Sopenharmony_ci#define ADM8211_WEPCTL_WPAENABLE   (1 << 30)
3108c2ecf20Sopenharmony_ci#define ADM8211_WEPCTL_CURRENT_TABLE (1 << 29)
3118c2ecf20Sopenharmony_ci#define ADM8211_WEPCTL_TABLE_WR	(1 << 28)
3128c2ecf20Sopenharmony_ci#define ADM8211_WEPCTL_TABLE_RD	(1 << 27)
3138c2ecf20Sopenharmony_ci#define ADM8211_WEPCTL_WEPRXBYP	(1 << 25)
3148c2ecf20Sopenharmony_ci#define ADM8211_WEPCTL_SEL_WEPTABLE (1 << 23)
3158c2ecf20Sopenharmony_ci#define ADM8211_WEPCTL_ADDR	(0x000001ff)
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci/* CSR45 - WESK (Data Entry for Share/Individual Key) */
3188c2ecf20Sopenharmony_ci#define ADM8211_WESK_DATA	(0x0000ffff)
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci/* FER (Function Event Register) */
3218c2ecf20Sopenharmony_ci#define ADM8211_FER_INTR_EV_ENT	(1 << 15)
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci/* Si4126 RF Synthesizer - Control Registers */
3258c2ecf20Sopenharmony_ci#define SI4126_MAIN_CONF	0
3268c2ecf20Sopenharmony_ci#define SI4126_PHASE_DET_GAIN	1
3278c2ecf20Sopenharmony_ci#define SI4126_POWERDOWN	2
3288c2ecf20Sopenharmony_ci#define SI4126_RF1_N_DIV	3 /* only Si4136 */
3298c2ecf20Sopenharmony_ci#define SI4126_RF2_N_DIV	4
3308c2ecf20Sopenharmony_ci#define SI4126_IF_N_DIV		5
3318c2ecf20Sopenharmony_ci#define SI4126_RF1_R_DIV	6 /* only Si4136 */
3328c2ecf20Sopenharmony_ci#define SI4126_RF2_R_DIV	7
3338c2ecf20Sopenharmony_ci#define SI4126_IF_R_DIV		8
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/* Main Configuration */
3368c2ecf20Sopenharmony_ci#define SI4126_MAIN_XINDIV2	(1 << 6)
3378c2ecf20Sopenharmony_ci#define SI4126_MAIN_IFDIV	((1 << 11) | (1 << 10))
3388c2ecf20Sopenharmony_ci/* Powerdown */
3398c2ecf20Sopenharmony_ci#define SI4126_POWERDOWN_PDIB	(1 << 1)
3408c2ecf20Sopenharmony_ci#define SI4126_POWERDOWN_PDRB	(1 << 0)
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci/* RF3000 BBP - Control Port Registers */
3448c2ecf20Sopenharmony_ci/* 0x00 - reserved */
3458c2ecf20Sopenharmony_ci#define RF3000_MODEM_CTRL__RX_STATUS 0x01
3468c2ecf20Sopenharmony_ci#define RF3000_CCA_CTRL 0x02
3478c2ecf20Sopenharmony_ci#define RF3000_DIVERSITY__RSSI 0x03
3488c2ecf20Sopenharmony_ci#define RF3000_RX_SIGNAL_FIELD 0x04
3498c2ecf20Sopenharmony_ci#define RF3000_RX_LEN_MSB 0x05
3508c2ecf20Sopenharmony_ci#define RF3000_RX_LEN_LSB 0x06
3518c2ecf20Sopenharmony_ci#define RF3000_RX_SERVICE_FIELD 0x07
3528c2ecf20Sopenharmony_ci#define RF3000_TX_VAR_GAIN__TX_LEN_EXT 0x11
3538c2ecf20Sopenharmony_ci#define RF3000_TX_LEN_MSB 0x12
3548c2ecf20Sopenharmony_ci#define RF3000_TX_LEN_LSB 0x13
3558c2ecf20Sopenharmony_ci#define RF3000_LOW_GAIN_CALIB 0x14
3568c2ecf20Sopenharmony_ci#define RF3000_HIGH_GAIN_CALIB 0x15
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci/* ADM8211 revisions */
3598c2ecf20Sopenharmony_ci#define ADM8211_REV_AB 0x11
3608c2ecf20Sopenharmony_ci#define ADM8211_REV_AF 0x15
3618c2ecf20Sopenharmony_ci#define ADM8211_REV_BA 0x20
3628c2ecf20Sopenharmony_ci#define ADM8211_REV_CA 0x30
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_cistruct adm8211_desc {
3658c2ecf20Sopenharmony_ci	__le32 status;
3668c2ecf20Sopenharmony_ci	__le32 length;
3678c2ecf20Sopenharmony_ci	__le32 buffer1;
3688c2ecf20Sopenharmony_ci	__le32 buffer2;
3698c2ecf20Sopenharmony_ci};
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci#define RDES0_STATUS_OWN	(1 << 31)
3728c2ecf20Sopenharmony_ci#define RDES0_STATUS_ES		(1 << 30)
3738c2ecf20Sopenharmony_ci#define RDES0_STATUS_SQL	(1 << 29)
3748c2ecf20Sopenharmony_ci#define RDES0_STATUS_DE		(1 << 28)
3758c2ecf20Sopenharmony_ci#define RDES0_STATUS_FS		(1 << 27)
3768c2ecf20Sopenharmony_ci#define RDES0_STATUS_LS		(1 << 26)
3778c2ecf20Sopenharmony_ci#define RDES0_STATUS_PCF	(1 << 25)
3788c2ecf20Sopenharmony_ci#define RDES0_STATUS_SFDE	(1 << 24)
3798c2ecf20Sopenharmony_ci#define RDES0_STATUS_SIGE	(1 << 23)
3808c2ecf20Sopenharmony_ci#define RDES0_STATUS_CRC16E	(1 << 22)
3818c2ecf20Sopenharmony_ci#define RDES0_STATUS_RXTOE	(1 << 21)
3828c2ecf20Sopenharmony_ci#define RDES0_STATUS_CRC32E	(1 << 20)
3838c2ecf20Sopenharmony_ci#define RDES0_STATUS_ICVE	(1 << 19)
3848c2ecf20Sopenharmony_ci#define RDES0_STATUS_DA1	(1 << 17)
3858c2ecf20Sopenharmony_ci#define RDES0_STATUS_DA0	(1 << 16)
3868c2ecf20Sopenharmony_ci#define RDES0_STATUS_RXDR	((1 << 15) | (1 << 14) | (1 << 13) | (1 << 12))
3878c2ecf20Sopenharmony_ci#define RDES0_STATUS_FL		(0x00000fff)
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_ci#define RDES1_CONTROL_RER	(1 << 25)
3908c2ecf20Sopenharmony_ci#define RDES1_CONTROL_RCH	(1 << 24)
3918c2ecf20Sopenharmony_ci#define RDES1_CONTROL_RBS2	(0x00fff000)
3928c2ecf20Sopenharmony_ci#define RDES1_CONTROL_RBS1	(0x00000fff)
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_ci#define RDES1_STATUS_RSSI	(0x0000007f)
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci#define TDES0_CONTROL_OWN	(1 << 31)
3988c2ecf20Sopenharmony_ci#define TDES0_CONTROL_DONE	(1 << 30)
3998c2ecf20Sopenharmony_ci#define TDES0_CONTROL_TXDR	(0x0ff00000)
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci#define TDES0_STATUS_OWN	(1 << 31)
4028c2ecf20Sopenharmony_ci#define TDES0_STATUS_DONE	(1 << 30)
4038c2ecf20Sopenharmony_ci#define TDES0_STATUS_ES		(1 << 29)
4048c2ecf20Sopenharmony_ci#define TDES0_STATUS_TLT	(1 << 28)
4058c2ecf20Sopenharmony_ci#define TDES0_STATUS_TRT	(1 << 27)
4068c2ecf20Sopenharmony_ci#define TDES0_STATUS_TUF	(1 << 26)
4078c2ecf20Sopenharmony_ci#define TDES0_STATUS_TRO	(1 << 25)
4088c2ecf20Sopenharmony_ci#define TDES0_STATUS_SOFBR	(1 << 24)
4098c2ecf20Sopenharmony_ci#define TDES0_STATUS_ACR	(0x00000fff)
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci#define TDES1_CONTROL_IC	(1 << 31)
4128c2ecf20Sopenharmony_ci#define TDES1_CONTROL_LS	(1 << 30)
4138c2ecf20Sopenharmony_ci#define TDES1_CONTROL_FS	(1 << 29)
4148c2ecf20Sopenharmony_ci#define TDES1_CONTROL_TER	(1 << 25)
4158c2ecf20Sopenharmony_ci#define TDES1_CONTROL_TCH	(1 << 24)
4168c2ecf20Sopenharmony_ci#define TDES1_CONTROL_RBS2	(0x00fff000)
4178c2ecf20Sopenharmony_ci#define TDES1_CONTROL_RBS1	(0x00000fff)
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ci/* SRAM offsets */
4208c2ecf20Sopenharmony_ci#define ADM8211_SRAM(x) (priv->pdev->revision < ADM8211_REV_BA ? \
4218c2ecf20Sopenharmony_ci        ADM8211_SRAM_A_ ## x : ADM8211_SRAM_B_ ## x)
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci#define ADM8211_SRAM_INDIV_KEY   0x0000
4248c2ecf20Sopenharmony_ci#define ADM8211_SRAM_A_SHARE_KEY 0x0160
4258c2ecf20Sopenharmony_ci#define ADM8211_SRAM_B_SHARE_KEY 0x00c0
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci#define ADM8211_SRAM_A_SSID      0x0180
4288c2ecf20Sopenharmony_ci#define ADM8211_SRAM_B_SSID      0x00d4
4298c2ecf20Sopenharmony_ci#define ADM8211_SRAM_SSID ADM8211_SRAM(SSID)
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_ci#define ADM8211_SRAM_A_SUPP_RATE 0x0191
4328c2ecf20Sopenharmony_ci#define ADM8211_SRAM_B_SUPP_RATE 0x00dd
4338c2ecf20Sopenharmony_ci#define ADM8211_SRAM_SUPP_RATE ADM8211_SRAM(SUPP_RATE)
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci#define ADM8211_SRAM_A_SIZE      0x0200
4368c2ecf20Sopenharmony_ci#define ADM8211_SRAM_B_SIZE      0x01c0
4378c2ecf20Sopenharmony_ci#define ADM8211_SRAM_SIZE ADM8211_SRAM(SIZE)
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_cistruct adm8211_rx_ring_info {
4408c2ecf20Sopenharmony_ci	struct sk_buff *skb;
4418c2ecf20Sopenharmony_ci	dma_addr_t mapping;
4428c2ecf20Sopenharmony_ci};
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_cistruct adm8211_tx_ring_info {
4458c2ecf20Sopenharmony_ci	struct sk_buff *skb;
4468c2ecf20Sopenharmony_ci	dma_addr_t mapping;
4478c2ecf20Sopenharmony_ci	size_t hdrlen;
4488c2ecf20Sopenharmony_ci};
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ci#define PLCP_SIGNAL_1M		0x0a
4518c2ecf20Sopenharmony_ci#define PLCP_SIGNAL_2M		0x14
4528c2ecf20Sopenharmony_ci#define PLCP_SIGNAL_5M5		0x37
4538c2ecf20Sopenharmony_ci#define PLCP_SIGNAL_11M		0x6e
4548c2ecf20Sopenharmony_ci
4558c2ecf20Sopenharmony_cistruct adm8211_tx_hdr {
4568c2ecf20Sopenharmony_ci	u8 da[6];
4578c2ecf20Sopenharmony_ci	u8 signal; /* PLCP signal / TX rate in 100 Kbps */
4588c2ecf20Sopenharmony_ci	u8 service;
4598c2ecf20Sopenharmony_ci	__le16 frame_body_size;
4608c2ecf20Sopenharmony_ci	__le16 frame_control;
4618c2ecf20Sopenharmony_ci	__le16 plcp_frag_tail_len;
4628c2ecf20Sopenharmony_ci	__le16 plcp_frag_head_len;
4638c2ecf20Sopenharmony_ci	__le16 dur_frag_tail;
4648c2ecf20Sopenharmony_ci	__le16 dur_frag_head;
4658c2ecf20Sopenharmony_ci	u8 addr4[6];
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_ci#define ADM8211_TXHDRCTL_SHORT_PREAMBLE		(1 <<  0)
4688c2ecf20Sopenharmony_ci#define ADM8211_TXHDRCTL_MORE_FRAG		(1 <<  1)
4698c2ecf20Sopenharmony_ci#define ADM8211_TXHDRCTL_MORE_DATA		(1 <<  2)
4708c2ecf20Sopenharmony_ci#define ADM8211_TXHDRCTL_FRAG_NO		(1 <<  3) /* ? */
4718c2ecf20Sopenharmony_ci#define ADM8211_TXHDRCTL_ENABLE_RTS		(1 <<  4)
4728c2ecf20Sopenharmony_ci#define ADM8211_TXHDRCTL_ENABLE_WEP_ENGINE	(1 <<  5)
4738c2ecf20Sopenharmony_ci#define ADM8211_TXHDRCTL_ENABLE_EXTEND_HEADER	(1 << 15) /* ? */
4748c2ecf20Sopenharmony_ci	__le16 header_control;
4758c2ecf20Sopenharmony_ci	__le16 frag;
4768c2ecf20Sopenharmony_ci	u8 reserved_0;
4778c2ecf20Sopenharmony_ci	u8 retry_limit;
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci	u32 wep2key0;
4808c2ecf20Sopenharmony_ci	u32 wep2key1;
4818c2ecf20Sopenharmony_ci	u32 wep2key2;
4828c2ecf20Sopenharmony_ci	u32 wep2key3;
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci	u8 keyid;
4858c2ecf20Sopenharmony_ci	u8 entry_control;	// huh??
4868c2ecf20Sopenharmony_ci	u16 reserved_1;
4878c2ecf20Sopenharmony_ci	u32 reserved_2;
4888c2ecf20Sopenharmony_ci} __packed;
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci#define RX_COPY_BREAK 128
4928c2ecf20Sopenharmony_ci#define RX_PKT_SIZE 2500
4938c2ecf20Sopenharmony_ci
4948c2ecf20Sopenharmony_cistruct adm8211_eeprom {
4958c2ecf20Sopenharmony_ci	__le16	signature;		/* 0x00 */
4968c2ecf20Sopenharmony_ci	u8	major_version;		/* 0x02 */
4978c2ecf20Sopenharmony_ci	u8	minor_version;		/* 0x03 */
4988c2ecf20Sopenharmony_ci	u8	reserved_1[4];		/* 0x04 */
4998c2ecf20Sopenharmony_ci	u8	hwaddr[6];		/* 0x08 */
5008c2ecf20Sopenharmony_ci	u8	reserved_2[8];		/* 0x1E */
5018c2ecf20Sopenharmony_ci	__le16	cr49;			/* 0x16 */
5028c2ecf20Sopenharmony_ci	u8	cr03;			/* 0x18 */
5038c2ecf20Sopenharmony_ci	u8	cr28;			/* 0x19 */
5048c2ecf20Sopenharmony_ci	u8	cr29;			/* 0x1A */
5058c2ecf20Sopenharmony_ci	u8	country_code;		/* 0x1B */
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ci/* specific bbp types */
5088c2ecf20Sopenharmony_ci#define ADM8211_BBP_RFMD3000	0x00
5098c2ecf20Sopenharmony_ci#define ADM8211_BBP_RFMD3002	0x01
5108c2ecf20Sopenharmony_ci#define ADM8211_BBP_ADM8011	0x04
5118c2ecf20Sopenharmony_ci	u8	specific_bbptype;	/* 0x1C */
5128c2ecf20Sopenharmony_ci	u8	specific_rftype;	/* 0x1D */
5138c2ecf20Sopenharmony_ci	u8	reserved_3[2];		/* 0x1E */
5148c2ecf20Sopenharmony_ci	__le16	device_id;		/* 0x20 */
5158c2ecf20Sopenharmony_ci	__le16	vendor_id;		/* 0x22 */
5168c2ecf20Sopenharmony_ci	__le16	subsystem_id;		/* 0x24 */
5178c2ecf20Sopenharmony_ci	__le16	subsystem_vendor_id;	/* 0x26 */
5188c2ecf20Sopenharmony_ci	u8	maxlat;			/* 0x28 */
5198c2ecf20Sopenharmony_ci	u8	mingnt;			/* 0x29 */
5208c2ecf20Sopenharmony_ci	__le16	cis_pointer_low;	/* 0x2A */
5218c2ecf20Sopenharmony_ci	__le16	cis_pointer_high;	/* 0x2C */
5228c2ecf20Sopenharmony_ci	__le16	csr18;			/* 0x2E */
5238c2ecf20Sopenharmony_ci	u8	reserved_4[16];		/* 0x30 */
5248c2ecf20Sopenharmony_ci	u8	d1_pwrdara;		/* 0x40 */
5258c2ecf20Sopenharmony_ci	u8	d0_pwrdara;		/* 0x41 */
5268c2ecf20Sopenharmony_ci	u8	d3_pwrdara;		/* 0x42 */
5278c2ecf20Sopenharmony_ci	u8	d2_pwrdara;		/* 0x43 */
5288c2ecf20Sopenharmony_ci	u8	antenna_power[14];	/* 0x44 */
5298c2ecf20Sopenharmony_ci	__le16	cis_wordcnt;		/* 0x52 */
5308c2ecf20Sopenharmony_ci	u8	tx_power[14];		/* 0x54 */
5318c2ecf20Sopenharmony_ci	u8	lpf_cutoff[14];		/* 0x62 */
5328c2ecf20Sopenharmony_ci	u8	lnags_threshold[14];	/* 0x70 */
5338c2ecf20Sopenharmony_ci	__le16	checksum;		/* 0x7E */
5348c2ecf20Sopenharmony_ci	u8	cis_data[];		/* 0x80, 384 bytes */
5358c2ecf20Sopenharmony_ci} __packed;
5368c2ecf20Sopenharmony_ci
5378c2ecf20Sopenharmony_cistruct adm8211_priv {
5388c2ecf20Sopenharmony_ci	struct pci_dev *pdev;
5398c2ecf20Sopenharmony_ci	spinlock_t lock;
5408c2ecf20Sopenharmony_ci	struct adm8211_csr __iomem *map;
5418c2ecf20Sopenharmony_ci	struct adm8211_desc *rx_ring;
5428c2ecf20Sopenharmony_ci	struct adm8211_desc *tx_ring;
5438c2ecf20Sopenharmony_ci	dma_addr_t rx_ring_dma;
5448c2ecf20Sopenharmony_ci	dma_addr_t tx_ring_dma;
5458c2ecf20Sopenharmony_ci	struct adm8211_rx_ring_info *rx_buffers;
5468c2ecf20Sopenharmony_ci	struct adm8211_tx_ring_info *tx_buffers;
5478c2ecf20Sopenharmony_ci	unsigned int rx_ring_size, tx_ring_size;
5488c2ecf20Sopenharmony_ci	unsigned int cur_tx, dirty_tx, cur_rx;
5498c2ecf20Sopenharmony_ci
5508c2ecf20Sopenharmony_ci	struct ieee80211_low_level_stats stats;
5518c2ecf20Sopenharmony_ci	struct ieee80211_supported_band band;
5528c2ecf20Sopenharmony_ci	struct ieee80211_channel channels[14];
5538c2ecf20Sopenharmony_ci	int mode;
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ci	int channel;
5568c2ecf20Sopenharmony_ci	u8 bssid[ETH_ALEN];
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci	u8 soft_rx_crc;
5598c2ecf20Sopenharmony_ci	u8 retry_limit;
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci	u8 ant_power;
5628c2ecf20Sopenharmony_ci	u8 tx_power;
5638c2ecf20Sopenharmony_ci	u8 lpf_cutoff;
5648c2ecf20Sopenharmony_ci	u8 lnags_threshold;
5658c2ecf20Sopenharmony_ci	struct adm8211_eeprom *eeprom;
5668c2ecf20Sopenharmony_ci	size_t eeprom_len;
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci	u32 nar;
5698c2ecf20Sopenharmony_ci
5708c2ecf20Sopenharmony_ci#define ADM8211_TYPE_INTERSIL	0x00
5718c2ecf20Sopenharmony_ci#define ADM8211_TYPE_RFMD	0x01
5728c2ecf20Sopenharmony_ci#define ADM8211_TYPE_MARVEL	0x02
5738c2ecf20Sopenharmony_ci#define ADM8211_TYPE_AIROHA	0x03
5748c2ecf20Sopenharmony_ci#define ADM8211_TYPE_ADMTEK     0x05
5758c2ecf20Sopenharmony_ci	unsigned int rf_type:3;
5768c2ecf20Sopenharmony_ci	unsigned int bbp_type:3;
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci	u8 specific_bbptype;
5798c2ecf20Sopenharmony_ci	enum {
5808c2ecf20Sopenharmony_ci		ADM8211_RFMD2948 = 0x0,
5818c2ecf20Sopenharmony_ci		ADM8211_RFMD2958 = 0x1,
5828c2ecf20Sopenharmony_ci		ADM8211_RFMD2958_RF3000_CONTROL_POWER = 0x2,
5838c2ecf20Sopenharmony_ci		ADM8211_MAX2820 = 0x8,
5848c2ecf20Sopenharmony_ci		ADM8211_AL2210L = 0xC,	/* Airoha */
5858c2ecf20Sopenharmony_ci	} transceiver_type;
5868c2ecf20Sopenharmony_ci};
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_cistruct ieee80211_chan_range {
5898c2ecf20Sopenharmony_ci	u8 min;
5908c2ecf20Sopenharmony_ci	u8 max;
5918c2ecf20Sopenharmony_ci};
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_cistatic const struct ieee80211_chan_range cranges[] = {
5948c2ecf20Sopenharmony_ci	{1,  11},	/* FCC */
5958c2ecf20Sopenharmony_ci	{1,  11},	/* IC */
5968c2ecf20Sopenharmony_ci	{1,  13},	/* ETSI */
5978c2ecf20Sopenharmony_ci	{10, 11},	/* SPAIN */
5988c2ecf20Sopenharmony_ci	{10, 13},	/* FRANCE */
5998c2ecf20Sopenharmony_ci	{14, 14},	/* MMK */
6008c2ecf20Sopenharmony_ci	{1,  14},	/* MMK2 */
6018c2ecf20Sopenharmony_ci};
6028c2ecf20Sopenharmony_ci
6038c2ecf20Sopenharmony_ci#endif /* ADM8211_H */
604