diff mbox series

wifi: mt76: mt7915: add dev->hif2 support for mt7916 WED device

Message ID 5dcd2b1b74b7c46ba4245f96eaf3a4e2f84b37e7.1677039727.git.ryder.lee@mediatek.com (mailing list archive)
State New, archived
Headers show
Series wifi: mt76: mt7915: add dev->hif2 support for mt7916 WED device | expand

Commit Message

Sujuan Chen Feb. 22, 2023, 6:29 a.m. UTC
Enable two PCIe interfaces (dev->hif2) support for mt7916 when WED is enabled.

Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7915/dma.c  | 10 ++++++++--
 drivers/net/wireless/mediatek/mt76/mt7915/mcu.c  |  3 ++-
 drivers/net/wireless/mediatek/mt76/mt7915/mmio.c | 10 +++++-----
 3 files changed, 15 insertions(+), 8 deletions(-)

Comments

kernel test robot Feb. 22, 2023, 8:38 a.m. UTC | #1
Hi Sujuan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v6.2 next-20230222]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sujuan-Chen/wifi-mt76-mt7915-add-dev-hif2-support-for-mt7916-WED-device/20230222-143114
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/5dcd2b1b74b7c46ba4245f96eaf3a4e2f84b37e7.1677039727.git.ryder.lee%40mediatek.com
patch subject: [PATCH] wifi: mt76: mt7915: add dev->hif2 support for mt7916 WED device
config: ia64-allyesconfig (https://download.01.org/0day-ci/archive/20230222/202302221620.bpkNoy9N-lkp@intel.com/config)
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/b87d9f0ad8413128e108128b7f95e2b90db406cc
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Sujuan-Chen/wifi-mt76-mt7915-add-dev-hif2-support-for-mt7916-WED-device/20230222-143114
        git checkout b87d9f0ad8413128e108128b7f95e2b90db406cc
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/net/wireless/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202302221620.bpkNoy9N-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/wireless/mediatek/mt76/mt7915/mcu.c: In function 'mt7915_mcu_init_firmware':
>> drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:2373:56: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
    2373 |         if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&


vim +2373 drivers/net/wireless/mediatek/mt76/mt7915/mcu.c

  2340	
  2341	int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
  2342	{
  2343		int ret;
  2344	
  2345		/* force firmware operation mode into normal state,
  2346		 * which should be set before firmware download stage.
  2347		 */
  2348		mt76_wr(dev, MT_SWDEF_MODE, MT_SWDEF_NORMAL_MODE);
  2349	
  2350		ret = mt7915_driver_own(dev, 0);
  2351		if (ret)
  2352			return ret;
  2353		/* set driver own for band1 when two hif exist */
  2354		if (dev->hif2) {
  2355			ret = mt7915_driver_own(dev, 1);
  2356			if (ret)
  2357				return ret;
  2358		}
  2359	
  2360		ret = mt7915_load_firmware(dev);
  2361		if (ret)
  2362			return ret;
  2363	
  2364		set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
  2365		ret = mt7915_mcu_fw_log_2_host(dev, MCU_FW_LOG_WM, 0);
  2366		if (ret)
  2367			return ret;
  2368	
  2369		ret = mt7915_mcu_fw_log_2_host(dev, MCU_FW_LOG_WA, 0);
  2370		if (ret)
  2371			return ret;
  2372	
> 2373		if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
  2374		    is_mt7915(&dev->mt76) || !mtk_wed_get_rx_capa(&dev->mt76.mmio.wed))
  2375			mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY), 0, 0, 0);
  2376	
  2377		ret = mt7915_mcu_set_mwds(dev, 1);
  2378		if (ret)
  2379			return ret;
  2380	
  2381		ret = mt7915_mcu_set_muru_ctrl(dev, MURU_SET_PLATFORM_TYPE,
  2382					       MURU_PLATFORM_TYPE_PERF_LEVEL_2);
  2383		if (ret)
  2384			return ret;
  2385	
  2386		ret = mt7915_mcu_init_rx_airtime(dev);
  2387		if (ret)
  2388			return ret;
  2389	
  2390		return mt7915_mcu_set_red(dev, mtk_wed_device_active(&dev->mt76.mmio.wed));
  2391	}
  2392
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/dma.c b/drivers/net/wireless/mediatek/mt76/mt7915/dma.c
index abe17dac9996..43a5456d4b97 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/dma.c
@@ -87,8 +87,14 @@  static void mt7915_dma_config(struct mt7915_dev *dev)
 				   MT7916_RXQ_BAND0);
 			RXQ_CONFIG(MT_RXQ_MCU_WA, WFDMA0, MT_INT_WED_RX_DONE_WA_MT7916,
 				   MT7916_RXQ_MCU_WA);
-			RXQ_CONFIG(MT_RXQ_BAND1, WFDMA0, MT_INT_WED_RX_DONE_BAND1_MT7916,
-				   MT7916_RXQ_BAND1);
+			if (dev->hif2)
+				RXQ_CONFIG(MT_RXQ_BAND1, WFDMA0,
+					   MT_INT_RX_DONE_BAND1_MT7916,
+					   MT7916_RXQ_BAND1);
+			else
+				RXQ_CONFIG(MT_RXQ_BAND1, WFDMA0,
+					   MT_INT_WED_RX_DONE_BAND1_MT7916,
+					   MT7916_RXQ_BAND1);
 			RXQ_CONFIG(MT_RXQ_MAIN_WA, WFDMA0, MT_INT_WED_RX_DONE_WA_MAIN_MT7916,
 				   MT7916_RXQ_MCU_WA_MAIN);
 			TXQ_CONFIG(0, WFDMA0, MT_INT_WED_TX_DONE_BAND0,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index 5545a8bdf1d0..cd440aaa969e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -2370,7 +2370,8 @@  int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
 	if (ret)
 		return ret;
 
-	if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7915(&dev->mt76))
+	if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
+	    is_mt7915(&dev->mt76) || !mtk_wed_get_rx_capa(&dev->mt76.mmio.wed))
 		mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY), 0, 0, 0);
 
 	ret = mt7915_mcu_set_mwds(dev, 1);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
index 225a19604d3e..6f0c0e2ae045 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
@@ -989,13 +989,13 @@  irqreturn_t mt7915_irq_handler(int irq, void *dev_instance)
 	struct mt7915_dev *dev = dev_instance;
 	struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
 
-	if (mtk_wed_device_active(wed)) {
+	if (mtk_wed_device_active(wed))
 		mtk_wed_device_irq_set_mask(wed, 0);
-	} else {
+	else
 		mt76_wr(dev, MT_INT_MASK_CSR, 0);
-		if (dev->hif2)
-			mt76_wr(dev, MT_INT1_MASK_CSR, 0);
-	}
+
+	if (dev->hif2)
+		mt76_wr(dev, MT_INT1_MASK_CSR, 0);
 
 	if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
 		return IRQ_NONE;