[U-Boot] [PATCH v2] AT91SAM9XE add embedded flash support
Reinhard Meyer
u-boot at emk-elektronik.de
Mon Aug 9 07:13:50 CEST 2010
Wolfgang Denk wrote:
> Dear "Reinhard Meyer (-VC)",
>
> In message <4C400E81.8070208 at emk-elektronik.de> you wrote:
>> Add support for the embedded flash in the AT91SAM9XE128/256/512 SoCs:
>> - Environment can be put into that flash
>> - U-Boot can be in that flash
>> - Commands "cp" and "protect" are supported
>>
>> Signed-off-by: Reinhard Meyer <reinhard.meyer at emk-elektronik.de>
>
>> + for (i=0; i<nlocks; i++) {
>> + tmp = readl(&eefc->frr); /* words 4+nplanes+1.. */
>> + flash_info[0].start[i] = addr;
>> + flash_info[0].protect[i] = 0;
>> + addr += tmp;
>> + };
>
> No ';' here.
OK, why thats there in the first place i don't know :)
The rest here I copied from existing flash code,
it would need fixing there as well :)
>
>> + if (info->size >= (1 << 20)) {
>> + i = 20;
>> + } else {
>> + i = 10;
>> + }
>
> No braces needed for single line statements.
>
>> + printf(" Size: %ld %cB in %d Sectors\n",
>> + info->size >> i,
>> + (i == 20) ? 'M' : 'k',
>> + info->sector_count);
>
> Please use available functions to print sizes like that (and always
> use SI units, i. e. MiB and KiB if that's what you mean).
>
>> +int flash_erase (flash_info_t *info, int s_first, int s_last)
>> +{
>> + DEBUGF("erase first=%d last=%d\n", s_first, s_last);
>> + return 0;
>> +}
>
> Is this complete?
That embedded flash does not need to be erased. In fact it
does not have a sector erase command. Only "erase and
write page" (512 bytes).
The function needs to be there for linking the code.
See in the comments at the beginning of the file:
* Each page in a sector can be rewritten anytime.
* Since pages are erased when written, the "erase" does nothing.
I could write the sectors with 0xff or print a message
"erasing the embedded flash not required".
Btw... you missed that debug() should probably be used :)
So, simple question: how do I get a new patch against the original
state after editing the file? commit + format-patch master does
not do the trick. It produces a patch with the new changes only.
Reinhard
More information about the U-Boot
mailing list