mt76: connac: move mcu reg access utility routines in mt76_connac_lib module
From: Sean Wang <[email protected]>
Quoted 22 lines
Quoted 22 lines
From: Sean Wang <[email protected]>
Move mcu reg access shared between mt7663s and mt7921s in
mt76_connac_libmodule.Tested-by Deren Wu <[email protected]>Signed-off-by Sean Wang <[email protected]>--- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 27 +++++++++++++++++++ .../wireless/mediatek/mt76/mt76_connac_mcu.h | 2 ++ 2 files changed, 29 insertions(+)drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +0
-0@@ -2406,6 +2406,33 @@ void mt76_connac_mcu_set_suspend_iter(void *priv, u8 *mac, }EXPORT_SYMBOL_GPL (mt76_connac_mcu_set_suspend_iter);
Quoted 14 lines
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c void mt76_connac_mcu_set_suspend_iter(void · line 2420
Quoted 12 lines
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +12
-0+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.
Quoted 19 lines
Regards,
LorenzoQuoted 15 lines
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +13
-0+ +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 */
Quoted 16 lines
Quoted 14 lines
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +0
-0MODULE_AUTHOR("Lorenzo Bianconi <[email protected]>"); diff --git
a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.hb/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.hindexea46dde364e1..6c410c4a8d6e100644drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +0
-0@@ -1111,4 +1111,6 @@ void mt76_connac_mcu_coredump_event(struct
mt76_dev*dev, structsk_buff*skb, intmt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy); int mt76_connac_mcu_set_p2p_oppps(structieee80211_hw*hw,struct ieee80211_vif *vif);drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +2
-1+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 */ --Quoted 2 lines
2.25.1
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek