[U-Boot] [PATCH V8 3/9] omap-common: add nand spl support

Simon Schwarz simonschwarzcor at googlemail.com
Mon Aug 8 09:50:26 CEST 2011


Hi Aneesh,

On 08/05/2011 09:30 AM, Aneesh V wrote:
> Hi Simon,
>
> Sorry if my response is late. I was not in office for couple of days.

First day in office since vacation - so no you are not late ;)

>
> On Tuesday 02 August 2011 09:29 PM, Simon Schwarz wrote:
>> Add NAND support for the new SPL structure.
>>
>> Signed-off-by: Simon Schwarz<simonschwarzcor at gmail.com>
>> ---
>> This patch didn't exist before V2!
>>
>> V2 changes:
>> ADD Some define-barriers for OMAP3 to only use NAND
>> ADD nand_load_image() - inits the OMAP gpmc, loads the images - parses
>> the
>> header
>> CHG cosmetic
>> ADD do_reset() implementation for omap-common spl
>> ADD nand_copy_image to nand.h
>> ADD CPP barriers for mmc and nand support. The parts depending on library
>> support are only compiled if the respective library is included.
>>
>> V3 changes:
>> ADD Comment why setup_clocks_for_console() isn't called for OMAP3
>> CHG cosmetic (deleted empty line)
>> CHG rename of NAND_MODE_HW to NAND_MODE_HW_ECC
>> DEL NAND_MODE_SW. Not used.
>>
>> V4 changes:
>> CHG cosmetic - style problems
>>
>> V5 changes:
>> CHG renamed nand_copy_image to nand_spl_load_image
>> CHG offs paramter of nand_spl_load_image is of type loff_t now
>>
>> V6 changes:
>> ADD call to nand_deselect after loading the images
>> ADD nand_deselect to nand.h
>>
>> V7 changes:
>> DEL some CONFIG_SPL_* relying on garbage collection now
>> ADD mmc_load_image and nand_load_image now have
>> __attribute__((unused)) to
>> prevent warnings when the lib is not added to SPL
>> DEL do_reset() isn't used anymore
>> CHG header based loading in SPL
>>
>> V8 changes:
>> DEL nand_spl_read_page is replaced by nand_spl_load_image with
>> size=page size
>>
>> Transition from V1 to V2 also includes that this patch is now based on
>> - the new SPL layout by Aneesh V and Daniel Schwierzeck
>> - the OMAP4 SPL patches by Aneesh V
>> ---
>> arch/arm/cpu/armv7/omap-common/spl.c | 46
>> +++++++++++++++++++++++++++++++++-
>> arch/arm/include/asm/omap_common.h | 1 +
>> include/nand.h | 3 ++
>> 3 files changed, 49 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/cpu/armv7/omap-common/spl.c
>> b/arch/arm/cpu/armv7/omap-common/spl.c
>> index 1d301f4..53d10bf 100644
>> --- a/arch/arm/cpu/armv7/omap-common/spl.c
>> +++ b/arch/arm/cpu/armv7/omap-common/spl.c
>> @@ -26,6 +26,7 @@
>> #include<asm/u-boot.h>
>> #include<asm/utils.h>
>> #include<asm/arch/sys_proto.h>
>> +#include<nand.h>
>> #include<mmc.h>
>> #include<fat.h>
>> #include<timestamp_autogenerated.h>
>> @@ -173,7 +174,7 @@ end:
>> hang();
>> }
>> }
>> -
>> +static void mmc_load_image(void) __attribute__((unused));
>> static void mmc_load_image(void)
>> {
>> struct mmc *mmc;
>> @@ -207,12 +208,48 @@ static void mmc_load_image(void)
>> }
>> }
>>
>> +#ifdef CONFIG_SPL_NAND_SUPPORT
>> +static void nand_load_image(void) __attribute__ ((unused));
>> +static void nand_load_image(void)
>> +{
>> + struct image_header *header;
>> +
>> + gpmc_init();
>> + nand_init();
>> +
>> + /*use CONFIG_SYS_TEXT_BASE as temporary storage area */
>> + header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
>> +
>> +#ifdef CONFIG_NAND_ENV_DST
>> + nand_spl_load_image(CONFIG_ENV_OFFSET,
>> + CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
>> + parse_image_header(header);
>> + nand_spl_load_image(CONFIG_ENV_OFFSET, image_size,
>> + (void *)image_load_addr);
>> +#ifdef CONFIG_ENV_OFFSET_REDUND
>> + nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND,
>> + CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
>> + parse_image_header(header);
>> + nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, image_size,
>> + (void *)image_load_addr);
>> +#endif
>> +#endif
>
> Can you please explain the logic here. What are you loading here?

This is from the old nand_spl.c. AFAIK this is to load the environment 
from NAND to RAM. I kept this to not break boards using it - although 
there has to be some other mechanism for this because it is only used in 
smdk6400.h.

The REDUND part does the same for a redundant copy. (docs say: to have a 
working copy if power fails while doing saveenv).

>
> br,
> Aneesh

Regards
Simon


More information about the U-Boot mailing list