summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c15
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c8
2 files changed, 17 insertions, 6 deletions
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
index e4abcafba8..15c97ccb0d 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
@@ -1778,6 +1778,8 @@ uint32_t ftl_sync(void)
uint32_t ppb = (*ftl_nand_type).pagesperblock * ftl_banks;
if (ftl_cxt.clean_flag == 1) return 0;
+ mutex_lock(&ftl_mtx);
+
if (ftl_cxt.swapcounter >= 20)
for (i = 0; i < 4; i++)
if (ftl_swap_blocks() == 0)
@@ -1793,10 +1795,19 @@ uint32_t ftl_sync(void)
rc |= ftl_commit_sequential(&ftl_log[i]);
else rc |= ftl_commit_scattered(&ftl_log[i]);
}
- if (rc != 0) return 1;
+ if (rc != 0)
+ {
+ mutex_unlock(&ftl_mtx);
+ return 1;
+ }
for (i = 0; i < 5; i++)
- if (ftl_commit_cxt() == 0) return 0;
+ if (ftl_commit_cxt() == 0)
+ {
+ mutex_unlock(&ftl_mtx);
+ return 0;
+ }
else ftl_cxt.ftlctrlpage |= ppb - 1;
+ mutex_unlock(&ftl_mtx);
return 1;
}
#endif
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c
index 302ffdee21..795e489258 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c
@@ -312,6 +312,7 @@ uint32_t nand_read_page(uint32_t bank, uint32_t page, void* databuffer,
if (databuffer != 0)
if (nand_transfer_data(bank, 0, nand_uncached_data, 0x800) != 0)
return nand_unlock(1);
+ rc = 0;
if (doecc == 0)
{
memcpy(databuffer, nand_uncached_data, 0x800);
@@ -321,11 +322,10 @@ uint32_t nand_read_page(uint32_t bank, uint32_t page, void* databuffer,
return nand_unlock(1);
memcpy(sparebuffer, nand_uncached_spare, 0x800);
if (checkempty != 0)
- return nand_check_empty((uint8_t*)sparebuffer) << 1;
+ rc = nand_check_empty((uint8_t*)sparebuffer) << 1;
}
- return nand_unlock(0);
+ return nand_unlock(rc);
}
- rc = 0;
if (nand_transfer_data(bank, 0, nand_uncached_spare, 0x40) != 0)
return nand_unlock(1);
memcpy(nand_uncached_ecc, &nand_uncached_spare[0xC], 0x28);
@@ -377,7 +377,7 @@ uint32_t nand_write_page(uint32_t bank, uint32_t page, void* databuffer,
if (nand_transfer_data(bank, 1, nand_uncached_spare, 0x40) != 0)
return nand_unlock(1);
if (nand_send_cmd(NAND_CMD_PROGCNFRM) != 0) return nand_unlock(1);
- return nand_wait_status_ready(bank);
+ return nand_unlock(nand_wait_status_ready(bank));
}
uint32_t nand_block_erase(uint32_t bank, uint32_t page)