18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2015 Qualcomm Atheros Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef REG_WOW_H
188c2ecf20Sopenharmony_ci#define REG_WOW_H
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define AR_WOW_PATTERN                  0x825C
218c2ecf20Sopenharmony_ci#define AR_WOW_COUNT                    0x8260
228c2ecf20Sopenharmony_ci#define AR_WOW_BCN_EN                   0x8270
238c2ecf20Sopenharmony_ci#define AR_WOW_BCN_TIMO                 0x8274
248c2ecf20Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_TIMO          0x8278
258c2ecf20Sopenharmony_ci#define AR_WOW_KEEP_ALIVE               0x827c
268c2ecf20Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_DELAY         0x8288
278c2ecf20Sopenharmony_ci#define AR_WOW_PATTERN_MATCH            0x828c
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/*
308c2ecf20Sopenharmony_ci * AR_WOW_LENGTH1
318c2ecf20Sopenharmony_ci * bit 31:24 pattern 0 length
328c2ecf20Sopenharmony_ci * bit 23:16 pattern 1 length
338c2ecf20Sopenharmony_ci * bit 15:8 pattern 2 length
348c2ecf20Sopenharmony_ci * bit 7:0 pattern 3 length
358c2ecf20Sopenharmony_ci *
368c2ecf20Sopenharmony_ci * AR_WOW_LENGTH2
378c2ecf20Sopenharmony_ci * bit 31:24 pattern 4 length
388c2ecf20Sopenharmony_ci * bit 23:16 pattern 5 length
398c2ecf20Sopenharmony_ci * bit 15:8 pattern 6 length
408c2ecf20Sopenharmony_ci * bit 7:0 pattern 7 length
418c2ecf20Sopenharmony_ci *
428c2ecf20Sopenharmony_ci * AR_WOW_LENGTH3
438c2ecf20Sopenharmony_ci * bit 31:24 pattern 8 length
448c2ecf20Sopenharmony_ci * bit 23:16 pattern 9 length
458c2ecf20Sopenharmony_ci * bit 15:8 pattern 10 length
468c2ecf20Sopenharmony_ci * bit 7:0 pattern 11 length
478c2ecf20Sopenharmony_ci *
488c2ecf20Sopenharmony_ci * AR_WOW_LENGTH4
498c2ecf20Sopenharmony_ci * bit 31:24 pattern 12 length
508c2ecf20Sopenharmony_ci * bit 23:16 pattern 13 length
518c2ecf20Sopenharmony_ci * bit 15:8 pattern 14 length
528c2ecf20Sopenharmony_ci * bit 7:0 pattern 15 length
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_ci#define AR_WOW_LENGTH1                  0x8360
558c2ecf20Sopenharmony_ci#define AR_WOW_LENGTH2                  0X8364
568c2ecf20Sopenharmony_ci#define AR_WOW_LENGTH3                  0X8380
578c2ecf20Sopenharmony_ci#define AR_WOW_LENGTH4                  0X8384
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define AR_WOW_PATTERN_MATCH_LT_256B    0x8368
608c2ecf20Sopenharmony_ci#define AR_MAC_PCU_WOW4                 0x8370
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#define AR_SW_WOW_CONTROL               0x20018
638c2ecf20Sopenharmony_ci#define AR_SW_WOW_ENABLE                0x1
648c2ecf20Sopenharmony_ci#define AR_SWITCH_TO_REFCLK             0x2
658c2ecf20Sopenharmony_ci#define AR_RESET_CONTROL                0x4
668c2ecf20Sopenharmony_ci#define AR_RESET_VALUE_MASK             0x8
678c2ecf20Sopenharmony_ci#define AR_HW_WOW_DISABLE               0x10
688c2ecf20Sopenharmony_ci#define AR_CLR_MAC_INTERRUPT            0x20
698c2ecf20Sopenharmony_ci#define AR_CLR_KA_INTERRUPT             0x40
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define AR_WOW_BACK_OFF_SHIFT(x)        ((x & 0xf) << 27) /* in usecs */
728c2ecf20Sopenharmony_ci#define AR_WOW_MAC_INTR_EN              0x00040000
738c2ecf20Sopenharmony_ci#define AR_WOW_MAGIC_EN                 0x00010000
748c2ecf20Sopenharmony_ci#define AR_WOW_PATTERN_EN(x)            (x & 0xff)
758c2ecf20Sopenharmony_ci#define AR_WOW_PAT_FOUND_SHIFT          8
768c2ecf20Sopenharmony_ci#define AR_WOW_PATTERN_FOUND(x)         (x & (0xff << AR_WOW_PAT_FOUND_SHIFT))
778c2ecf20Sopenharmony_ci#define AR_WOW_PATTERN_FOUND_MASK       ((0xff) << AR_WOW_PAT_FOUND_SHIFT)
788c2ecf20Sopenharmony_ci#define AR_WOW_MAGIC_PAT_FOUND          0x00020000
798c2ecf20Sopenharmony_ci#define AR_WOW_MAC_INTR                 0x00080000
808c2ecf20Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_FAIL          0x00100000
818c2ecf20Sopenharmony_ci#define AR_WOW_BEACON_FAIL              0x00200000
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#define AR_WOW_STATUS(x)                (x & (AR_WOW_PATTERN_FOUND_MASK | \
848c2ecf20Sopenharmony_ci                                              AR_WOW_MAGIC_PAT_FOUND    | \
858c2ecf20Sopenharmony_ci                                              AR_WOW_KEEP_ALIVE_FAIL    | \
868c2ecf20Sopenharmony_ci                                              AR_WOW_BEACON_FAIL))
878c2ecf20Sopenharmony_ci#define AR_WOW_CLEAR_EVENTS(x)          (x & ~(AR_WOW_PATTERN_EN(0xff) | \
888c2ecf20Sopenharmony_ci                                               AR_WOW_MAGIC_EN |	\
898c2ecf20Sopenharmony_ci                                               AR_WOW_MAC_INTR_EN |	\
908c2ecf20Sopenharmony_ci                                               AR_WOW_BEACON_FAIL |	\
918c2ecf20Sopenharmony_ci                                               AR_WOW_KEEP_ALIVE_FAIL))
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define AR_WOW2_PATTERN_EN(x)           ((x & 0xff) << 0)
948c2ecf20Sopenharmony_ci#define AR_WOW2_PATTERN_FOUND_SHIFT     8
958c2ecf20Sopenharmony_ci#define AR_WOW2_PATTERN_FOUND(x)        (x & (0xff << AR_WOW2_PATTERN_FOUND_SHIFT))
968c2ecf20Sopenharmony_ci#define AR_WOW2_PATTERN_FOUND_MASK      ((0xff) << AR_WOW2_PATTERN_FOUND_SHIFT)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define AR_WOW_STATUS2(x)               (x & AR_WOW2_PATTERN_FOUND_MASK)
998c2ecf20Sopenharmony_ci#define AR_WOW_CLEAR_EVENTS2(x)         (x & ~(AR_WOW2_PATTERN_EN(0xff)))
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci#define AR_WOW_AIFS_CNT(x)              (x & 0xff)
1028c2ecf20Sopenharmony_ci#define AR_WOW_SLOT_CNT(x)              ((x & 0xff) << 8)
1038c2ecf20Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_CNT(x)        ((x & 0xff) << 16)
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define AR_WOW_BEACON_FAIL_EN           0x00000001
1068c2ecf20Sopenharmony_ci#define AR_WOW_BEACON_TIMO              0x40000000
1078c2ecf20Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_NEVER         0xffffffff
1088c2ecf20Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_AUTO_DIS      0x00000001
1098c2ecf20Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_FAIL_DIS      0x00000002
1108c2ecf20Sopenharmony_ci#define AR_WOW_KEEP_ALIVE_DELAY_VALUE   0x000003e8 /* 1 msec */
1118c2ecf20Sopenharmony_ci#define AR_WOW_BMISSTHRESHOLD           0x20
1128c2ecf20Sopenharmony_ci#define AR_WOW_PAT_END_OF_PKT(x)        (x & 0xf)
1138c2ecf20Sopenharmony_ci#define AR_WOW_PAT_OFF_MATCH(x)         ((x & 0xf) << 8)
1148c2ecf20Sopenharmony_ci#define AR_WOW_PAT_BACKOFF              0x00000004
1158c2ecf20Sopenharmony_ci#define AR_WOW_CNT_AIFS_CNT             0x00000022
1168c2ecf20Sopenharmony_ci#define AR_WOW_CNT_SLOT_CNT             0x00000009
1178c2ecf20Sopenharmony_ci#define AR_WOW_CNT_KA_CNT               0x00000008
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define AR_WOW_TRANSMIT_BUFFER          0xe000
1208c2ecf20Sopenharmony_ci#define AR_WOW_TXBUF(i)                 (AR_WOW_TRANSMIT_BUFFER + ((i) << 2))
1218c2ecf20Sopenharmony_ci#define AR_WOW_KA_DESC_WORD2            0xe000
1228c2ecf20Sopenharmony_ci#define AR_WOW_TB_PATTERN(i)            (0xe100 + (i << 8))
1238c2ecf20Sopenharmony_ci#define AR_WOW_TB_MASK(i)               (0xec00 + (i << 5))
1248c2ecf20Sopenharmony_ci#define AR_WOW_PATTERN_SUPPORTED_LEGACY 0xff
1258c2ecf20Sopenharmony_ci#define AR_WOW_PATTERN_SUPPORTED        0xffff
1268c2ecf20Sopenharmony_ci#define AR_WOW_LENGTH_MAX               0xff
1278c2ecf20Sopenharmony_ci#define AR_WOW_LEN1_SHIFT(_i)           ((0x3 - ((_i) & 0x3)) << 0x3)
1288c2ecf20Sopenharmony_ci#define AR_WOW_LENGTH1_MASK(_i)         (AR_WOW_LENGTH_MAX << AR_WOW_LEN1_SHIFT(_i))
1298c2ecf20Sopenharmony_ci#define AR_WOW_LEN2_SHIFT(_i)           ((0x7 - ((_i) & 0x7)) << 0x3)
1308c2ecf20Sopenharmony_ci#define AR_WOW_LENGTH2_MASK(_i)         (AR_WOW_LENGTH_MAX << AR_WOW_LEN2_SHIFT(_i))
1318c2ecf20Sopenharmony_ci#define AR_WOW_LEN3_SHIFT(_i)           ((0xb - ((_i) & 0xb)) << 0x3)
1328c2ecf20Sopenharmony_ci#define AR_WOW_LENGTH3_MASK(_i)         (AR_WOW_LENGTH_MAX << AR_WOW_LEN3_SHIFT(_i))
1338c2ecf20Sopenharmony_ci#define AR_WOW_LEN4_SHIFT(_i)           ((0xf - ((_i) & 0xf)) << 0x3)
1348c2ecf20Sopenharmony_ci#define AR_WOW_LENGTH4_MASK(_i)         (AR_WOW_LENGTH_MAX << AR_WOW_LEN4_SHIFT(_i))
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci#endif /* REG_WOW_H */
137