.. | .. |
---|
83 | 83 | !(data & HW_CFG_LRST_), 100000, 10000000); |
---|
84 | 84 | } |
---|
85 | 85 | |
---|
| 86 | +static int lan743x_csr_wait_for_bit_atomic(struct lan743x_adapter *adapter, |
---|
| 87 | + int offset, u32 bit_mask, |
---|
| 88 | + int target_value, int udelay_min, |
---|
| 89 | + int udelay_max, int count) |
---|
| 90 | +{ |
---|
| 91 | + u32 data; |
---|
| 92 | + |
---|
| 93 | + return readx_poll_timeout_atomic(LAN743X_CSR_READ_OP, offset, data, |
---|
| 94 | + target_value == !!(data & bit_mask), |
---|
| 95 | + udelay_max, udelay_min * count); |
---|
| 96 | +} |
---|
| 97 | + |
---|
86 | 98 | static int lan743x_csr_wait_for_bit(struct lan743x_adapter *adapter, |
---|
87 | 99 | int offset, u32 bit_mask, |
---|
88 | 100 | int target_value, int usleep_min, |
---|
.. | .. |
---|
678 | 690 | u32 dp_sel; |
---|
679 | 691 | int i; |
---|
680 | 692 | |
---|
681 | | - if (lan743x_csr_wait_for_bit(adapter, DP_SEL, DP_SEL_DPRDY_, |
---|
682 | | - 1, 40, 100, 100)) |
---|
| 693 | + if (lan743x_csr_wait_for_bit_atomic(adapter, DP_SEL, DP_SEL_DPRDY_, |
---|
| 694 | + 1, 40, 100, 100)) |
---|
683 | 695 | return -EIO; |
---|
684 | 696 | dp_sel = lan743x_csr_read(adapter, DP_SEL); |
---|
685 | 697 | dp_sel &= ~DP_SEL_MASK_; |
---|
.. | .. |
---|
690 | 702 | lan743x_csr_write(adapter, DP_ADDR, addr + i); |
---|
691 | 703 | lan743x_csr_write(adapter, DP_DATA_0, buf[i]); |
---|
692 | 704 | lan743x_csr_write(adapter, DP_CMD, DP_CMD_WRITE_); |
---|
693 | | - if (lan743x_csr_wait_for_bit(adapter, DP_SEL, DP_SEL_DPRDY_, |
---|
694 | | - 1, 40, 100, 100)) |
---|
| 705 | + if (lan743x_csr_wait_for_bit_atomic(adapter, DP_SEL, |
---|
| 706 | + DP_SEL_DPRDY_, |
---|
| 707 | + 1, 40, 100, 100)) |
---|
695 | 708 | return -EIO; |
---|
696 | 709 | } |
---|
697 | 710 | |
---|