diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2011-02-03 09:02:13 -0600 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2011-04-04 09:24:41 -0500 |
commit | 7639675131673e8f1582d760203a9af34fba9e79 (patch) | |
tree | 1f3ce78f0a6e0619804b5b15ee3e5a425750caaf /drivers/misc | |
parent | b6ccd2c9dee758a70e761403a41e60c31a1cfcec (diff) | |
download | u-boot-imx-7639675131673e8f1582d760203a9af34fba9e79.zip u-boot-imx-7639675131673e8f1582d760203a9af34fba9e79.tar.gz u-boot-imx-7639675131673e8f1582d760203a9af34fba9e79.tar.bz2 |
powerpc/8xxx: Fix LAW init to respect pre-initialized entries
If some pre-boot or earlier stage bootloader (NAND SPL) has setup LAW
entries consider them good and mark them used.
In the NAND SPL case we skip re-initializing based on the law_table
since the SPL phase already did that.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/fsl_law.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/misc/fsl_law.c b/drivers/misc/fsl_law.c index 031c974..3233ff2 100644 --- a/drivers/misc/fsl_law.c +++ b/drivers/misc/fsl_law.c @@ -24,6 +24,7 @@ */ #include <common.h> +#include <linux/compiler.h> #include <asm/fsl_law.h> #include <asm/io.h> @@ -246,6 +247,25 @@ void init_laws(void) #error FSL_HW_NUM_LAWS can not be greater than 32 w/o code changes #endif + /* + * Any LAWs that were set up before we booted assume they are meant to + * be around and mark them used. + */ + for (i = 0; i < FSL_HW_NUM_LAWS; i++) { + u32 lawar = in_be32(LAWAR_ADDR(i)); + + if (lawar & LAW_EN) + gd->used_laws |= (1 << i); + } + +#if defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL) + /* + * in NAND boot we've already parsed the law_table and setup those LAWs + * so don't do it again. + */ + return; +#endif + for (i = 0; i < num_law_entries; i++) { if (law_table[i].index == -1) set_next_law(law_table[i].addr, law_table[i].size, |