* Re: [PATCH v2 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module
[not found] <YUW8KBTC7t3PHJwF@lore-desk--annotate>
@ 2021-09-24 5:30 ` sean.wang
0 siblings, 0 replies; 6+ messages in thread
From: sean.wang @ 2021-09-24 5:30 UTC (permalink / raw)
To: lorenzo.bianconi
Cc: nbd, sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun,
ted.huang, Eric.Liang, Stella.Chang, steve.lee, jsiuda, frankgor,
jemele, shawnku, linux-wireless, linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
>> From: Sean Wang <sean.wang@mediatek.com>
>>
>> Move mcu reg access shared between mt7663s and mt7921s in
>> mt76_connac_lib module.
>>
>> Tested-by: Deren Wu <deren.wu@mediatek.com>
>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>> ---
>> .../wireless/mediatek/mt76/mt76_connac_mcu.c | 27
>> +++++++++++++++++++ .../wireless/mediatek/mt76/mt76_connac_mcu.h |
>> 2 ++
>> 2 files changed, 29 insertions(+)
>>
>> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> index ae692052de97..a53f6344a184 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> @@ -2406,6 +2406,33 @@ void mt76_connac_mcu_set_suspend_iter(void
>> *priv, u8 *mac, }
>> EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_suspend_iter);
>>
>> +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset) {
>> + struct {
>> + __le32 addr;
>> + __le32 val;
>> + } __packed req = {
>> + .addr = cpu_to_le32(offset),
>> + };
>> +
>> + return mt76_mcu_send_msg(dev, MCU_CMD_REG_READ, &req, sizeof(req),
>> + true);
>> +}
>> +EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_rr);
>
>It seems quite a common code, does it worth to move them in mcu.c? (mt76 module)
My understanding would be mt76/mcu.c only provides the framework that handle the
pure software stuff and shouldn't contain any firmware or device related logic.
So I prefer to add those commands MCU_CMD_REG_READ and MCU_CMD_REG_WRITE to
mt76_connac_mcu.c like the other commands we have added there.
>
>Regards,
>Lorenzo
>
>> +
>> +void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32
>> +val) {
>> + struct {
>> + __le32 addr;
>> + __le32 val;
>> + } __packed req = {
>> + .addr = cpu_to_le32(offset),
>> + .val = cpu_to_le32(val),
>> + };
>> +
>> + mt76_mcu_send_msg(dev, MCU_CMD_REG_WRITE, &req, sizeof(req), false);
>> +} EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_wr);
>> #endif /* CONFIG_PM */
>>
>> MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>"); diff --git
>> a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
>> b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
>> index ea46dde364e1..6c410c4a8d6e 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
>> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
>> @@ -1111,4 +1111,6 @@ void mt76_connac_mcu_coredump_event(struct
>> mt76_dev *dev, struct sk_buff *skb, int
>> mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy); int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw *hw,
>> struct ieee80211_vif *vif);
>> +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset); void
>> +mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val);
>> #endif /* __MT76_CONNAC_MCU_H */
>> --
>> 2.25.1
>>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module
@ 2021-09-24 5:30 ` sean.wang
0 siblings, 0 replies; 6+ messages in thread
From: sean.wang @ 2021-09-24 5:30 UTC (permalink / raw)
To: lorenzo.bianconi
Cc: nbd, sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun,
ted.huang, Eric.Liang, Stella.Chang, steve.lee, jsiuda, frankgor,
jemele, shawnku, linux-wireless, linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
>> From: Sean Wang <sean.wang@mediatek.com>
>>
>> Move mcu reg access shared between mt7663s and mt7921s in
>> mt76_connac_lib module.
>>
>> Tested-by: Deren Wu <deren.wu@mediatek.com>
>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>> ---
>> .../wireless/mediatek/mt76/mt76_connac_mcu.c | 27
>> +++++++++++++++++++ .../wireless/mediatek/mt76/mt76_connac_mcu.h |
>> 2 ++
>> 2 files changed, 29 insertions(+)
>>
>> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> index ae692052de97..a53f6344a184 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> @@ -2406,6 +2406,33 @@ void mt76_connac_mcu_set_suspend_iter(void
>> *priv, u8 *mac, }
>> EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_suspend_iter);
>>
>> +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset) {
>> + struct {
>> + __le32 addr;
>> + __le32 val;
>> + } __packed req = {
>> + .addr = cpu_to_le32(offset),
>> + };
>> +
>> + return mt76_mcu_send_msg(dev, MCU_CMD_REG_READ, &req, sizeof(req),
>> + true);
>> +}
>> +EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_rr);
>
>It seems quite a common code, does it worth to move them in mcu.c? (mt76 module)
My understanding would be mt76/mcu.c only provides the framework that handle the
pure software stuff and shouldn't contain any firmware or device related logic.
So I prefer to add those commands MCU_CMD_REG_READ and MCU_CMD_REG_WRITE to
mt76_connac_mcu.c like the other commands we have added there.
>
>Regards,
>Lorenzo
>
>> +
>> +void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32
>> +val) {
>> + struct {
>> + __le32 addr;
>> + __le32 val;
>> + } __packed req = {
>> + .addr = cpu_to_le32(offset),
>> + .val = cpu_to_le32(val),
>> + };
>> +
>> + mt76_mcu_send_msg(dev, MCU_CMD_REG_WRITE, &req, sizeof(req), false);
>> +} EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_wr);
>> #endif /* CONFIG_PM */
>>
>> MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>"); diff --git
>> a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
>> b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
>> index ea46dde364e1..6c410c4a8d6e 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
>> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
>> @@ -1111,4 +1111,6 @@ void mt76_connac_mcu_coredump_event(struct
>> mt76_dev *dev, struct sk_buff *skb, int
>> mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy); int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw *hw,
>> struct ieee80211_vif *vif);
>> +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset); void
>> +mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val);
>> #endif /* __MT76_CONNAC_MCU_H */
>> --
>> 2.25.1
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module
2021-09-17 23:59 ` sean.wang
@ 2021-09-18 10:15 ` Lorenzo Bianconi
-1 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2021-09-18 10:15 UTC (permalink / raw)
To: sean.wang
Cc: nbd, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu,
km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun, ted.huang,
Eric.Liang, Stella.Chang, steve.lee, jsiuda, frankgor, jemele,
shawnku, linux-wireless, linux-mediatek
[-- Attachment #1: Type: text/plain, Size: 2527 bytes --]
> From: Sean Wang <sean.wang@mediatek.com>
>
> Move mcu reg access shared between mt7663s and mt7921s in mt76_connac_lib
> module.
>
> Tested-by: Deren Wu <deren.wu@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> .../wireless/mediatek/mt76/mt76_connac_mcu.c | 27 +++++++++++++++++++
> .../wireless/mediatek/mt76/mt76_connac_mcu.h | 2 ++
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> index ae692052de97..a53f6344a184 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> @@ -2406,6 +2406,33 @@ void mt76_connac_mcu_set_suspend_iter(void *priv, u8 *mac,
> }
> EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_suspend_iter);
>
> +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset)
> +{
> + struct {
> + __le32 addr;
> + __le32 val;
> + } __packed req = {
> + .addr = cpu_to_le32(offset),
> + };
> +
> + return mt76_mcu_send_msg(dev, MCU_CMD_REG_READ, &req, sizeof(req),
> + true);
> +}
> +EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_rr);
It seems quite a common code, does it worth to move them in mcu.c? (mt76 module)
Regards,
Lorenzo
> +
> +void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val)
> +{
> + struct {
> + __le32 addr;
> + __le32 val;
> + } __packed req = {
> + .addr = cpu_to_le32(offset),
> + .val = cpu_to_le32(val),
> + };
> +
> + mt76_mcu_send_msg(dev, MCU_CMD_REG_WRITE, &req, sizeof(req), false);
> +}
> +EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_wr);
> #endif /* CONFIG_PM */
>
> MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> index ea46dde364e1..6c410c4a8d6e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> @@ -1111,4 +1111,6 @@ void mt76_connac_mcu_coredump_event(struct mt76_dev *dev, struct sk_buff *skb,
> int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy);
> int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw *hw,
> struct ieee80211_vif *vif);
> +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset);
> +void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val);
> #endif /* __MT76_CONNAC_MCU_H */
> --
> 2.25.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module
@ 2021-09-18 10:15 ` Lorenzo Bianconi
0 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2021-09-18 10:15 UTC (permalink / raw)
To: sean.wang
Cc: nbd, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu,
km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun, ted.huang,
Eric.Liang, Stella.Chang, steve.lee, jsiuda, frankgor, jemele,
shawnku, linux-wireless, linux-mediatek
[-- Attachment #1.1: Type: text/plain, Size: 2527 bytes --]
> From: Sean Wang <sean.wang@mediatek.com>
>
> Move mcu reg access shared between mt7663s and mt7921s in mt76_connac_lib
> module.
>
> Tested-by: Deren Wu <deren.wu@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> .../wireless/mediatek/mt76/mt76_connac_mcu.c | 27 +++++++++++++++++++
> .../wireless/mediatek/mt76/mt76_connac_mcu.h | 2 ++
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> index ae692052de97..a53f6344a184 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> @@ -2406,6 +2406,33 @@ void mt76_connac_mcu_set_suspend_iter(void *priv, u8 *mac,
> }
> EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_suspend_iter);
>
> +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset)
> +{
> + struct {
> + __le32 addr;
> + __le32 val;
> + } __packed req = {
> + .addr = cpu_to_le32(offset),
> + };
> +
> + return mt76_mcu_send_msg(dev, MCU_CMD_REG_READ, &req, sizeof(req),
> + true);
> +}
> +EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_rr);
It seems quite a common code, does it worth to move them in mcu.c? (mt76 module)
Regards,
Lorenzo
> +
> +void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val)
> +{
> + struct {
> + __le32 addr;
> + __le32 val;
> + } __packed req = {
> + .addr = cpu_to_le32(offset),
> + .val = cpu_to_le32(val),
> + };
> +
> + mt76_mcu_send_msg(dev, MCU_CMD_REG_WRITE, &req, sizeof(req), false);
> +}
> +EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_wr);
> #endif /* CONFIG_PM */
>
> MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> index ea46dde364e1..6c410c4a8d6e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> @@ -1111,4 +1111,6 @@ void mt76_connac_mcu_coredump_event(struct mt76_dev *dev, struct sk_buff *skb,
> int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy);
> int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw *hw,
> struct ieee80211_vif *vif);
> +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset);
> +void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val);
> #endif /* __MT76_CONNAC_MCU_H */
> --
> 2.25.1
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module
2021-09-17 23:59 [PATCH v2 00/16] Add MT7921 SDIO support sean.wang
@ 2021-09-17 23:59 ` sean.wang
0 siblings, 0 replies; 6+ messages in thread
From: sean.wang @ 2021-09-17 23:59 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun,
ted.huang, Eric.Liang, Stella.Chang, steve.lee, jsiuda, frankgor,
jemele, shawnku, linux-wireless, linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Move mcu reg access shared between mt7663s and mt7921s in mt76_connac_lib
module.
Tested-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../wireless/mediatek/mt76/mt76_connac_mcu.c | 27 +++++++++++++++++++
.../wireless/mediatek/mt76/mt76_connac_mcu.h | 2 ++
2 files changed, 29 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index ae692052de97..a53f6344a184 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -2406,6 +2406,33 @@ void mt76_connac_mcu_set_suspend_iter(void *priv, u8 *mac,
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_suspend_iter);
+u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset)
+{
+ struct {
+ __le32 addr;
+ __le32 val;
+ } __packed req = {
+ .addr = cpu_to_le32(offset),
+ };
+
+ return mt76_mcu_send_msg(dev, MCU_CMD_REG_READ, &req, sizeof(req),
+ true);
+}
+EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_rr);
+
+void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val)
+{
+ struct {
+ __le32 addr;
+ __le32 val;
+ } __packed req = {
+ .addr = cpu_to_le32(offset),
+ .val = cpu_to_le32(val),
+ };
+
+ mt76_mcu_send_msg(dev, MCU_CMD_REG_WRITE, &req, sizeof(req), false);
+}
+EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_wr);
#endif /* CONFIG_PM */
MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index ea46dde364e1..6c410c4a8d6e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -1111,4 +1111,6 @@ void mt76_connac_mcu_coredump_event(struct mt76_dev *dev, struct sk_buff *skb,
int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy);
int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
+u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset);
+void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val);
#endif /* __MT76_CONNAC_MCU_H */
--
2.25.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module
@ 2021-09-17 23:59 ` sean.wang
0 siblings, 0 replies; 6+ messages in thread
From: sean.wang @ 2021-09-17 23:59 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun,
ted.huang, Eric.Liang, Stella.Chang, steve.lee, jsiuda, frankgor,
jemele, shawnku, linux-wireless, linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Move mcu reg access shared between mt7663s and mt7921s in mt76_connac_lib
module.
Tested-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../wireless/mediatek/mt76/mt76_connac_mcu.c | 27 +++++++++++++++++++
.../wireless/mediatek/mt76/mt76_connac_mcu.h | 2 ++
2 files changed, 29 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index ae692052de97..a53f6344a184 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -2406,6 +2406,33 @@ void mt76_connac_mcu_set_suspend_iter(void *priv, u8 *mac,
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_suspend_iter);
+u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset)
+{
+ struct {
+ __le32 addr;
+ __le32 val;
+ } __packed req = {
+ .addr = cpu_to_le32(offset),
+ };
+
+ return mt76_mcu_send_msg(dev, MCU_CMD_REG_READ, &req, sizeof(req),
+ true);
+}
+EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_rr);
+
+void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val)
+{
+ struct {
+ __le32 addr;
+ __le32 val;
+ } __packed req = {
+ .addr = cpu_to_le32(offset),
+ .val = cpu_to_le32(val),
+ };
+
+ mt76_mcu_send_msg(dev, MCU_CMD_REG_WRITE, &req, sizeof(req), false);
+}
+EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_wr);
#endif /* CONFIG_PM */
MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index ea46dde364e1..6c410c4a8d6e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -1111,4 +1111,6 @@ void mt76_connac_mcu_coredump_event(struct mt76_dev *dev, struct sk_buff *skb,
int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy);
int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
+u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset);
+void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val);
#endif /* __MT76_CONNAC_MCU_H */
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-09-24 5:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <YUW8KBTC7t3PHJwF@lore-desk--annotate>
2021-09-24 5:30 ` [PATCH v2 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module sean.wang
2021-09-24 5:30 ` sean.wang
2021-09-17 23:59 [PATCH v2 00/16] Add MT7921 SDIO support sean.wang
2021-09-17 23:59 ` [PATCH v2 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module sean.wang
2021-09-17 23:59 ` sean.wang
2021-09-18 10:15 ` Lorenzo Bianconi
2021-09-18 10:15 ` Lorenzo Bianconi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.