* [U-Boot] ARM Versatile port - possibly inefficient code?
@ 2008-09-30 6:40 Roman Mashak
2008-09-30 10:10 ` Hebbar
0 siblings, 1 reply; 3+ messages in thread
From: Roman Mashak @ 2008-09-30 6:40 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 3+ messages in thread* [U-Boot] ARM Versatile port - possibly inefficient code? 2008-09-30 6:40 [U-Boot] ARM Versatile port - possibly inefficient code? Roman Mashak @ 2008-09-30 10:10 ` Hebbar 2008-09-30 11:19 ` Roman Mashak 0 siblings, 1 reply; 3+ messages in thread From: Hebbar @ 2008-09-30 10:10 UTC (permalink / raw) To: u-boot Hi, >>Regardless of CFG_MAX_FLASH_BANKS value, the only first bank is >>configured. Was it done deliberately or it's logical flaw? I think >>is code could cloned on a multiple of other platforms. ARM Versatile has only one flash bank. What if a user has configured an incorrect number for flash banks. The driver should take care of this properly. Since CFG_MAX_FLASH_BANKS is in a different place & the flash.c is a different file, care is taken to see that an incorrect bank is not considered for initialization also, >>panic ("configured too many flash banks!\n"); this error message clearly explains the mistake the user did. Regards Gururaja -- View this message in context: http://www.nabble.com/-U-Boot--ARM-Versatile-port---possibly-inefficient-code--tp19736928p19739341.html Sent from the Uboot - Users mailing list archive at Nabble.com. ^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] ARM Versatile port - possibly inefficient code? 2008-09-30 10:10 ` Hebbar @ 2008-09-30 11:19 ` Roman Mashak 0 siblings, 0 replies; 3+ messages in thread From: Roman Mashak @ 2008-09-30 11:19 UTC (permalink / raw) To: u-boot Hello 2008/9/30 Hebbar <gururajakr@sanyo.co.in>: > ARM Versatile has only one flash bank. > What if a user has configured an incorrect number for flash banks. Hm, I didn't think of it. > The driver should take care of this properly. Since CFG_MAX_FLASH_BANKS > is in a different place & the flash.c is a different file, care is taken to > see > that an incorrect bank is not considered for initialization Yes, that makes sense then. Thank you. -- Roman Mashak ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-30 11:19 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-09-30 6:40 [U-Boot] ARM Versatile port - possibly inefficient code? Roman Mashak 2008-09-30 10:10 ` Hebbar 2008-09-30 11:19 ` Roman Mashak
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.