xref: /openbmc/u-boot/drivers/bootcount/Kconfig (revision 8bf3c2442b59aedd1e58b7013fc12180cab0b541)
1f31dac4eSIan Ray#
2f31dac4eSIan Ray# Boot count configuration
3f31dac4eSIan Ray#
4f31dac4eSIan Ray
5c1e1c1ecSAlex Kiernanmenuconfig BOOTCOUNT_LIMIT
6d1ec9461SLukasz Majewski	bool "Enable support for checking boot count limit"
7d1ec9461SLukasz Majewski	help
8d1ec9461SLukasz Majewski	  Enable checking for exceeding the boot count limit.
9d1ec9461SLukasz Majewski	  More information: http://www.denx.de/wiki/DULG/UBootBootCountLimit
10d1ec9461SLukasz Majewski
113dccc10eSAlex Kiernanif BOOTCOUNT_LIMIT
12f31dac4eSIan Ray
13c1e1c1ecSAlex Kiernanchoice
14c1e1c1ecSAlex Kiernan	prompt "Boot count device"
15c35e2d91SAlex Kiernan	default BOOTCOUNT_AM33XX if AM33XX || SOC_DA8XX
16bec8c647SAlex Kiernan	default BOOTCOUNT_AT91 if AT91SAM9XE
17aa5a8632SAlex Kiernan	default BOOTCOUNT_GENERIC
18aa5a8632SAlex Kiernan
19aa5a8632SAlex Kiernanconfig BOOTCOUNT_GENERIC
20aa5a8632SAlex Kiernan	bool "Generic default boot counter"
21aa5a8632SAlex Kiernan	help
22aa5a8632SAlex Kiernan	  Generic bootcount stored at SYS_BOOTCOUNT_ADDR.
23aa5a8632SAlex Kiernan
24aa5a8632SAlex Kiernan	  SYS_BOOTCOUNT_ADDR:
25aa5a8632SAlex Kiernan	    Set to the address where the bootcount and bootcount magic
26aa5a8632SAlex Kiernan	    will be stored.
27c1e1c1ecSAlex Kiernan
28f31dac4eSIan Rayconfig BOOTCOUNT_EXT
29f31dac4eSIan Ray	bool "Boot counter on EXT filesystem"
30f31dac4eSIan Ray	help
31f31dac4eSIan Ray	  Add support for maintaining boot count in a file on an EXT
32f31dac4eSIan Ray	  filesystem.
33f31dac4eSIan Ray
34c35e2d91SAlex Kiernanconfig BOOTCOUNT_AM33XX
35c35e2d91SAlex Kiernan	bool "Boot counter in AM33XX RTC IP block"
36c35e2d91SAlex Kiernan	depends on AM33XX || SOC_DA8XX
373bf5f13cSAlex Kiernan	select SPL_AM33XX_ENABLE_RTC32K_OSC if AM33XX
38c35e2d91SAlex Kiernan	help
39c35e2d91SAlex Kiernan	  A bootcount driver for the RTC IP block found on many TI platforms.
40c35e2d91SAlex Kiernan	  This requires the RTC clocks, etc, to be enabled prior to use and
41c35e2d91SAlex Kiernan	  not all boards with this IP block on it will have the RTC in use.
42c35e2d91SAlex Kiernan
4304c96ed2SAlex Kiernanconfig BOOTCOUNT_ENV
4404c96ed2SAlex Kiernan	bool "Boot counter in environment"
4504c96ed2SAlex Kiernan	help
4604c96ed2SAlex Kiernan	  If no softreset save registers are found on the hardware
4704c96ed2SAlex Kiernan	  "bootcount" is stored in the environment. To prevent a
4804c96ed2SAlex Kiernan	  saveenv on all reboots, the environment variable
4904c96ed2SAlex Kiernan	  "upgrade_available" is used. If "upgrade_available" is
5004c96ed2SAlex Kiernan	  0, "bootcount" is always 0, if "upgrade_available" is
5104c96ed2SAlex Kiernan	  1 "bootcount" is incremented in the environment.
5204c96ed2SAlex Kiernan	  So the Userspace Application must set the "upgrade_available"
5304c96ed2SAlex Kiernan	  and "bootcount" variable to 0, if a boot was successfully.
5404c96ed2SAlex Kiernan
55ff5410d3SAlex Kiernanconfig BOOTCOUNT_RAM
56ff5410d3SAlex Kiernan	bool "Boot counter in RAM"
57ff5410d3SAlex Kiernan	help
58ff5410d3SAlex Kiernan	  Store the bootcount in DRAM protected against against bit errors
59ff5410d3SAlex Kiernan	  due to short power loss or holding a system in RESET.
60ff5410d3SAlex Kiernan
616cdd70ebSAlex Kiernanconfig BOOTCOUNT_I2C
626cdd70ebSAlex Kiernan	bool "Boot counter on I2C device"
636cdd70ebSAlex Kiernan	help
646cdd70ebSAlex Kiernan	  Enable support for the bootcounter on an i2c (like RTC) device.
656cdd70ebSAlex Kiernan	  CONFIG_SYS_I2C_RTC_ADDR = i2c chip address
666cdd70ebSAlex Kiernan	  CONFIG_SYS_BOOTCOUNT_ADDR = i2c addr which is used for
676cdd70ebSAlex Kiernan	                              the bootcounter.
686cdd70ebSAlex Kiernan
69bec8c647SAlex Kiernanconfig BOOTCOUNT_AT91
70bec8c647SAlex Kiernan	bool "Boot counter for Atmel AT91SAM9XE"
71bec8c647SAlex Kiernan	depends on AT91SAM9XE
72bec8c647SAlex Kiernan
73ebb73de1SPhilipp Tomsichconfig DM_BOOTCOUNT
74ebb73de1SPhilipp Tomsich        bool "Boot counter in a device-model device"
75ebb73de1SPhilipp Tomsich	help
76ebb73de1SPhilipp Tomsich	  Enables reading/writing the bootcount in a device-model based
77ebb73de1SPhilipp Tomsich	  backing store.  If an entry in /chosen/u-boot,bootcount-device
78ebb73de1SPhilipp Tomsich	  exists, this will be the preferred bootcount device; otherwise
79ebb73de1SPhilipp Tomsich	  the first available bootcount device will be used.
80ebb73de1SPhilipp Tomsich
81c1e1c1ecSAlex Kiernanendchoice
82c1e1c1ecSAlex Kiernan
83*482734aaSPhilipp Tomsichif DM_BOOTCOUNT
84*482734aaSPhilipp Tomsich
85*482734aaSPhilipp Tomsichmenu "Backing stores for device-model backed bootcount"
86*482734aaSPhilipp Tomsichconfig DM_BOOTCOUNT_RTC
87*482734aaSPhilipp Tomsich	bool "Support RTC devices as a backing store for bootcount"
88*482734aaSPhilipp Tomsich	depends on DM_RTC
89*482734aaSPhilipp Tomsich	help
90*482734aaSPhilipp Tomsich	  Enabled reading/writing the bootcount in a DM RTC device.
91*482734aaSPhilipp Tomsich	  The wrapper device is to be specified with the compatible string
92*482734aaSPhilipp Tomsich	  'u-boot,bootcount-rtc' and the 'rtc'-property (a phandle pointing
93*482734aaSPhilipp Tomsich	  to the underlying RTC device) and an optional 'offset' property
94*482734aaSPhilipp Tomsich	  are supported.
95*482734aaSPhilipp Tomsich
96*482734aaSPhilipp Tomsich	  Accesses to the backing store are performed using the write16
97*482734aaSPhilipp Tomsich	  and read16 ops of DM RTC devices.
98*482734aaSPhilipp Tomsich
99*482734aaSPhilipp Tomsichendmenu
100*482734aaSPhilipp Tomsich
101*482734aaSPhilipp Tomsichendif
102*482734aaSPhilipp Tomsich
103c9ad6bc2SAlex Kiernanconfig BOOTCOUNT_BOOTLIMIT
104c9ad6bc2SAlex Kiernan	int "Maximum number of reboot cycles allowed"
105c9ad6bc2SAlex Kiernan	default 0
106c9ad6bc2SAlex Kiernan	help
107c9ad6bc2SAlex Kiernan	  Set the Maximum number of reboot cycles allowed without the boot
108c9ad6bc2SAlex Kiernan	  counter being cleared.
109c9ad6bc2SAlex Kiernan	  If set to 0 do not set a boot limit in the environment.
110c9ad6bc2SAlex Kiernan
1114bc4f8a6SAlex Kiernanconfig BOOTCOUNT_ALEN
1124bc4f8a6SAlex Kiernan	int "I2C address length"
1134bc4f8a6SAlex Kiernan	default 1
1144bc4f8a6SAlex Kiernan	depends on BOOTCOUNT_I2C
1154bc4f8a6SAlex Kiernan	help
1164bc4f8a6SAlex Kiernan	  Length of the the I2C address at SYS_BOOTCOUNT_ADDR for storing
1174bc4f8a6SAlex Kiernan	  the boot counter.
1184bc4f8a6SAlex Kiernan
119c1e1c1ecSAlex Kiernanconfig SYS_BOOTCOUNT_SINGLEWORD
120c1e1c1ecSAlex Kiernan	bool "Use single word to pack boot count and magic value"
121aa5a8632SAlex Kiernan	depends on BOOTCOUNT_GENERIC
122c1e1c1ecSAlex Kiernan	help
123c1e1c1ecSAlex Kiernan	  This option enables packing boot count magic value and boot count
124c1e1c1ecSAlex Kiernan	  into single word (32 bits).
125f31dac4eSIan Ray
126f31dac4eSIan Rayconfig SYS_BOOTCOUNT_EXT_INTERFACE
127f31dac4eSIan Ray	string "Interface on which to find boot counter EXT filesystem"
128f31dac4eSIan Ray	default "mmc"
129f31dac4eSIan Ray	depends on BOOTCOUNT_EXT
130f31dac4eSIan Ray	help
131f31dac4eSIan Ray	  Set the interface to use when locating the filesystem to use for the
132f31dac4eSIan Ray	  boot counter.
133f31dac4eSIan Ray
134f31dac4eSIan Rayconfig SYS_BOOTCOUNT_EXT_DEVPART
135f31dac4eSIan Ray	string "Partition of the boot counter EXT filesystem"
136f31dac4eSIan Ray	default "0:1"
137f31dac4eSIan Ray	depends on BOOTCOUNT_EXT
138f31dac4eSIan Ray	help
139f31dac4eSIan Ray	  Set the partition to use when locating the filesystem to use for the
140f31dac4eSIan Ray	  boot counter.
141f31dac4eSIan Ray
142f31dac4eSIan Rayconfig SYS_BOOTCOUNT_EXT_NAME
143f31dac4eSIan Ray	string "Path and filename of the EXT filesystem based boot counter"
144f31dac4eSIan Ray	default "/boot/failures"
145f31dac4eSIan Ray	depends on BOOTCOUNT_EXT
146f31dac4eSIan Ray	help
147f31dac4eSIan Ray	  Set the filename and path of the file used to store the boot counter.
148f31dac4eSIan Ray
149f31dac4eSIan Rayconfig SYS_BOOTCOUNT_ADDR
150f31dac4eSIan Ray	hex "RAM address used for reading and writing the boot counter"
15139bcbb77STom Rini	default 0x44E3E000 if BOOTCOUNT_AM33XX
15239bcbb77STom Rini	default 0xE0115FF8 if ARCH_LS1043A || ARCH_LS1021A
15339bcbb77STom Rini	depends on BOOTCOUNT_AM33XX || BOOTCOUNT_GENERIC || BOOTCOUNT_EXT || \
15439bcbb77STom Rini		   BOOTCOUNT_I2C
155f31dac4eSIan Ray	help
156f31dac4eSIan Ray	  Set the address used for reading and writing the boot counter.
157f31dac4eSIan Ray
158758694ffSMarek Vasutconfig SYS_BOOTCOUNT_MAGIC
159758694ffSMarek Vasut	hex "Magic value for the boot counter"
160758694ffSMarek Vasut	default 0xB001C041
161758694ffSMarek Vasut	help
162758694ffSMarek Vasut	  Set the magic value used for the boot counter.
163758694ffSMarek Vasut
164f31dac4eSIan Rayendif
165