mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: mt7925: add per-chip PCIe register definitions
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]>
This commit is contained in:
committed by
Felix Fietkau
parent
eacf301a0b
commit
accac9958d
+10
-5
@@ -298,6 +298,11 @@ static int mt7925_dma_init(struct mt792x_dev *dev)
|
|||||||
return mt792x_dma_enable(dev);
|
return mt792x_dma_enable(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct mt792x_pcie_reg mt7925_pcie_reg = {
|
||||||
|
.imask = MT7925_PCIE_MAC_INT_ENABLE,
|
||||||
|
.pm = MT7925_PCIE_MAC_PM,
|
||||||
|
};
|
||||||
|
|
||||||
static const struct mt792x_irq_map mt7925_irq_map = {
|
static const struct mt792x_irq_map mt7925_irq_map = {
|
||||||
.host_irq_enable = MT_WFDMA0_HOST_INT_ENA,
|
.host_irq_enable = MT_WFDMA0_HOST_INT_ENA,
|
||||||
.tx = {
|
.tx = {
|
||||||
@@ -413,6 +418,8 @@ static int mt7925_pci_probe(struct pci_dev *pdev,
|
|||||||
dev->fw_features = features;
|
dev->fw_features = features;
|
||||||
dev->hif_ops = &mt7925_pcie_ops;
|
dev->hif_ops = &mt7925_pcie_ops;
|
||||||
dev->irq_map = is_mt7927_hw ? &mt7927_irq_map : &mt7925_irq_map;
|
dev->irq_map = is_mt7927_hw ? &mt7927_irq_map : &mt7925_irq_map;
|
||||||
|
dev->pcie_reg = &mt7925_pcie_reg;
|
||||||
|
|
||||||
mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]);
|
mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]);
|
||||||
tasklet_init(&mdev->irq_tasklet, mt792x_irq_tasklet, (unsigned long)dev);
|
tasklet_init(&mdev->irq_tasklet, mt792x_irq_tasklet, (unsigned long)dev);
|
||||||
|
|
||||||
@@ -462,8 +469,7 @@ static int mt7925_pci_probe(struct pci_dev *pdev,
|
|||||||
goto err_free_dev;
|
goto err_free_dev;
|
||||||
|
|
||||||
mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
|
mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
|
||||||
|
mt76_wr(dev, dev->pcie_reg->imask, 0xff);
|
||||||
mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
|
|
||||||
|
|
||||||
ret = devm_request_irq(mdev->dev, pdev->irq, mt792x_irq_handler,
|
ret = devm_request_irq(mdev->dev, pdev->irq, mt792x_irq_handler,
|
||||||
IRQF_SHARED, KBUILD_MODNAME, dev);
|
IRQF_SHARED, KBUILD_MODNAME, dev);
|
||||||
@@ -564,8 +570,7 @@ static int mt7925_pci_suspend(struct device *device)
|
|||||||
|
|
||||||
/* disable interrupt */
|
/* disable interrupt */
|
||||||
mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
|
mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
|
||||||
|
mt76_wr(dev, dev->pcie_reg->imask, 0x0);
|
||||||
mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
|
|
||||||
|
|
||||||
synchronize_irq(pdev->irq);
|
synchronize_irq(pdev->irq);
|
||||||
tasklet_kill(&mdev->irq_tasklet);
|
tasklet_kill(&mdev->irq_tasklet);
|
||||||
@@ -615,7 +620,7 @@ static int _mt7925_pci_resume(struct device *device, bool restore)
|
|||||||
mt792x_wpdma_reinit_cond(dev);
|
mt792x_wpdma_reinit_cond(dev);
|
||||||
|
|
||||||
/* enable interrupt */
|
/* enable interrupt */
|
||||||
mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
|
mt76_wr(dev, dev->pcie_reg->imask, 0xff);
|
||||||
mt76_connac_irq_enable(&dev->mt76,
|
mt76_connac_irq_enable(&dev->mt76,
|
||||||
dev->irq_map->tx.all_complete_mask |
|
dev->irq_map->tx.all_complete_mask |
|
||||||
dev->irq_map->rx.all_complete_mask |
|
dev->irq_map->rx.all_complete_mask |
|
||||||
|
|||||||
+2
-2
@@ -78,7 +78,7 @@ int mt7925e_mac_reset(struct mt792x_dev *dev)
|
|||||||
mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
|
mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
|
||||||
|
|
||||||
mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
|
mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
|
||||||
mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
|
mt76_wr(dev, dev->pcie_reg->imask, 0x0);
|
||||||
|
|
||||||
set_bit(MT76_RESET, &dev->mphy.state);
|
set_bit(MT76_RESET, &dev->mphy.state);
|
||||||
set_bit(MT76_MCU_RESET, &dev->mphy.state);
|
set_bit(MT76_MCU_RESET, &dev->mphy.state);
|
||||||
@@ -121,7 +121,7 @@ int mt7925e_mac_reset(struct mt792x_dev *dev)
|
|||||||
dev->irq_map->tx.all_complete_mask |
|
dev->irq_map->tx.all_complete_mask |
|
||||||
dev->irq_map->rx.all_complete_mask |
|
dev->irq_map->rx.all_complete_mask |
|
||||||
MT_INT_MCU_CMD);
|
MT_INT_MCU_CMD);
|
||||||
mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
|
mt76_wr(dev, dev->pcie_reg->imask, 0xff);
|
||||||
|
|
||||||
err = mt792xe_mcu_fw_pmctrl(dev);
|
err = mt792xe_mcu_fw_pmctrl(dev);
|
||||||
if (err)
|
if (err)
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ int mt7925e_mcu_init(struct mt792x_dev *dev)
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
mt76_rmw_field(dev, MT_PCIE_MAC_PM, MT_PCIE_MAC_PM_L0S_DIS, 1);
|
mt76_rmw_field(dev, dev->pcie_reg->pm, MT_PCIE_MAC_PM_L0S_DIS, 1);
|
||||||
|
|
||||||
err = mt7925_run_firmware(dev);
|
err = mt7925_run_firmware(dev);
|
||||||
|
|
||||||
|
|||||||
@@ -97,4 +97,9 @@
|
|||||||
#define MT_WTBL_UPDATE_WLAN_IDX GENMASK(11, 0)
|
#define MT_WTBL_UPDATE_WLAN_IDX GENMASK(11, 0)
|
||||||
#define MT_WTBL_UPDATE_ADM_COUNT_CLEAR BIT(14)
|
#define MT_WTBL_UPDATE_ADM_COUNT_CLEAR BIT(14)
|
||||||
|
|
||||||
|
#define MT7925_PCIE_MAC_BASE 0x10000
|
||||||
|
#define MT7925_PCIE_MAC(ofs) (MT7925_PCIE_MAC_BASE + (ofs))
|
||||||
|
#define MT7925_PCIE_MAC_INT_ENABLE MT7925_PCIE_MAC(0x188)
|
||||||
|
#define MT7925_PCIE_MAC_PM MT7925_PCIE_MAC(0x194)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user