Search Linux Wireless

Re: [PATCH -next v4 02/13] mt76: mt7921: add MCU support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2020-12-31 at 02:06 +0800, sean.wang@xxxxxxxxxxxx wrote:
> From: Sean Wang <sean.wang@xxxxxxxxxxxx>
> 
> MT7921 contains a microprocessor with which the host can use command/event
> to communicate to implement offload features such as establish connection,
> hardware scan and so on. The host has to download the ROM patch, RAM
> firmware and finally activate the MCU to complete the MT7921
> initialization.
> 
> Co-developed-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
> Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
> Co-developed-by: Soul Huang <Soul.Huang@xxxxxxxxxxxx>
> Signed-off-by: Soul Huang <Soul.Huang@xxxxxxxxxxxx>
> Signed-off-by: Sean Wang <sean.wang@xxxxxxxxxxxx>
> ---
>  .../wireless/mediatek/mt76/mt7921/Makefile    |    2 +-
>  .../net/wireless/mediatek/mt76/mt7921/mac.h   |  333 +++
>  .../net/wireless/mediatek/mt76/mt7921/mcu.c   | 2438 +++++++++++++++++
>  .../net/wireless/mediatek/mt76/mt7921/mcu.h   | 1050 +++++++
>  .../wireless/mediatek/mt76/mt7921/mt7921.h    |  353 +++
>  .../net/wireless/mediatek/mt76/mt7921/regs.h  |  413 +++
>  6 files changed, 4588 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/mac.h
>  create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
>  create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/mcu.h
>  create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
>  create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/regs.h


> +static int
> +mt7921_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
> +			int cmd, int *wait_seq)
> +{
> +	struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
> +	int txd_len, mcu_cmd = cmd & MCU_CMD_MASK;
> +	enum mt76_txq_id txq = MT_MCUQ_WM;

Implicit conversion from enumeration type 'enum mt76_mcuq_id' to
different enumeration type 'enum mt76_txq_id' 

Should be enum mt76_mcuq_id


> +static int
> +mt7921_mcu_sta_key_tlv(struct sk_buff *skb, struct ieee80211_key_conf *key,
> +		       enum set_key_cmd cmd)
> +{
> +	struct sta_rec_sec *sec;
> +	struct tlv *tlv;
> +	u32 len = sizeof(*sec);
> +
> +	tlv = mt7921_mcu_add_tlv(skb, STA_REC_KEY_V2, sizeof(*sec));
> +
> +	sec = (struct sta_rec_sec *)tlv;
> +	sec->add = cmd;
> +
> +	if (cmd == SET_KEY) {
> +		struct sec_key *sec_key;
> +		u8 cipher;
> +
> +		cipher = mt7921_mcu_get_cipher(key->cipher);
> +		if (cipher == MT_CIPHER_NONE)
> +			return -EOPNOTSUPP;
> +
> +		sec_key = &sec->key[0];
> +		sec_key->cipher_len = sizeof(*sec_key);
> +		sec_key->key_id = key->keyidx;
> +
> +		if (cipher == MT_CIPHER_BIP_CMAC_128) {

This was copied/pasted my wrong flow from mt7915 so I guess BIP_CMAC_128
cannot work. I've fixed this recently for mt7915. You may take a look at
https://patchwork.kernel.org/project/linux-wireless/patch/fc6abcd810a74bb4e8568b0f46bfc851fdcfd800.1607445161.git.ryder.lee@xxxxxxxxxxxx/

Or, fallback to sw version

> +extern const struct ieee80211_ops mt7921_ops;
> +extern struct pci_driver mt7921_pci_driver;
> +
> +u32 mt7921_reg_map(struct mt7921_dev *dev, u32 addr);
> +
> +int mt7921_register_device(struct mt7921_dev *dev);
> +void mt7921_unregister_device(struct mt7921_dev *dev);
> +int mt7921_eeprom_init(struct mt7921_dev *dev);
> +void mt7921_eeprom_parse_band_config(struct mt7921_phy *phy);
> +int mt7921_eeprom_get_target_power(struct mt7921_dev *dev,
> +				   struct ieee80211_channel *chan,
> +				   u8 chain_idx);
> +void mt7921_eeprom_init_sku(struct mt7921_dev *dev);
> +int mt7921_dma_init(struct mt7921_dev *dev);
> +void mt7921_dma_prefetch(struct mt7921_dev *dev);
> +void mt7921_dma_cleanup(struct mt7921_dev *dev);
> +int mt7921_mcu_init(struct mt7921_dev *dev);
> +int mt7921_mcu_add_bss_info(struct mt7921_phy *phy,
> +			    struct ieee80211_vif *vif, int enable);
> +int mt7921_mcu_sta_update_hdr_trans(struct mt7921_dev *dev,
> +				    struct ieee80211_vif *vif,
> +				    struct ieee80211_sta *sta);
> +int mt7921_mcu_add_key(struct mt7921_dev *dev, struct ieee80211_vif *vif,
> +		       struct mt7921_sta *msta, struct ieee80211_key_conf *key,
> +		       enum set_key_cmd cmd);
> +int mt7921_set_channel(struct mt7921_phy *phy);
> +int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd);
> +int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif);
> +int mt7921_mcu_set_eeprom(struct mt7921_dev *dev);
> +int mt7921_mcu_get_eeprom(struct mt7921_dev *dev, u32 offset);
> +int mt7921_mcu_set_mac(struct mt7921_dev *dev, int band, bool enable,
> +		       bool hdr_trans);
> +int mt7921_mcu_set_rts_thresh(struct mt7921_phy *phy, u32 val);
> +int mt7921_mcu_get_rx_rate(struct mt7921_phy *phy, struct ieee80211_vif *vif,
> +			   struct ieee80211_sta *sta, struct rate_info *rate);
Just a quick look. Seem some unused functions (used by mt7915) are
exported here. e.g. mt7921_mcu_get_rx_rate()





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux