Index: backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/ahb.c
===================================================================
--- backports-20161201-3.14.77-9ab3068.orig/drivers/net/wireless/ath/ath10k/ahb.c	2017-03-23 22:14:00.310204315 +0530
+++ backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/ahb.c	2017-03-23 22:14:00.302204377 +0530
@@ -714,6 +714,7 @@
 	.power_down             = ath10k_pci_hif_power_down,
 	.read32                 = ath10k_ahb_read32,
 	.write32                = ath10k_ahb_write32,
+	.dump_registers		= ath10k_pci_hif_dump_registers,
 };
 
 static const struct ath10k_bus_ops ath10k_ahb_bus_ops = {
Index: backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/hif.h
===================================================================
--- backports-20161201-3.14.77-9ab3068.orig/drivers/net/wireless/ath/ath10k/hif.h	2017-03-23 22:14:00.310204315 +0530
+++ backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/hif.h	2017-03-23 22:14:00.302204377 +0530
@@ -91,6 +91,9 @@
 	/* fetch calibration data from target eeprom */
 	int (*fetch_cal_eeprom)(struct ath10k *ar, void **data,
 				size_t *data_len);
+
+	/* PCI and CE register dump */
+	void (*dump_registers)(struct ath10k *ar);
 };
 
 static inline int ath10k_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
@@ -216,4 +219,13 @@
 	return ar->hif.ops->fetch_cal_eeprom(ar, data, data_len);
 }
 
+static inline void ath10k_hif_dump_registers(struct ath10k *ar)
+{
+	if (!ar->hif.ops->dump_registers)
+		return;
+
+	ar->hif.ops->dump_registers(ar);
+}
+
+
 #endif /* _HIF_H_ */
Index: backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/pci.c
===================================================================
--- backports-20161201-3.14.77-9ab3068.orig/drivers/net/wireless/ath/ath10k/pci.c	2017-03-23 22:14:00.310204315 +0530
+++ backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/pci.c	2017-03-23 22:14:00.302204377 +0530
@@ -1489,6 +1489,16 @@
 	queue_work(ar->workqueue, &ar->restart_work);
 }
 
+void ath10k_pci_hif_dump_registers(struct ath10k *ar)
+{
+	spin_lock_bh(&ar->data_lock);
+	ath10k_print_driver_info(ar);
+	ath10k_err(ar, "Dumping PCI and CE registers\n");
+	ath10k_pci_dump_registers(ar, NULL);
+	spin_unlock_bh(&ar->data_lock);
+	ath10k_ce_dump_registers(ar);
+}
+
 void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
 					int force)
 {
@@ -2752,6 +2762,7 @@
 	.resume			= ath10k_pci_hif_resume,
 #endif
 	.fetch_cal_eeprom	= ath10k_pci_hif_fetch_cal_eeprom,
+	.dump_registers		= ath10k_pci_hif_dump_registers,
 };
 
 /*
Index: backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/pci.h
===================================================================
--- backports-20161201-3.14.77-9ab3068.orig/drivers/net/wireless/ath/ath10k/pci.h	2017-03-23 22:14:00.310204315 +0530
+++ backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/pci.h	2017-03-23 22:14:00.302204377 +0530
@@ -287,6 +287,7 @@
 					int force);
 u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe);
 void ath10k_pci_hif_power_down(struct ath10k *ar);
+void ath10k_pci_hif_dump_registers(struct ath10k *ar);
 int ath10k_pci_alloc_pipes(struct ath10k *ar);
 void ath10k_pci_free_pipes(struct ath10k *ar);
 void ath10k_pci_free_pipes(struct ath10k *ar);
Index: backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/wmi.c
===================================================================
--- backports-20161201-3.14.77-9ab3068.orig/drivers/net/wireless/ath/ath10k/wmi.c	2017-03-23 22:14:00.310204315 +0530
+++ backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/wmi.c	2017-03-23 22:14:18.318063379 +0530
@@ -29,6 +29,7 @@
 #include "p2p.h"
 #include "hw.h"
 #include "fwlog.h"
+#include "hif.h"
 
 #define ATH10K_WMI_BARRIER_ECHO_ID 0xBA991E9
 #define ATH10K_WMI_BARRIER_TIMEOUT_HZ (3 * HZ)
@@ -1845,8 +1846,10 @@
 		(ret != -EAGAIN);
 	}), 3 * HZ);
 
-	if (ret)
+	if (ret) {
 		dev_kfree_skb_any(skb);
+		ath10k_hif_dump_registers(ar);
+	}
 
 	return ret;
 }
