From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 31/31] 83xx, kmeter1: added bootcount feature
Date: Wed, 28 Jan 2009 10:41:02 +0100 [thread overview]
Message-ID: <4980282E.3020109@denx.de> (raw)
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
next reply other threads:[~2009-01-28 9:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 9:41 Heiko Schocher [this message]
2009-01-29 2:12 ` [U-Boot] [PATCH 31/31] 83xx, kmeter1: added bootcount feature Kim Phillips
2009-01-29 9:22 ` Heiko Schocher
2009-01-29 16:28 ` Kim Phillips
2009-01-29 19:00 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4980282E.3020109@denx.de \
--to=hs@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.