2 * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
3 * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
17 int mt7601u_wait_asic_ready(struct mt7601u_dev *dev)
23 if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
26 val = mt7601u_rr(dev, MT_MAC_CSR0);
36 bool mt76_poll(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val,
43 if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
46 cur = mt7601u_rr(dev, offset) & mask;
51 } while (timeout-- > 0);
53 dev_err(dev->dev, "Error: Time out with reg %08x\n", offset);
58 bool mt76_poll_msec(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val,
65 if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
68 cur = mt7601u_rr(dev, offset) & mask;
73 } while (timeout-- > 0);
75 dev_err(dev->dev, "Error: Time out with reg %08x\n", offset);