Skip to contentSkip to conversation

mt76: mt7915: add module paramater to enable firmware debug

PATCH New [email protected] 1 participant 1 message Oct 11, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mt76: mt7915: add module paramater to enable firmware debug

From: Ben Greear <[email protected]>

This helps to enable logging during startup.

---
 .../wireless/mediatek/mt76/mt7915/debugfs.c   |  8 +-------
 .../net/wireless/mediatek/mt76/mt7915/mcu.c   | 19 ++++++++++++++++++-
 .../net/wireless/mediatek/mt76/mt7915/mcu.h   |  8 ++++++++
 3 files changed, 27 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +1 -7
index be1a0cf25587..7a12bf46c877 100644
@@ -78,13 +78,7 @@ static int
 mt7915_fw_debug_set(void *data, u64 val)
 {
 	struct mt7915_dev *dev = data;
-	enum {
-		DEBUG_TXCMD = 62,
-		DEBUG_CMD_RPT_TX,
-		DEBUG_CMD_RPT_TRIG,
-		DEBUG_SPL,
-		DEBUG_RPT_RX,
-	} debug;
+	enum mt_debug debug;
 
 	dev->fw_debug = !!val;
 
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +18 -1
index e97cdeae785f..a16347af788e 100644
@@ -8,6 +8,11 @@
 #include "mac.h"
 #include "eeprom.h"
 
+static int fw_debug = 0;
+module_param(fw_debug, int, 0644);
+MODULE_PARM_DESC(fw_debug,
+		 "Set to 1 to enable FW debugging on startup.");
+
 struct mt7915_patch_hdr {
 	char build_date[16];
 	char platform[4];
@@ -3016,7 +3021,19 @@ int mt7915_mcu_init(struct mt7915_dev *dev)
 		return ret;
 
 	set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
-	mt7915_mcu_fw_log_2_host(dev, 0);
+	if (fw_debug) {
+		enum mt_debug debug;
+
+		/* enable debugging on bootup */
+		dev->fw_debug = 1;
+		mt7915_mcu_fw_log_2_host(dev, 2);
+		for (debug = DEBUG_TXCMD; debug <= DEBUG_RPT_RX; debug++)
+			mt7915_mcu_fw_dbg_ctrl(dev, debug, dev->fw_debug);
+	}
+	else {
+		mt7915_mcu_fw_log_2_host(dev, 0);
+	}
+
 	mt7915_mcu_set_mwds(dev, 1);
 	mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET), MCU_WA_PARAM_RED, 0, 0);
 
drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +8 -0
index d05be18d9288..d0d0b3ee4105 100644
@@ -1098,6 +1098,14 @@ enum {
 	MT_BF_MODULE_UPDATE = 25
 };
 
+enum mt_debug {
+	DEBUG_TXCMD = 62,
+	DEBUG_CMD_RPT_TX,
+	DEBUG_CMD_RPT_TRIG,
+	DEBUG_SPL,
+	DEBUG_RPT_RX,
+};
+
 #define MT7915_WTBL_UPDATE_MAX_SIZE	(sizeof(struct wtbl_req_hdr) +	\
 					 sizeof(struct wtbl_generic) +	\
 					 sizeof(struct wtbl_rx) +	\
Signature · 1 line
2.20.1