diff options
Diffstat (limited to 'drivers/net/qlge')
-rw-r--r-- | drivers/net/qlge/qlge_main.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index ed7138d07bad..bc04aebc9289 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -3129,36 +3129,23 @@ static int ql_adapter_initialize(struct ql_adapter *qdev) | |||
3129 | static int ql_adapter_reset(struct ql_adapter *qdev) | 3129 | static int ql_adapter_reset(struct ql_adapter *qdev) |
3130 | { | 3130 | { |
3131 | u32 value; | 3131 | u32 value; |
3132 | int max_wait_time; | ||
3133 | int status = 0; | 3132 | int status = 0; |
3134 | int resetCnt = 0; | 3133 | unsigned long end_jiffies = jiffies + |
3134 | max((unsigned long)1, usecs_to_jiffies(30)); | ||
3135 | 3135 | ||
3136 | #define MAX_RESET_CNT 1 | ||
3137 | issueReset: | ||
3138 | resetCnt++; | ||
3139 | QPRINTK(qdev, IFDOWN, DEBUG, "Issue soft reset to chip.\n"); | ||
3140 | ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); | 3136 | ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); |
3141 | /* Wait for reset to complete. */ | 3137 | |
3142 | max_wait_time = 3; | ||
3143 | QPRINTK(qdev, IFDOWN, DEBUG, "Wait %d seconds for reset to complete.\n", | ||
3144 | max_wait_time); | ||
3145 | do { | 3138 | do { |
3146 | value = ql_read32(qdev, RST_FO); | 3139 | value = ql_read32(qdev, RST_FO); |
3147 | if ((value & RST_FO_FR) == 0) | 3140 | if ((value & RST_FO_FR) == 0) |
3148 | break; | 3141 | break; |
3142 | cpu_relax(); | ||
3143 | } while (time_before(jiffies, end_jiffies)); | ||
3149 | 3144 | ||
3150 | ssleep(1); | ||
3151 | } while ((--max_wait_time)); | ||
3152 | if (value & RST_FO_FR) { | 3145 | if (value & RST_FO_FR) { |
3153 | QPRINTK(qdev, IFDOWN, ERR, | 3146 | QPRINTK(qdev, IFDOWN, ERR, |
3154 | "Stuck in SoftReset: FSC_SR:0x%08x\n", value); | ||
3155 | if (resetCnt < MAX_RESET_CNT) | ||
3156 | goto issueReset; | ||
3157 | } | ||
3158 | if (max_wait_time == 0) { | ||
3159 | status = -ETIMEDOUT; | ||
3160 | QPRINTK(qdev, IFDOWN, ERR, | ||
3161 | "ETIMEOUT!!! errored out of resetting the chip!\n"); | 3147 | "ETIMEOUT!!! errored out of resetting the chip!\n"); |
3148 | status = -ETIMEDOUT; | ||
3162 | } | 3149 | } |
3163 | 3150 | ||
3164 | return status; | 3151 | return status; |