blob: 2d6e8db126eabec07438111c65d0d0cac5531d68 [file] [log] [blame]
Heiko Schochereda0ba32013-11-04 14:04:59 +01001/*
2 * (C) Copyright 2013
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9
10void bootcount_store(ulong a)
11{
12 int upgrade_available = getenv_ulong("upgrade_available", 10, 0);
13
14 if (upgrade_available) {
15 setenv_ulong("bootcount", a);
16 saveenv();
17 }
18}
19
20ulong bootcount_load(void)
21{
22 int upgrade_available = getenv_ulong("upgrade_available", 10, 0);
23 ulong val = 0;
24
25 if (upgrade_available)
26 val = getenv_ulong("bootcount", 10, 0);
27
28 return val;
29}