public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 31/31] 83xx, kmeter1: added bootcount feature
@ 2009-01-28  9:41 Heiko Schocher
  2009-01-29  2:12 ` Kim Phillips
  0 siblings, 1 reply; 5+ messages in thread
From: Heiko Schocher @ 2009-01-28  9:41 UTC (permalink / raw)
  To: u-boot

add CONFIG_BOUTCOUNT_LIMIT feature for 83xx CPU.
activate this feature for the kmeter1 board.

Signed-off-by: Heiko Schocher <hs@denx.de>
---
 cpu/mpc83xx/cpu.c                |   27 +++++++++++++++++++++++++++
 include/configs/keymile-common.h |    2 --
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
index 587fca3..7c12672 100644
--- a/cpu/mpc83xx/cpu.c
+++ b/cpu/mpc83xx/cpu.c
@@ -34,6 +34,9 @@
 #include <libfdt.h>
 #include <tsec.h>
 #include <netdev.h>
+#ifdef CONFIG_BOOTCOUNT_LIMIT
+#include <asm/io.h>
+#endif

 DECLARE_GLOBAL_DATA_PTR;

@@ -385,3 +388,27 @@ int cpu_eth_init(bd_t *bis)
 #endif
 	return 0;
 }
+
+#ifdef CONFIG_BOOTCOUNT_LIMIT
+
+#if !defined(CONFIG_BOOTCOUNT_ADDR)
+#define CONFIG_BOOTCOUNT_ADDR	0x11bff8
+#endif
+
+void bootcount_store (ulong a)
+{
+	void *reg = (unsigned __iomem *)(CONFIG_SYS_IMMR + CONFIG_BOOTCOUNT_ADDR);
+	out_be32 (reg, a);
+	out_be32 (reg + 4, BOOTCOUNT_MAGIC);
+}
+
+ulong bootcount_load (void)
+{
+	void *reg = (unsigned __iomem *)(CONFIG_SYS_IMMR + CONFIG_BOOTCOUNT_ADDR);
+
+	if (in_be32 (reg + 4) != BOOTCOUNT_MAGIC)
+		return 0;
+	else
+		return in_be32 (reg);
+}
+#endif /* CONFIG_BOOTCOUNT_LIMIT */
diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h
index 3736cd8..6a25262 100644
--- a/include/configs/keymile-common.h
+++ b/include/configs/keymile-common.h
@@ -27,9 +27,7 @@
 /* Do boardspecific init for all boards */
 #define CONFIG_BOARD_EARLY_INIT_R       1

-#if defined(CONFIG_MGCOGE) || defined(CONFIG_MGSUVD) || defined(CONFIG_KMSUPX4)
 #define CONFIG_BOOTCOUNT_LIMIT
-#endif

 /*
  * Command line configuration.
-- 
1.6.0.6

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

* [U-Boot] [PATCH 31/31] 83xx, kmeter1: added bootcount feature
  2009-01-28  9:41 [U-Boot] [PATCH 31/31] 83xx, kmeter1: added bootcount feature Heiko Schocher
@ 2009-01-29  2:12 ` Kim Phillips
  2009-01-29  9:22   ` Heiko Schocher
  0 siblings, 1 reply; 5+ messages in thread
From: Kim Phillips @ 2009-01-29  2:12 UTC (permalink / raw)
  To: u-boot

On Wed, 28 Jan 2009 10:41:02 +0100
Heiko Schocher <hs@denx.de> wrote:

> diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c

> +#ifdef CONFIG_BOOTCOUNT_LIMIT
> +
> +#if !defined(CONFIG_BOOTCOUNT_ADDR)
> +#define CONFIG_BOOTCOUNT_ADDR	0x11bff8

it's CONFIG_SYS and magic number, but now that I've found it, sorry, I
can't accept this - not all 83xx have a QE and thus this MURAM.  Even
if they did this would require changing the device tree muram node
property, to indicate its size has shrunk 8 bytes, right?  In fact, not
all QE's have 48Kbytes of MURAM either - the 8323 only has 16Kbytes.  
Problem is, I don't know of a better place to put the
bootcount.  Ideas?

Kim

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

* [U-Boot] [PATCH 31/31] 83xx, kmeter1: added bootcount feature
  2009-01-29  2:12 ` Kim Phillips
@ 2009-01-29  9:22   ` Heiko Schocher
  2009-01-29 16:28     ` Kim Phillips
  0 siblings, 1 reply; 5+ messages in thread
From: Heiko Schocher @ 2009-01-29  9:22 UTC (permalink / raw)
  To: u-boot

Hello Kim,

Kim Phillips wrote:
> On Wed, 28 Jan 2009 10:41:02 +0100
> Heiko Schocher <hs@denx.de> wrote:
> 
>> diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
> 
>> +#ifdef CONFIG_BOOTCOUNT_LIMIT
>> +
>> +#if !defined(CONFIG_BOOTCOUNT_ADDR)
>> +#define CONFIG_BOOTCOUNT_ADDR	0x11bff8
> 
> it's CONFIG_SYS and magic number, but now that I've found it, sorry, I
> can't accept this - not all 83xx have a QE and thus this MURAM.  Even

Hmm.. maybe we make this dependent on CONFIG_QE ?

> if they did this would require changing the device tree muram node
> property, to indicate its size has shrunk 8 bytes, right?  In fact, not

Yes, we should do this.

> all QE's have 48Kbytes of MURAM either - the 8323 only has 16Kbytes.  

Thats why you could define it with CONFIG_BOOTCOUNT_ADDR, where
exactly this 8 bytes are.

> Problem is, I don't know of a better place to put the
> bootcount.  Ideas?

I thought to make it as on 82xx (using parameter Ram of SCC1), because
UCC5 should be compatible to the SCC1 see 8360ERM.pdf Table 19-11 on
page 19-20. But on the 8360, after reset, the complete parameter RAM is
initialized with 0 ... so that didn't work. Other places I couldn't
found for this feature :-(

bye
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

* [U-Boot] [PATCH 31/31] 83xx, kmeter1: added bootcount feature
  2009-01-29  9:22   ` Heiko Schocher
@ 2009-01-29 16:28     ` Kim Phillips
  2009-01-29 19:00       ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Kim Phillips @ 2009-01-29 16:28 UTC (permalink / raw)
  To: u-boot

On Thu, 29 Jan 2009 10:22:06 +0100
Heiko Schocher <hs@denx.de> wrote:

> Hello Kim,
> 
> Kim Phillips wrote:
> > On Wed, 28 Jan 2009 10:41:02 +0100
> > Heiko Schocher <hs@denx.de> wrote:
> > 
> >> diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
> > 
> >> +#ifdef CONFIG_BOOTCOUNT_LIMIT
> >> +
> >> +#if !defined(CONFIG_BOOTCOUNT_ADDR)
> >> +#define CONFIG_BOOTCOUNT_ADDR	0x11bff8
> > 
> > it's CONFIG_SYS and magic number, but now that I've found it, sorry, I
> > can't accept this - not all 83xx have a QE and thus this MURAM.  Even
> 
> Hmm.. maybe we make this dependent on CONFIG_QE ?

still, the 8323 and 8360 would need different address values...so not
only CONFIG_QE.

> > if they did this would require changing the device tree muram node
> > property, to indicate its size has shrunk 8 bytes, right?  In fact, not
> 
> Yes, we should do this.

I hope the QE drivers don't significantly drop their performance given
a muram size is not a multiple of a power of 2.

> > all QE's have 48Kbytes of MURAM either - the 8323 only has 16Kbytes.  
> 
> Thats why you could define it with CONFIG_BOOTCOUNT_ADDR, where
> exactly this 8 bytes are.

it would be nice if all 83xx had the same address though.

> > Problem is, I don't know of a better place to put the
> > bootcount.  Ideas?
> 
> I thought to make it as on 82xx (using parameter Ram of SCC1), because
> UCC5 should be compatible to the SCC1 see 8360ERM.pdf Table 19-11 on
> page 19-20. But on the 8360, after reset, the complete parameter RAM is
> initialized with 0 ... so that didn't work. Other places I couldn't
> found for this feature :-(

you thinking is right, I just can't think of another place to put it -
and I suspect this isn't something that can be put in memory that lies
outside the IMMR.

if you really want this, make it only for the QE based chips, and
include the device tree modification.  I still don't know if this
should be enabled by default in the configs, however - debugging QE
performance down to this change would be relatively hard to find.

Kim

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

* [U-Boot] [PATCH 31/31] 83xx, kmeter1: added bootcount feature
  2009-01-29 16:28     ` Kim Phillips
@ 2009-01-29 19:00       ` Wolfgang Denk
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2009-01-29 19:00 UTC (permalink / raw)
  To: u-boot

Dear Kim Phillips,

In message <20090129102814.6e267b96.kim.phillips@freescale.com> you wrote:
> 
> you thinking is right, I just can't think of another place to put it -
> and I suspect this isn't something that can be put in memory that lies
> outside the IMMR.

We could use any registers that are guaranteed to maintaion their
current values through a core reset. Documentation usually gives
little or no guarantees, though.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Microsoft Multimedia:
You have nice graphics, sound and animations when the system crashes.

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

end of thread, other threads:[~2009-01-29 19:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-28  9:41 [U-Boot] [PATCH 31/31] 83xx, kmeter1: added bootcount feature Heiko Schocher
2009-01-29  2:12 ` Kim Phillips
2009-01-29  9:22   ` Heiko Schocher
2009-01-29 16:28     ` Kim Phillips
2009-01-29 19:00       ` Wolfgang Denk

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