}
uint8_t status;
- retval = cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->block_erase_timeout_typ),
- &status);
+ retval = cfi_intel_wait_status_busy(bank, cfi_info->block_erase_timeout, &status);
if (retval != ERROR_OK)
return retval;
return retval;
}
- if (cfi_spansion_wait_status_busy(bank,
- 1000 * (1 << cfi_info->block_erase_timeout_typ)) == ERROR_OK)
+ if (cfi_spansion_wait_status_busy(bank, cfi_info->block_erase_timeout) == ERROR_OK)
{
bank->sectors[i].is_erased = 1;
}
}
uint8_t status;
- retval = cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->word_write_timeout_max),
- &status);
+ retval = cfi_intel_wait_status_busy(bank, cfi_info->word_write_timeout, &status);
if (retval != 0x80)
{
if ((retval = cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x0))) != ERROR_OK)
return retval;
}
uint8_t status;
- retval = cfi_intel_wait_status_busy(bank,
- 1000 * (1 << cfi_info->buf_write_timeout_max), &status);
+ retval = cfi_intel_wait_status_busy(bank, cfi_info->buf_write_timeout, &status);
if (retval != ERROR_OK)
return retval;
if (status != 0x80)
return retval;
}
- retval = cfi_intel_wait_status_busy(bank,
- 1000 * (1 << cfi_info->buf_write_timeout_max), &status);
+ retval = cfi_intel_wait_status_busy(bank, cfi_info->buf_write_timeout, &status);
if (retval != ERROR_OK)
return retval;
return retval;
}
- if (cfi_spansion_wait_status_busy(bank,
- 1000 * (1 << cfi_info->word_write_timeout_max)) != ERROR_OK)
+ if (cfi_spansion_wait_status_busy(bank, cfi_info->word_write_timeout) != ERROR_OK)
{
if ((retval = cfi_send_command(bank, 0xf0, flash_address(bank, 0, 0x0))) != ERROR_OK)
{
}
/* Write buffer wordcount-1 and data words */
- if ((retval = cfi_send_command(bank,
- bufferwsize-1, address)) != ERROR_OK)
+ if ((retval = cfi_send_command(bank, bufferwsize-1, address)) != ERROR_OK)
{
return retval;
}
return retval;
}
- if (cfi_spansion_wait_status_busy(bank,
- 1000 * (1 << cfi_info->word_write_timeout_max)) != ERROR_OK)
+ if (cfi_spansion_wait_status_busy(bank, cfi_info->buf_write_timeout) != ERROR_OK)
{
if ((retval = cfi_send_command(bank, 0xf0,
flash_address(bank, 0, 0x0))) != ERROR_OK)
(1 << cfi_info->block_erase_timeout_max) * (1 << cfi_info->block_erase_timeout_typ),
(1 << cfi_info->chip_erase_timeout_max) * (1 << cfi_info->chip_erase_timeout_typ));
+ /* convert timeouts to real values in ms */
+ cfi_info->word_write_timeout = DIV_ROUND_UP((1 << cfi_info->word_write_timeout_typ) *
+ (1 << cfi_info->word_write_timeout_max), 1000);
+ cfi_info->buf_write_timeout = DIV_ROUND_UP((1 << cfi_info->buf_write_timeout_typ) *
+ (1 << cfi_info->buf_write_timeout_max), 1000);
+ cfi_info->block_erase_timeout = (1 << cfi_info->block_erase_timeout_typ) *
+ (1 << cfi_info->block_erase_timeout_max);
+ cfi_info->chip_erase_timeout = (1 << cfi_info->chip_erase_timeout_typ) *
+ (1 << cfi_info->chip_erase_timeout_max);
+
+ LOG_DEBUG("calculated word write timeout: %u ms, buf write timeout: %u ms, "
+ "block erase timeout: %u ms, chip erase timeout: %u ms",
+ cfi_info->word_write_timeout, cfi_info->buf_write_timeout,
+ cfi_info->block_erase_timeout, cfi_info->chip_erase_timeout);
+
uint8_t data;
retval = cfi_query_u8(bank, 0, 0x27, &data);
if (retval != ERROR_OK)