]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/glsdk-u-boot.git/blob - include/bootcount.h
dra7xx: Enabled UART-boot mode
[glsdk/glsdk-u-boot.git] / include / bootcount.h
1 /*
2  * (C) Copyright 2012
3  * Stefan Roese, DENX Software Engineering, sr@denx.de.
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  */
19 #include <common.h>
20 #include <asm/io.h>
21 #include <asm/byteorder.h>
23 #if !defined(CONFIG_SYS_BOOTCOUNT_LE) && !defined(CONFIG_SYS_BOOTCOUNT_BE)
24 # if __BYTE_ORDER == __LITTLE_ENDIAN
25 #  define CONFIG_SYS_BOOTCOUNT_LE
26 # else
27 #  define CONFIG_SYS_BOOTCOUNT_BE
28 # endif
29 #endif
31 #ifdef CONFIG_SYS_BOOTCOUNT_LE
32 static inline void raw_bootcount_store(volatile u32 *addr, u32 data)
33 {
34         out_le32(addr, data);
35 }
37 static inline u32 raw_bootcount_load(volatile u32 *addr)
38 {
39         return in_le32(addr);
40 }
41 #else
42 static inline void raw_bootcount_store(volatile u32 *addr, u32 data)
43 {
44         out_be32(addr, data);
45 }
47 static inline u32 raw_bootcount_load(volatile u32 *addr)
48 {
49         return in_be32(addr);
50 }
51 #endif