diff options
author | Hou Zhiqiang <Zhiqiang.Hou@nxp.com> | 2017-03-17 16:12:30 +0800 |
---|---|---|
committer | York Sun <york.sun@nxp.com> | 2017-03-28 10:38:37 -0700 |
commit | d72158c045eacf5022b052bdc56a32bc98c89034 (patch) | |
tree | fc211bb1bae84d84a9ecb5482d625152ec57ac34 /drivers | |
parent | 132a1468dcc0bb79553bf2e219014cc8c527c8e6 (diff) |
mtd: nand: add initialization flag
Add initialization flag to avoid initializing NAND Flash multiple
times, otherwise it will calculate a wrong total size.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/nand/nand.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c index 05512412b9..3ea2dcfb73 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 |