From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kumar Gala Date: Fri, 4 Feb 2011 15:14:41 -0600 Subject: [U-Boot] [PATCH v3] powerpc/8xxx: Fix LAW init to respect pre-initialized entries In-Reply-To: <1296786961-27216-1-git-send-email-galak@kernel.crashing.org> References: <1296786961-27216-1-git-send-email-galak@kernel.crashing.org> Message-ID: <1296854081-10176-1-git-send-email-galak@kernel.crashing.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- * Fix problem in non-NAND case we didn't set the law_table 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 63c08bf..e440d29 100644 --- a/drivers/misc/fsl_law.c +++ b/drivers/misc/fsl_law.c @@ -24,6 +24,7 @@ */ #include +#include #include #include @@ -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, -- 1.7.2.3