mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 05:16:57 +00:00
Add MT7925_PCIE_MAC_{INT_ENABLE,PM} macros and mt7925_pcie_reg
struct. Update all PCIe register accesses in pci.c, pci_mac.c, and
pci_mcu.c to use dev->pcie_reg->{imask,pm}.
This is a preparation patch before enabling MT7928 PCIe support.
Signed-off-by: Xiong <[email protected]>
Signed-off-by: Emery Hsin <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
// SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
/* Copyright (C) 2023 MediaTek Inc. */
|
|
|
|
#include "mt7925.h"
|
|
#include "mcu.h"
|
|
|
|
static int
|
|
mt7925_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
|
|
int cmd, int *seq)
|
|
{
|
|
struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
|
|
enum mt76_mcuq_id txq = MT_MCUQ_WM;
|
|
int ret;
|
|
|
|
ret = mt7925_mcu_fill_message(mdev, skb, cmd, seq);
|
|
if (ret)
|
|
return ret;
|
|
|
|
mdev->mcu.timeout = 3 * HZ;
|
|
|
|
if (cmd == MCU_CMD(FW_SCATTER))
|
|
txq = MT_MCUQ_FWDL;
|
|
|
|
return mt76_tx_queue_skb_raw(dev, mdev->q_mcu[txq], skb, 0);
|
|
}
|
|
|
|
int mt7925e_mcu_init(struct mt792x_dev *dev)
|
|
{
|
|
static const struct mt76_mcu_ops mt7925_mcu_ops = {
|
|
.headroom = sizeof(struct mt76_connac2_mcu_txd),
|
|
.mcu_skb_send_msg = mt7925_mcu_send_message,
|
|
.mcu_parse_response = mt7925_mcu_parse_response,
|
|
};
|
|
int err;
|
|
|
|
dev->mt76.mcu_ops = &mt7925_mcu_ops;
|
|
|
|
err = mt792xe_mcu_fw_pmctrl(dev);
|
|
if (err)
|
|
return err;
|
|
|
|
err = __mt792xe_mcu_drv_pmctrl(dev);
|
|
if (err)
|
|
return err;
|
|
|
|
mt76_rmw_field(dev, dev->pcie_reg->pm, MT_PCIE_MAC_PM_L0S_DIS, 1);
|
|
|
|
err = mt7925_run_firmware(dev);
|
|
|
|
mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_FWDL], false);
|
|
|
|
return err;
|
|
}
|