1ce6e982bSSujith Manoharan /*
2ce6e982bSSujith Manoharan  * Copyright (c) 2015 Qualcomm Atheros Inc.
3ce6e982bSSujith Manoharan  *
4ce6e982bSSujith Manoharan  * Permission to use, copy, modify, and/or distribute this software for any
5ce6e982bSSujith Manoharan  * purpose with or without fee is hereby granted, provided that the above
6ce6e982bSSujith Manoharan  * copyright notice and this permission notice appear in all copies.
7ce6e982bSSujith Manoharan  *
8ce6e982bSSujith Manoharan  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9ce6e982bSSujith Manoharan  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10ce6e982bSSujith Manoharan  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11ce6e982bSSujith Manoharan  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12ce6e982bSSujith Manoharan  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13ce6e982bSSujith Manoharan  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14ce6e982bSSujith Manoharan  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15ce6e982bSSujith Manoharan  */
16ce6e982bSSujith Manoharan 
17ce6e982bSSujith Manoharan #ifndef REG_WOW_H
18ce6e982bSSujith Manoharan #define REG_WOW_H
19ce6e982bSSujith Manoharan 
20ce6e982bSSujith Manoharan #define AR_WOW_PATTERN                  0x825C
21ce6e982bSSujith Manoharan #define AR_WOW_COUNT                    0x8260
22ce6e982bSSujith Manoharan #define AR_WOW_BCN_EN                   0x8270
23ce6e982bSSujith Manoharan #define AR_WOW_BCN_TIMO                 0x8274
24ce6e982bSSujith Manoharan #define AR_WOW_KEEP_ALIVE_TIMO          0x8278
25ce6e982bSSujith Manoharan #define AR_WOW_KEEP_ALIVE               0x827c
26ce6e982bSSujith Manoharan #define AR_WOW_KEEP_ALIVE_DELAY         0x8288
27ce6e982bSSujith Manoharan #define AR_WOW_PATTERN_MATCH            0x828c
28a28815dbSSujith Manoharan 
29a28815dbSSujith Manoharan /*
30a28815dbSSujith Manoharan  * AR_WOW_LENGTH1
31a28815dbSSujith Manoharan  * bit 31:24 pattern 0 length
32a28815dbSSujith Manoharan  * bit 23:16 pattern 1 length
33a28815dbSSujith Manoharan  * bit 15:8 pattern 2 length
34a28815dbSSujith Manoharan  * bit 7:0 pattern 3 length
35a28815dbSSujith Manoharan  *
36a28815dbSSujith Manoharan  * AR_WOW_LENGTH2
37a28815dbSSujith Manoharan  * bit 31:24 pattern 4 length
38a28815dbSSujith Manoharan  * bit 23:16 pattern 5 length
39a28815dbSSujith Manoharan  * bit 15:8 pattern 6 length
40a28815dbSSujith Manoharan  * bit 7:0 pattern 7 length
41a28815dbSSujith Manoharan  *
42a28815dbSSujith Manoharan  * AR_WOW_LENGTH3
43a28815dbSSujith Manoharan  * bit 31:24 pattern 8 length
44a28815dbSSujith Manoharan  * bit 23:16 pattern 9 length
45a28815dbSSujith Manoharan  * bit 15:8 pattern 10 length
46a28815dbSSujith Manoharan  * bit 7:0 pattern 11 length
47a28815dbSSujith Manoharan  *
48a28815dbSSujith Manoharan  * AR_WOW_LENGTH4
49a28815dbSSujith Manoharan  * bit 31:24 pattern 12 length
50a28815dbSSujith Manoharan  * bit 23:16 pattern 13 length
51a28815dbSSujith Manoharan  * bit 15:8 pattern 14 length
52a28815dbSSujith Manoharan  * bit 7:0 pattern 15 length
53a28815dbSSujith Manoharan  */
54ce6e982bSSujith Manoharan #define AR_WOW_LENGTH1                  0x8360
55ce6e982bSSujith Manoharan #define AR_WOW_LENGTH2                  0X8364
56a28815dbSSujith Manoharan #define AR_WOW_LENGTH3                  0X8380
57a28815dbSSujith Manoharan #define AR_WOW_LENGTH4                  0X8384
58a28815dbSSujith Manoharan 
59ce6e982bSSujith Manoharan #define AR_WOW_PATTERN_MATCH_LT_256B    0x8368
60a28815dbSSujith Manoharan #define AR_MAC_PCU_WOW4                 0x8370
61ce6e982bSSujith Manoharan 
62ce6e982bSSujith Manoharan #define AR_SW_WOW_CONTROL               0x20018
63ce6e982bSSujith Manoharan #define AR_SW_WOW_ENABLE                0x1
64ce6e982bSSujith Manoharan #define AR_SWITCH_TO_REFCLK             0x2
65ce6e982bSSujith Manoharan #define AR_RESET_CONTROL                0x4
66ce6e982bSSujith Manoharan #define AR_RESET_VALUE_MASK             0x8
67ce6e982bSSujith Manoharan #define AR_HW_WOW_DISABLE               0x10
68ce6e982bSSujith Manoharan #define AR_CLR_MAC_INTERRUPT            0x20
69ce6e982bSSujith Manoharan #define AR_CLR_KA_INTERRUPT             0x40
70ce6e982bSSujith Manoharan 
71bb631314SSujith Manoharan #define AR_WOW_BACK_OFF_SHIFT(x)        ((x & 0xf) << 27) /* in usecs */
72ce6e982bSSujith Manoharan #define AR_WOW_MAC_INTR_EN              0x00040000
73ce6e982bSSujith Manoharan #define AR_WOW_MAGIC_EN                 0x00010000
74ce6e982bSSujith Manoharan #define AR_WOW_PATTERN_EN(x)            (x & 0xff)
75ce6e982bSSujith Manoharan #define AR_WOW_PAT_FOUND_SHIFT          8
76ce6e982bSSujith Manoharan #define AR_WOW_PATTERN_FOUND(x)         (x & (0xff << AR_WOW_PAT_FOUND_SHIFT))
77ce6e982bSSujith Manoharan #define AR_WOW_PATTERN_FOUND_MASK       ((0xff) << AR_WOW_PAT_FOUND_SHIFT)
78ce6e982bSSujith Manoharan #define AR_WOW_MAGIC_PAT_FOUND          0x00020000
79ce6e982bSSujith Manoharan #define AR_WOW_MAC_INTR                 0x00080000
80ce6e982bSSujith Manoharan #define AR_WOW_KEEP_ALIVE_FAIL          0x00100000
81ce6e982bSSujith Manoharan #define AR_WOW_BEACON_FAIL              0x00200000
82ce6e982bSSujith Manoharan 
83ce6e982bSSujith Manoharan #define AR_WOW_STATUS(x)                (x & (AR_WOW_PATTERN_FOUND_MASK | \
84ce6e982bSSujith Manoharan                                               AR_WOW_MAGIC_PAT_FOUND    | \
85ce6e982bSSujith Manoharan                                               AR_WOW_KEEP_ALIVE_FAIL    | \
86ce6e982bSSujith Manoharan                                               AR_WOW_BEACON_FAIL))
87ce6e982bSSujith Manoharan #define AR_WOW_CLEAR_EVENTS(x)          (x & ~(AR_WOW_PATTERN_EN(0xff) | \
88ce6e982bSSujith Manoharan                                                AR_WOW_MAGIC_EN |	\
89ce6e982bSSujith Manoharan                                                AR_WOW_MAC_INTR_EN |	\
90ce6e982bSSujith Manoharan                                                AR_WOW_BEACON_FAIL |	\
91ce6e982bSSujith Manoharan                                                AR_WOW_KEEP_ALIVE_FAIL))
926aaefab6SSujith Manoharan 
933277b202SSujith Manoharan #define AR_WOW2_PATTERN_EN(x)           ((x & 0xff) << 0)
946aaefab6SSujith Manoharan #define AR_WOW2_PATTERN_FOUND_SHIFT     8
956aaefab6SSujith Manoharan #define AR_WOW2_PATTERN_FOUND(x)        (x & (0xff << AR_WOW2_PATTERN_FOUND_SHIFT))
966aaefab6SSujith Manoharan #define AR_WOW2_PATTERN_FOUND_MASK      ((0xff) << AR_WOW2_PATTERN_FOUND_SHIFT)
976aaefab6SSujith Manoharan 
986aaefab6SSujith Manoharan #define AR_WOW_STATUS2(x)               (x & AR_WOW2_PATTERN_FOUND_MASK)
993277b202SSujith Manoharan #define AR_WOW_CLEAR_EVENTS2(x)         (x & ~(AR_WOW2_PATTERN_EN(0xff)))
100ce6e982bSSujith Manoharan 
101ce6e982bSSujith Manoharan #define AR_WOW_AIFS_CNT(x)              (x & 0xff)
102ce6e982bSSujith Manoharan #define AR_WOW_SLOT_CNT(x)              ((x & 0xff) << 8)
103ce6e982bSSujith Manoharan #define AR_WOW_KEEP_ALIVE_CNT(x)        ((x & 0xff) << 16)
104ce6e982bSSujith Manoharan 
105ce6e982bSSujith Manoharan #define AR_WOW_BEACON_FAIL_EN           0x00000001
106404033c1SSujith Manoharan #define AR_WOW_BEACON_TIMO              0x40000000
107ce6e982bSSujith Manoharan #define AR_WOW_KEEP_ALIVE_NEVER         0xffffffff
108ce6e982bSSujith Manoharan #define AR_WOW_KEEP_ALIVE_AUTO_DIS      0x00000001
109ce6e982bSSujith Manoharan #define AR_WOW_KEEP_ALIVE_FAIL_DIS      0x00000002
110ce6e982bSSujith Manoharan #define AR_WOW_KEEP_ALIVE_DELAY_VALUE   0x000003e8 /* 1 msec */
111ce6e982bSSujith Manoharan #define AR_WOW_BMISSTHRESHOLD           0x20
112ce6e982bSSujith Manoharan #define AR_WOW_PAT_END_OF_PKT(x)        (x & 0xf)
113ce6e982bSSujith Manoharan #define AR_WOW_PAT_OFF_MATCH(x)         ((x & 0xf) << 8)
114404033c1SSujith Manoharan #define AR_WOW_PAT_BACKOFF              0x00000004
115404033c1SSujith Manoharan #define AR_WOW_CNT_AIFS_CNT             0x00000022
116404033c1SSujith Manoharan #define AR_WOW_CNT_SLOT_CNT             0x00000009
117404033c1SSujith Manoharan #define AR_WOW_CNT_KA_CNT               0x00000008
118ce6e982bSSujith Manoharan 
119404033c1SSujith Manoharan #define AR_WOW_TRANSMIT_BUFFER          0xe000
120ce6e982bSSujith Manoharan #define AR_WOW_TXBUF(i)                 (AR_WOW_TRANSMIT_BUFFER + ((i) << 2))
121ce6e982bSSujith Manoharan #define AR_WOW_KA_DESC_WORD2            0xe000
122ce6e982bSSujith Manoharan #define AR_WOW_TB_PATTERN(i)            (0xe100 + (i << 8))
123ce6e982bSSujith Manoharan #define AR_WOW_TB_MASK(i)               (0xec00 + (i << 5))
124bb631314SSujith Manoharan #define AR_WOW_PATTERN_SUPPORTED_LEGACY 0xff
125bb631314SSujith Manoharan #define AR_WOW_PATTERN_SUPPORTED        0xffff
126ce6e982bSSujith Manoharan #define AR_WOW_LENGTH_MAX               0xff
127ce6e982bSSujith Manoharan #define AR_WOW_LEN1_SHIFT(_i)           ((0x3 - ((_i) & 0x3)) << 0x3)
128ce6e982bSSujith Manoharan #define AR_WOW_LENGTH1_MASK(_i)         (AR_WOW_LENGTH_MAX << AR_WOW_LEN1_SHIFT(_i))
129ce6e982bSSujith Manoharan #define AR_WOW_LEN2_SHIFT(_i)           ((0x7 - ((_i) & 0x7)) << 0x3)
130ce6e982bSSujith Manoharan #define AR_WOW_LENGTH2_MASK(_i)         (AR_WOW_LENGTH_MAX << AR_WOW_LEN2_SHIFT(_i))
131a28815dbSSujith Manoharan #define AR_WOW_LEN3_SHIFT(_i)           ((0xb - ((_i) & 0xb)) << 0x3)
132a28815dbSSujith Manoharan #define AR_WOW_LENGTH3_MASK(_i)         (AR_WOW_LENGTH_MAX << AR_WOW_LEN3_SHIFT(_i))
133a28815dbSSujith Manoharan #define AR_WOW_LEN4_SHIFT(_i)           ((0xf - ((_i) & 0xf)) << 0x3)
134a28815dbSSujith Manoharan #define AR_WOW_LENGTH4_MASK(_i)         (AR_WOW_LENGTH_MAX << AR_WOW_LEN4_SHIFT(_i))
135ce6e982bSSujith Manoharan 
136ce6e982bSSujith Manoharan #endif /* REG_WOW_H */
137