From 3352b265e68bf6f7e1e75325f6034c3301380004 Mon Sep 17 00:00:00 2001 From: Rob Purchase Date: Tue, 15 Jul 2008 21:32:20 +0000 Subject: [PATCH] Update the Telechips NAND driver to use the nand_identify() function introduced in r18052. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18063 a1c6a512-1295-4272-9138-f99709370657 --- firmware/SOURCES | 5 +++ firmware/target/arm/ata-nand-telechips.c | 56 +++++------------------- 2 files changed, 16 insertions(+), 45 deletions(-) diff --git a/firmware/SOURCES b/firmware/SOURCES index 99e880c19a..e6ff82d4a9 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -975,6 +975,7 @@ target/arm/pnx0101/pcm-pnx0101.c #ifdef LOGIK_DAX #ifndef SIMULATOR +drivers/nand_id.c target/arm/ata-nand-telechips.c target/arm/tcc77x/adc-tcc77x.c target/arm/tcc77x/kernel-tcc77x.c @@ -994,6 +995,7 @@ target/arm/tcc77x/pcm-tcc77x.c #ifdef SANSA_M200 #ifndef SIMULATOR +drivers/nand_id.c target/arm/ata-nand-telechips.c target/arm/tcc77x/adc-tcc77x.c target/arm/tcc77x/kernel-tcc77x.c @@ -1013,6 +1015,7 @@ target/arm/tcc77x/pcm-tcc77x.c #ifdef SANSA_C100 #ifndef SIMULATOR +drivers/nand_id.c target/arm/ata-nand-telechips.c target/arm/tcc77x/adc-tcc77x.c target/arm/tcc77x/kernel-tcc77x.c @@ -1032,6 +1035,7 @@ target/arm/tcc77x/pcm-tcc77x.c #ifdef IAUDIO_7 #ifndef SIMULATOR +drivers/nand_id.c target/arm/ata-nand-telechips.c target/arm/tcc77x/adc-tcc77x.c target/arm/tcc77x/system-tcc77x.c @@ -1042,6 +1046,7 @@ target/arm/tcc77x/iaudio7/power-iaudio7.c #ifdef COWON_D2 #ifndef SIMULATOR +drivers/nand_id.c drivers/pcf50606.c target/arm/lcd-as-memframe.S target/arm/ata-nand-telechips.c diff --git a/firmware/target/arm/ata-nand-telechips.c b/firmware/target/arm/ata-nand-telechips.c index fc4418cc44..b6ecab6091 100644 --- a/firmware/target/arm/ata-nand-telechips.c +++ b/firmware/target/arm/ata-nand-telechips.c @@ -24,6 +24,7 @@ #include #include "led.h" #include "panic.h" +#include "nand_id.h" /* The NAND driver is currently work-in-progress and as such contains some dead code and debug stuff, such as the next few lines. */ @@ -378,57 +379,22 @@ static void nand_get_chip_info(void) manuf_id = id_buf[0]; - switch (manuf_id) - { - case 0xEC: /* SAMSUNG */ + /* Identify the chip geometry */ + struct nand_info* nand_data = nand_identify(id_buf); - switch(id_buf[1]) /* Chip Id */ - { - case 0xD3: /* K9K8G08UOM */ - - page_size = 2048; - spare_size = 64; - pages_per_block = 64; - blocks_per_bank = 8192; - col_cycles = 2; - row_cycles = 3; - - found = true; - break; - - case 0xD5: /* K9LAG08UOM */ - - page_size = 2048; - spare_size = 64; - pages_per_block = 128; - blocks_per_bank = 8192; - col_cycles = 2; - row_cycles = 3; - - found = true; - break; - - case 0xD7: /* K9LBG08UOM */ - - page_size = 4096; - spare_size = 128; - pages_per_block = 128; - blocks_per_bank = 8192; - col_cycles = 2; - row_cycles = 3; - - found = true; - break; - } - break; - } - - if (!found) + if (nand_data == NULL) { panicf("Unknown NAND: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x", id_buf[0],id_buf[1],id_buf[2],id_buf[3],id_buf[4]); } + page_size = nand_data->page_size; + spare_size = nand_data->spare_size; + pages_per_block = nand_data->pages_per_block; + blocks_per_bank = nand_data->blocks_per_bank; + col_cycles = nand_data->col_cycles; + row_cycles = nand_data->row_cycles; + pages_per_bank = blocks_per_bank * pages_per_block; segments_per_bank = blocks_per_bank / BLOCKS_PER_SEGMENT; bytes_per_segment = page_size * pages_per_block * BLOCKS_PER_SEGMENT;