enable, false);
}
-static char *mt7921_patch_name(struct mt792x_dev *dev)
-{
- char *ret;
-
- if (is_mt7922(&dev->mt76))
- ret = MT7922_ROM_PATCH;
- else
- ret = MT7921_ROM_PATCH;
-
- return ret;
-}
-
-static char *mt7921_ram_name(struct mt792x_dev *dev)
-{
- char *ret;
-
- if (is_mt7922(&dev->mt76))
- ret = MT7922_FIRMWARE_WM;
- else
- ret = MT7921_FIRMWARE_WM;
-
- return ret;
-}
-
static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)
{
const struct mt76_connac2_fw_trailer *hdr;
return ret;
}
-static int mt7921_load_firmware(struct mt792x_dev *dev)
-{
- int ret;
-
- ret = mt76_connac2_load_patch(&dev->mt76, mt7921_patch_name(dev));
- if (ret)
- return ret;
-
- if (mt76_is_sdio(&dev->mt76)) {
- /* activate again */
- ret = __mt792x_mcu_fw_pmctrl(dev);
- if (!ret)
- ret = __mt792x_mcu_drv_pmctrl(dev);
- }
-
- ret = mt76_connac2_load_ram(&dev->mt76, mt7921_ram_name(dev), NULL);
- if (ret)
- return ret;
-
- if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_N9_RDY,
- MT_TOP_MISC2_FW_N9_RDY, 1500)) {
- dev_err(dev->mt76.dev, "Timeout for initializing firmware\n");
-
- return -EIO;
- }
-
-#ifdef CONFIG_PM
- dev->mt76.hw->wiphy->wowlan = &mt76_connac_wowlan_support;
-#endif /* CONFIG_PM */
-
- dev_dbg(dev->mt76.dev, "Firmware init done\n");
-
- return 0;
-}
-
int mt7921_mcu_fw_log_2_host(struct mt792x_dev *dev, u8 ctrl)
{
struct {
{
int err;
- err = mt7921_load_firmware(dev);
+ err = mt792x_load_firmware(dev);
if (err)
return err;
return err;
set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
- err = mt7921_load_clc(dev, mt7921_ram_name(dev));
+ err = mt7921_load_clc(dev, mt792x_ram_name(dev));
if (err)
return err;
#define MT7921_RX_RING_SIZE 1536
#define MT7921_RX_MCU_RING_SIZE 512
-#define MT7921_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7961_1.bin"
-#define MT7921_ROM_PATCH "mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin"
-
-#define MT7922_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7922_1.bin"
-#define MT7922_ROM_PATCH "mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin"
-
#define MT7921_EEPROM_SIZE 3584
#define MT7921_TOKEN_SIZE 8192
#define MT792x_MCU_INIT_RETRY_COUNT 10
#define MT792x_WFSYS_INIT_RETRY_COUNT 2
+#define MT7921_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7961_1.bin"
+#define MT7922_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7922_1.bin"
+
+#define MT7921_ROM_PATCH "mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin"
+#define MT7922_ROM_PATCH "mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin"
+
struct mt792x_vif;
struct mt792x_sta;
int mt792x_mcu_drv_pmctrl(struct mt792x_dev *dev);
int mt792x_mcu_fw_pmctrl(struct mt792x_dev *dev);
+static inline char *mt792x_ram_name(struct mt792x_dev *dev)
+{
+ switch (mt76_chip(&dev->mt76)) {
+ case 0x7922:
+ return MT7922_FIRMWARE_WM;
+ default:
+ return MT7921_FIRMWARE_WM;
+ }
+}
+
+static inline char *mt792x_patch_name(struct mt792x_dev *dev)
+{
+ switch (mt76_chip(&dev->mt76)) {
+ case 0x7922:
+ return MT7922_ROM_PATCH;
+ default:
+ return MT7921_ROM_PATCH;
+ }
+}
+
+int mt792x_load_firmware(struct mt792x_dev *dev);
+
/* usb */
#define MT_USB_TYPE_VENDOR (USB_TYPE_VENDOR | 0x1f)
#define MT_USB_TYPE_UHW_VENDOR (USB_TYPE_VENDOR | 0x1e)
}
EXPORT_SYMBOL_GPL(mt792xe_mcu_fw_pmctrl);
+int mt792x_load_firmware(struct mt792x_dev *dev)
+{
+ int ret;
+
+ ret = mt76_connac2_load_patch(&dev->mt76, mt792x_patch_name(dev));
+ if (ret)
+ return ret;
+
+ if (mt76_is_sdio(&dev->mt76)) {
+ /* activate again */
+ ret = __mt792x_mcu_fw_pmctrl(dev);
+ if (!ret)
+ ret = __mt792x_mcu_drv_pmctrl(dev);
+ }
+
+ ret = mt76_connac2_load_ram(&dev->mt76, mt792x_ram_name(dev), NULL);
+ if (ret)
+ return ret;
+
+ if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_N9_RDY,
+ MT_TOP_MISC2_FW_N9_RDY, 1500)) {
+ dev_err(dev->mt76.dev, "Timeout for initializing firmware\n");
+
+ return -EIO;
+ }
+
+#ifdef CONFIG_PM
+ dev->mt76.hw->wiphy->wowlan = &mt76_connac_wowlan_support;
+#endif /* CONFIG_PM */
+
+ dev_dbg(dev->mt76.dev, "Firmware init done\n");
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(mt792x_load_firmware);
+
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");