* 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
* [PATCH v2 00/16] Add MT7921 SDIO support @ 2021-09-17 23:59 sean.wang 2021-09-17 23:59 ` sean.wang 0 siblings, 1 reply; 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, Sean Wang From: Sean Wang <objelf@gmail.com> The patchset adds the SDIO support to the MT7921 driver, basically are made up of 3 parts. PART 1: patch 1-5, 8-9 and 12-14 These are preliminary patches for mt7921s driver to refactor and reuse the current mt7921e driver as much as possible. PART 2: patch 6-7, 10 These are preliminary patches for mt7921s driver to refactor and reuse the current mt7663s driver as much as possible. PART 3: patch 11 and 15-16 These are specific patches for mt7921s driver and reset mechanism in the same framework where mt7921e have been supported. The patchset are built and generated against the current mt76 tree plus the extra pending patches [1] expected to be merged to mt76 tree soon to help the review and merge process be easier. The change list from v1 to v2 1. rework the whole driver according to the new patches added ("mt76: introduce __mt76_mcu_send_firmware routine"), ("mt76: not accounting the MCU header size in __mt76_mcu_send_firmware for mt7915/21") and ("mt76: sdio: move common code in mt76_sdio module") 2. drop pci_init.c and sdio_init.c by moving the related logic to pci.c and sdio.c, respectively. 3. cosmetics the patches like removing unnecessary new line and adding an extra space to fixed_map table. 4. fix typo in commit message [1] The pending patch list prior to add MT7921 SDIO support da0054ae6b1f mt76: mt7921s: add reset support 31c979d37209 mt76: mt7921: introduce mt7921s support c8f8caad718f mt76: mt7921: refactor mt7921_mcu_send_message f4bb6338d638 mt76: mt7921: rely on mcu_get_nic_capability 0bfd21e29498 mt76: connac: extend mcu_get_nic_capability 3b5f8d1815a4 mt76: sdio: extend sdio module to support CONNAC2 28669a9ceff5 mt76: sdio: move common code in mt76_sdio module ad7ba2b9c6af mt76: mt7921: use physical addr to unify register access a6aebd446a9a mt76: mt7921: make all event parser reusable between mt7921s and mt7921e 0c52f915f728 mt76: mt7663s: rely on mcu reg access utility 42112d6b7b1c mt76: connac: move mcu reg access utility routines in mt76_connac_lib module 23bf9455d505 mt76: mt7921: add MT7921_COMMON module 688be52542bb mt76: mt7921: refactor init.c to be bus independent 099a0527d05c mt76: mt7921: refactor mcu.c to be bus independent 378767d66e2b mt76: mt7921: refactor dma.c to be pcie specific e15c4c1be3ea mt76: mt7921: refactor mac.c to be bus independent b72eaca3c81b mt76: not accounting the MCU header size in __mt76_mcu_send_firmware for mt7915/21 870fe1bc5fc8 mt76: introduce __mt76_mcu_send_firmware routine 465a8a6e834f mt76: schedule status timeout at dma completion 4d3b6422fe5e mt76: substitute sk_buff_head status_list with spinlock_t status_lock 13d50c723b79 mt76: remove mt76_wcid pointer from mt76_tx_status_check signature ed46465dc741 mt76: introduce packet_id idr b3568b1f391a mt76: mt7921: add 6GHz support 6605e1e5c2be mt76: add 6GHz support 1dcae1bad280 mt76: connac: enable hw amsdu @ 6GHz 88c34fb4fdef mt76: connac: add 6GHz support to mt76_connac_mcu_uni_add_bss 8bb780867211 mt76: connac: add 6GHz support to mt76_connac_mcu_sta_tlv 6e021ff24950 mt76: connac: set 6G phymode in single-sku support 21a96eed203d mt76: connac: add 6GHz support to mt76_connac_mcu_set_channel_domain b70bae155a51 mt76: connac: enable 6GHz band for hw scan 92e29c77494c mt76: mt7921: remove mt7921_sta_stats 56ea41ec4ae3 mt76: mt7921: remove mcu rate reporting code 94b97e96549e mt76: mt7921: report tx rate directly from tx status 8dd12eb23009 mt76: mt7921: add support for tx status reporting 69328a635189 mt76: mt7921: start reworking tx rate reporting b915a7d2b882 mt76: mt7921: update mib counters dumping phy stats 2a694a754e32 mt76: mt7921: always wake device if necessary in debugfs 067927a52e93 mt76: mt7921: move mt7921_queue_rx_skb to mac.c a866733d977d mt76: mt7921: fix retrying release semaphore without end 8853d1b5b6bf mt76: mt7921: robustify hardware initialization flow Lorenzo Bianconi (1): mt76: sdio: move common code in mt76_sdio module Sean Wang (15): mt76: mt7921: refactor mac.c to be bus independent mt76: mt7921: refactor dma.c to be pcie specific mt76: mt7921: refactor mcu.c to be bus independent mt76: mt7921: refactor init.c to be bus independent mt76: mt7921: add MT7921_COMMON module mt76: connac: move mcu reg access utility routines in mt76_connac_lib module mt76: mt7663s: rely on mcu reg access utility mt76: mt7921: make all event parser reusable between mt7921s and mt7921e mt76: mt7921: use physical addr to unify register access mt76: sdio: extend sdio module to support CONNAC2 mt76: connac: extend mcu_get_nic_capability mt76: mt7921: rely on mcu_get_nic_capability mt76: mt7921: refactor mt7921_mcu_send_message mt76: mt7921: introduce mt7921s support mt76: mt7921s: add reset support drivers/net/wireless/mediatek/mt76/Makefile | 2 +- drivers/net/wireless/mediatek/mt76/mt76.h | 22 ++ .../wireless/mediatek/mt76/mt7615/Makefile | 2 +- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 28 -- .../wireless/mediatek/mt76/mt7615/mt7615.h | 6 - .../net/wireless/mediatek/mt76/mt7615/sdio.c | 282 +------------ .../wireless/mediatek/mt76/mt7615/sdio_mcu.c | 11 +- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 93 +++++ .../wireless/mediatek/mt76/mt76_connac_mcu.h | 2 + .../net/wireless/mediatek/mt76/mt7921/Kconfig | 18 +- .../wireless/mediatek/mt76/mt7921/Makefile | 8 +- .../wireless/mediatek/mt76/mt7921/debugfs.c | 18 +- .../net/wireless/mediatek/mt76/mt7921/dma.c | 38 +- .../wireless/mediatek/mt76/mt7921/eeprom.c | 101 ----- .../net/wireless/mediatek/mt76/mt7921/init.c | 52 +-- .../net/wireless/mediatek/mt76/mt7921/mac.c | 372 ++---------------- .../net/wireless/mediatek/mt76/mt7921/mac.h | 4 + .../net/wireless/mediatek/mt76/mt7921/main.c | 7 + .../net/wireless/mediatek/mt76/mt7921/mcu.c | 138 ++----- .../wireless/mediatek/mt76/mt7921/mt7921.h | 94 ++++- .../net/wireless/mediatek/mt76/mt7921/pci.c | 49 ++- .../wireless/mediatek/mt76/mt7921/pci_mac.c | 346 ++++++++++++++++ .../wireless/mediatek/mt76/mt7921/pci_mcu.c | 115 ++++++ .../net/wireless/mediatek/mt76/mt7921/regs.h | 22 +- .../net/wireless/mediatek/mt76/mt7921/sdio.c | 285 ++++++++++++++ .../wireless/mediatek/mt76/mt7921/sdio_mac.c | 220 +++++++++++ .../wireless/mediatek/mt76/mt7921/sdio_mcu.c | 135 +++++++ drivers/net/wireless/mediatek/mt76/sdio.c | 282 +++++++++++++ .../mediatek/mt76/{mt7615 => }/sdio.h | 50 ++- .../mediatek/mt76/{mt7615 => }/sdio_txrx.c | 171 +++++--- 30 files changed, 1982 insertions(+), 991 deletions(-) delete mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/eeprom.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/sdio.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c rename drivers/net/wireless/mediatek/mt76/{mt7615 => }/sdio.h (68%) rename drivers/net/wireless/mediatek/mt76/{mt7615 => }/sdio_txrx.c (59%) -- 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
* [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
* 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
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.