[U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
Andreas Bießmann
andreas.devel at googlemail.com
Mon Aug 13 15:11:54 CEST 2012
Dear Stefan Roese,
On 05.06.2012 08:37, Stefan Roese wrote:
> 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 at denx.de>
> Cc: Heiko Schocher <hs at denx.de>
> Cc: Valentin Longchamp <valentin.longchamp at keymile.com>
> Cc: Christian Riesch <christian.riesch at omicron.at>
> Cc: Manfred Rudigier <manfred.rudigier at omicron.at>
> Cc: Mike Frysinger <vapier at gentoo.org>
> Cc: Rob Herring <rob.herring at calxeda.com>
> Cc: Reinhard Meyer <reinhard.meyer at emk-elektronik.de>
> Tested-by: Valentin Longchamp <valentin.longchamp at keymile.com>
> Tested-by: Christian Riesch <christian.riesch at omicron.at>
> ---
> v3:
> - Moved le-/be-accessors into header so that they now can be
> used by all bootcount drivers.
> - Changed CONFIG_BOOTCOUNT_LE to CONFIG_SYS_BOOTCOUNT_LE
> - Enabled CONFIG_SYS_BOOTCOUNT_LE in highbank
> - Enabled CONFIG_SYS_BOOTCOUNT_SINGLEWORD in highbank
>
> v2:
> - Added CONFIG_BOOTCOUNT_LE to bootcount_davinci.c and enabled it
> in calimain.h to select little-endian accessors.
>
> Makefile | 3 +
> arch/arm/cpu/arm926ejs/at91/cpu.c | 26 -------
> arch/arm/cpu/armv7/highbank/Makefile | 2 +-
> arch/arm/cpu/armv7/highbank/bootcount.c | 36 ----------
> arch/arm/cpu/ixp/cpu.c | 22 ------
> arch/powerpc/lib/Makefile | 1 -
> board/enbw/enbw_cmc/enbw_cmc.c | 29 --------
> board/keymile/km_arm/km_arm.c | 51 --------------
> board/omicron/calimain/calimain.c | 29 --------
> drivers/bootcount/Makefile | 47 +++++++++++++
> .../powerpc/lib => drivers/bootcount}/bootcount.c | 25 ++++---
> drivers/bootcount/bootcount_at91.c | 43 ++++++++++++
> .../bootcount/bootcount_blackfin.c | 0
> drivers/bootcount/bootcount_davinci.c | 49 +++++++++++++
> drivers/bootcount/bootcount_ram.c | 72 ++++++++++++++++++++
> include/bootcount.h | 42 ++++++++++++
> include/configs/calimain.h | 1 +
> include/configs/highbank.h | 2 +
> include/configs/km/km_arm.h | 2 +
> 19 files changed, 276 insertions(+), 206 deletions(-)
> delete mode 100644 arch/arm/cpu/armv7/highbank/bootcount.c
> create mode 100644 drivers/bootcount/Makefile
> rename {arch/powerpc/lib => drivers/bootcount}/bootcount.c (84%)
> create mode 100644 drivers/bootcount/bootcount_at91.c
> rename arch/blackfin/cpu/bootcount.c => drivers/bootcount/bootcount_blackfin.c (100%)
> create mode 100644 drivers/bootcount/bootcount_davinci.c
> create mode 100644 drivers/bootcount/bootcount_ram.c
> create mode 100644 include/bootcount.h
>
> diff --git a/Makefile b/Makefile
> index 659e8f2..8fd51b8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -249,6 +249,9 @@ LIBS += net/libnet.o
> LIBS += disk/libdisk.o
> LIBS += drivers/bios_emulator/libatibiosemu.o
> LIBS += drivers/block/libblock.o
> +ifeq ($(CONFIG_BOOTCOUNT_LIMIT),y)
> +LIBS += drivers/bootcount/libbootcount.o
> +endif
> LIBS += drivers/dma/libdma.o
> LIBS += drivers/fpga/libfpga.o
> LIBS += drivers/gpio/libgpio.o
> diff --git a/arch/arm/cpu/arm926ejs/at91/cpu.c b/arch/arm/cpu/arm926ejs/at91/cpu.c
> index c47fb31..5cf4fad 100644
> --- a/arch/arm/cpu/arm926ejs/at91/cpu.c
> +++ b/arch/arm/cpu/arm926ejs/at91/cpu.c
> @@ -71,29 +71,3 @@ int print_cpuinfo(void)
> return 0;
> }
> #endif
> -
> -#ifdef CONFIG_BOOTCOUNT_LIMIT
> -/*
> - * We combine the BOOTCOUNT_MAGIC and bootcount in one 32-bit register.
> - * This is done so we need to use only one of the four GPBR registers.
> - */
> -void bootcount_store (ulong a)
> -{
> - at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR;
> -
> - writel((BOOTCOUNT_MAGIC & 0xffff0000) | (a & 0x0000ffff),
> - &gpbr->reg[AT91_GPBR_INDEX_BOOTCOUNT]);
> -}
> -
> -ulong bootcount_load (void)
> -{
> - at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR;
> -
> - ulong val = readl(&gpbr->reg[AT91_GPBR_INDEX_BOOTCOUNT]);
> - if ((val & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000))
> - return 0;
> - else
> - return val & 0x0000ffff;
> -}
> -
> -#endif /* CONFIG_BOOTCOUNT_LIMIT */
<snip>
> diff --git a/drivers/bootcount/Makefile b/drivers/bootcount/Makefile
> new file mode 100644
> index 0000000..3d5ec13
> --- /dev/null
> +++ b/drivers/bootcount/Makefile
> @@ -0,0 +1,47 @@
> +#
> +# See file CREDITS for list of people who contributed to this
> +# project.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> +# MA 02111-1307 USA
> +#
> +
> +include $(TOPDIR)/config.mk
> +
> +LIB := $(obj)libbootcount.o
> +
> +COBJS-y += bootcount.o
> +COBJS-$(CONFIG_AT91SAM9XE) += bootcount_at91.o
I tend to NAK this. Before it was available to all at91 processors (keep
in mind nearly all at91 have this gpbr register). Now it is only
available to AT91SAM9XE processor series which is the only user for
bootcount in mainline. I fear we may break some not mainline boards
here. I would prefer something that includes all different at91 SoC by
default (except rm9200).
I have no solution yet but send this to prevent a v4. Will send a
proposal for at91 later this day.
Best regards
Andreas Bießmann
More information about the U-Boot
mailing list