Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- drivers/net/e1000/e1000.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index 291e64d..5e24758 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h @@ -2176,5 +2176,24 @@ static inline uint32_t e1000_read_reg(struct e1000_hw *hw, uint32_t reg) } +static inline int e1000_poll_reg(struct e1000_hw *hw, uint32_t reg, + uint32_t mask, uint32_t value, + uint64_t timeout) +{ + const uint64_t start = get_time_ns(); + + do { + const uint32_t v = e1000_read_reg(hw, reg); + + if ((v & mask) == value) + return 0; + + } while (!is_timeout(start, timeout)); + + return -ETIMEDOUT; +} + +#define E1000_POLL_REG(a, reg, mask, value, timeout) \ + e1000_poll_reg((a), E1000_##reg, (mask), (value), (timeout)) #endif /* _E1000_HW_H_ */ -- 2.5.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox