]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/bootcount/bootcount_env.c
net: zynq_gem: Add support for SGMII interface
[people/ms/u-boot.git] / drivers / bootcount / bootcount_env.c
CommitLineData
eda0ba38
HS
1/*
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}