forked from len0rd/rockbox
Fix an error in the TCC NAND driver which caused a panic on startup for certain users.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21485 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4e3f39fc45
commit
5e24a2c98c
1 changed files with 7 additions and 5 deletions
|
@ -822,21 +822,23 @@ int nand_init(void)
|
||||||
16, spare_buf);
|
16, spare_buf);
|
||||||
|
|
||||||
int type = get_sector_type(spare_buf);
|
int type = get_sector_type(spare_buf);
|
||||||
|
|
||||||
|
#ifdef FTL_V2
|
||||||
if (type == SECTYPE_MAIN_INPLACE_CACHE)
|
if (type == SECTYPE_MAIN_INPLACE_CACHE)
|
||||||
{
|
{
|
||||||
/* Check last sector of sequential write cache block */
|
/* Since this type of segment is written to sequentially, its
|
||||||
|
job is complete if the final page has been written. In this
|
||||||
|
case we need to treat it as a normal data segment. */
|
||||||
nand_read_raw(bank, phys_segment_to_page_addr
|
nand_read_raw(bank, phys_segment_to_page_addr
|
||||||
(phys_segment, pages_per_segment - 1),
|
(phys_segment, pages_per_segment - 1),
|
||||||
nand_data->page_size + nand_data->spare_size - 16,
|
SECTOR_SIZE, 16, spare_buf);
|
||||||
16, spare_buf);
|
|
||||||
|
|
||||||
/* If last sector has been written, treat block as main data */
|
|
||||||
if (get_sector_type(spare_buf) != 0xff)
|
if (get_sector_type(spare_buf) != 0xff)
|
||||||
{
|
{
|
||||||
type = SECTYPE_MAIN_DATA;
|
type = SECTYPE_MAIN_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue