wil6210: fix usage of print_hex_dump_debug
[cascardo/linux.git] / drivers / net / wireless / ath / wil6210 / wil6210.h
index e25edc5..e51531b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012 Qualcomm Atheros, Inc.
+ * Copyright (c) 2012-2014 Qualcomm Atheros, 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
 #include <linux/netdevice.h>
 #include <linux/wireless.h>
 #include <net/cfg80211.h>
+#include <linux/timex.h>
+#include "wil_platform.h"
+
 
 #define WIL_NAME "wil6210"
+#define WIL_FW_NAME "wil6210.fw"
+
+#define WIL_MAX_BUS_REQUEST_KBPS 800000 /* ~6.1Gbps */
+
+struct wil_board {
+       int board;
+#define WIL_BOARD_MARLON       (1)
+#define WIL_BOARD_SPARROW      (2)
+       const char * const name;
+};
 
 /**
  * extract bits [@b0:@b1] (inclusive) from the value @x
@@ -77,21 +90,30 @@ struct RGF_ICR {
 } __packed;
 
 /* registers - FW addresses */
+#define RGF_USER_USAGE_1               (0x880004)
+#define RGF_USER_USAGE_6               (0x880018)
 #define RGF_USER_HW_MACHINE_STATE      (0x8801dc)
        #define HW_MACHINE_BOOT_DONE    (0x3fffffd)
 #define RGF_USER_USER_CPU_0            (0x8801e0)
+       #define BIT_USER_USER_CPU_MAN_RST       BIT(1) /* user_cpu_man_rst */
 #define RGF_USER_MAC_CPU_0             (0x8801fc)
+       #define BIT_USER_MAC_CPU_MAN_RST        BIT(1) /* mac_cpu_man_rst */
 #define RGF_USER_USER_SCRATCH_PAD      (0x8802bc)
 #define RGF_USER_FW_REV_ID             (0x880a8c) /* chip revision */
 #define RGF_USER_CLKS_CTL_0            (0x880abc)
+       #define BIT_USER_CLKS_CAR_AHB_SW_SEL    BIT(1) /* ref clk/PLL */
        #define BIT_USER_CLKS_RST_PWGD  BIT(11) /* reset on "power good" */
 #define RGF_USER_CLKS_CTL_SW_RST_VEC_0 (0x880b04)
 #define RGF_USER_CLKS_CTL_SW_RST_VEC_1 (0x880b08)
 #define RGF_USER_CLKS_CTL_SW_RST_VEC_2 (0x880b0c)
 #define RGF_USER_CLKS_CTL_SW_RST_VEC_3 (0x880b10)
 #define RGF_USER_CLKS_CTL_SW_RST_MASK_0        (0x880b14)
+       #define BIT_HPAL_PERST_FROM_PAD BIT(6)
+       #define BIT_CAR_PERST_RST       BIT(7)
 #define RGF_USER_USER_ICR              (0x880b4c) /* struct RGF_ICR */
        #define BIT_USER_USER_ICR_SW_INT_2      BIT(18)
+#define RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_0     (0x880c18)
+#define RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_1     (0x880c2c)
 
 #define RGF_DMA_EP_TX_ICR              (0x881bb4) /* struct RGF_ICR */
        #define BIT_DMA_EP_TX_ICR_TX_DONE       BIT(0)
@@ -120,8 +142,14 @@ struct RGF_ICR {
        #define BIT_DMA_PSEUDO_CAUSE_TX         BIT(1)
        #define BIT_DMA_PSEUDO_CAUSE_MISC       BIT(2)
 
+#define RGF_HP_CTRL                    (0x88265c)
 #define RGF_PCIE_LOS_COUNTER_CTL       (0x882dc4)
 
+/* MAC timer, usec, for packet lifetime */
+#define RGF_MAC_MTRL_COUNTER_0         (0x886aa8)
+
+#define RGF_CAF_ICR                    (0x88946c) /* struct RGF_ICR */
+
 /* popular locations */
 #define HOST_MBOX   HOSTADDR(RGF_USER_USER_SCRATCH_PAD)
 #define HOST_SW_INT (HOSTADDR(RGF_USER_USER_ICR) + \
@@ -134,6 +162,15 @@ struct RGF_ICR {
 #define ISR_MISC_FW_ERROR      BIT_DMA_EP_MISC_ICR_FW_INT(3)
 
 /* Hardware definitions end */
+struct fw_map {
+       u32 from; /* linker address - from, inclusive */
+       u32 to;   /* linker address - to, exclusive */
+       u32 host; /* PCI/Host address - BAR0 + 0x880000 */
+       const char *name; /* for debugfs */
+};
+
+/* array size should be in sync with actual definition in the wmi.c */
+extern const struct fw_map fw_mapping[7];
 
 /**
  * mk_cidxtid - construct @cidxtid field
@@ -251,7 +288,7 @@ struct vring {
  */
 struct vring_tx_data {
        int enabled;
-
+       cycles_t idle, last_idle, begin;
 };
 
 enum { /* for wil6210_priv.status */
@@ -303,21 +340,11 @@ struct wil_tid_ampdu_rx {
        u16 ssn;
        u16 buf_size;
        u16 timeout;
+       u16 ssn_last_drop;
        u8 dialog_token;
        bool first_time; /* is it 1-st time this buffer used? */
 };
 
-struct wil6210_stats {
-       u64 tsf;
-       u32 snr;
-       u16 last_mcs_rx;
-       u16 bf_mcs; /* last BF, used for Tx */
-       u16 my_rx_sector;
-       u16 my_tx_sector;
-       u16 peer_rx_sector;
-       u16 peer_tx_sector;
-};
-
 enum wil_sta_status {
        wil_sta_unused = 0,
        wil_sta_conn_pending = 1,
@@ -363,6 +390,7 @@ struct wil6210_priv {
        ulong status;
        u32 fw_version;
        u32 hw_version;
+       struct wil_board *board;
        u8 n_mids; /* number of additional MIDs as reported by FW */
        int recovery_count; /* num of FW recovery attempts in a short time */
        unsigned long last_fw_recovery; /* jiffies of last fw recovery */
@@ -409,15 +437,13 @@ struct wil6210_priv {
 
        struct mutex mutex; /* for wil6210_priv access in wil_{up|down} */
        /* statistics */
-       struct wil6210_stats stats;
+       atomic_t isr_count_rx, isr_count_tx;
        /* debugfs */
        struct dentry *debug;
-       struct debugfs_blob_wrapper fw_code_blob;
-       struct debugfs_blob_wrapper fw_data_blob;
-       struct debugfs_blob_wrapper fw_peri_blob;
-       struct debugfs_blob_wrapper uc_code_blob;
-       struct debugfs_blob_wrapper uc_data_blob;
-       struct debugfs_blob_wrapper rgf_blob;
+       struct debugfs_blob_wrapper blobs[ARRAY_SIZE(fw_mapping)];
+
+       void *platform_handle;
+       struct wil_platform_ops platform_ops;
 };
 
 #define wil_to_wiphy(i) (i->wdev->wiphy)
@@ -427,6 +453,7 @@ struct wil6210_priv {
 #define wdev_to_wil(w) (struct wil6210_priv *)(wdev_priv(w))
 #define wil_to_ndev(i) (wil_to_wdev(i)->netdev)
 #define ndev_to_wil(n) (wdev_to_wil(n->ieee80211_ptr))
+#define wil_to_pcie_dev(i) (&i->pdev->dev)
 
 int wil_dbg_trace(struct wil6210_priv *wil, const char *fmt, ...);
 int wil_err(struct wil6210_priv *wil, const char *fmt, ...);
@@ -441,6 +468,7 @@ int wil_info(struct wil6210_priv *wil, const char *fmt, ...);
 #define wil_dbg_wmi(wil, fmt, arg...) wil_dbg(wil, "DBG[ WMI]" fmt, ##arg)
 #define wil_dbg_misc(wil, fmt, arg...) wil_dbg(wil, "DBG[MISC]" fmt, ##arg)
 
+#if defined(CONFIG_DYNAMIC_DEBUG)
 #define wil_hex_dump_txrx(prefix_str, prefix_type, rowsize,    \
                          groupsize, buf, len, ascii)           \
                          print_hex_dump_debug("DBG[TXRX]" prefix_str,\
@@ -452,6 +480,12 @@ int wil_info(struct wil6210_priv *wil, const char *fmt, ...);
                         print_hex_dump_debug("DBG[ WMI]" prefix_str,\
                                        prefix_type, rowsize,   \
                                        groupsize, buf, len, ascii)
+#else
+#define wil_hex_dump_txrx(prefix_str, prefix_type, rowsize,    \
+                         groupsize, buf, len, ascii)
+#define wil_hex_dump_wmi(prefix_str, prefix_type, rowsize,     \
+                        groupsize, buf, len, ascii)
+#endif
 
 void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src,
                          size_t count);
@@ -504,9 +538,14 @@ int wil6210_init_irq(struct wil6210_priv *wil, int irq);
 void wil6210_fini_irq(struct wil6210_priv *wil, int irq);
 void wil6210_disable_irq(struct wil6210_priv *wil);
 void wil6210_enable_irq(struct wil6210_priv *wil);
+int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
+                        struct cfg80211_mgmt_tx_params *params,
+                        u64 *cookie);
 
 int wil6210_debugfs_init(struct wil6210_priv *wil);
 void wil6210_debugfs_remove(struct wil6210_priv *wil);
+int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
+                      struct station_info *sinfo);
 
 struct wireless_dev *wil_cfg80211_init(struct device *dev);
 void wil_wdev_free(struct wil6210_priv *wil);
@@ -534,4 +573,5 @@ void wil6210_unmask_irq_rx(struct wil6210_priv *wil);
 
 int wil_iftype_nl2wmi(enum nl80211_iftype type);
 
+int wil_request_firmware(struct wil6210_priv *wil, const char *name);
 #endif /* __WIL6210_H__ */