• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2013
4  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
5  */
6 
7 #include <common.h>
8 #include <env.h>
9 
bootcount_store(ulong a)10 void bootcount_store(ulong a)
11 {
12 	int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
13 
14 	if (upgrade_available) {
15 		env_set_ulong("bootcount", a);
16 		env_save();
17 	}
18 }
19 
bootcount_load(void)20 ulong bootcount_load(void)
21 {
22 	int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
23 	ulong val = 0;
24 
25 	if (upgrade_available)
26 		val = env_get_ulong("bootcount", 10, 0);
27 
28 	return val;
29 }
30