[U-Boot] ARM Versatile port - possibly inefficient code?

Roman Mashak romez777 at gmail.com
Tue Sep 30 08:40:50 CEST 2008


Hello

Investigating the code for ARM Versatile port, I've found this weird
piece of code. If you look in $(UBOOT)/board/versatile/flash.c, line
100, flash_init() :

unsigned long flash_init (void)
{
    int i;
    ulong size = 0;
    for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
        switch (i) {
        case 0:
                flash_vpp(1);
            flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]);
            flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
            flash_vpp(0);
            break;
        default:
            panic ("configured too many flash banks!\n");
            break;
        }
        size += flash_info[i].size;
    }
.....

}

Regardless of CFG_MAX_FLASH_BANKS value, the only first bank is
configured. Was it done deliberately or it's logical flaw? I think
this code could cloned on a multiple of other platforms.

-- 
Roman Mashak


More information about the U-Boot mailing list