1189 spin_unlock(chip->mutex);
1190 if (inval_len)
1191 INVALIDATE_CACHED_RANGE(map, inval_adr, inval_len);
1192 spin_lock(chip->mutex);
1193
1194 timeo = chip_op_time_max;
1195 if (!timeo)
1196 timeo = 500000;
1197 reset_timeo = timeo;
1198 sleep_time = chip_op_time / 2;
1199
1200 for (;;) {
1201 status = map_read(map, cmd_adr);
1202 if (map_word_andequal(map, status, status_OK, status_OK))
1203 break;
1204
1205 if (!timeo) {
1206 map_write(map, CMD(0x70), cmd_adr);
1207 chip->state = FL_STATUS;
1208 return -ETIME;
1209 }
1210
1211
1212 spin_unlock(chip->mutex);
1213 if (sleep_time >= 1000000/HZ) {
1214
1215
1216
1217
1218
1219 msleep(sleep_time/1000);
1220 timeo -= sleep_time;
1221 sleep_time = 1000000/HZ;
1222 } else {
1223 udelay(1);
1224 cond_resched();
1225 timeo--;
1226 }
1227 spin_lock(chip->mutex);
1228
1229 while (chip->state != chip_state) {