summaryrefslogtreecommitdiff
path: root/drivers/misc/fsl_law.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2011-04-05 12:24:20 +0200
committerWolfgang Denk <wd@denx.de>2011-04-05 12:24:20 +0200
commit4db2fa7f9446d0f2fe8db3d62184b1212fe22707 (patch)
treebc62cbfc14296551caebda626db7a90fef9ae844 /drivers/misc/fsl_law.c
parent75df0d594990875419121c6f8687472ac9f4ae7a (diff)
parent7d3053fbf16caad4745f42f7ae3e38e9d3e964b5 (diff)
downloadu-boot-imx-4db2fa7f9446d0f2fe8db3d62184b1212fe22707.zip
u-boot-imx-4db2fa7f9446d0f2fe8db3d62184b1212fe22707.tar.gz
u-boot-imx-4db2fa7f9446d0f2fe8db3d62184b1212fe22707.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
Conflicts: drivers/usb/host/ehci-pci.c Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'drivers/misc/fsl_law.c')
-rw-r--r--drivers/misc/fsl_law.c20
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,