> -----Original Message-----
> From: U-Boot [mailto:[email protected]] On Behalf Of Zhiqiang
> Hou
> Sent: Friday, March 03, 2017 7:01 PM
> To: [email protected]; [email protected]; york sun <[email protected]>;
> [email protected]; [email protected]; Xiaobo Xie
> <[email protected]>
> Cc: Z.Q. Hou <[email protected]>
> Subject: [U-Boot] [PATCH 1/5] mtd: nand: add initialization flag
> 
> From: Hou Zhiqiang <[email protected]>
> 
> Add initialization flag to avoid initializing NAND Flash multiple
> times, otherwise it will calculate a wrong total size.
> 
> Signed-off-by: Hou Zhiqiang <[email protected]>
> ---
>  drivers/mtd/nand/nand.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c
> index 0551241..3ea2dcf 100644
> --- a/drivers/mtd/nand/nand.c
> +++ b/drivers/mtd/nand/nand.c
> @@ -133,6 +133,16 @@ static void create_mtd_concat(void)
> 
>  void nand_init(void)
>  {
> +     static int initialized;
> +
> +     /*
> +      * Avoid initializing NAND Flash multiple times,
> +      * otherwise it will calculate a wrong total size.
> +      */
> +     if (initialized)
> +             return;
> +     initialized = 1;
> +
>  #ifdef CONFIG_SYS_NAND_SELF_INIT
>       board_nand_init();
>  #else

If I am correct, above has done to avoid nand_init() if already done from SPL 
boot. 
I will suggest to use compile time option to skip nand_init from board_r.c 
instead of global variable

--prabhakar 





_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

Reply via email to