162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright (c) 2015 Qualcomm Atheros Inc. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 562306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 662306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 962306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1062306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1162306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1262306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1362306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1462306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1562306a36Sopenharmony_ci */ 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#ifndef REG_WOW_H 1862306a36Sopenharmony_ci#define REG_WOW_H 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#define AR_WOW_PATTERN 0x825C 2162306a36Sopenharmony_ci#define AR_WOW_COUNT 0x8260 2262306a36Sopenharmony_ci#define AR_WOW_BCN_EN 0x8270 2362306a36Sopenharmony_ci#define AR_WOW_BCN_TIMO 0x8274 2462306a36Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_TIMO 0x8278 2562306a36Sopenharmony_ci#define AR_WOW_KEEP_ALIVE 0x827c 2662306a36Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_DELAY 0x8288 2762306a36Sopenharmony_ci#define AR_WOW_PATTERN_MATCH 0x828c 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci/* 3062306a36Sopenharmony_ci * AR_WOW_LENGTH1 3162306a36Sopenharmony_ci * bit 31:24 pattern 0 length 3262306a36Sopenharmony_ci * bit 23:16 pattern 1 length 3362306a36Sopenharmony_ci * bit 15:8 pattern 2 length 3462306a36Sopenharmony_ci * bit 7:0 pattern 3 length 3562306a36Sopenharmony_ci * 3662306a36Sopenharmony_ci * AR_WOW_LENGTH2 3762306a36Sopenharmony_ci * bit 31:24 pattern 4 length 3862306a36Sopenharmony_ci * bit 23:16 pattern 5 length 3962306a36Sopenharmony_ci * bit 15:8 pattern 6 length 4062306a36Sopenharmony_ci * bit 7:0 pattern 7 length 4162306a36Sopenharmony_ci * 4262306a36Sopenharmony_ci * AR_WOW_LENGTH3 4362306a36Sopenharmony_ci * bit 31:24 pattern 8 length 4462306a36Sopenharmony_ci * bit 23:16 pattern 9 length 4562306a36Sopenharmony_ci * bit 15:8 pattern 10 length 4662306a36Sopenharmony_ci * bit 7:0 pattern 11 length 4762306a36Sopenharmony_ci * 4862306a36Sopenharmony_ci * AR_WOW_LENGTH4 4962306a36Sopenharmony_ci * bit 31:24 pattern 12 length 5062306a36Sopenharmony_ci * bit 23:16 pattern 13 length 5162306a36Sopenharmony_ci * bit 15:8 pattern 14 length 5262306a36Sopenharmony_ci * bit 7:0 pattern 15 length 5362306a36Sopenharmony_ci */ 5462306a36Sopenharmony_ci#define AR_WOW_LENGTH1 0x8360 5562306a36Sopenharmony_ci#define AR_WOW_LENGTH2 0X8364 5662306a36Sopenharmony_ci#define AR_WOW_LENGTH3 0X8380 5762306a36Sopenharmony_ci#define AR_WOW_LENGTH4 0X8384 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#define AR_WOW_PATTERN_MATCH_LT_256B 0x8368 6062306a36Sopenharmony_ci#define AR_MAC_PCU_WOW4 0x8370 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci#define AR_SW_WOW_CONTROL 0x20018 6362306a36Sopenharmony_ci#define AR_SW_WOW_ENABLE 0x1 6462306a36Sopenharmony_ci#define AR_SWITCH_TO_REFCLK 0x2 6562306a36Sopenharmony_ci#define AR_RESET_CONTROL 0x4 6662306a36Sopenharmony_ci#define AR_RESET_VALUE_MASK 0x8 6762306a36Sopenharmony_ci#define AR_HW_WOW_DISABLE 0x10 6862306a36Sopenharmony_ci#define AR_CLR_MAC_INTERRUPT 0x20 6962306a36Sopenharmony_ci#define AR_CLR_KA_INTERRUPT 0x40 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci#define AR_WOW_BACK_OFF_SHIFT(x) ((x & 0xf) << 27) /* in usecs */ 7262306a36Sopenharmony_ci#define AR_WOW_MAC_INTR_EN 0x00040000 7362306a36Sopenharmony_ci#define AR_WOW_MAGIC_EN 0x00010000 7462306a36Sopenharmony_ci#define AR_WOW_PATTERN_EN(x) (x & 0xff) 7562306a36Sopenharmony_ci#define AR_WOW_PAT_FOUND_SHIFT 8 7662306a36Sopenharmony_ci#define AR_WOW_PATTERN_FOUND(x) (x & (0xff << AR_WOW_PAT_FOUND_SHIFT)) 7762306a36Sopenharmony_ci#define AR_WOW_PATTERN_FOUND_MASK ((0xff) << AR_WOW_PAT_FOUND_SHIFT) 7862306a36Sopenharmony_ci#define AR_WOW_MAGIC_PAT_FOUND 0x00020000 7962306a36Sopenharmony_ci#define AR_WOW_MAC_INTR 0x00080000 8062306a36Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_FAIL 0x00100000 8162306a36Sopenharmony_ci#define AR_WOW_BEACON_FAIL 0x00200000 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci#define AR_WOW_STATUS(x) (x & (AR_WOW_PATTERN_FOUND_MASK | \ 8462306a36Sopenharmony_ci AR_WOW_MAGIC_PAT_FOUND | \ 8562306a36Sopenharmony_ci AR_WOW_KEEP_ALIVE_FAIL | \ 8662306a36Sopenharmony_ci AR_WOW_BEACON_FAIL)) 8762306a36Sopenharmony_ci#define AR_WOW_CLEAR_EVENTS(x) (x & ~(AR_WOW_PATTERN_EN(0xff) | \ 8862306a36Sopenharmony_ci AR_WOW_MAGIC_EN | \ 8962306a36Sopenharmony_ci AR_WOW_MAC_INTR_EN | \ 9062306a36Sopenharmony_ci AR_WOW_BEACON_FAIL | \ 9162306a36Sopenharmony_ci AR_WOW_KEEP_ALIVE_FAIL)) 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define AR_WOW2_PATTERN_EN(x) ((x & 0xff) << 0) 9462306a36Sopenharmony_ci#define AR_WOW2_PATTERN_FOUND_SHIFT 8 9562306a36Sopenharmony_ci#define AR_WOW2_PATTERN_FOUND(x) (x & (0xff << AR_WOW2_PATTERN_FOUND_SHIFT)) 9662306a36Sopenharmony_ci#define AR_WOW2_PATTERN_FOUND_MASK ((0xff) << AR_WOW2_PATTERN_FOUND_SHIFT) 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci#define AR_WOW_STATUS2(x) (x & AR_WOW2_PATTERN_FOUND_MASK) 9962306a36Sopenharmony_ci#define AR_WOW_CLEAR_EVENTS2(x) (x & ~(AR_WOW2_PATTERN_EN(0xff))) 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci#define AR_WOW_AIFS_CNT(x) (x & 0xff) 10262306a36Sopenharmony_ci#define AR_WOW_SLOT_CNT(x) ((x & 0xff) << 8) 10362306a36Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_CNT(x) ((x & 0xff) << 16) 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#define AR_WOW_BEACON_FAIL_EN 0x00000001 10662306a36Sopenharmony_ci#define AR_WOW_BEACON_TIMO 0x40000000 10762306a36Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_NEVER 0xffffffff 10862306a36Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_AUTO_DIS 0x00000001 10962306a36Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_FAIL_DIS 0x00000002 11062306a36Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_DELAY_VALUE 0x000003e8 /* 1 msec */ 11162306a36Sopenharmony_ci#define AR_WOW_BMISSTHRESHOLD 0x20 11262306a36Sopenharmony_ci#define AR_WOW_PAT_END_OF_PKT(x) (x & 0xf) 11362306a36Sopenharmony_ci#define AR_WOW_PAT_OFF_MATCH(x) ((x & 0xf) << 8) 11462306a36Sopenharmony_ci#define AR_WOW_PAT_BACKOFF 0x00000004 11562306a36Sopenharmony_ci#define AR_WOW_CNT_AIFS_CNT 0x00000022 11662306a36Sopenharmony_ci#define AR_WOW_CNT_SLOT_CNT 0x00000009 11762306a36Sopenharmony_ci#define AR_WOW_CNT_KA_CNT 0x00000008 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci#define AR_WOW_TRANSMIT_BUFFER 0xe000 12062306a36Sopenharmony_ci#define AR_WOW_TXBUF(i) (AR_WOW_TRANSMIT_BUFFER + ((i) << 2)) 12162306a36Sopenharmony_ci#define AR_WOW_KA_DESC_WORD2 0xe000 12262306a36Sopenharmony_ci#define AR_WOW_TB_PATTERN(i) (0xe100 + (i << 8)) 12362306a36Sopenharmony_ci#define AR_WOW_TB_MASK(i) (0xec00 + (i << 5)) 12462306a36Sopenharmony_ci#define AR_WOW_PATTERN_SUPPORTED_LEGACY 0xff 12562306a36Sopenharmony_ci#define AR_WOW_PATTERN_SUPPORTED 0xffff 12662306a36Sopenharmony_ci#define AR_WOW_LENGTH_MAX 0xff 12762306a36Sopenharmony_ci#define AR_WOW_LEN1_SHIFT(_i) ((0x3 - ((_i) & 0x3)) << 0x3) 12862306a36Sopenharmony_ci#define AR_WOW_LENGTH1_MASK(_i) (AR_WOW_LENGTH_MAX << AR_WOW_LEN1_SHIFT(_i)) 12962306a36Sopenharmony_ci#define AR_WOW_LEN2_SHIFT(_i) ((0x7 - ((_i) & 0x7)) << 0x3) 13062306a36Sopenharmony_ci#define AR_WOW_LENGTH2_MASK(_i) (AR_WOW_LENGTH_MAX << AR_WOW_LEN2_SHIFT(_i)) 13162306a36Sopenharmony_ci#define AR_WOW_LEN3_SHIFT(_i) ((0xb - ((_i) & 0xb)) << 0x3) 13262306a36Sopenharmony_ci#define AR_WOW_LENGTH3_MASK(_i) (AR_WOW_LENGTH_MAX << AR_WOW_LEN3_SHIFT(_i)) 13362306a36Sopenharmony_ci#define AR_WOW_LEN4_SHIFT(_i) ((0xf - ((_i) & 0xf)) << 0x3) 13462306a36Sopenharmony_ci#define AR_WOW_LENGTH4_MASK(_i) (AR_WOW_LENGTH_MAX << AR_WOW_LEN4_SHIFT(_i)) 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci#endif /* REG_WOW_H */ 137