target/renesas: remove alignment checks

This commit is contained in:
Rafael Silva 2022-08-23 13:02:16 +01:00 committed by Rachel Mant
parent 3a28b58aa9
commit 78296deffb
1 changed files with 0 additions and 29 deletions

View File

@ -482,32 +482,6 @@ static int renesas_rv40_flash_erase(target_flash_s *f, target_addr_t addr, size_
/* code flash or data flash operation */ /* code flash or data flash operation */
const bool code_flash = addr < RENESAS_CF_END; const bool code_flash = addr < RENESAS_CF_END;
if (code_flash) {
/* align start address */
uint32_t start_align = 0;
if (addr < RV40_CF_REGION0_SIZE)
start_align = addr % RV40_CF_REGION0_BLOCK_SIZE;
else
start_align = addr % RV40_CF_REGION1_BLOCK_SIZE;
len += start_align;
addr -= start_align;
/* align len */
if (addr + len > RV40_CF_REGION0_SIZE)
len += RV40_CF_REGION1_BLOCK_SIZE - len % RV40_CF_REGION1_BLOCK_SIZE;
else
len += RV40_CF_REGION0_BLOCK_SIZE - len % RV40_CF_REGION0_BLOCK_SIZE;
} else {
/* align start address */
const uint32_t start_align = addr % RV40_DF_BLOCK_SIZE;
len += start_align;
addr -= start_align;
/* align len */
len += RV40_DF_BLOCK_SIZE - len % RV40_DF_BLOCK_SIZE;
}
if (!(target_mem_read32(t, RV40_FSTATR) & RV40_FSTATR_RDY) || target_mem_read16(t, RV40_FENTRYR) != 0) { if (!(target_mem_read32(t, RV40_FSTATR) & RV40_FSTATR_RDY) || target_mem_read16(t, RV40_FENTRYR) != 0) {
DEBUG_WARN("flash is not ready, may be hanging mid unfinished command due to something going wrong, " DEBUG_WARN("flash is not ready, may be hanging mid unfinished command due to something going wrong, "
"please power on reset the device\n"); "please power on reset the device\n");
@ -580,9 +554,6 @@ static int renesas_rv40_flash_write(target_flash_s *f, target_addr_t dest, const
/* write size for code flash / data flash */ /* write size for code flash / data flash */
const uint8_t write_size = code_flash ? RV40_CF_WRITE_SIZE : RV40_DF_WRITE_SIZE; const uint8_t write_size = code_flash ? RV40_CF_WRITE_SIZE : RV40_DF_WRITE_SIZE;
if (dest % write_size || len % write_size) /* dest/len must be aligned to write_size */
return -1;
if (!(target_mem_read32(t, RV40_FSTATR) & RV40_FSTATR_RDY) || target_mem_read16(t, RV40_FENTRYR) != 0) { if (!(target_mem_read32(t, RV40_FSTATR) & RV40_FSTATR_RDY) || target_mem_read16(t, RV40_FENTRYR) != 0) {
DEBUG_WARN("flash is not ready, may be hanging mid unfinished command due to something going wrong, " DEBUG_WARN("flash is not ready, may be hanging mid unfinished command due to something going wrong, "
"please power on reset the device\n"); "please power on reset the device\n");