Merge "ipq807x: Dont use PCIe for CPE boards(HK01.c5)"
diff --git a/board/qca/arm/common/crashdump.c b/board/qca/arm/common/crashdump.c
index 50a7538..403a5d3 100644
--- a/board/qca/arm/common/crashdump.c
+++ b/board/qca/arm/common/crashdump.c
@@ -62,7 +62,9 @@
 	QCA_WDT_LOG_DUMP_TYPE_LEVEL1_PT,
 	/* Module structures are in highmem zone*/
 	QCA_WDT_LOG_DUMP_TYPE_WLAN_MOD,
+	QCA_WDT_LOG_DUMP_TYPE_WLAN_MOD_DEBUGFS,
 	QCA_WDT_LOG_DUMP_TYPE_WLAN_MOD_INFO,
+	QCA_WDT_LOG_DUMP_TYPE_WLAN_MMU_INFO,
 	QCA_WDT_LOG_DUMP_TYPE_EMPTY,
 };
 /* This will be used for parsing the TLV data */
@@ -356,21 +358,31 @@
 		ret_val = qca_wdt_scm_extract_tlv_info(scm_tlv_msg,
 			&cur_type, &cur_size);
 
-		/* Each Dump segment is represented by a TLV tuple comprising of
-		three TLVs representing the type,size and physical addresses of
-		the data segments and corresponding PMD and PTE entries.
-		QCA_WDT_LOG_DUMP_TYPE_EMPTY type indicates that the TLV tuple has
+		/* Each Dump segment is represented by a TLV representing
+		the type,size and physical addresses of	the dump segments.
+		QCA_WDT_LOG_DUMP_TYPE_EMPTY type indicates that the TLV has
 		been invalidated. When type QCA_WDT_LOG_DUMP_TYPE_EMPTY is encountered,
-		we skip over the TLV touple by moving the current massage buffer pointer
-		ahead by three TLVs */
+		we skip over the TLV by moving the current message buffer pointer
+		ahead by one TLV */
 
 		if(cur_type == QCA_WDT_LOG_DUMP_TYPE_EMPTY) {
 			tlv_size = (cur_size + QCA_WDT_SCM_TLV_TYPE_LEN_SIZE);
-			scm_tlv_msg->cur_msg_buffer_pos += (3 * tlv_size);
+			scm_tlv_msg->cur_msg_buffer_pos += tlv_size;
 		}
 
+		/* While iterating over the crashdump buffer, if MetaData file
+		* TLV types are found (QCA_WDT_LOG_DUMP_TYPE_WLAN_MOD_INFO or
+		* QCA_WDT_LOG_DUMP_TYPE_WLAN_MMU_INFO), we dump the segment with
+		* name "MOD_INFO.txt"/"MMU_INFO.txt". If DEBUFGS TLV type is found
+		* we prefix the Dump binary with “DEBUGFS_” which is useful in
+		* post processing step. If we encounter a QCA_WDT_LOG_DUMP_TYPE_WLAN_MOD
+		* TLV type, we dump the binary with name equal to the physical address
+		* of the binary.
+		*/
 		if (!ret_val && ( cur_type == QCA_WDT_LOG_DUMP_TYPE_WLAN_MOD ||
-						cur_type == QCA_WDT_LOG_DUMP_TYPE_WLAN_MOD_INFO )) {
+						cur_type == QCA_WDT_LOG_DUMP_TYPE_WLAN_MOD_INFO ||
+						cur_type == QCA_WDT_LOG_DUMP_TYPE_WLAN_MMU_INFO ||
+						cur_type == QCA_WDT_LOG_DUMP_TYPE_WLAN_MOD_DEBUGFS )) {
 			ret_val = qca_wdt_scm_extract_tlv_data(scm_tlv_msg,
 				(unsigned char *)&tlv_info,cur_size);
 			memaddr = tlv_info.start;
@@ -379,6 +391,14 @@
 				snprintf(wlan_segment_name,	sizeof(wlan_segment_name),
 							 "MOD_INFO.txt");
 				wlan_tlv_size = *(uint32_t *)(uintptr_t)tlv_info.size;
+			} else if (cur_type == QCA_WDT_LOG_DUMP_TYPE_WLAN_MMU_INFO) {
+				snprintf(wlan_segment_name, sizeof(wlan_segment_name),
+							"MMU_INFO.txt");
+				wlan_tlv_size = *(uint32_t *)(uintptr_t)tlv_info.size;
+			} else if (cur_type == QCA_WDT_LOG_DUMP_TYPE_WLAN_MOD_DEBUGFS) {
+				snprintf(wlan_segment_name, sizeof(wlan_segment_name),
+					"DEBUGFS_%lx.BIN",(long unsigned int)memaddr);
+				wlan_tlv_size = tlv_info.size;
 			} else {
 				snprintf(wlan_segment_name,
 						 sizeof(wlan_segment_name), "%lx.BIN",(long unsigned int)memaddr);
diff --git a/board/qca/arm/ipq807x/ipq807x.c b/board/qca/arm/ipq807x/ipq807x.c
index 03fa539..013d741 100644
--- a/board/qca/arm/ipq807x/ipq807x.c
+++ b/board/qca/arm/ipq807x/ipq807x.c
@@ -1647,8 +1647,8 @@
 	uint32_t noc_err_pending = 0;
 	noc_err_pending = readl(NOC_ERR_STATUS_REG);
 
-	printf("NOC Error detected, restarting");
 	if ((noc_err_pending & REG_VAL_NOC_ERR) == REG_VAL_NOC_ERR) {
+		printf("NOC Error detected, restarting");
 		writel(REG_VAL_NOC_ERR, NOC_ERR_CLR_REG);
 		run_command("reset", 0);
 	}