162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci	Copyright (C) 2009 Ivo van Doorn <IvDoorn@gmail.com>
462306a36Sopenharmony_ci	Copyright (C) 2009 Mattias Nissler <mattias.nissler@gmx.de>
562306a36Sopenharmony_ci	Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
662306a36Sopenharmony_ci	Copyright (C) 2009 Xose Vazquez Perez <xose.vazquez@gmail.com>
762306a36Sopenharmony_ci	Copyright (C) 2009 Axel Kollhofer <rain_maker@root-forum.org>
862306a36Sopenharmony_ci	<http://rt2x00.serialmonkey.com>
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/*
1362306a36Sopenharmony_ci	Module: rt2800usb
1462306a36Sopenharmony_ci	Abstract: Data structures and registers for the rt2800usb module.
1562306a36Sopenharmony_ci	Supported chipsets: RT2800U.
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#ifndef RT2800USB_H
1962306a36Sopenharmony_ci#define RT2800USB_H
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/*
2262306a36Sopenharmony_ci * 8051 firmware image.
2362306a36Sopenharmony_ci */
2462306a36Sopenharmony_ci#define FIRMWARE_RT2870			"rt2870.bin"
2562306a36Sopenharmony_ci#define FIRMWARE_IMAGE_BASE		0x3000
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/*
2862306a36Sopenharmony_ci * DMA descriptor defines.
2962306a36Sopenharmony_ci */
3062306a36Sopenharmony_ci#define TXINFO_DESC_SIZE		(1 * sizeof(__le32))
3162306a36Sopenharmony_ci#define RXINFO_DESC_SIZE		(1 * sizeof(__le32))
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/*
3462306a36Sopenharmony_ci * TX Info structure
3562306a36Sopenharmony_ci */
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/*
3862306a36Sopenharmony_ci * Word0
3962306a36Sopenharmony_ci * WIV: Wireless Info Valid. 1: Driver filled WI,  0: DMA needs to copy WI
4062306a36Sopenharmony_ci * QSEL: Select on-chip FIFO ID for 2nd-stage output scheduler.
4162306a36Sopenharmony_ci *       0:MGMT, 1:HCCA 2:EDCA
4262306a36Sopenharmony_ci * USB_DMA_NEXT_VALID: Used ONLY in USB bulk Aggregation, NextValid
4362306a36Sopenharmony_ci * DMA_TX_BURST: used ONLY in USB bulk Aggregation.
4462306a36Sopenharmony_ci *               Force USB DMA transmit frame from current selected endpoint
4562306a36Sopenharmony_ci */
4662306a36Sopenharmony_ci#define TXINFO_W0_USB_DMA_TX_PKT_LEN	FIELD32(0x0000ffff)
4762306a36Sopenharmony_ci#define TXINFO_W0_WIV			FIELD32(0x01000000)
4862306a36Sopenharmony_ci#define TXINFO_W0_QSEL			FIELD32(0x06000000)
4962306a36Sopenharmony_ci#define TXINFO_W0_SW_USE_LAST_ROUND	FIELD32(0x08000000)
5062306a36Sopenharmony_ci#define TXINFO_W0_USB_DMA_NEXT_VALID	FIELD32(0x40000000)
5162306a36Sopenharmony_ci#define TXINFO_W0_USB_DMA_TX_BURST	FIELD32(0x80000000)
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci/*
5462306a36Sopenharmony_ci * RX Info structure
5562306a36Sopenharmony_ci */
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci/*
5862306a36Sopenharmony_ci * Word 0
5962306a36Sopenharmony_ci */
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define RXINFO_W0_USB_DMA_RX_PKT_LEN	FIELD32(0x0000ffff)
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/*
6462306a36Sopenharmony_ci * RX descriptor format for RX Ring.
6562306a36Sopenharmony_ci */
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci/*
6862306a36Sopenharmony_ci * Word0
6962306a36Sopenharmony_ci * UNICAST_TO_ME: This RX frame is unicast to me.
7062306a36Sopenharmony_ci * MULTICAST: This is a multicast frame.
7162306a36Sopenharmony_ci * BROADCAST: This is a broadcast frame.
7262306a36Sopenharmony_ci * MY_BSS: this frame belongs to the same BSSID.
7362306a36Sopenharmony_ci * CRC_ERROR: CRC error.
7462306a36Sopenharmony_ci * CIPHER_ERROR: 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid.
7562306a36Sopenharmony_ci * AMSDU: rx with 802.3 header, not 802.11 header.
7662306a36Sopenharmony_ci */
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define RXD_W0_BA			FIELD32(0x00000001)
7962306a36Sopenharmony_ci#define RXD_W0_DATA			FIELD32(0x00000002)
8062306a36Sopenharmony_ci#define RXD_W0_NULLDATA			FIELD32(0x00000004)
8162306a36Sopenharmony_ci#define RXD_W0_FRAG			FIELD32(0x00000008)
8262306a36Sopenharmony_ci#define RXD_W0_UNICAST_TO_ME		FIELD32(0x00000010)
8362306a36Sopenharmony_ci#define RXD_W0_MULTICAST		FIELD32(0x00000020)
8462306a36Sopenharmony_ci#define RXD_W0_BROADCAST		FIELD32(0x00000040)
8562306a36Sopenharmony_ci#define RXD_W0_MY_BSS			FIELD32(0x00000080)
8662306a36Sopenharmony_ci#define RXD_W0_CRC_ERROR		FIELD32(0x00000100)
8762306a36Sopenharmony_ci#define RXD_W0_CIPHER_ERROR		FIELD32(0x00000600)
8862306a36Sopenharmony_ci#define RXD_W0_AMSDU			FIELD32(0x00000800)
8962306a36Sopenharmony_ci#define RXD_W0_HTC			FIELD32(0x00001000)
9062306a36Sopenharmony_ci#define RXD_W0_RSSI			FIELD32(0x00002000)
9162306a36Sopenharmony_ci#define RXD_W0_L2PAD			FIELD32(0x00004000)
9262306a36Sopenharmony_ci#define RXD_W0_AMPDU			FIELD32(0x00008000)
9362306a36Sopenharmony_ci#define RXD_W0_DECRYPTED		FIELD32(0x00010000)
9462306a36Sopenharmony_ci#define RXD_W0_PLCP_RSSI		FIELD32(0x00020000)
9562306a36Sopenharmony_ci#define RXD_W0_CIPHER_ALG		FIELD32(0x00040000)
9662306a36Sopenharmony_ci#define RXD_W0_LAST_AMSDU		FIELD32(0x00080000)
9762306a36Sopenharmony_ci#define RXD_W0_PLCP_SIGNAL		FIELD32(0xfff00000)
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci#endif /* RT2800USB_H */
100