Search Linux Wireless

[PATCH] mt76: mt7915: add module paramater to enable firmware debug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ben Greear <greearb@xxxxxxxxxxxxxxx>

This helps to enable logging during startup.

Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
---
 .../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(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
index be1a0cf25587..7a12bf46c877 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
@@ -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;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index e97cdeae785f..a16347af788e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -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);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
index d05be18d9288..d0d0b3ee4105 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
@@ -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) +	\
-- 
2.20.1




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux