ath9k_hw: remove ar9287 v1.3+ specific hardcoded register hacks
[pandora-kernel.git] / drivers / net / wireless / ath / ath9k / wmi.h
index 4208427..fde6da6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010 Atheros Communications Inc.
+ * Copyright (c) 2010-2011 Atheros Communications Inc.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -17,7 +17,6 @@
 #ifndef WMI_H
 #define WMI_H
 
-
 struct wmi_event_txrate {
        __be32 txrate;
        struct {
@@ -31,18 +30,65 @@ struct wmi_cmd_hdr {
        __be16 seq_no;
 } __packed;
 
+struct wmi_fw_version {
+       __be16 major;
+       __be16 minor;
+
+} __packed;
+
+struct wmi_event_swba {
+       __be64 tsf;
+       u8 beacon_pending;
+};
+
+/*
+ * 64 - HTC header - WMI header - 1 / txstatus
+ * And some other hdr. space is also accounted for.
+ * 12 seems to be the magic number.
+ */
+#define HTC_MAX_TX_STATUS 12
+
+#define ATH9K_HTC_TXSTAT_ACK        BIT(0)
+#define ATH9K_HTC_TXSTAT_FILT       BIT(1)
+#define ATH9K_HTC_TXSTAT_RTC_CTS    BIT(2)
+#define ATH9K_HTC_TXSTAT_MCS        BIT(3)
+#define ATH9K_HTC_TXSTAT_CW40       BIT(4)
+#define ATH9K_HTC_TXSTAT_SGI        BIT(5)
+
+/*
+ * Legacy rates are indicated as indices.
+ * HT rates are indicated as dot11 numbers.
+ * This allows us to resrict the rate field
+ * to 4 bits.
+ */
+#define ATH9K_HTC_TXSTAT_RATE       0x0f
+#define ATH9K_HTC_TXSTAT_RATE_S     0
+
+#define ATH9K_HTC_TXSTAT_EPID       0xf0
+#define ATH9K_HTC_TXSTAT_EPID_S     4
+
+struct __wmi_event_txstatus {
+       u8 cookie;
+       u8 ts_rate; /* Also holds EP ID */
+       u8 ts_flags;
+};
+
+struct wmi_event_txstatus {
+       u8 cnt;
+       struct __wmi_event_txstatus txstatus[HTC_MAX_TX_STATUS];
+} __packed;
+
 enum wmi_cmd_id {
        WMI_ECHO_CMDID = 0x0001,
        WMI_ACCESS_MEMORY_CMDID,
 
        /* Commands to Target */
+       WMI_GET_FW_VERSION,
        WMI_DISABLE_INTR_CMDID,
        WMI_ENABLE_INTR_CMDID,
-       WMI_RX_LINK_CMDID,
        WMI_ATH_INIT_CMDID,
        WMI_ABORT_TXQ_CMDID,
        WMI_STOP_TX_DMA_CMDID,
-       WMI_STOP_DMA_RECV_CMDID,
        WMI_ABORT_TX_DMA_CMDID,
        WMI_DRAIN_TXQ_CMDID,
        WMI_DRAIN_TXQ_ALL_CMDID,
@@ -50,24 +96,22 @@ enum wmi_cmd_id {
        WMI_STOP_RECV_CMDID,
        WMI_FLUSH_RECV_CMDID,
        WMI_SET_MODE_CMDID,
-       WMI_RESET_CMDID,
        WMI_NODE_CREATE_CMDID,
        WMI_NODE_REMOVE_CMDID,
        WMI_VAP_REMOVE_CMDID,
        WMI_VAP_CREATE_CMDID,
-       WMI_BEACON_UPDATE_CMDID,
        WMI_REG_READ_CMDID,
        WMI_REG_WRITE_CMDID,
        WMI_RC_STATE_CHANGE_CMDID,
        WMI_RC_RATE_UPDATE_CMDID,
-       WMI_DEBUG_INFO_CMDID,
-       WMI_HOST_ATTACH,
        WMI_TARGET_IC_UPDATE_CMDID,
-       WMI_TGT_STATS_CMDID,
        WMI_TX_AGGR_ENABLE_CMDID,
        WMI_TGT_DETACH_CMDID,
-       WMI_TGT_TXQ_ENABLE_CMDID,
-       WMI_AGGR_LIMIT_CMD = 0x0026,
+       WMI_NODE_UPDATE_CMDID,
+       WMI_INT_STATS_CMDID,
+       WMI_TX_STATS_CMDID,
+       WMI_RX_STATS_CMDID,
+       WMI_BITRATE_MASK_CMDID,
 };
 
 enum wmi_event_id {
@@ -76,9 +120,8 @@ enum wmi_event_id {
        WMI_FATAL_EVENTID,
        WMI_TXTO_EVENTID,
        WMI_BMISS_EVENTID,
-       WMI_WLAN_TXCOMP_EVENTID,
        WMI_DELBA_EVENTID,
-       WMI_TXRATE_EVENTID,
+       WMI_TXSTATUS_EVENTID,
 };
 
 #define MAX_CMD_NUMBER 62
@@ -88,6 +131,12 @@ struct register_write {
        __be32 val;
 };
 
+struct ath9k_htc_tx_event {
+       int count;
+       struct __wmi_event_txstatus txs;
+       struct list_head list;
+};
+
 struct wmi {
        struct ath9k_htc_priv *drv_priv;
        struct htc_target *htc;
@@ -95,12 +144,16 @@ struct wmi {
        struct mutex op_mutex;
        struct completion cmd_wait;
        enum wmi_cmd_id last_cmd_id;
+       struct sk_buff_head wmi_event_queue;
+       struct tasklet_struct wmi_event_tasklet;
        u16 tx_seq_id;
        u8 *cmd_rsp_buf;
        u32 cmd_rsp_len;
        bool stopped;
 
-       u8 beacon_pending;
+       struct list_head pending_tx_events;
+       spinlock_t event_lock;
+
        spinlock_t wmi_lock;
 
        atomic_t mwrite_cnt;
@@ -117,8 +170,9 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
                  u8 *cmd_buf, u32 cmd_len,
                  u8 *rsp_buf, u32 rsp_len,
                  u32 timeout);
-void ath9k_swba_tasklet(unsigned long data);
+void ath9k_wmi_event_tasklet(unsigned long data);
 void ath9k_fatal_work(struct work_struct *work);
+void ath9k_wmi_event_drain(struct ath9k_htc_priv *priv);
 
 #define WMI_CMD(_wmi_cmd)                                              \
        do {                                                            \