From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/9] kmp204x: support for QRIO1 bootcounter
Date: Tue, 14 Jan 2014 07:58:22 +0100 [thread overview]
Message-ID: <52D4E00E.90503@denx.de> (raw)
In-Reply-To: <1389630557-32312-2-git-send-email-valentin.longchamp@keymile.com>
Hi Valentin,
On 13.01.2014 17:29, Valentin Longchamp wrote:
> From: Rainer Boschung <rainer.boschung@keymile.com>
>
> - make use of the QRIO1 32bit register at 0x20 as bootcounter register
> - check for BOOTCOUNT_MAGIC pattern when before bootcounter value is read
>
> Signed-off-by: Rainer Boschung <rainer.boschung@keymile.com>
> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
> Acked-by: Valentin Longchamp <valentin.longchamp@keymile.com>
> ---
>
> board/keymile/kmp204x/kmp204x.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
> index f02642a..b41929a 100644
> --- a/board/keymile/kmp204x/kmp204x.c
> +++ b/board/keymile/kmp204x/kmp204x.c
> @@ -134,22 +134,25 @@ void qrio_prstcfg(u8 bit, u8 mode)
> }
>
>
> -#define BOOTCOUNT_OFF 0x12
> +#define BOOTCOUNT_OFF 0x20
>
> void bootcount_store(ulong counter)
> {
> - u8 val;
> void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
>
> - val = (counter <= 255) ? (u8)counter : 255;
> - out_8(qrio_base + BOOTCOUNT_OFF, val);
> + out_be32(qrio_base + BOOTCOUNT_OFF, counter);
> }
>
> ulong bootcount_load(void)
> {
> - u8 val;
> + u32 val;
> void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
> - val = in_8(qrio_base + BOOTCOUNT_OFF);
> + val = in_be32(qrio_base + BOOTCOUNT_OFF + 4);
> +
> + if (val == BOOTCOUNT_MAGIC)
> + val = in_be32(qrio_base + BOOTCOUNT_OFF);
> + else
> + val = 0;
> return val;
> }
Can't you just use the common bootcount driver
(drivers/bootcount/bootcount.c) instead? Should be easy. Just define
this in your config header:
#define CONFIG_BOOTCOUNT_LIMIT
#define CONFIG_SYS_BOOTCOUNT_ADDR (CONFIG_SYS_QRIO_BASE + 0x20)
Thanks,
Stefan
next prev parent reply other threads:[~2014-01-14 6:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 1/9] kmp204x: support for QRIO1 bootcounter Valentin Longchamp
2014-01-14 6:58 ` Stefan Roese [this message]
2014-01-14 8:29 ` Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 2/9] kmp204x: introduce QRIO GPIO functions Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 3/9] kmp204x: I2C deblocking for I2C-bus1 added Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 4/9] kmp204x: implement workaround for A-006559 Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 5/9] kmp204x: add support for the kmcoge4 board Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 6/9] kmp204x: update I2C field of RCW Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 7/9] KM: add the KM_UBI_PART_BOOT_OPTS #define Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 8/9] kmp204x: enable support for SPANSION SPI NOR Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 9/9] kmp204x: initial support for PCIe FPGA configuration Valentin Longchamp
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=52D4E00E.90503@denx.de \
--to=sr@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox