Revert Nano2G fast VFL reads for now. They just won't work on some hardware.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25170 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c18e80e127
commit
7e4b53892e
2 changed files with 29 additions and 80 deletions
|
@ -863,65 +863,18 @@ uint32_t ftl_vfl_read_fast(uint32_t vpage, void* buffer, void* sparebuffer,
|
|||
panicf("FTL: Trying to read out-of-bounds vPage %u", (unsigned)vpage);
|
||||
//return 4;
|
||||
|
||||
uint32_t bank = abspage % ftl_banks;
|
||||
uint32_t block = abspage / ((*ftl_nand_type).pagesperblock * ftl_banks);
|
||||
uint32_t page = (abspage / ftl_banks) % (*ftl_nand_type).pagesperblock;
|
||||
if (bank)
|
||||
{
|
||||
for (i = 0; i < ftl_banks; i++)
|
||||
{
|
||||
void* databuf = (void*)0;
|
||||
void* sparebuf = (void*)0;
|
||||
if (buffer) databuf = (void*)((uint32_t)buffer + 0x800 * i);
|
||||
if (sparebuffer) sparebuf = (void*)((uint32_t)sparebuffer + 0x40 * i);
|
||||
uint32_t ret = ftl_vfl_read(vpage + i, databuf, sparebuf, checkempty, remaponfail);
|
||||
if (ret & 1) rc |= 1 << (i << 2);
|
||||
if (ret & 2) rc |= 2 << (i << 2);
|
||||
if (ret & 0x10) rc |= 4 << (i << 2);
|
||||
if (ret & 0x100) rc |= 8 << (i << 2);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
uint32_t physblock = ftl_vfl_get_physical_block(bank, block);
|
||||
uint32_t physpage = physblock * (*ftl_nand_type).pagesperblock + page;
|
||||
|
||||
rc = nand_read_page_fast(physpage, buffer, sparebuffer, 1, checkempty);
|
||||
if (!(rc & 0xdddd)) return rc;
|
||||
|
||||
for (i = 0; i < ftl_banks; i++)
|
||||
{
|
||||
if ((rc >> (i << 2)) & 0x2) continue;
|
||||
if ((rc >> (i << 2)) & 0xf)
|
||||
{
|
||||
nand_reset(i);
|
||||
uint32_t ret = nand_read_page(i, physpage,
|
||||
(void*)((uint32_t)buffer + 0x800 * i),
|
||||
(void*)((uint32_t)sparebuffer + 0x40 * i),
|
||||
1, checkempty);
|
||||
if ((ret & 0x11D) != 0 && (ret & 2) == 0)
|
||||
{
|
||||
nand_reset(i);
|
||||
ret = nand_read_page(i, physpage,
|
||||
(void*)((uint32_t)buffer + 0x800 * i),
|
||||
(void*)((uint32_t)sparebuffer + 0x40 * i),
|
||||
1, checkempty);
|
||||
#ifdef FTL_READONLY
|
||||
(void)remaponfail;
|
||||
#else
|
||||
if (remaponfail == 1 && (ret & 0x11D) != 0 && (ret & 2) == 0)
|
||||
panicf("FTL: VFL fast read failed, RC %04X, bank %d, RET %03X, base %d",
|
||||
rc, i, ret, vpage);
|
||||
// ftl_vfl_schedule_block_for_remap(i, block);
|
||||
#endif
|
||||
}
|
||||
rc &= ~(0xf << (i << 2));
|
||||
if (ret & 1) rc |= 1 << (i << 2);
|
||||
if (ret & 2) rc |= 2 << (i << 2);
|
||||
if (ret & 0x10) rc |= 4 << (i << 2);
|
||||
if (ret & 0x100) rc |= 8 << (i << 2);
|
||||
}
|
||||
void* databuf = (void*)0;
|
||||
void* sparebuf = (void*)0;
|
||||
if (buffer) databuf = (void*)((uint32_t)buffer + 0x800 * i);
|
||||
if (sparebuffer) sparebuf = (void*)((uint32_t)sparebuffer + 0x40 * i);
|
||||
uint32_t ret = ftl_vfl_read(vpage + i, databuf, sparebuf, checkempty, remaponfail);
|
||||
if (ret & 1) rc |= 1 << (i << 2);
|
||||
if (ret & 2) rc |= 2 << (i << 2);
|
||||
if (ret & 0x10) rc |= 4 << (i << 2);
|
||||
if (ret & 0x100) rc |= 8 << (i << 2);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -528,20 +528,28 @@ uint32_t nand_read_page_fast(uint32_t page, void* databuffer,
|
|||
nand_last_activity_value = current_tick;
|
||||
led(true);
|
||||
if (!nand_powered) nand_power_up();
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (nand_type[i] == 0xFFFFFFFF) continue;
|
||||
nand_set_fmctrl0(i, FMCTRL0_ENABLEDMA);
|
||||
if (nand_send_cmd(NAND_CMD_READ))
|
||||
{
|
||||
rc |= 1 << (i << 2);
|
||||
continue;
|
||||
}
|
||||
if (nand_send_address(page, databuffer ? 0 : 0x800))
|
||||
{
|
||||
rc |= 1 << (i << 2);
|
||||
continue;
|
||||
}
|
||||
if (nand_send_cmd(NAND_CMD_READ2))
|
||||
{
|
||||
rc |= 1 << (i << 2);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
uint8_t status[4];
|
||||
for (i = 0; i < 4; i++) status[i] = (nand_type[i] == 0xFFFFFFFF);
|
||||
if (!status[0])
|
||||
{
|
||||
nand_set_fmctrl0(0, FMCTRL0_ENABLEDMA);
|
||||
if (nand_send_cmd(NAND_CMD_READ))
|
||||
status[0] = 1;
|
||||
}
|
||||
if (!status[0])
|
||||
if (nand_send_address(page, 0))
|
||||
status[0] = 1;
|
||||
if (!status[0])
|
||||
if (nand_send_cmd(NAND_CMD_READ2))
|
||||
status[0] = 1;
|
||||
if (!status[0])
|
||||
if (nand_wait_status_ready(0))
|
||||
status[0] = 1;
|
||||
|
@ -553,18 +561,6 @@ uint32_t nand_read_page_fast(uint32_t page, void* databuffer,
|
|||
status[0] = 1;
|
||||
for (i = 1; i < 4; i++)
|
||||
{
|
||||
if (!status[i])
|
||||
{
|
||||
nand_set_fmctrl0(i, FMCTRL0_ENABLEDMA);
|
||||
if (nand_send_cmd(NAND_CMD_READ))
|
||||
status[i] = 1;
|
||||
}
|
||||
if (!status[i])
|
||||
if (nand_send_address(page, 0))
|
||||
status[i] = 1;
|
||||
if (!status[i])
|
||||
if (nand_send_cmd(NAND_CMD_READ2))
|
||||
status[i] = 1;
|
||||
if (!status[i])
|
||||
if (nand_wait_status_ready(i))
|
||||
status[i] = 1;
|
||||
|
|
Loading…
Reference in a new issue