1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-26 12:02:50 +02:00

qi-fix-block-init-cache-logic.patch

Changes in the last couple of weeks aimed at cleaning this
code broke the block device init cache logic.  This patch
restores the logic and reduces the card init failures when
there is no SD Card present to 1 regardless of the number
of partitions probed on the card.

Together with the reduction in Glamo card wait on init this
reduces the delay before trying NAND to 1/9th of before the
patches.

Signed-off-by: Andy Green <andy@openmoko.com>
This commit is contained in:
Andy Green 2009-02-01 19:28:18 +00:00 committed by Andy Green
parent f3c740f11c
commit a1af68434b

View File

@ -103,28 +103,32 @@ static int do_block_init(void)
{ {
static void * last_block_init = NULL; static void * last_block_init = NULL;
static int last_block_init_result = 0; static int last_block_init_result = 0;
int fresh = 0;
/* if this device needs initializing, try to init it */ /* if this device needs initializing, try to init it */
if (!this_kernel->block_init) if (!this_kernel->block_init)
return 1; return 1; /* happy */
/* /*
* cache result to limit attempts for same * cache result to limit attempts for same
* block device to one time * block device to one time
*/ */
if (this_kernel->block_init != last_block_init) if (this_kernel->block_init != last_block_init) {
last_block_init = this_kernel->block_init;
last_block_init_result = (this_kernel->block_init)(); last_block_init_result = (this_kernel->block_init)();
fresh = 1;
}
if (last_block_init_result) { if (last_block_init_result) {
puts("block device init failed\n"); puts("block device init failed\n");
if (this_kernel->block_init != last_block_init) if (fresh)
indicate(UI_IND_MOUNT_FAIL); indicate(UI_IND_MOUNT_FAIL);
last_block_init = NULL;
return 0; return 0; /* failed */
} }
last_block_init = this_kernel->block_init; last_block_init = this_kernel->block_init;
return 1; return 1; /* happy */
} }
static int do_partitions(void *kernel_dram) static int do_partitions(void *kernel_dram)