Commit 5beadb27 authored by Ryder Lee's avatar Ryder Lee Committed by Felix Fietkau

mt76: mt7915: always call mt7915_wfsys_reset() during init

Soft reboot might not clear certain condition, so always call
mt7915_wfsys_reset() during init.
Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 47eea8ad
...@@ -564,7 +564,7 @@ static void mt7915_init_work(struct work_struct *work) ...@@ -564,7 +564,7 @@ static void mt7915_init_work(struct work_struct *work)
mt7915_txbf_init(dev); mt7915_txbf_init(dev);
} }
static void mt7915_wfsys_reset(struct mt7915_dev *dev) void mt7915_wfsys_reset(struct mt7915_dev *dev)
{ {
#define MT_MCU_DUMMY_RANDOM GENMASK(15, 0) #define MT_MCU_DUMMY_RANDOM GENMASK(15, 0)
#define MT_MCU_DUMMY_DEFAULT GENMASK(31, 16) #define MT_MCU_DUMMY_DEFAULT GENMASK(31, 16)
...@@ -653,11 +653,6 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2) ...@@ -653,11 +653,6 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
INIT_WORK(&dev->init_work, mt7915_init_work); INIT_WORK(&dev->init_work, mt7915_init_work);
/* If MCU was already running, it is likely in a bad state */
if (mt76_get_field(dev, MT_TOP_MISC, MT_TOP_MISC_FW_STATE) >
FW_STATE_FW_DOWNLOAD)
mt7915_wfsys_reset(dev);
ret = mt7915_dma_init(dev, phy2); ret = mt7915_dma_init(dev, phy2);
if (ret) if (ret)
return ret; return ret;
...@@ -665,14 +660,8 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2) ...@@ -665,14 +660,8 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state); set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
ret = mt7915_mcu_init(dev); ret = mt7915_mcu_init(dev);
if (ret) { if (ret)
/* Reset and try again */ return ret;
mt7915_wfsys_reset(dev);
ret = mt7915_mcu_init(dev);
if (ret)
return ret;
}
ret = mt7915_eeprom_init(dev); ret = mt7915_eeprom_init(dev);
if (ret < 0) if (ret < 0)
......
...@@ -429,6 +429,7 @@ static inline void mt7986_wmac_disable(struct mt7915_dev *dev) ...@@ -429,6 +429,7 @@ static inline void mt7986_wmac_disable(struct mt7915_dev *dev)
#endif #endif
struct mt7915_dev *mt7915_mmio_probe(struct device *pdev, struct mt7915_dev *mt7915_mmio_probe(struct device *pdev,
void __iomem *mem_base, u32 device_id); void __iomem *mem_base, u32 device_id);
void mt7915_wfsys_reset(struct mt7915_dev *dev);
irqreturn_t mt7915_irq_handler(int irq, void *dev_instance); irqreturn_t mt7915_irq_handler(int irq, void *dev_instance);
u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif); u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif);
int mt7915_register_device(struct mt7915_dev *dev); int mt7915_register_device(struct mt7915_dev *dev);
......
...@@ -126,6 +126,7 @@ static int mt7915_pci_probe(struct pci_dev *pdev, ...@@ -126,6 +126,7 @@ static int mt7915_pci_probe(struct pci_dev *pdev,
return PTR_ERR(dev); return PTR_ERR(dev);
mdev = &dev->mt76; mdev = &dev->mt76;
mt7915_wfsys_reset(dev);
hif2 = mt7915_pci_init_hif2(pdev); hif2 = mt7915_pci_init_hif2(pdev);
ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
......
...@@ -1128,7 +1128,7 @@ static int mt7986_wmac_init(struct mt7915_dev *dev) ...@@ -1128,7 +1128,7 @@ static int mt7986_wmac_init(struct mt7915_dev *dev)
if (IS_ERR(dev->rstc)) if (IS_ERR(dev->rstc))
return PTR_ERR(dev->rstc); return PTR_ERR(dev->rstc);
return mt7986_wmac_enable(dev); return 0;
} }
static int mt7986_wmac_probe(struct platform_device *pdev) static int mt7986_wmac_probe(struct platform_device *pdev)
...@@ -1161,12 +1161,13 @@ static int mt7986_wmac_probe(struct platform_device *pdev) ...@@ -1161,12 +1161,13 @@ static int mt7986_wmac_probe(struct platform_device *pdev)
if (ret) if (ret)
goto free_device; goto free_device;
mt76_wr(dev, MT_INT_MASK_CSR, 0);
ret = mt7986_wmac_init(dev); ret = mt7986_wmac_init(dev);
if (ret) if (ret)
goto free_irq; goto free_irq;
mt7915_wfsys_reset(dev);
mt76_wr(dev, MT_INT_MASK_CSR, 0);
ret = mt7915_register_device(dev); ret = mt7915_register_device(dev);
if (ret) if (ret)
goto free_irq; goto free_irq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment