aboutsummaryrefslogtreecommitdiff
path: root/drivers/bootcount
AgeCommit message (Collapse)AuthorFilesLines
2020-04-24bootcount_ext: Add flag to enable/disable bootcountFrédéric Danis1-12/+34
After a successful upgrade, multiple problem during boot sequence may trigger the altbootcmd process. This patch adds a version and an upgrade_available entries to the bootcount file to enable/disable the bootcount check. When failing to read the bootcount file it will consider that bootcount is enabled, acting as previously, and update the file accordingly. The bootcount file is only saved when `upgrade_available` is true, this allows to save writes to the filesystem. Signed-off-by: Frédéric Danis <frederic.danis@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-03-16bootcounter: add DM support for memory based bootcounterHeiko Schocher3-0/+100
add DM/DTS support for the memory based bootcounter in drivers/bootcount/bootcount.c. Let the old implementation in, so boards which have not yet convert to DM/DTS do not break. Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-10bootcount: add a DM i2c eeprom backing store for bootcountRobert Beckett3-0/+106
This driver allows the use of i2c eeprom device or partition as backing store for boot counter values with DM enabled. Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
2019-12-02common: Move ARM cache operations out of common.hSimon Glass2-0/+2
These functions are CPU-related and do not use driver model. Move them to cpu_func.h Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-08-11env: Drop environment.h header file where not neededSimon Glass1-1/+0
This header file is now only used by files that access internal environment features. Drop it from various places where it is not needed. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11env: Move env_set_ulong() to env.hSimon Glass1-0/+1
Move env_set_ulong() over to the new header file. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-12-10bootcount: add a DM RTC backing store for bootcountPhilipp Tomsich3-0/+110
This implements a driver using a RTC-based backing store for the DM bootcount implementation. The node configuring this feature will be compatible with 'u-boot,bootcount-rtc' and the underlying RTC device shall be reference through the property 'rtc'. An offset into the RTC device's register space can be provided through the 'offset' property. Tested on a RK3399-Q7 on a Flamingo carrier board using the SRAM area of the carrier board's RV3029 RTC. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-12-10bootcount: add uclass for bootcountPhilipp Tomsich3-0/+103
The original bootcount methods do not provide an interface to DM and rely on a static configuration for I2C devices (e.g. bus, chip-addr, etc. are configured through defines statically). On a modern system that exposes multiple devices in a DTS-configurable way, this is less than optimal and a interface to DM-based devices will be desirable. This adds a simple driver that is DM-aware and configurable via DTS. If ambiguous (i.e. multiple bootcount-devices are present) the /chosen/u-boot,bootcount-device property can be used to select one bootcount device. Initially, this provides support for the following DM devices: * RTC devices Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
2018-10-19bootcount: Make bootcount magic configurableMarek Vasut5-12/+19
Add new Kconfig option, SYS_BOOTCOUNT_MAGIC, to select the boot counter magic word. This can be useful ie. in case the entire boot counter register is not usable. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com>
2018-08-17Add BOOTCOUNT_BOOTLIMIT to set reboot limitAlex Kiernan1-0/+8
Add ability to set environment bootlimit from Kconfig Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-08-03bootcount: Fix misaligned cache operationAlex Kiernan1-3/+10
1947c2d2a0 introduces cache line flushes for the bootcounter, but if the start address is not aligned then the flush causes warnings of the form: CACHE: Misaligned operation at range [4030b7fc, 4030b83c] Align both the start and end of the buffer (possibly crossing multiple lines). Fixes: 1947c2d2a0 ("bootcount: flush after storing the bootcounter") Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Acked-by: Stefano Babic <sbabic@denx.de>
2018-07-23bootcount: flush after storing the bootcounterStefano Babic1-0/+3
If the bootcounter address is in a cached memory, a flush of dcache must occur after updateing the bootcounter. Issue found on i.MX6 where bootcounter is put into the internal (cached) IRAM. Signed-off-by: Stefano Babic <sbabic@denx.de>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini8-18/+8
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-06Migrate CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSCAlex Kiernan1-0/+1
This converts CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC to Kconfig Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-02-25bootcount: Migrate CONFIG_SYS_BOOTCOUNT_ADDRTom Rini2-18/+4
Migrate the users of CONFIG_SYS_BOOTCOUNT_ADDR to Kconfig. We can provide a default for BOOTCOUNT_AM33XX as that's a specific part of the RTC in use. We can also provide a default for ARCH_LS1043A and ARCH_LS1021A as they had been previously calculated and their symbols are in Kconfig. In the case of other QE-enabled platforms, they are not so we must update the relevant defconfig files. The previous default only applied in some cases, even on a specific SoC family. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2018-02-24Migrate CONFIG_BOOTCOUNT_ALEN to KconfigAlex Kiernan1-1/+8
Convert CONFIG_BOOTCOUNT_ALEN to Kconfig Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-02-24Migrate generic bootcount to KconfigAlex Kiernan2-1/+12
Make generate boot counter selected in the same way as other boot count drivers Reviewed-by: Lukasz Majewski <lukma@denx.de> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-02-24Integrate AT91 bootcount driverAlex Kiernan2-1/+6
Integrate Boot counter for Atmel AT91SAM9XE into Kconfig Reviewed-by: Lukasz Majewski <lukma@denx.de> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-02-24Convert CONFIG_BOOTCOUNT_I2C to KconfigAlex Kiernan1-0/+9
This converts the following to Kconfig: CONFIG_BOOTCOUNT_I2C Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-02-24Convert CONFIG_BOOTCOUNT_RAM to KconfigAlex Kiernan1-0/+6
This converts the following to Kconfig: CONFIG_BOOTCOUNT_RAM Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-02-24Convert CONFIG_BOOTCOUNT_ENV to KconfigAlex Kiernan1-0/+12
This converts the following to Kconfig: CONFIG_BOOTCOUNT_ENV Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-02-24Convert CONFIG_BOOTCOUNT_AM33XX to KconfigAlex Kiernan2-1/+9
This converts the following to Kconfig: CONFIG_BOOTCOUNT_AM33XX Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com> Acked-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-02-24Prepare for multiple bootcount driversAlex Kiernan1-14/+11
Reviewed-by: Lukasz Majewski <lukma@denx.de> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-02-24Merge CONFIG_BOOTCOUNT and CONFIG_BOOTCOUNT_LIMITAlex Kiernan1-8/+1
CONFIG_BOOTCOUNT was only used in mx53ppd, merge it with CONFIG_BOOTCOUNT_LIMIT Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Ian Ray <ian.ray@ge.com>
2018-02-15Convert CONFIG_SYS_BOOTCOUNT_SINGLEWORD to KconfigLukasz Majewski1-0/+6
This converts the following to Kconfig: CONFIG_SYS_BOOTCOUNT_SINGLEWORD Signed-off-by: Lukasz Majewski <lukma@denx.de> Tested-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Ian Ray <ian.ray@ge.com>
2018-02-15Convert CONFIG_BOOTCOUNT_LIMIT to KconfigLukasz Majewski1-0/+6
This converts the following to Kconfig: CONFIG_BOOTCOUNT_LIMIT Signed-off-by: Lukasz Majewski <lukma@denx.de> Tested-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com> Acked-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
2017-11-20bootcount: add support for bootcounter on EXT filesystemIan Ray3-0/+121
Add support for bootcounter on an EXT filesystem. Sync configuration whitelist. Signed-off-by: Ian Ray <ian.ray@ge.com> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
2017-09-12cosmetic: bootcount: correct comment for used scratch registerTomas Melin1-3/+3
Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
2017-08-16env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()Simon Glass1-3/+3
We are now using an env_ prefix for environment functions. Rename these for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename common functions related to setenv()Simon Glass1-1/+1
We are now using an env_ prefix for environment functions. Rename these commonly used functions, for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-15env: Drop saveenv() in favour of env_save()Simon Glass1-1/+2
Use the env_save() function directly now that there is only one implementation of saveenv(). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wolfgang Denk <wd@denx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-07-03powerpc: remove 4xx supportHeiko Schocher1-5/+0
There was for long time no activity in the 4xx area. We need to go further and convert to Kconfig, but it turned out, nobody is interested anymore in 4xx, so remove it. Signed-off-by: Heiko Schocher <hs@denx.de>
2017-06-16powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512xHeiko Schocher1-10/+0
There was for long time no activity in the mpx5xxx area. We need to go further and convert to Kconfig, but it turned out, nobody is interested anymore in mpc5xxx, so remove it. Signed-off-by: Heiko Schocher <hs@denx.de>
2017-06-12powerpc, 8260: remove support for mpc8260Heiko Schocher1-5/+0
There was for long time no activity in the 8260 area. We need to go further and convert to Kconfig, but it turned out, nobody is interested anymore in 8260, so remove it. Signed-off-by: Heiko Schocher <hs@denx.de>
2017-06-12powerpc, 8xx: remove support for 8xxHeiko Schocher1-5/+0
There was for long time no activity in the 8xx area. We need to go further and convert to Kconfig, but it turned out, nobody is interested anymore in 8xx, so remove it (with a heavy heart, knowing that I remove here the root of U-Boot). Signed-off-by: Heiko Schocher <hs@denx.de>
2017-04-05Blackfin: RemoveTom Rini2-35/+0
The architecture is currently unmaintained, remove. Cc: Benjamin Matthews <mben12@gmail.com> Cc: Chong Huang <chuang@ucrobotics.com> Cc: Dimitar Penev <dpn@switchfin.org> Cc: Haitao Zhang <hzhang@ucrobotics.com> Cc: I-SYST Micromodule <support@i-syst.com> Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de> Cc: Marek Vasut <marex@denx.de> Cc: Martin Strubel <strubel@section5.ch> Cc: Peter Meerwald <devel@bct-electronic.com> Cc: Sonic Zhang <sonic.adi@gmail.com> Cc: Valentin Yakovenkov <yakovenkov@niistt.ru> Cc: Wojtek Skulski <info@skutek.com> Cc: Wojtek Skulski <skulski@pas.rochester.edu> Signed-off-by: Tom Rini <trini@konsulko.com>
2016-11-28bootcounter_ram: Fix misaligned cache warningStefan Roese1-1/+2
This patch fixes the warning about misaligned cache on Armada XP: CACHE: Misaligned operation at range [7ffff000, 7fffffac] Signed-off-by: Stefan Roese <sr@denx.de> Cc: Valentin Longchamp <valentin.longchamp@keymile.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-04-11bootcounter_ram: Flush dcache after data is written into SDRAMStefan Roese1-0/+3
This patch adds a call to flush_dcache_range() to bootcount_store() to make sure, that the bootcounter data (including the patterns) is written to memory. Without this, platforms with dcache enabled may not have the bootcounter updated upon reset. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Valentin Longchamp <valentin.longchamp@keymile.com>
2016-01-08bootcount: Correct #endif comment to match, other aestheticsRobert P. J. Day1-6/+4
Correct mismatched comment on #endif to agree with its #if defined(). Also add some missing #endif comments for consistency, take out extraneous blank lines for readability. rday
2014-07-22qe: move immap_qe.h from arch directory into common directoryZhao Qiang1-1/+1
ls1021 is arm-core and supports qe too. Move immap_qe.h into common directory for both arm and powerpc. Signed-off-by: Zhao Qiang <B45475@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
2014-02-20i2c, bootcount: add support for bootcounter on i2c devicesHeiko Schocher2-0/+45
add support for bootcounter on an i2c device. And add a README for all bootcounter options. Signed-off-by: Heiko Schocher <hs@denx.de>
2013-11-11am33xx: Make SoC bootcount driver have its own symbolTom Rini2-1/+5
Some am33xx boards may not use the RTC block for bootcount (as it may not be wired up for the board) and use some other facility. So add another symbol for the bootcount driver for the IP block. Acked-by: Heiko Schocher <hs@denx.de> Signed-off-by: Tom Rini <trini@ti.com>
2013-11-11bootcount: store bootcount var in environmentHeiko Schocher2-0/+30
If no softreset save registers are found on the hardware "bootcount" is stored in the environment. To prevent a saveenv on all reboots, the environment variable "upgrade_available" is introduced. If "upgrade_available" is 0, "bootcount" is always 0 therefore no need to save the environment on u-boot boot, if "upgrade_available" is 1 "bootcount" is incremented in the environment and environment gets written on u-boot start. So the Userspace Applikation must set the "upgrade_available" and "bootcount" variable to 0 (for example with fw_setenv), if a boot was successfully. Signed-off-by: Heiko Schocher <hs@denx.de>
2013-11-09Merge branch 'iu-boot/master' into 'u-boot-arm/master'Albert ARIBAUD2-6/+8
Conflicts: arch/arm/cpu/arm926ejs/mxs/Makefile board/compulab/cm_t35/Makefile board/corscience/tricorder/Makefile board/ppcag/bg0900/Makefile drivers/bootcount/Makefile include/configs/omap4_common.h include/configs/pdnb3.h Makefile conflicts are due to additions/removals of object files on the ARM branch vs KBuild introduction on the main branch. Resolution consists in adjusting the list of object files in the main branch version. This also applies to two files which are not listed as conflicting but had to be modified: board/compulab/common/Makefile board/udoo/Makefile include/configs/omap4_common.h conflicts are due to the OMAP4 conversion to ti_armv7_common.h on the ARM side, and CONFIG_SYS_HZ removal on the main side. Resolution is to convert as this icludes removal of CONFIG_SYS_HZ. include/configs/pdnb3.h is due to a removal on ARM side. Trivial resolution is to remove the file. Note: 'git show' will also list two files just because they are new: include/configs/am335x_igep0033.h include/configs/omap3_igep00x0.h
2013-11-01TI:am33xx: Add bootcount support to ti_am335x_common.hTom Rini1-0/+1
Enable the bootcount driver for am335x in general. We leave adding a bootlimit and altbootcmd to the environment to the board ports. Signed-off-by: Tom Rini <trini@ti.com>
2013-11-01bootcount_davinci: Switch to scratch register #2Tom Rini1-4/+6
The RTC IP block here provides 3 scratch registers. Currently when using DeepSleep on am335x the scratch0/1 registers are used so moving ourself to scratch2 makes cooperation easier. Signed-off-by: Tom Rini <trini@ti.com>
2013-11-01am33xx, davinci: Create and use <asm/davinci_rtc.h>Tom Rini1-2/+1
Create a common header file for the RTC IP block that is shared between davinci and am33xx. Signed-off-by: Tom Rini <trini@ti.com>
2013-10-31drivers: convert makefiles to Kbuild styleMasahiro Yamada1-25/+5
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk5-73/+5
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2012-09-01Consolidate bootcount code into drivers/bootcountStefan Roese6-0/+343
This patch moves all bootcount implementations into a common directory: drivers/bootcount. The generic bootcount driver is now usable not only by powerpc platforms, but others as well. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Heiko Schocher <hs@denx.de> Cc: Valentin Longchamp <valentin.longchamp@keymile.com> Cc: Christian Riesch <christian.riesch@omicron.at> Cc: Manfred Rudigier <manfred.rudigier@omicron.at> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Reinhard Meyer <reinhard.meyer@emk-elektronik.de> Tested-by: Valentin Longchamp <valentin.longchamp@keymile.com> Tested-by: Christian Riesch <christian.riesch@omicron.at> Acked-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Mike Frysinger <vapier@gentoo.org>