diff mbox series

[v2,8/8] mt76: mt7915: set muru platform type

Message ID 20210906114423.13646-8-shayne.chen@mediatek.com (mailing list archive)
State Superseded
Delegated to: Felix Fietkau
Headers show
Series [v2,1/8] mt76: mt7915: introduce mt7915_mcu_beacon_check_caps() | expand

Commit Message

Shayne Chen Sept. 6, 2021, 11:44 a.m. UTC
Notify fw to init corresponding muru algorithm.

Suggested-by: Money Wang <money.wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7915/mcu.c  | 16 ++++++++++++++++
 drivers/net/wireless/mediatek/mt76/mt7915/mcu.h  |  5 +++++
 .../net/wireless/mediatek/mt76/mt7915/testmode.h |  4 ----
 3 files changed, 21 insertions(+), 4 deletions(-)

Comments

Ryder Lee Sept. 6, 2021, 6:46 p.m. UTC | #1
On Mon, 2021-09-06 at 19:44 +0800, Shayne Chen wrote:
> Notify fw to init corresponding muru algorithm.
> 
> Suggested-by: Money Wang <money.wang@mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7915/mcu.c  | 16
> ++++++++++++++++
>  drivers/net/wireless/mediatek/mt76/mt7915/mcu.h  |  5 +++++
>  .../net/wireless/mediatek/mt76/mt7915/testmode.h |  4 ----
>  3 files changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> index 229ba3c469d1..6242d5e11107 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> @@ -2949,6 +2949,21 @@ static int mt7915_mcu_set_mwds(struct
> mt7915_dev *dev, bool enabled)
>                                  sizeof(req), false);
>  }
> 
> +static int mt7915_mcu_set_muru_ptype(struct mt7915_dev *dev)
> +{
> +       struct {
> +               __le32 cmd;
> +               u8 ptype;
> +               u8 _rsv[3];
> +       } __packed req = {
> +               .cmd = MURU_SET_PLATFORM_TYPE,

cpu_to_le32

> +               .ptype = 2,
> +       };
> +
> +       return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(MURU_CTRL),
> &req,
> +                                sizeof(req), false);
> +}
> +
>  int mt7915_mcu_init(struct mt7915_dev *dev)
>  {
>         static const struct mt76_mcu_ops mt7915_mcu_ops = {
> @@ -2973,6 +2988,7 @@ int mt7915_mcu_init(struct mt7915_dev *dev)
>         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);
> +       mt7915_mcu_set_muru_ptype(dev);
> 
>         return 0;
>  }
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
> b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
> index 6344faf3f394..57be9262ec2a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
> @@ -1086,6 +1086,11 @@ enum {
>         MT_BF_MODULE_UPDATE = 25
>  };
> 
> +enum {
> +       MURU_SET_ARB_OP_MODE = 14,
> +       MURU_SET_PLATFORM_TYPE = 25,
> +};
> 

I think it's better to use mt7915_mcu_set_muru_cmd(phy, cmd, opcode) in
the long run to avoid adding duplicated muru_ctrl for future UL
support.
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index 229ba3c469d1..6242d5e11107 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -2949,6 +2949,21 @@  static int mt7915_mcu_set_mwds(struct mt7915_dev *dev, bool enabled)
 				 sizeof(req), false);
 }
 
+static int mt7915_mcu_set_muru_ptype(struct mt7915_dev *dev)
+{
+	struct {
+		__le32 cmd;
+		u8 ptype;
+		u8 _rsv[3];
+	} __packed req = {
+		.cmd = MURU_SET_PLATFORM_TYPE,
+		.ptype = 2,
+	};
+
+	return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(MURU_CTRL), &req,
+				 sizeof(req), false);
+}
+
 int mt7915_mcu_init(struct mt7915_dev *dev)
 {
 	static const struct mt76_mcu_ops mt7915_mcu_ops = {
@@ -2973,6 +2988,7 @@  int mt7915_mcu_init(struct mt7915_dev *dev)
 	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);
+	mt7915_mcu_set_muru_ptype(dev);
 
 	return 0;
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
index 6344faf3f394..57be9262ec2a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
@@ -1086,6 +1086,11 @@  enum {
 	MT_BF_MODULE_UPDATE = 25
 };
 
+enum {
+	MURU_SET_ARB_OP_MODE = 14,
+	MURU_SET_PLATFORM_TYPE = 25,
+};
+
 #define MT7915_WTBL_UPDATE_MAX_SIZE	(sizeof(struct wtbl_req_hdr) +	\
 					 sizeof(struct wtbl_generic) +	\
 					 sizeof(struct wtbl_rx) +	\
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.h b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.h
index 107f0cf2505e..5573ac309363 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.h
@@ -102,8 +102,4 @@  enum {
 	TAM_ARB_OP_MODE_FORCE_SU = 5,
 };
 
-enum {
-	MURU_SET_ARB_OP_MODE = 14,
-};
-
 #endif