wifi: mt76: add flexible polling wait-interval support
[ Upstream commit 35effe6c0c24adcf0f732bb1c3d75573d4c88e63 ] The default waiting unit is 10ms and the value is too much for data path related control. Provide a new API mt76_poll_msec_tick() to support different cases, such as 1ms polling waiting kick. Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> Stable-dep-of: c397fc1e6365 ("wifi: mt76: mt7921e: fix probe timeout after reboot") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
710f3c7fb3
commit
27ce664b7f
@ -904,10 +904,11 @@ bool __mt76_poll(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
|
||||
|
||||
#define mt76_poll(dev, ...) __mt76_poll(&((dev)->mt76), __VA_ARGS__)
|
||||
|
||||
bool __mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
|
||||
int timeout);
|
||||
|
||||
#define mt76_poll_msec(dev, ...) __mt76_poll_msec(&((dev)->mt76), __VA_ARGS__)
|
||||
bool ____mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
|
||||
int timeout, int kick);
|
||||
#define __mt76_poll_msec(...) ____mt76_poll_msec(__VA_ARGS__, 10)
|
||||
#define mt76_poll_msec(dev, ...) ____mt76_poll_msec(&((dev)->mt76), __VA_ARGS__, 10)
|
||||
#define mt76_poll_msec_tick(dev, ...) ____mt76_poll_msec(&((dev)->mt76), __VA_ARGS__)
|
||||
|
||||
void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs);
|
||||
void mt76_pci_disable_aspm(struct pci_dev *pdev);
|
||||
|
@ -24,23 +24,23 @@ bool __mt76_poll(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__mt76_poll);
|
||||
|
||||
bool __mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
|
||||
int timeout)
|
||||
bool ____mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
|
||||
int timeout, int tick)
|
||||
{
|
||||
u32 cur;
|
||||
|
||||
timeout /= 10;
|
||||
timeout /= tick;
|
||||
do {
|
||||
cur = __mt76_rr(dev, offset) & mask;
|
||||
if (cur == val)
|
||||
return true;
|
||||
|
||||
usleep_range(10000, 20000);
|
||||
usleep_range(1000 * tick, 2000 * tick);
|
||||
} while (timeout-- > 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__mt76_poll_msec);
|
||||
EXPORT_SYMBOL_GPL(____mt76_poll_msec);
|
||||
|
||||
int mt76_wcid_alloc(u32 *mask, int size)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user