18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Shared Atheros AR9170 Header 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Register map, hardware-specific definitions 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright 2008, Johannes Berg <johannes@sipsolutions.net> 78c2ecf20Sopenharmony_ci * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com> 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by 118c2ecf20Sopenharmony_ci * the Free Software Foundation; either version 2 of the License. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, 148c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 158c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 168c2ecf20Sopenharmony_ci * GNU General Public License for more details. 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License 198c2ecf20Sopenharmony_ci * along with this program; see the file COPYING. If not, see 208c2ecf20Sopenharmony_ci * http://www.gnu.org/licenses/. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * This file incorporates work covered by the following copyright and 238c2ecf20Sopenharmony_ci * permission notice: 248c2ecf20Sopenharmony_ci * Copyright (c) 2007-2008 Atheros Communications, Inc. 258c2ecf20Sopenharmony_ci * 268c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 278c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 288c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 298c2ecf20Sopenharmony_ci * 308c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 318c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 328c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 338c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 348c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 358c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 368c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 378c2ecf20Sopenharmony_ci */ 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#ifndef __CARL9170_SHARED_HW_H 408c2ecf20Sopenharmony_ci#define __CARL9170_SHARED_HW_H 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci/* High Speed UART */ 438c2ecf20Sopenharmony_ci#define AR9170_UART_REG_BASE 0x1c0000 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* Definitions of interrupt registers */ 468c2ecf20Sopenharmony_ci#define AR9170_UART_REG_RX_BUFFER (AR9170_UART_REG_BASE + 0x000) 478c2ecf20Sopenharmony_ci#define AR9170_UART_REG_TX_HOLDING (AR9170_UART_REG_BASE + 0x004) 488c2ecf20Sopenharmony_ci#define AR9170_UART_REG_FIFO_CONTROL (AR9170_UART_REG_BASE + 0x010) 498c2ecf20Sopenharmony_ci#define AR9170_UART_FIFO_CTRL_RESET_RX_FIFO 0x02 508c2ecf20Sopenharmony_ci#define AR9170_UART_FIFO_CTRL_RESET_TX_FIFO 0x04 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define AR9170_UART_REG_LINE_CONTROL (AR9170_UART_REG_BASE + 0x014) 538c2ecf20Sopenharmony_ci#define AR9170_UART_REG_MODEM_CONTROL (AR9170_UART_REG_BASE + 0x018) 548c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_CTRL_DTR_BIT 0x01 558c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_CTRL_RTS_BIT 0x02 568c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_CTRL_INTERNAL_LOOP_BACK 0x10 578c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_CTRL_AUTO_RTS 0x20 588c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_CTRL_AUTO_CTR 0x40 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define AR9170_UART_REG_LINE_STATUS (AR9170_UART_REG_BASE + 0x01c) 618c2ecf20Sopenharmony_ci#define AR9170_UART_LINE_STS_RX_DATA_READY 0x01 628c2ecf20Sopenharmony_ci#define AR9170_UART_LINE_STS_RX_BUFFER_OVERRUN 0x02 638c2ecf20Sopenharmony_ci#define AR9170_UART_LINE_STS_RX_BREAK_IND 0x10 648c2ecf20Sopenharmony_ci#define AR9170_UART_LINE_STS_TX_FIFO_NEAR_EMPTY 0x20 658c2ecf20Sopenharmony_ci#define AR9170_UART_LINE_STS_TRANSMITTER_EMPTY 0x40 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define AR9170_UART_REG_MODEM_STATUS (AR9170_UART_REG_BASE + 0x020) 688c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_STS_CTS_CHANGE 0x01 698c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_STS_DSR_CHANGE 0x02 708c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_STS_DCD_CHANGE 0x08 718c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_STS_CTS_COMPL 0x10 728c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_STS_DSR_COMPL 0x20 738c2ecf20Sopenharmony_ci#define AR9170_UART_MODEM_STS_DCD_COMPL 0x80 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define AR9170_UART_REG_SCRATCH (AR9170_UART_REG_BASE + 0x024) 768c2ecf20Sopenharmony_ci#define AR9170_UART_REG_DIVISOR_LSB (AR9170_UART_REG_BASE + 0x028) 778c2ecf20Sopenharmony_ci#define AR9170_UART_REG_DIVISOR_MSB (AR9170_UART_REG_BASE + 0x02c) 788c2ecf20Sopenharmony_ci#define AR9170_UART_REG_WORD_RX_BUFFER (AR9170_UART_REG_BASE + 0x034) 798c2ecf20Sopenharmony_ci#define AR9170_UART_REG_WORD_TX_HOLDING (AR9170_UART_REG_BASE + 0x038) 808c2ecf20Sopenharmony_ci#define AR9170_UART_REG_FIFO_COUNT (AR9170_UART_REG_BASE + 0x03c) 818c2ecf20Sopenharmony_ci#define AR9170_UART_REG_REMAINDER (AR9170_UART_REG_BASE + 0x04c) 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/* Timer */ 848c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_BASE 0x1c1000 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_WATCH_DOG (AR9170_TIMER_REG_BASE + 0x000) 878c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_TIMER0 (AR9170_TIMER_REG_BASE + 0x010) 888c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_TIMER1 (AR9170_TIMER_REG_BASE + 0x014) 898c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_TIMER2 (AR9170_TIMER_REG_BASE + 0x018) 908c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_TIMER3 (AR9170_TIMER_REG_BASE + 0x01c) 918c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_TIMER4 (AR9170_TIMER_REG_BASE + 0x020) 928c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_CONTROL (AR9170_TIMER_REG_BASE + 0x024) 938c2ecf20Sopenharmony_ci#define AR9170_TIMER_CTRL_DISABLE_CLOCK 0x100 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_INTERRUPT (AR9170_TIMER_REG_BASE + 0x028) 968c2ecf20Sopenharmony_ci#define AR9170_TIMER_INT_TIMER0 0x001 978c2ecf20Sopenharmony_ci#define AR9170_TIMER_INT_TIMER1 0x002 988c2ecf20Sopenharmony_ci#define AR9170_TIMER_INT_TIMER2 0x004 998c2ecf20Sopenharmony_ci#define AR9170_TIMER_INT_TIMER3 0x008 1008c2ecf20Sopenharmony_ci#define AR9170_TIMER_INT_TIMER4 0x010 1018c2ecf20Sopenharmony_ci#define AR9170_TIMER_INT_TICK_TIMER 0x100 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_TICK_TIMER (AR9170_TIMER_REG_BASE + 0x030) 1048c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_CLOCK_LOW (AR9170_TIMER_REG_BASE + 0x040) 1058c2ecf20Sopenharmony_ci#define AR9170_TIMER_REG_CLOCK_HIGH (AR9170_TIMER_REG_BASE + 0x044) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BASE 0x1c3000 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_POWER_STATE_CTRL (AR9170_MAC_REG_BASE + 0x500) 1108c2ecf20Sopenharmony_ci#define AR9170_MAC_POWER_STATE_CTRL_RESET 0x20 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_MAC_POWER_STATE_CTRL (AR9170_MAC_REG_BASE + 0x50c) 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_INT_CTRL (AR9170_MAC_REG_BASE + 0x510) 1158c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_TXC BIT(0) 1168c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_RXC BIT(1) 1178c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_RETRY_FAIL BIT(2) 1188c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_WAKEUP BIT(3) 1198c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_ATIM BIT(4) 1208c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_DTIM BIT(5) 1218c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_CFG_BCN BIT(6) 1228c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_ABORT BIT(7) 1238c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_QOS BIT(8) 1248c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_MIMO_PS BIT(9) 1258c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_KEY_GEN BIT(10) 1268c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_DECRY_NOUSER BIT(11) 1278c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_RADAR BIT(12) 1288c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_QUIET_FRAME BIT(13) 1298c2ecf20Sopenharmony_ci#define AR9170_MAC_INT_PRETBTT BIT(14) 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TSF_L (AR9170_MAC_REG_BASE + 0x514) 1328c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TSF_H (AR9170_MAC_REG_BASE + 0x518) 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_ATIM_WINDOW (AR9170_MAC_REG_BASE + 0x51c) 1358c2ecf20Sopenharmony_ci#define AR9170_MAC_ATIM_PERIOD_S 0 1368c2ecf20Sopenharmony_ci#define AR9170_MAC_ATIM_PERIOD 0x0000ffff 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BCN_PERIOD (AR9170_MAC_REG_BASE + 0x520) 1398c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_PERIOD_S 0 1408c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_PERIOD 0x0000ffff 1418c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_DTIM_S 16 1428c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_DTIM 0x00ff0000 1438c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_AP_MODE BIT(24) 1448c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_IBSS_MODE BIT(25) 1458c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_PWR_MGT BIT(26) 1468c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_STA_PS BIT(27) 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_PRETBTT (AR9170_MAC_REG_BASE + 0x524) 1498c2ecf20Sopenharmony_ci#define AR9170_MAC_PRETBTT_S 0 1508c2ecf20Sopenharmony_ci#define AR9170_MAC_PRETBTT 0x0000ffff 1518c2ecf20Sopenharmony_ci#define AR9170_MAC_PRETBTT2_S 16 1528c2ecf20Sopenharmony_ci#define AR9170_MAC_PRETBTT2 0xffff0000 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_MAC_ADDR_L (AR9170_MAC_REG_BASE + 0x610) 1558c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_MAC_ADDR_H (AR9170_MAC_REG_BASE + 0x614) 1568c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BSSID_L (AR9170_MAC_REG_BASE + 0x618) 1578c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BSSID_H (AR9170_MAC_REG_BASE + 0x61c) 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_GROUP_HASH_TBL_L (AR9170_MAC_REG_BASE + 0x624) 1608c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_GROUP_HASH_TBL_H (AR9170_MAC_REG_BASE + 0x628) 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_TIMEOUT (AR9170_MAC_REG_BASE + 0x62c) 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BASIC_RATE (AR9170_MAC_REG_BASE + 0x630) 1658c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_MANDATORY_RATE (AR9170_MAC_REG_BASE + 0x634) 1668c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RTS_CTS_RATE (AR9170_MAC_REG_BASE + 0x638) 1678c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BACKOFF_PROTECT (AR9170_MAC_REG_BASE + 0x63c) 1688c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_THRESHOLD (AR9170_MAC_REG_BASE + 0x640) 1698c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AFTER_PNP (AR9170_MAC_REG_BASE + 0x648) 1708c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_PE_DELAY (AR9170_MAC_REG_BASE + 0x64c) 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DYNAMIC_SIFS_ACK (AR9170_MAC_REG_BASE + 0x658) 1738c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_SNIFFER (AR9170_MAC_REG_BASE + 0x674) 1748c2ecf20Sopenharmony_ci#define AR9170_MAC_SNIFFER_ENABLE_PROMISC BIT(0) 1758c2ecf20Sopenharmony_ci#define AR9170_MAC_SNIFFER_DEFAULTS 0x02000000 1768c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_ENCRYPTION (AR9170_MAC_REG_BASE + 0x678) 1778c2ecf20Sopenharmony_ci#define AR9170_MAC_ENCRYPTION_MGMT_RX_SOFTWARE BIT(2) 1788c2ecf20Sopenharmony_ci#define AR9170_MAC_ENCRYPTION_RX_SOFTWARE BIT(3) 1798c2ecf20Sopenharmony_ci#define AR9170_MAC_ENCRYPTION_DEFAULTS 0x70 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_MISC_680 (AR9170_MAC_REG_BASE + 0x680) 1828c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_MISC_684 (AR9170_MAC_REG_BASE + 0x684) 1838c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TX_UNDERRUN (AR9170_MAC_REG_BASE + 0x688) 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_FRAMETYPE_FILTER (AR9170_MAC_REG_BASE + 0x68c) 1868c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_ASSOC_REQ BIT(0) 1878c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_ASSOC_RESP BIT(1) 1888c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_REASSOC_REQ BIT(2) 1898c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_REASSOC_RESP BIT(3) 1908c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_PRB_REQ BIT(4) 1918c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_PRB_RESP BIT(5) 1928c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_BIT6 BIT(6) 1938c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_BIT7 BIT(7) 1948c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_BEACON BIT(8) 1958c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_ATIM BIT(9) 1968c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_DEASSOC BIT(10) 1978c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_AUTH BIT(11) 1988c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_DEAUTH BIT(12) 1998c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_BIT13 BIT(13) 2008c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_BIT14 BIT(14) 2018c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_BIT15 BIT(15) 2028c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_BAR BIT(24) 2038c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_BA BIT(25) 2048c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_PSPOLL BIT(26) 2058c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_RTS BIT(27) 2068c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_CTS BIT(28) 2078c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_ACK BIT(29) 2088c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_CFE BIT(30) 2098c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_CFE_ACK BIT(31) 2108c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_DEFAULTS 0x0500ffff 2118c2ecf20Sopenharmony_ci#define AR9170_MAC_FTF_MONITOR 0xff00ffff 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_ACK_EXTENSION (AR9170_MAC_REG_BASE + 0x690) 2148c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_ACK_TPC (AR9170_MAC_REG_BASE + 0x694) 2158c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_EIFS_AND_SIFS (AR9170_MAC_REG_BASE + 0x698) 2168c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_TIMEOUT_COUNT (AR9170_MAC_REG_BASE + 0x69c) 2178c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_TOTAL (AR9170_MAC_REG_BASE + 0x6a0) 2188c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_CRC32 (AR9170_MAC_REG_BASE + 0x6a4) 2198c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_CRC16 (AR9170_MAC_REG_BASE + 0x6a8) 2208c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_ERR_DECRYPTION_UNI (AR9170_MAC_REG_BASE + 0x6ac) 2218c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_OVERRUN (AR9170_MAC_REG_BASE + 0x6b0) 2228c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_ERR_DECRYPTION_MUL (AR9170_MAC_REG_BASE + 0x6bc) 2238c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TX_BLOCKACKS (AR9170_MAC_REG_BASE + 0x6c0) 2248c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_NAV_COUNT (AR9170_MAC_REG_BASE + 0x6c4) 2258c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BACKOFF_STATUS (AR9170_MAC_REG_BASE + 0x6c8) 2268c2ecf20Sopenharmony_ci#define AR9170_MAC_BACKOFF_CCA BIT(24) 2278c2ecf20Sopenharmony_ci#define AR9170_MAC_BACKOFF_TX_PEX BIT(25) 2288c2ecf20Sopenharmony_ci#define AR9170_MAC_BACKOFF_RX_PE BIT(26) 2298c2ecf20Sopenharmony_ci#define AR9170_MAC_BACKOFF_MD_READY BIT(27) 2308c2ecf20Sopenharmony_ci#define AR9170_MAC_BACKOFF_TX_PE BIT(28) 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TX_RETRY (AR9170_MAC_REG_BASE + 0x6cc) 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TX_COMPLETE (AR9170_MAC_REG_BASE + 0x6d4) 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CHANNEL_BUSY (AR9170_MAC_REG_BASE + 0x6e8) 2378c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_EXT_BUSY (AR9170_MAC_REG_BASE + 0x6ec) 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_SLOT_TIME (AR9170_MAC_REG_BASE + 0x6f0) 2408c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TX_TOTAL (AR9170_MAC_REG_BASE + 0x6f4) 2418c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_ACK_FC (AR9170_MAC_REG_BASE + 0x6f8) 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_MODE (AR9170_MAC_REG_BASE + 0x700) 2448c2ecf20Sopenharmony_ci#define AR9170_MAC_CAM_IBSS 0xe0 2458c2ecf20Sopenharmony_ci#define AR9170_MAC_CAM_AP 0xa1 2468c2ecf20Sopenharmony_ci#define AR9170_MAC_CAM_STA 0x2 2478c2ecf20Sopenharmony_ci#define AR9170_MAC_CAM_AP_WDS 0x3 2488c2ecf20Sopenharmony_ci#define AR9170_MAC_CAM_DEFAULTS (0xf << 24) 2498c2ecf20Sopenharmony_ci#define AR9170_MAC_CAM_HOST_PENDING 0x80000000 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_ROLL_CALL_TBL_L (AR9170_MAC_REG_BASE + 0x704) 2528c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_ROLL_CALL_TBL_H (AR9170_MAC_REG_BASE + 0x708) 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_ADDR (AR9170_MAC_REG_BASE + 0x70c) 2558c2ecf20Sopenharmony_ci#define AR9170_MAC_CAM_ADDR_WRITE 0x80000000 2568c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_DATA0 (AR9170_MAC_REG_BASE + 0x720) 2578c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_DATA1 (AR9170_MAC_REG_BASE + 0x724) 2588c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_DATA2 (AR9170_MAC_REG_BASE + 0x728) 2598c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_DATA3 (AR9170_MAC_REG_BASE + 0x72c) 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_DBG0 (AR9170_MAC_REG_BASE + 0x730) 2628c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_DBG1 (AR9170_MAC_REG_BASE + 0x734) 2638c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_DBG2 (AR9170_MAC_REG_BASE + 0x738) 2648c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_STATE (AR9170_MAC_REG_BASE + 0x73c) 2658c2ecf20Sopenharmony_ci#define AR9170_MAC_CAM_STATE_READ_PENDING 0x40000000 2668c2ecf20Sopenharmony_ci#define AR9170_MAC_CAM_STATE_WRITE_PENDING 0x80000000 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_TXKEY (AR9170_MAC_REG_BASE + 0x740) 2698c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_RXKEY (AR9170_MAC_REG_BASE + 0x750) 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_TX_ENC_TYPE (AR9170_MAC_REG_BASE + 0x760) 2728c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_RX_ENC_TYPE (AR9170_MAC_REG_BASE + 0x770) 2738c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_TX_SERACH_HIT (AR9170_MAC_REG_BASE + 0x780) 2748c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CAM_RX_SERACH_HIT (AR9170_MAC_REG_BASE + 0x790) 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AC0_CW (AR9170_MAC_REG_BASE + 0xb00) 2778c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AC1_CW (AR9170_MAC_REG_BASE + 0xb04) 2788c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AC2_CW (AR9170_MAC_REG_BASE + 0xb08) 2798c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AC3_CW (AR9170_MAC_REG_BASE + 0xb0c) 2808c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AC4_CW (AR9170_MAC_REG_BASE + 0xb10) 2818c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AC2_AC1_AC0_AIFS (AR9170_MAC_REG_BASE + 0xb14) 2828c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AC4_AC3_AC2_AIFS (AR9170_MAC_REG_BASE + 0xb18) 2838c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TXOP_ACK_EXTENSION (AR9170_MAC_REG_BASE + 0xb1c) 2848c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TXOP_ACK_INTERVAL (AR9170_MAC_REG_BASE + 0xb20) 2858c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CONTENTION_POINT (AR9170_MAC_REG_BASE + 0xb24) 2868c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RETRY_MAX (AR9170_MAC_REG_BASE + 0xb28) 2878c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TID_CFACK_CFEND_RATE (AR9170_MAC_REG_BASE + 0xb2c) 2888c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TXOP_NOT_ENOUGH_IND (AR9170_MAC_REG_BASE + 0xb30) 2898c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TKIP_TSC (AR9170_MAC_REG_BASE + 0xb34) 2908c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TXOP_DURATION (AR9170_MAC_REG_BASE + 0xb38) 2918c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TX_QOS_THRESHOLD (AR9170_MAC_REG_BASE + 0xb3c) 2928c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_QOS_PRIORITY_VIRTUAL_CCA (AR9170_MAC_REG_BASE + 0xb40) 2938c2ecf20Sopenharmony_ci#define AR9170_MAC_VIRTUAL_CCA_Q0 BIT(15) 2948c2ecf20Sopenharmony_ci#define AR9170_MAC_VIRTUAL_CCA_Q1 BIT(16) 2958c2ecf20Sopenharmony_ci#define AR9170_MAC_VIRTUAL_CCA_Q2 BIT(17) 2968c2ecf20Sopenharmony_ci#define AR9170_MAC_VIRTUAL_CCA_Q3 BIT(18) 2978c2ecf20Sopenharmony_ci#define AR9170_MAC_VIRTUAL_CCA_Q4 BIT(19) 2988c2ecf20Sopenharmony_ci#define AR9170_MAC_VIRTUAL_CCA_ALL (0xf8000) 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AC1_AC0_TXOP (AR9170_MAC_REG_BASE + 0xb44) 3018c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AC3_AC2_TXOP (AR9170_MAC_REG_BASE + 0xb48) 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AMPDU_COUNT (AR9170_MAC_REG_BASE + 0xb88) 3048c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_MPDU_COUNT (AR9170_MAC_REG_BASE + 0xb8c) 3058c2ecf20Sopenharmony_ci 3068c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AMPDU_FACTOR (AR9170_MAC_REG_BASE + 0xb9c) 3078c2ecf20Sopenharmony_ci#define AR9170_MAC_AMPDU_FACTOR 0x7f0000 3088c2ecf20Sopenharmony_ci#define AR9170_MAC_AMPDU_FACTOR_S 16 3098c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AMPDU_DENSITY (AR9170_MAC_REG_BASE + 0xba0) 3108c2ecf20Sopenharmony_ci#define AR9170_MAC_AMPDU_DENSITY 0x7 3118c2ecf20Sopenharmony_ci#define AR9170_MAC_AMPDU_DENSITY_S 0 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_FCS_SELECT (AR9170_MAC_REG_BASE + 0xbb0) 3148c2ecf20Sopenharmony_ci#define AR9170_MAC_FCS_SWFCS 0x1 3158c2ecf20Sopenharmony_ci#define AR9170_MAC_FCS_FIFO_PROT 0x4 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RTS_CTS_TPC (AR9170_MAC_REG_BASE + 0xbb4) 3188c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_CFEND_QOSNULL_TPC (AR9170_MAC_REG_BASE + 0xbb8) 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_ACK_TABLE (AR9170_MAC_REG_BASE + 0xc00) 3218c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_CONTROL (AR9170_MAC_REG_BASE + 0xc40) 3228c2ecf20Sopenharmony_ci#define AR9170_MAC_RX_CTRL_DEAGG 0x1 3238c2ecf20Sopenharmony_ci#define AR9170_MAC_RX_CTRL_SHORT_FILTER 0x2 3248c2ecf20Sopenharmony_ci#define AR9170_MAC_RX_CTRL_SA_DA_SEARCH 0x20 3258c2ecf20Sopenharmony_ci#define AR9170_MAC_RX_CTRL_PASS_TO_HOST BIT(28) 3268c2ecf20Sopenharmony_ci#define AR9170_MAC_RX_CTRL_ACK_IN_SNIFFER BIT(30) 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_CONTROL_1 (AR9170_MAC_REG_BASE + 0xc44) 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_AMPDU_RX_THRESH (AR9170_MAC_REG_BASE + 0xc50) 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_MPDU (AR9170_MAC_REG_BASE + 0xca0) 3338c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_DROPPED_MPDU (AR9170_MAC_REG_BASE + 0xca4) 3348c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_DEL_MPDU (AR9170_MAC_REG_BASE + 0xca8) 3358c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_PHY_MISC_ERROR (AR9170_MAC_REG_BASE + 0xcac) 3368c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_PHY_XR_ERROR (AR9170_MAC_REG_BASE + 0xcb0) 3378c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_PHY_OFDM_ERROR (AR9170_MAC_REG_BASE + 0xcb4) 3388c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_PHY_CCK_ERROR (AR9170_MAC_REG_BASE + 0xcb8) 3398c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_PHY_HT_ERROR (AR9170_MAC_REG_BASE + 0xcbc) 3408c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_RX_PHY_TOTAL (AR9170_MAC_REG_BASE + 0xcc0) 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ_ADDR (AR9170_MAC_REG_BASE + 0xd00) 3438c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd04) 3448c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ0_ADDR (AR9170_MAC_REG_BASE + 0xd00) 3458c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ0_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd04) 3468c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ1_ADDR (AR9170_MAC_REG_BASE + 0xd08) 3478c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ1_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd0c) 3488c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ2_ADDR (AR9170_MAC_REG_BASE + 0xd10) 3498c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ2_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd14) 3508c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ3_ADDR (AR9170_MAC_REG_BASE + 0xd18) 3518c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ3_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd1c) 3528c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ4_ADDR (AR9170_MAC_REG_BASE + 0xd20) 3538c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ4_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd24) 3548c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_RXQ_ADDR (AR9170_MAC_REG_BASE + 0xd28) 3558c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_RXQ_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd2c) 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TRIGGER (AR9170_MAC_REG_BASE + 0xd30) 3588c2ecf20Sopenharmony_ci#define AR9170_DMA_TRIGGER_TXQ0 BIT(0) 3598c2ecf20Sopenharmony_ci#define AR9170_DMA_TRIGGER_TXQ1 BIT(1) 3608c2ecf20Sopenharmony_ci#define AR9170_DMA_TRIGGER_TXQ2 BIT(2) 3618c2ecf20Sopenharmony_ci#define AR9170_DMA_TRIGGER_TXQ3 BIT(3) 3628c2ecf20Sopenharmony_ci#define AR9170_DMA_TRIGGER_TXQ4 BIT(4) 3638c2ecf20Sopenharmony_ci#define AR9170_DMA_TRIGGER_RXQ BIT(8) 3648c2ecf20Sopenharmony_ci 3658c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_WLAN_STATUS (AR9170_MAC_REG_BASE + 0xd38) 3668c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_STATUS (AR9170_MAC_REG_BASE + 0xd3c) 3678c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd40) 3688c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ0_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd40) 3698c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ1_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd44) 3708c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ2_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd48) 3718c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ3_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd4c) 3728c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ4_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd50) 3738c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ0Q1_LEN (AR9170_MAC_REG_BASE + 0xd54) 3748c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ2Q3_LEN (AR9170_MAC_REG_BASE + 0xd58) 3758c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQ4_LEN (AR9170_MAC_REG_BASE + 0xd5c) 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQX_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd74) 3788c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQX_FAIL_ADDR (AR9170_MAC_REG_BASE + 0xd78) 3798c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_TXRX_MPI (AR9170_MAC_REG_BASE + 0xd7c) 3808c2ecf20Sopenharmony_ci#define AR9170_MAC_TXRX_MPI_TX_MPI_MASK 0x0000000f 3818c2ecf20Sopenharmony_ci#define AR9170_MAC_TXRX_MPI_TX_TO_MASK 0x0000fff0 3828c2ecf20Sopenharmony_ci#define AR9170_MAC_TXRX_MPI_RX_MPI_MASK 0x000f0000 3838c2ecf20Sopenharmony_ci#define AR9170_MAC_TXRX_MPI_RX_TO_MASK 0xfff00000 3848c2ecf20Sopenharmony_ci 3858c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BCN_ADDR (AR9170_MAC_REG_BASE + 0xd84) 3868c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BCN_LENGTH (AR9170_MAC_REG_BASE + 0xd88) 3878c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_LENGTH_MAX (512 - 32) 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BCN_STATUS (AR9170_MAC_REG_BASE + 0xd8c) 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BCN_PLCP (AR9170_MAC_REG_BASE + 0xd90) 3928c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BCN_CTRL (AR9170_MAC_REG_BASE + 0xd94) 3938c2ecf20Sopenharmony_ci#define AR9170_BCN_CTRL_READY 0x01 3948c2ecf20Sopenharmony_ci#define AR9170_BCN_CTRL_LOCK 0x02 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BCN_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd98) 3978c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BCN_COUNT (AR9170_MAC_REG_BASE + 0xd9c) 3988c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BCN_HT1 (AR9170_MAC_REG_BASE + 0xda0) 3998c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_HT_EN BIT(0) 4008c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_GF_PMB BIT(1) 4018c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_SP_EXP BIT(2) 4028c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_TX_BF BIT(3) 4038c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_PWR_CTRL_S 4 4048c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_PWR_CTRL 0x70 4058c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_TX_ANT1 BIT(7) 4068c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_TX_ANT0 BIT(8) 4078c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_NUM_LFT_S 9 4088c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_NUM_LFT 0x600 4098c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_BWC_20M_EXT BIT(16) 4108c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_BWC_40M_SHARED BIT(17) 4118c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_BWC_40M_DUP (BIT(16) | BIT(17)) 4128c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_BF_MCS_S 18 4138c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_BF_MCS 0x1c0000 4148c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_TPC_S 21 4158c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_TPC 0x7e00000 4168c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_CHAIN_MASK_S 27 4178c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT1_CHAIN_MASK 0x38000000 4188c2ecf20Sopenharmony_ci 4198c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_BCN_HT2 (AR9170_MAC_REG_BASE + 0xda4) 4208c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_MCS_S 0 4218c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_MCS 0x7f 4228c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_BW40 BIT(8) 4238c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_SMOOTHING BIT(9) 4248c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_SS BIT(10) 4258c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_NSS BIT(11) 4268c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_STBC_S 12 4278c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_STBC 0x3000 4288c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_ADV_COD BIT(14) 4298c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_SGI BIT(15) 4308c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_LEN_S 16 4318c2ecf20Sopenharmony_ci#define AR9170_MAC_BCN_HT2_LEN 0xffff0000 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_DMA_TXQX_ADDR_CURR (AR9170_MAC_REG_BASE + 0xdc0) 4348c2ecf20Sopenharmony_ci 4358c2ecf20Sopenharmony_ci/* Random number generator */ 4368c2ecf20Sopenharmony_ci#define AR9170_RAND_REG_BASE 0x1d0000 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ci#define AR9170_RAND_REG_NUM (AR9170_RAND_REG_BASE + 0x000) 4398c2ecf20Sopenharmony_ci#define AR9170_RAND_REG_MODE (AR9170_RAND_REG_BASE + 0x004) 4408c2ecf20Sopenharmony_ci#define AR9170_RAND_MODE_MANUAL 0x000 4418c2ecf20Sopenharmony_ci#define AR9170_RAND_MODE_FREE 0x001 4428c2ecf20Sopenharmony_ci 4438c2ecf20Sopenharmony_ci/* GPIO */ 4448c2ecf20Sopenharmony_ci#define AR9170_GPIO_REG_BASE 0x1d0100 4458c2ecf20Sopenharmony_ci#define AR9170_GPIO_REG_PORT_TYPE (AR9170_GPIO_REG_BASE + 0x000) 4468c2ecf20Sopenharmony_ci#define AR9170_GPIO_REG_PORT_DATA (AR9170_GPIO_REG_BASE + 0x004) 4478c2ecf20Sopenharmony_ci#define AR9170_GPIO_PORT_LED_0 1 4488c2ecf20Sopenharmony_ci#define AR9170_GPIO_PORT_LED_1 2 4498c2ecf20Sopenharmony_ci/* WPS Button GPIO for TP-Link TL-WN821N */ 4508c2ecf20Sopenharmony_ci#define AR9170_GPIO_PORT_WPS_BUTTON_PRESSED 4 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci/* Memory Controller */ 4538c2ecf20Sopenharmony_ci#define AR9170_MC_REG_BASE 0x1d1000 4548c2ecf20Sopenharmony_ci 4558c2ecf20Sopenharmony_ci#define AR9170_MC_REG_FLASH_WAIT_STATE (AR9170_MC_REG_BASE + 0x000) 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_ci#define AR9170_SPI_REG_BASE (AR9170_MC_REG_BASE + 0x200) 4588c2ecf20Sopenharmony_ci#define AR9170_SPI_REG_CONTROL0 (AR9170_SPI_REG_BASE + 0x000) 4598c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL0_BUSY BIT(0) 4608c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL0_CMD_GO BIT(1) 4618c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL0_PAGE_WR BIT(2) 4628c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL0_SEQ_RD BIT(3) 4638c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL0_CMD_ABORT BIT(4) 4648c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL0_CMD_LEN_S 8 4658c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL0_CMD_LEN 0x00000f00 4668c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL0_RD_LEN_S 12 4678c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL0_RD_LEN 0x00007000 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ci#define AR9170_SPI_REG_CONTROL1 (AR9170_SPI_REG_BASE + 0x004) 4708c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL1_SCK_RATE BIT(0) 4718c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL1_DRIVE_SDO BIT(1) 4728c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL1_MODE_SEL_S 2 4738c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL1_MODE_SEL 0x000000c0 4748c2ecf20Sopenharmony_ci#define AR9170_SPI_CONTROL1_WRITE_PROTECT BIT(4) 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci#define AR9170_SPI_REG_COMMAND_PORT0 (AR9170_SPI_REG_BASE + 0x008) 4778c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT0_CMD0_S 0 4788c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT0_CMD0 0x000000ff 4798c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT0_CMD1_S 8 4808c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT0_CMD1 0x0000ff00 4818c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT0_CMD2_S 16 4828c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT0_CMD2 0x00ff0000 4838c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT0_CMD3_S 24 4848c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT0_CMD3 0xff000000 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ci#define AR9170_SPI_REG_COMMAND_PORT1 (AR9170_SPI_REG_BASE + 0x00C) 4878c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT1_CMD4_S 0 4888c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT1_CMD4 0x000000ff 4898c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT1_CMD5_S 8 4908c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT1_CMD5 0x0000ff00 4918c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT1_CMD6_S 16 4928c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT1_CMD6 0x00ff0000 4938c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT1_CMD7_S 24 4948c2ecf20Sopenharmony_ci#define AR9170_SPI_COMMAND_PORT1_CMD7 0xff000000 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci#define AR9170_SPI_REG_DATA_PORT (AR9170_SPI_REG_BASE + 0x010) 4978c2ecf20Sopenharmony_ci#define AR9170_SPI_REG_PAGE_WRITE_LEN (AR9170_SPI_REG_BASE + 0x014) 4988c2ecf20Sopenharmony_ci 4998c2ecf20Sopenharmony_ci#define AR9170_EEPROM_REG_BASE (AR9170_MC_REG_BASE + 0x400) 5008c2ecf20Sopenharmony_ci#define AR9170_EEPROM_REG_WP_MAGIC1 (AR9170_EEPROM_REG_BASE + 0x000) 5018c2ecf20Sopenharmony_ci#define AR9170_EEPROM_WP_MAGIC1 0x12345678 5028c2ecf20Sopenharmony_ci 5038c2ecf20Sopenharmony_ci#define AR9170_EEPROM_REG_WP_MAGIC2 (AR9170_EEPROM_REG_BASE + 0x004) 5048c2ecf20Sopenharmony_ci#define AR9170_EEPROM_WP_MAGIC2 0x55aa00ff 5058c2ecf20Sopenharmony_ci 5068c2ecf20Sopenharmony_ci#define AR9170_EEPROM_REG_WP_MAGIC3 (AR9170_EEPROM_REG_BASE + 0x008) 5078c2ecf20Sopenharmony_ci#define AR9170_EEPROM_WP_MAGIC3 0x13579ace 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_ci#define AR9170_EEPROM_REG_CLOCK_DIV (AR9170_EEPROM_REG_BASE + 0x00C) 5108c2ecf20Sopenharmony_ci#define AR9170_EEPROM_CLOCK_DIV_FAC_S 0 5118c2ecf20Sopenharmony_ci#define AR9170_EEPROM_CLOCK_DIV_FAC 0x000001ff 5128c2ecf20Sopenharmony_ci#define AR9170_EEPROM_CLOCK_DIV_FAC_39KHZ 0xff 5138c2ecf20Sopenharmony_ci#define AR9170_EEPROM_CLOCK_DIV_FAC_78KHZ 0x7f 5148c2ecf20Sopenharmony_ci#define AR9170_EEPROM_CLOCK_DIV_FAC_312KHZ 0x1f 5158c2ecf20Sopenharmony_ci#define AR9170_EEPROM_CLOCK_DIV_FAC_10MHZ 0x0 5168c2ecf20Sopenharmony_ci#define AR9170_EEPROM_CLOCK_DIV_SOFT_RST BIT(9) 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci#define AR9170_EEPROM_REG_MODE (AR9170_EEPROM_REG_BASE + 0x010) 5198c2ecf20Sopenharmony_ci#define AR9170_EEPROM_MODE_EEPROM_SIZE_16K_PLUS BIT(31) 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_ci#define AR9170_EEPROM_REG_WRITE_PROTECT (AR9170_EEPROM_REG_BASE + 0x014) 5228c2ecf20Sopenharmony_ci#define AR9170_EEPROM_WRITE_PROTECT_WP_STATUS BIT(0) 5238c2ecf20Sopenharmony_ci#define AR9170_EEPROM_WRITE_PROTECT_WP_SET BIT(8) 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_ci/* Interrupt Controller */ 5268c2ecf20Sopenharmony_ci#define AR9170_MAX_INT_SRC 9 5278c2ecf20Sopenharmony_ci#define AR9170_INT_REG_BASE 0x1d2000 5288c2ecf20Sopenharmony_ci 5298c2ecf20Sopenharmony_ci#define AR9170_INT_REG_FLAG (AR9170_INT_REG_BASE + 0x000) 5308c2ecf20Sopenharmony_ci#define AR9170_INT_REG_FIQ_MASK (AR9170_INT_REG_BASE + 0x004) 5318c2ecf20Sopenharmony_ci#define AR9170_INT_REG_IRQ_MASK (AR9170_INT_REG_BASE + 0x008) 5328c2ecf20Sopenharmony_ci/* INT_REG_FLAG, INT_REG_FIQ_MASK and INT_REG_IRQ_MASK */ 5338c2ecf20Sopenharmony_ci#define AR9170_INT_FLAG_WLAN 0x001 5348c2ecf20Sopenharmony_ci#define AR9170_INT_FLAG_PTAB_BIT 0x002 5358c2ecf20Sopenharmony_ci#define AR9170_INT_FLAG_SE_BIT 0x004 5368c2ecf20Sopenharmony_ci#define AR9170_INT_FLAG_UART_BIT 0x008 5378c2ecf20Sopenharmony_ci#define AR9170_INT_FLAG_TIMER_BIT 0x010 5388c2ecf20Sopenharmony_ci#define AR9170_INT_FLAG_EXT_BIT 0x020 5398c2ecf20Sopenharmony_ci#define AR9170_INT_FLAG_SW_BIT 0x040 5408c2ecf20Sopenharmony_ci#define AR9170_INT_FLAG_USB_BIT 0x080 5418c2ecf20Sopenharmony_ci#define AR9170_INT_FLAG_ETHERNET_BIT 0x100 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_ci#define AR9170_INT_REG_PRIORITY1 (AR9170_INT_REG_BASE + 0x00c) 5448c2ecf20Sopenharmony_ci#define AR9170_INT_REG_PRIORITY2 (AR9170_INT_REG_BASE + 0x010) 5458c2ecf20Sopenharmony_ci#define AR9170_INT_REG_PRIORITY3 (AR9170_INT_REG_BASE + 0x014) 5468c2ecf20Sopenharmony_ci#define AR9170_INT_REG_EXT_INT_CONTROL (AR9170_INT_REG_BASE + 0x018) 5478c2ecf20Sopenharmony_ci#define AR9170_INT_REG_SW_INT_CONTROL (AR9170_INT_REG_BASE + 0x01c) 5488c2ecf20Sopenharmony_ci#define AR9170_INT_SW_INT_ENABLE 0x1 5498c2ecf20Sopenharmony_ci 5508c2ecf20Sopenharmony_ci#define AR9170_INT_REG_FIQ_ENCODE (AR9170_INT_REG_BASE + 0x020) 5518c2ecf20Sopenharmony_ci#define AR9170_INT_INT_IRQ_ENCODE (AR9170_INT_REG_BASE + 0x024) 5528c2ecf20Sopenharmony_ci 5538c2ecf20Sopenharmony_ci/* Power Management */ 5548c2ecf20Sopenharmony_ci#define AR9170_PWR_REG_BASE 0x1d4000 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_ci#define AR9170_PWR_REG_POWER_STATE (AR9170_PWR_REG_BASE + 0x000) 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci#define AR9170_PWR_REG_RESET (AR9170_PWR_REG_BASE + 0x004) 5598c2ecf20Sopenharmony_ci#define AR9170_PWR_RESET_COMMIT_RESET_MASK BIT(0) 5608c2ecf20Sopenharmony_ci#define AR9170_PWR_RESET_WLAN_MASK BIT(1) 5618c2ecf20Sopenharmony_ci#define AR9170_PWR_RESET_DMA_MASK BIT(2) 5628c2ecf20Sopenharmony_ci#define AR9170_PWR_RESET_BRIDGE_MASK BIT(3) 5638c2ecf20Sopenharmony_ci#define AR9170_PWR_RESET_AHB_MASK BIT(9) 5648c2ecf20Sopenharmony_ci#define AR9170_PWR_RESET_BB_WARM_RESET BIT(10) 5658c2ecf20Sopenharmony_ci#define AR9170_PWR_RESET_BB_COLD_RESET BIT(11) 5668c2ecf20Sopenharmony_ci#define AR9170_PWR_RESET_ADDA_CLK_COLD_RESET BIT(12) 5678c2ecf20Sopenharmony_ci#define AR9170_PWR_RESET_PLL BIT(13) 5688c2ecf20Sopenharmony_ci#define AR9170_PWR_RESET_USB_PLL BIT(14) 5698c2ecf20Sopenharmony_ci 5708c2ecf20Sopenharmony_ci#define AR9170_PWR_REG_CLOCK_SEL (AR9170_PWR_REG_BASE + 0x008) 5718c2ecf20Sopenharmony_ci#define AR9170_PWR_CLK_AHB_40MHZ 0 5728c2ecf20Sopenharmony_ci#define AR9170_PWR_CLK_AHB_20_22MHZ 1 5738c2ecf20Sopenharmony_ci#define AR9170_PWR_CLK_AHB_40_44MHZ 2 5748c2ecf20Sopenharmony_ci#define AR9170_PWR_CLK_AHB_80_88MHZ 3 5758c2ecf20Sopenharmony_ci#define AR9170_PWR_CLK_DAC_160_INV_DLY 0x70 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_ci#define AR9170_PWR_REG_CHIP_REVISION (AR9170_PWR_REG_BASE + 0x010) 5788c2ecf20Sopenharmony_ci#define AR9170_PWR_REG_PLL_ADDAC (AR9170_PWR_REG_BASE + 0x014) 5798c2ecf20Sopenharmony_ci#define AR9170_PWR_PLL_ADDAC_DIV_S 2 5808c2ecf20Sopenharmony_ci#define AR9170_PWR_PLL_ADDAC_DIV 0xffc 5818c2ecf20Sopenharmony_ci#define AR9170_PWR_REG_WATCH_DOG_MAGIC (AR9170_PWR_REG_BASE + 0x020) 5828c2ecf20Sopenharmony_ci 5838c2ecf20Sopenharmony_ci/* Faraday USB Controller */ 5848c2ecf20Sopenharmony_ci#define AR9170_USB_REG_BASE 0x1e1000 5858c2ecf20Sopenharmony_ci 5868c2ecf20Sopenharmony_ci#define AR9170_USB_REG_MAIN_CTRL (AR9170_USB_REG_BASE + 0x000) 5878c2ecf20Sopenharmony_ci#define AR9170_USB_MAIN_CTRL_REMOTE_WAKEUP BIT(0) 5888c2ecf20Sopenharmony_ci#define AR9170_USB_MAIN_CTRL_ENABLE_GLOBAL_INT BIT(2) 5898c2ecf20Sopenharmony_ci#define AR9170_USB_MAIN_CTRL_GO_TO_SUSPEND BIT(3) 5908c2ecf20Sopenharmony_ci#define AR9170_USB_MAIN_CTRL_RESET BIT(4) 5918c2ecf20Sopenharmony_ci#define AR9170_USB_MAIN_CTRL_CHIP_ENABLE BIT(5) 5928c2ecf20Sopenharmony_ci#define AR9170_USB_MAIN_CTRL_HIGHSPEED BIT(6) 5938c2ecf20Sopenharmony_ci 5948c2ecf20Sopenharmony_ci#define AR9170_USB_REG_DEVICE_ADDRESS (AR9170_USB_REG_BASE + 0x001) 5958c2ecf20Sopenharmony_ci#define AR9170_USB_DEVICE_ADDRESS_CONFIGURE BIT(7) 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_ci#define AR9170_USB_REG_TEST (AR9170_USB_REG_BASE + 0x002) 5988c2ecf20Sopenharmony_ci#define AR9170_USB_REG_PHY_TEST_SELECT (AR9170_USB_REG_BASE + 0x008) 5998c2ecf20Sopenharmony_ci#define AR9170_USB_REG_CX_CONFIG_STATUS (AR9170_USB_REG_BASE + 0x00b) 6008c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP0_DATA (AR9170_USB_REG_BASE + 0x00c) 6018c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP0_DATA1 (AR9170_USB_REG_BASE + 0x00c) 6028c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP0_DATA2 (AR9170_USB_REG_BASE + 0x00d) 6038c2ecf20Sopenharmony_ci 6048c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_MASK_BYTE_0 (AR9170_USB_REG_BASE + 0x011) 6058c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_MASK_BYTE_1 (AR9170_USB_REG_BASE + 0x012) 6068c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_MASK_BYTE_2 (AR9170_USB_REG_BASE + 0x013) 6078c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_MASK_BYTE_3 (AR9170_USB_REG_BASE + 0x014) 6088c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_MASK_BYTE_4 (AR9170_USB_REG_BASE + 0x015) 6098c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_DISABLE_OUT_INT (BIT(7) | BIT(6)) 6108c2ecf20Sopenharmony_ci 6118c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_MASK_BYTE_5 (AR9170_USB_REG_BASE + 0x016) 6128c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_MASK_BYTE_6 (AR9170_USB_REG_BASE + 0x017) 6138c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_DISABLE_IN_INT BIT(6) 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_MASK_BYTE_7 (AR9170_USB_REG_BASE + 0x018) 6168c2ecf20Sopenharmony_ci 6178c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_GROUP (AR9170_USB_REG_BASE + 0x020) 6188c2ecf20Sopenharmony_ci 6198c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_SOURCE_0 (AR9170_USB_REG_BASE + 0x021) 6208c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC0_SETUP BIT(0) 6218c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC0_IN BIT(1) 6228c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC0_OUT BIT(2) 6238c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC0_FAIL BIT(3) /* ??? */ 6248c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC0_END BIT(4) /* ??? */ 6258c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC0_ABORT BIT(7) 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_SOURCE_1 (AR9170_USB_REG_BASE + 0x022) 6288c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_SOURCE_2 (AR9170_USB_REG_BASE + 0x023) 6298c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_SOURCE_3 (AR9170_USB_REG_BASE + 0x024) 6308c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_SOURCE_4 (AR9170_USB_REG_BASE + 0x025) 6318c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_SOURCE_5 (AR9170_USB_REG_BASE + 0x026) 6328c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_SOURCE_6 (AR9170_USB_REG_BASE + 0x027) 6338c2ecf20Sopenharmony_ci#define AR9170_USB_REG_INTR_SOURCE_7 (AR9170_USB_REG_BASE + 0x028) 6348c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC7_USB_RESET BIT(1) 6358c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC7_USB_SUSPEND BIT(2) 6368c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC7_USB_RESUME BIT(3) 6378c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC7_ISO_SEQ_ERR BIT(4) 6388c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC7_ISO_SEQ_ABORT BIT(5) 6398c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC7_TX0BYTE BIT(6) 6408c2ecf20Sopenharmony_ci#define AR9170_USB_INTR_SRC7_RX0BYTE BIT(7) 6418c2ecf20Sopenharmony_ci 6428c2ecf20Sopenharmony_ci#define AR9170_USB_REG_IDLE_COUNT (AR9170_USB_REG_BASE + 0x02f) 6438c2ecf20Sopenharmony_ci 6448c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP_MAP (AR9170_USB_REG_BASE + 0x030) 6458c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP1_MAP (AR9170_USB_REG_BASE + 0x030) 6468c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP2_MAP (AR9170_USB_REG_BASE + 0x031) 6478c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP3_MAP (AR9170_USB_REG_BASE + 0x032) 6488c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP4_MAP (AR9170_USB_REG_BASE + 0x033) 6498c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP5_MAP (AR9170_USB_REG_BASE + 0x034) 6508c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP6_MAP (AR9170_USB_REG_BASE + 0x035) 6518c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP7_MAP (AR9170_USB_REG_BASE + 0x036) 6528c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP8_MAP (AR9170_USB_REG_BASE + 0x037) 6538c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP9_MAP (AR9170_USB_REG_BASE + 0x038) 6548c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP10_MAP (AR9170_USB_REG_BASE + 0x039) 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP_IN_MAX_SIZE_HIGH (AR9170_USB_REG_BASE + 0x03f) 6578c2ecf20Sopenharmony_ci#define AR9170_USB_EP_IN_STALL 0x8 6588c2ecf20Sopenharmony_ci#define AR9170_USB_EP_IN_TOGGLE 0x10 6598c2ecf20Sopenharmony_ci 6608c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP_IN_MAX_SIZE_LOW (AR9170_USB_REG_BASE + 0x03e) 6618c2ecf20Sopenharmony_ci 6628c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP_OUT_MAX_SIZE_HIGH (AR9170_USB_REG_BASE + 0x05f) 6638c2ecf20Sopenharmony_ci#define AR9170_USB_EP_OUT_STALL 0x8 6648c2ecf20Sopenharmony_ci#define AR9170_USB_EP_OUT_TOGGLE 0x10 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP_OUT_MAX_SIZE_LOW (AR9170_USB_REG_BASE + 0x05e) 6678c2ecf20Sopenharmony_ci 6688c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP3_BYTE_COUNT_HIGH (AR9170_USB_REG_BASE + 0x0ae) 6698c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP3_BYTE_COUNT_LOW (AR9170_USB_REG_BASE + 0x0be) 6708c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP4_BYTE_COUNT_HIGH (AR9170_USB_REG_BASE + 0x0af) 6718c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP4_BYTE_COUNT_LOW (AR9170_USB_REG_BASE + 0x0bf) 6728c2ecf20Sopenharmony_ci 6738c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO_MAP (AR9170_USB_REG_BASE + 0x080) 6748c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO0_MAP (AR9170_USB_REG_BASE + 0x080) 6758c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO1_MAP (AR9170_USB_REG_BASE + 0x081) 6768c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO2_MAP (AR9170_USB_REG_BASE + 0x082) 6778c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO3_MAP (AR9170_USB_REG_BASE + 0x083) 6788c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO4_MAP (AR9170_USB_REG_BASE + 0x084) 6798c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO5_MAP (AR9170_USB_REG_BASE + 0x085) 6808c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO6_MAP (AR9170_USB_REG_BASE + 0x086) 6818c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO7_MAP (AR9170_USB_REG_BASE + 0x087) 6828c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO8_MAP (AR9170_USB_REG_BASE + 0x088) 6838c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO9_MAP (AR9170_USB_REG_BASE + 0x089) 6848c2ecf20Sopenharmony_ci 6858c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO_CONFIG (AR9170_USB_REG_BASE + 0x090) 6868c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO0_CONFIG (AR9170_USB_REG_BASE + 0x090) 6878c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO1_CONFIG (AR9170_USB_REG_BASE + 0x091) 6888c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO2_CONFIG (AR9170_USB_REG_BASE + 0x092) 6898c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO3_CONFIG (AR9170_USB_REG_BASE + 0x093) 6908c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO4_CONFIG (AR9170_USB_REG_BASE + 0x094) 6918c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO5_CONFIG (AR9170_USB_REG_BASE + 0x095) 6928c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO6_CONFIG (AR9170_USB_REG_BASE + 0x096) 6938c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO7_CONFIG (AR9170_USB_REG_BASE + 0x097) 6948c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO8_CONFIG (AR9170_USB_REG_BASE + 0x098) 6958c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO9_CONFIG (AR9170_USB_REG_BASE + 0x099) 6968c2ecf20Sopenharmony_ci 6978c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP3_DATA (AR9170_USB_REG_BASE + 0x0f8) 6988c2ecf20Sopenharmony_ci#define AR9170_USB_REG_EP4_DATA (AR9170_USB_REG_BASE + 0x0fc) 6998c2ecf20Sopenharmony_ci 7008c2ecf20Sopenharmony_ci#define AR9170_USB_REG_FIFO_SIZE (AR9170_USB_REG_BASE + 0x100) 7018c2ecf20Sopenharmony_ci#define AR9170_USB_REG_DMA_CTL (AR9170_USB_REG_BASE + 0x108) 7028c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_ENABLE_TO_DEVICE BIT(0) 7038c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_ENABLE_FROM_DEVICE BIT(1) 7048c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_HIGH_SPEED BIT(2) 7058c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_UP_PACKET_MODE BIT(3) 7068c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_UP_STREAM_S 4 7078c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_UP_STREAM (BIT(4) | BIT(5)) 7088c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_UP_STREAM_4K (0) 7098c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_UP_STREAM_8K BIT(4) 7108c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_UP_STREAM_16K BIT(5) 7118c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_UP_STREAM_32K (BIT(4) | BIT(5)) 7128c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_CTL_DOWN_STREAM BIT(6) 7138c2ecf20Sopenharmony_ci 7148c2ecf20Sopenharmony_ci#define AR9170_USB_REG_DMA_STATUS (AR9170_USB_REG_BASE + 0x10c) 7158c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_STATUS_UP_IDLE BIT(8) 7168c2ecf20Sopenharmony_ci#define AR9170_USB_DMA_STATUS_DN_IDLE BIT(16) 7178c2ecf20Sopenharmony_ci 7188c2ecf20Sopenharmony_ci#define AR9170_USB_REG_MAX_AGG_UPLOAD (AR9170_USB_REG_BASE + 0x110) 7198c2ecf20Sopenharmony_ci#define AR9170_USB_REG_UPLOAD_TIME_CTL (AR9170_USB_REG_BASE + 0x114) 7208c2ecf20Sopenharmony_ci 7218c2ecf20Sopenharmony_ci#define AR9170_USB_REG_WAKE_UP (AR9170_USB_REG_BASE + 0x120) 7228c2ecf20Sopenharmony_ci#define AR9170_USB_WAKE_UP_WAKE BIT(0) 7238c2ecf20Sopenharmony_ci 7248c2ecf20Sopenharmony_ci#define AR9170_USB_REG_CBUS_CTRL (AR9170_USB_REG_BASE + 0x1f0) 7258c2ecf20Sopenharmony_ci#define AR9170_USB_CBUS_CTRL_BUFFER_END (BIT(1)) 7268c2ecf20Sopenharmony_ci 7278c2ecf20Sopenharmony_ci/* PCI/USB to AHB Bridge */ 7288c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_BASE 0x1e2000 7298c2ecf20Sopenharmony_ci 7308c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_CMD (AR9170_PTA_REG_BASE + 0x000) 7318c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_PARAM1 (AR9170_PTA_REG_BASE + 0x004) 7328c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_PARAM2 (AR9170_PTA_REG_BASE + 0x008) 7338c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_PARAM3 (AR9170_PTA_REG_BASE + 0x00c) 7348c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_RSP (AR9170_PTA_REG_BASE + 0x010) 7358c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_STATUS1 (AR9170_PTA_REG_BASE + 0x014) 7368c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_STATUS2 (AR9170_PTA_REG_BASE + 0x018) 7378c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_STATUS3 (AR9170_PTA_REG_BASE + 0x01c) 7388c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_AHB_INT_FLAG (AR9170_PTA_REG_BASE + 0x020) 7398c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_AHB_INT_MASK (AR9170_PTA_REG_BASE + 0x024) 7408c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_AHB_INT_ACK (AR9170_PTA_REG_BASE + 0x028) 7418c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_AHB_SCRATCH1 (AR9170_PTA_REG_BASE + 0x030) 7428c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_AHB_SCRATCH2 (AR9170_PTA_REG_BASE + 0x034) 7438c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_AHB_SCRATCH3 (AR9170_PTA_REG_BASE + 0x038) 7448c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_AHB_SCRATCH4 (AR9170_PTA_REG_BASE + 0x03c) 7458c2ecf20Sopenharmony_ci 7468c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_SHARE_MEM_CTRL (AR9170_PTA_REG_BASE + 0x124) 7478c2ecf20Sopenharmony_ci 7488c2ecf20Sopenharmony_ci/* 7498c2ecf20Sopenharmony_ci * PCI to AHB Bridge 7508c2ecf20Sopenharmony_ci */ 7518c2ecf20Sopenharmony_ci 7528c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_INT_FLAG (AR9170_PTA_REG_BASE + 0x100) 7538c2ecf20Sopenharmony_ci#define AR9170_PTA_INT_FLAG_DN 0x01 7548c2ecf20Sopenharmony_ci#define AR9170_PTA_INT_FLAG_UP 0x02 7558c2ecf20Sopenharmony_ci#define AR9170_PTA_INT_FLAG_CMD 0x04 7568c2ecf20Sopenharmony_ci 7578c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_INT_MASK (AR9170_PTA_REG_BASE + 0x104) 7588c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_DN_DMA_ADDRL (AR9170_PTA_REG_BASE + 0x108) 7598c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_DN_DMA_ADDRH (AR9170_PTA_REG_BASE + 0x10c) 7608c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_UP_DMA_ADDRL (AR9170_PTA_REG_BASE + 0x110) 7618c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_UP_DMA_ADDRH (AR9170_PTA_REG_BASE + 0x114) 7628c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_DN_PEND_TIME (AR9170_PTA_REG_BASE + 0x118) 7638c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_UP_PEND_TIME (AR9170_PTA_REG_BASE + 0x11c) 7648c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_CONTROL (AR9170_PTA_REG_BASE + 0x120) 7658c2ecf20Sopenharmony_ci#define AR9170_PTA_CTRL_4_BEAT_BURST 0x00 7668c2ecf20Sopenharmony_ci#define AR9170_PTA_CTRL_8_BEAT_BURST 0x01 7678c2ecf20Sopenharmony_ci#define AR9170_PTA_CTRL_16_BEAT_BURST 0x02 7688c2ecf20Sopenharmony_ci#define AR9170_PTA_CTRL_LOOPBACK_MODE 0x10 7698c2ecf20Sopenharmony_ci 7708c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_MEM_CTRL (AR9170_PTA_REG_BASE + 0x124) 7718c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_MEM_ADDR (AR9170_PTA_REG_BASE + 0x128) 7728c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_DN_DMA_TRIGGER (AR9170_PTA_REG_BASE + 0x12c) 7738c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_UP_DMA_TRIGGER (AR9170_PTA_REG_BASE + 0x130) 7748c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_DMA_STATUS (AR9170_PTA_REG_BASE + 0x134) 7758c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_DN_CURR_ADDRL (AR9170_PTA_REG_BASE + 0x138) 7768c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_DN_CURR_ADDRH (AR9170_PTA_REG_BASE + 0x13c) 7778c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_UP_CURR_ADDRL (AR9170_PTA_REG_BASE + 0x140) 7788c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_UP_CURR_ADDRH (AR9170_PTA_REG_BASE + 0x144) 7798c2ecf20Sopenharmony_ci#define AR9170_PTA_REG_DMA_MODE_CTRL (AR9170_PTA_REG_BASE + 0x148) 7808c2ecf20Sopenharmony_ci#define AR9170_PTA_DMA_MODE_CTRL_RESET BIT(0) 7818c2ecf20Sopenharmony_ci#define AR9170_PTA_DMA_MODE_CTRL_DISABLE_USB BIT(1) 7828c2ecf20Sopenharmony_ci 7838c2ecf20Sopenharmony_ci/* Protocol Controller Module */ 7848c2ecf20Sopenharmony_ci#define AR9170_MAC_REG_PC_REG_BASE (AR9170_MAC_REG_BASE + 0xe00) 7858c2ecf20Sopenharmony_ci 7868c2ecf20Sopenharmony_ci 7878c2ecf20Sopenharmony_ci#define AR9170_NUM_LEDS 2 7888c2ecf20Sopenharmony_ci 7898c2ecf20Sopenharmony_ci/* CAM */ 7908c2ecf20Sopenharmony_ci#define AR9170_CAM_MAX_USER 64 7918c2ecf20Sopenharmony_ci#define AR9170_CAM_MAX_KEY_LENGTH 16 7928c2ecf20Sopenharmony_ci 7938c2ecf20Sopenharmony_ci#define AR9170_SRAM_OFFSET 0x100000 7948c2ecf20Sopenharmony_ci#define AR9170_SRAM_SIZE 0x18000 7958c2ecf20Sopenharmony_ci 7968c2ecf20Sopenharmony_ci#define AR9170_PRAM_OFFSET 0x200000 7978c2ecf20Sopenharmony_ci#define AR9170_PRAM_SIZE 0x8000 7988c2ecf20Sopenharmony_ci 7998c2ecf20Sopenharmony_cienum cpu_clock { 8008c2ecf20Sopenharmony_ci AHB_STATIC_40MHZ = 0, 8018c2ecf20Sopenharmony_ci AHB_GMODE_22MHZ = 1, 8028c2ecf20Sopenharmony_ci AHB_AMODE_20MHZ = 1, 8038c2ecf20Sopenharmony_ci AHB_GMODE_44MHZ = 2, 8048c2ecf20Sopenharmony_ci AHB_AMODE_40MHZ = 2, 8058c2ecf20Sopenharmony_ci AHB_GMODE_88MHZ = 3, 8068c2ecf20Sopenharmony_ci AHB_AMODE_80MHZ = 3 8078c2ecf20Sopenharmony_ci}; 8088c2ecf20Sopenharmony_ci 8098c2ecf20Sopenharmony_ci/* USB endpoints */ 8108c2ecf20Sopenharmony_cienum ar9170_usb_ep { 8118c2ecf20Sopenharmony_ci /* 8128c2ecf20Sopenharmony_ci * Control EP is always EP 0 (USB SPEC) 8138c2ecf20Sopenharmony_ci * 8148c2ecf20Sopenharmony_ci * The weird thing is: the original firmware has a few 8158c2ecf20Sopenharmony_ci * comments that suggest that the actual EP numbers 8168c2ecf20Sopenharmony_ci * are in the 1 to 10 range?! 8178c2ecf20Sopenharmony_ci */ 8188c2ecf20Sopenharmony_ci AR9170_USB_EP_CTRL = 0, 8198c2ecf20Sopenharmony_ci 8208c2ecf20Sopenharmony_ci AR9170_USB_EP_TX, 8218c2ecf20Sopenharmony_ci AR9170_USB_EP_RX, 8228c2ecf20Sopenharmony_ci AR9170_USB_EP_IRQ, 8238c2ecf20Sopenharmony_ci AR9170_USB_EP_CMD, 8248c2ecf20Sopenharmony_ci AR9170_USB_NUM_EXTRA_EP = 4, 8258c2ecf20Sopenharmony_ci 8268c2ecf20Sopenharmony_ci __AR9170_USB_NUM_EP, 8278c2ecf20Sopenharmony_ci 8288c2ecf20Sopenharmony_ci __AR9170_USB_NUM_MAX_EP = 10 8298c2ecf20Sopenharmony_ci}; 8308c2ecf20Sopenharmony_ci 8318c2ecf20Sopenharmony_cienum ar9170_usb_fifo { 8328c2ecf20Sopenharmony_ci __AR9170_USB_NUM_MAX_FIFO = 10 8338c2ecf20Sopenharmony_ci}; 8348c2ecf20Sopenharmony_ci 8358c2ecf20Sopenharmony_cienum ar9170_tx_queues { 8368c2ecf20Sopenharmony_ci AR9170_TXQ0 = 0, 8378c2ecf20Sopenharmony_ci AR9170_TXQ1, 8388c2ecf20Sopenharmony_ci AR9170_TXQ2, 8398c2ecf20Sopenharmony_ci AR9170_TXQ3, 8408c2ecf20Sopenharmony_ci AR9170_TXQ_SPECIAL, 8418c2ecf20Sopenharmony_ci 8428c2ecf20Sopenharmony_ci /* keep last */ 8438c2ecf20Sopenharmony_ci __AR9170_NUM_TX_QUEUES = 5 8448c2ecf20Sopenharmony_ci}; 8458c2ecf20Sopenharmony_ci 8468c2ecf20Sopenharmony_ci#define AR9170_TX_STREAM_TAG 0x697e 8478c2ecf20Sopenharmony_ci#define AR9170_RX_STREAM_TAG 0x4e00 8488c2ecf20Sopenharmony_ci#define AR9170_RX_STREAM_MAX_SIZE 0xffff 8498c2ecf20Sopenharmony_ci 8508c2ecf20Sopenharmony_cistruct ar9170_stream { 8518c2ecf20Sopenharmony_ci __le16 length; 8528c2ecf20Sopenharmony_ci __le16 tag; 8538c2ecf20Sopenharmony_ci 8548c2ecf20Sopenharmony_ci u8 payload[]; 8558c2ecf20Sopenharmony_ci} __packed __aligned(4); 8568c2ecf20Sopenharmony_ci#define AR9170_STREAM_LEN 4 8578c2ecf20Sopenharmony_ci 8588c2ecf20Sopenharmony_ci#define AR9170_MAX_ACKTABLE_ENTRIES 8 8598c2ecf20Sopenharmony_ci#define AR9170_MAX_VIRTUAL_MAC 7 8608c2ecf20Sopenharmony_ci 8618c2ecf20Sopenharmony_ci#define AR9170_USB_EP_CTRL_MAX 64 8628c2ecf20Sopenharmony_ci#define AR9170_USB_EP_TX_MAX 512 8638c2ecf20Sopenharmony_ci#define AR9170_USB_EP_RX_MAX 512 8648c2ecf20Sopenharmony_ci#define AR9170_USB_EP_IRQ_MAX 64 8658c2ecf20Sopenharmony_ci#define AR9170_USB_EP_CMD_MAX 64 8668c2ecf20Sopenharmony_ci 8678c2ecf20Sopenharmony_ci/* Trigger PRETBTT interrupt 6 Kus earlier */ 8688c2ecf20Sopenharmony_ci#define CARL9170_PRETBTT_KUS 6 8698c2ecf20Sopenharmony_ci 8708c2ecf20Sopenharmony_ci#define AR5416_MAX_RATE_POWER 63 8718c2ecf20Sopenharmony_ci 8728c2ecf20Sopenharmony_ci#define SET_VAL(reg, value, newvalue) \ 8738c2ecf20Sopenharmony_ci (value = ((value) & ~reg) | (((newvalue) << reg##_S) & reg)) 8748c2ecf20Sopenharmony_ci 8758c2ecf20Sopenharmony_ci#define SET_CONSTVAL(reg, newvalue) \ 8768c2ecf20Sopenharmony_ci (((newvalue) << reg##_S) & reg) 8778c2ecf20Sopenharmony_ci 8788c2ecf20Sopenharmony_ci#define MOD_VAL(reg, value, newvalue) \ 8798c2ecf20Sopenharmony_ci (((value) & ~reg) | (((newvalue) << reg##_S) & reg)) 8808c2ecf20Sopenharmony_ci 8818c2ecf20Sopenharmony_ci#define GET_VAL(reg, value) \ 8828c2ecf20Sopenharmony_ci (((value) & reg) >> reg##_S) 8838c2ecf20Sopenharmony_ci 8848c2ecf20Sopenharmony_ci#endif /* __CARL9170_SHARED_HW_H */ 885