ath9k: Add definitions and structures to support WoW
authorMohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Tue, 10 Jul 2012 09:24:34 +0000 (14:54 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 12 Jul 2012 19:27:15 +0000 (15:27 -0400)
*add structures, macros and variables for WoW, so that the driver
can make use of it.
*maintain a list for user enabled patterns and masks
*track pattern slots for the hardware limitation on the
maximum number of patterns that can be stored.
*track interrupts enabled before WoW suspend, so
that can be reconfigured after resume
*have macros to parse user defined wow configurations to
hardware code

Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Cc: vadivel@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/hw.h

index 79840d6..f9c88dc 100644 (file)
@@ -510,6 +510,12 @@ static inline void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc)
 }
 #endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */
 
+struct ath9k_wow_pattern {
+       u8 pattern_bytes[MAX_PATTERN_SIZE];
+       u8 mask_bytes[MAX_PATTERN_SIZE];
+       u32 pattern_len;
+};
+
 /********************/
 /*   LED Control    */
 /********************/
@@ -711,6 +717,12 @@ struct ath_softc {
        struct ath_ant_comb ant_comb;
        u8 ant_tx, ant_rx;
        struct dfs_pattern_detector *dfs_detector;
+
+#ifdef CONFIG_PM_SLEEP
+       atomic_t wow_got_bmiss_intr;
+       atomic_t wow_sleep_proc_intr; /* in the middle of WoW sleep ? */
+       u32 wow_intr_before_sleep;
+#endif
 };
 
 void ath9k_tasklet(unsigned long data);
index 26da173..912f340 100644 (file)
 #define PAPRD_TABLE_SZ                 24
 #define PAPRD_IDEAL_AGC2_PWR_RANGE     0xe0
 
+/*
+ * Wake on Wireless
+ */
+
+/* Keep Alive Frame */
+#define KAL_FRAME_LEN          28
+#define KAL_FRAME_TYPE         0x2     /* data frame */
+#define KAL_FRAME_SUB_TYPE     0x4     /* null data frame */
+#define KAL_DURATION_ID                0x3d
+#define KAL_NUM_DATA_WORDS     6
+#define KAL_NUM_DESC_WORDS     12
+#define KAL_ANTENNA_MODE       1
+#define KAL_TO_DS              1
+#define KAL_DELAY              4       /*delay of 4ms between 2 KAL frames */
+#define KAL_TIMEOUT            900
+
+#define MAX_PATTERN_SIZE               256
+#define MAX_PATTERN_MASK_SIZE          32
+#define MAX_NUM_PATTERN                        8
+#define MAX_NUM_USER_PATTERN           6 /*  deducting the disassociate and
+                                             deauthenticate packets */
+
+/*
+ * WoW trigger mapping to hardware code
+ */
+
+#define AH_WOW_USER_PATTERN_EN         BIT(0)
+#define AH_WOW_MAGIC_PATTERN_EN                BIT(1)
+#define AH_WOW_LINK_CHANGE             BIT(2)
+#define AH_WOW_BEACON_MISS             BIT(3)
+
 enum ath_hw_txq_subtype {
        ATH_TXQ_AC_BE = 0,
        ATH_TXQ_AC_BK = 1,
@@ -863,6 +894,9 @@ struct ath_hw {
        /* Enterprise mode cap */
        u32 ent_mode;
 
+#ifdef CONFIG_PM_SLEEP
+       u32 wow_event_mask;
+#endif
        bool is_clk_25mhz;
        int (*get_mac_revision)(void);
        int (*external_reset)(void);