Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[cascardo/linux.git] / drivers / net / wireless / ath / ath10k / hif.h
index 30301f5..0c92e02 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/kernel.h>
 #include "core.h"
+#include "debug.h"
 
 struct ath10k_hif_sg_item {
        u16 transfer_id;
@@ -31,11 +32,9 @@ struct ath10k_hif_sg_item {
 
 struct ath10k_hif_cb {
        int (*tx_completion)(struct ath10k *ar,
-                            struct sk_buff *wbuf,
-                            unsigned transfer_id);
+                            struct sk_buff *wbuf);
        int (*rx_completion)(struct ath10k *ar,
-                            struct sk_buff *wbuf,
-                            u8 pipe_id);
+                            struct sk_buff *wbuf);
 };
 
 struct ath10k_hif_ops {
@@ -47,6 +46,8 @@ struct ath10k_hif_ops {
        int (*diag_read)(struct ath10k *ar, u32 address, void *buf,
                         size_t buf_len);
 
+       int (*diag_write)(struct ath10k *ar, u32 address, const void *data,
+                         int nbytes);
        /*
         * API to handle HIF-specific BMI message exchanges, this API is
         * synchronous and only allowed to be called from a context that
@@ -84,6 +85,10 @@ struct ath10k_hif_ops {
 
        u16 (*get_free_queue_number)(struct ath10k *ar, u8 pipe_id);
 
+       u32 (*read32)(struct ath10k *ar, u32 address);
+
+       void (*write32)(struct ath10k *ar, u32 address, u32 value);
+
        /* Power up the device and enter BMI transfer mode for FW download */
        int (*power_up)(struct ath10k *ar);
 
@@ -108,6 +113,15 @@ static inline int ath10k_hif_diag_read(struct ath10k *ar, u32 address, void *buf
        return ar->hif.ops->diag_read(ar, address, buf, buf_len);
 }
 
+static inline int ath10k_hif_diag_write(struct ath10k *ar, u32 address,
+                                       const void *data, int nbytes)
+{
+       if (!ar->hif.ops->diag_write)
+               return -EOPNOTSUPP;
+
+       return ar->hif.ops->diag_write(ar, address, data, nbytes);
+}
+
 static inline int ath10k_hif_exchange_bmi_msg(struct ath10k *ar,
                                              void *request, u32 request_len,
                                              void *response, u32 *response_len)
@@ -187,4 +201,25 @@ static inline int ath10k_hif_resume(struct ath10k *ar)
        return ar->hif.ops->resume(ar);
 }
 
+static inline u32 ath10k_hif_read32(struct ath10k *ar, u32 address)
+{
+       if (!ar->hif.ops->read32) {
+               ath10k_warn(ar, "hif read32 not supported\n");
+               return 0xdeaddead;
+       }
+
+       return ar->hif.ops->read32(ar, address);
+}
+
+static inline void ath10k_hif_write32(struct ath10k *ar,
+                                     u32 address, u32 data)
+{
+       if (!ar->hif.ops->write32) {
+               ath10k_warn(ar, "hif write32 not supported\n");
+               return;
+       }
+
+       ar->hif.ops->write32(ar, address, data);
+}
+
 #endif /* _HIF_H_ */