summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorAxel Beierlein <belatronix@web.de>2008-08-16 00:30:48 +0200
committerWolfgang Denk <wd@denx.de>2008-08-21 01:39:24 +0200
commitbef92e215d945cc574399c1a1b00a3a76d35aa03 (patch)
tree3bb35fdf25c2a2dea08083ca2d48880f1935af6e /cpu
parent0800707b6d5041a840a65d556032c15c584b55f8 (diff)
downloadu-boot-imx-bef92e215d945cc574399c1a1b00a3a76d35aa03.zip
u-boot-imx-bef92e215d945cc574399c1a1b00a3a76d35aa03.tar.gz
u-boot-imx-bef92e215d945cc574399c1a1b00a3a76d35aa03.tar.bz2
Adding bootlimit/bootcount feature for MPC5XXX on TQM5200 Boards
Tested with TQM5200S on STK52XX.200 Board Signed-off-by: Axel Beierlein <belatronix@web.de>
Diffstat (limited to 'cpu')
-rw-r--r--cpu/mpc5xxx/cpu.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c
index ace1653..d87f42c 100644
--- a/cpu/mpc5xxx/cpu.c
+++ b/cpu/mpc5xxx/cpu.c
@@ -135,3 +135,23 @@ void ft_cpu_setup(void *blob, bd_t *bd)
#endif
}
#endif
+
+#ifdef CONFIG_BOOTCOUNT_LIMIT
+
+void bootcount_store (ulong a)
+{
+ volatile ulong *save_addr = (volatile ulong *)(MPC5XXX_CDM_BRDCRMB);
+
+ *save_addr = (BOOTCOUNT_MAGIC & 0xffff0000) | a;
+}
+
+ulong bootcount_load (void)
+{
+ volatile ulong *save_addr = (volatile ulong *)(MPC5XXX_CDM_BRDCRMB);
+
+ if ((*save_addr & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000))
+ return 0;
+ else
+ return (*save_addr & 0x0000ffff);
+}
+#endif /* CONFIG_BOOTCOUNT_LIMIT */