mt76: mt7915: fix unexpected firmware mode
authorChih-Min Chen <chih-min.chen@mediatek.com>
Fri, 4 Sep 2020 05:51:02 +0000 (13:51 +0800)
committerFelix Fietkau <nbd@nbd.name>
Thu, 24 Sep 2020 16:10:17 +0000 (18:10 +0200)
Avoid firmware falling into spectrum mode since that will set
unexpected PSE/PLE thresholds which lead to Tx hang.

This mode should be cleaned before firmware download stage.

Signed-off-by: Chih-Min Chen <chih-min.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7915/init.c
drivers/net/wireless/mediatek/mt76/mt7915/regs.h

index 8431fda391083daf5aaf14c60ff2f5d88de59bb5..317ed0e93191cc5679a7f8bbb3ee4ed21f1bd147 100644 (file)
@@ -135,6 +135,12 @@ static int mt7915_init_hardware(struct mt7915_dev *dev)
 
        set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
 
+       /*
+        * force firmware operation mode into normal state,
+        * which should be set before firmware download stage.
+        */
+       mt76_wr(dev, MT_SWDEF_MODE, MT_SWDEF_NORMAL_MODE);
+
        ret = mt7915_mcu_init(dev);
        if (ret)
                return ret;
index 4b97b47c6b3105336890f5885f74854d5d26413f..64327153b7fafad47c54e73612ebf694c23e13a8 100644 (file)
 #define MT_HIF_REMAP_L2_BASE           GENMASK(31, 12)
 #define MT_HIF_REMAP_BASE_L2           0x00000
 
+#define MT_SWDEF_BASE                  0x41f200
+#define MT_SWDEF(ofs)                  (MT_SWDEF_BASE + (ofs))
+#define MT_SWDEF_MODE                  MT_SWDEF(0x3c)
+#define MT_SWDEF_NORMAL_MODE           0
+#define MT_SWDEF_ICAP_MODE             1
+#define MT_SWDEF_SPECTRUM_MODE         2
+
 #define MT_TOP_BASE                    0x18060000
 #define MT_TOP(ofs)                    (MT_TOP_BASE + (ofs))