public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] powerpc/8xxx: Fix LAW init to respect pre-initialized entries
@ 2011-02-04  2:36 Kumar Gala
  2011-02-04  3:52 ` Timur Tabi
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kumar Gala @ 2011-02-04  2:36 UTC (permalink / raw)
  To: u-boot

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>
---
 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..52b6666 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 where setup 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);
+	}
+
+#ifndef 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] powerpc/8xxx: Fix LAW init to respect pre-initialized entries
  2011-02-04  2:36 [U-Boot] [PATCH] powerpc/8xxx: Fix LAW init to respect pre-initialized entries Kumar Gala
@ 2011-02-04  3:52 ` Timur Tabi
  2011-02-04 20:43 ` [U-Boot] [PATCH v2] " Kumar Gala
  2011-02-04 21:14 ` [U-Boot] [PATCH v3] " Kumar Gala
  2 siblings, 0 replies; 5+ messages in thread
From: Timur Tabi @ 2011-02-04  3:52 UTC (permalink / raw)
  To: u-boot

On Thu, Feb 3, 2011 at 8:36 PM, Kumar Gala <galak@kernel.crashing.org> wrote:

> + ? ? ? ?* Any LAWs that where setup before we booted assume they are meant to
> + ? ? ? ?* be around and mark them used.

I think you mean "were set up".  "setup" == noun, "set up" == verb.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] powerpc/8xxx: Fix LAW init to respect pre-initialized entries
  2011-02-04  2:36 [U-Boot] [PATCH] powerpc/8xxx: Fix LAW init to respect pre-initialized entries Kumar Gala
  2011-02-04  3:52 ` Timur Tabi
@ 2011-02-04 20:43 ` Kumar Gala
  2011-02-04 21:14 ` [U-Boot] [PATCH v3] " Kumar Gala
  2 siblings, 0 replies; 5+ messages in thread
From: Kumar Gala @ 2011-02-04 20:43 UTC (permalink / raw)
  To: u-boot

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>
---
* Fixed wording in comment per Timur's feedback

 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..8b37a2f 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);
+	}
+
+#ifndef 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v3] powerpc/8xxx: Fix LAW init to respect pre-initialized entries
  2011-02-04  2:36 [U-Boot] [PATCH] powerpc/8xxx: Fix LAW init to respect pre-initialized entries Kumar Gala
  2011-02-04  3:52 ` Timur Tabi
  2011-02-04 20:43 ` [U-Boot] [PATCH v2] " Kumar Gala
@ 2011-02-04 21:14 ` Kumar Gala
  2011-02-10  6:17   ` Kumar Gala
  2 siblings, 1 reply; 5+ messages in thread
From: Kumar Gala @ 2011-02-04 21:14 UTC (permalink / raw)
  To: u-boot

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>
---
* 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 <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,
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v3] powerpc/8xxx: Fix LAW init to respect pre-initialized entries
  2011-02-04 21:14 ` [U-Boot] [PATCH v3] " Kumar Gala
@ 2011-02-10  6:17   ` Kumar Gala
  0 siblings, 0 replies; 5+ messages in thread
From: Kumar Gala @ 2011-02-10  6:17 UTC (permalink / raw)
  To: u-boot


On Feb 4, 2011, at 3:14 PM, Kumar Gala wrote:

> 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>
> ---
> * 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(-)

applied to 85xx next

- k

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-10  6:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-04  2:36 [U-Boot] [PATCH] powerpc/8xxx: Fix LAW init to respect pre-initialized entries Kumar Gala
2011-02-04  3:52 ` Timur Tabi
2011-02-04 20:43 ` [U-Boot] [PATCH v2] " Kumar Gala
2011-02-04 21:14 ` [U-Boot] [PATCH v3] " Kumar Gala
2011-02-10  6:17   ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox