1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-01 16:25:20 +02:00

qi-export-s3c2442-nand-bad-block-check.patch

At least GTA02 specific code is now interested in bad blocks.
Rename the function and export it.

Signed-off-by: Andy Green <andy@openmoko.com>
This commit is contained in:
Andy Green 2009-02-03 18:06:36 +00:00 committed by Andy Green
parent a1af68434b
commit 53279b5983

View File

@ -56,11 +56,12 @@ static inline void nand_wait(void)
#define NAND_BLOCK_MASK (NAND_PAGE_SIZE - 1) #define NAND_BLOCK_MASK (NAND_PAGE_SIZE - 1)
#define NAND_BLOCK_SIZE (NAND_PAGE_SIZE * 64) #define NAND_BLOCK_SIZE (NAND_PAGE_SIZE * 64)
static int is_bad_block(unsigned long block_index) int s3c2442_nand_is_bad_block(unsigned long block_index)
{ {
unsigned char data; unsigned char data;
unsigned long page_num; unsigned long page_num;
nand_select();
nand_clear_RnB(); nand_clear_RnB();
page_num = block_index >> 2; /* addr / 2048 */ page_num = block_index >> 2; /* addr / 2048 */
NFCMD = NAND_CMD_READ0; NFCMD = NAND_CMD_READ0;
@ -130,8 +131,8 @@ int nand_read_ll(unsigned char *buf, unsigned long start_block512,
; ;
while (blocks512 > 0) { while (blocks512 > 0) {
if (is_bad_block(start_block512) || if (s3c2442_nand_is_bad_block(start_block512) ||
is_bad_block(start_block512 + 4)) { s3c2442_nand_is_bad_block(start_block512 + 4)) {
start_block512 += 4; start_block512 += 4;
blocks512 += 4; blocks512 += 4;
if (bad_count++ == 4) if (bad_count++ == 4)