From ddb5176999cc892082f4ee5676253685a8975d63 Mon Sep 17 00:00:00 2001 From: rob Date: Wed, 24 Jun 2009 07:36:56 +0000 Subject: [PATCH] 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 --- firmware/target/arm/ata-nand-telechips.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/target/arm/ata-nand-telechips.c b/firmware/target/arm/ata-nand-telechips.c index ceabf9616..30ca302ce 100644 --- a/firmware/target/arm/ata-nand-telechips.c +++ b/firmware/target/arm/ata-nand-telechips.c @@ -822,21 +822,23 @@ int nand_init(void) 16, spare_buf); int type = get_sector_type(spare_buf); - + +#ifdef FTL_V2 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 (phys_segment, pages_per_segment - 1), - nand_data->page_size + nand_data->spare_size - 16, - 16, spare_buf); + SECTOR_SIZE, 16, spare_buf); - /* If last sector has been written, treat block as main data */ if (get_sector_type(spare_buf) != 0xff) { type = SECTYPE_MAIN_DATA; } } +#endif switch (type) { -- 2.11.4.GIT