Re: [U-Boot] [PATCH v2] Consolidate bootcount code into drivers/bootcount
Dear Stefan Roese, In message 201206041514.17201...@denx.de you wrote: Why don't you use __BYTE_ORDER rather than a new define? Unfortunately not. There are LE platforms that use BE accessors for the bootcounter already (Davinci enbw_cmc). Mostly historical reasons I assume, since the original bootcount implementation was powerpc specific with those be32() functions. We should check this, and eventually fix enbw_cmc. Heiko, what do you think? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de COMPONENT EQUIVALENCY NOTICE: The Subatomic Particles (Electrons, Protons, etc.) Comprising This Product Are Exactly the Same in Every Measurable Respect as Those Used in the Products of Other Manufactu- rers, and No Claim to the Contrary May Legitimately Be Expressed or Implied. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] Consolidate bootcount code into drivers/bootcount
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 s...@denx.de Cc: Heiko Schocher h...@denx.de Cc: Valentin Longchamp valentin.longch...@keymile.com Cc: Christian Riesch christian.rie...@omicron.at Cc: Manfred Rudigier manfred.rudig...@omicron.at Cc: Mike Frysinger vap...@gentoo.org Cc: Rob Herring rob.herr...@calxeda.com Cc: Reinhard Meyer reinhard.me...@emk-elektronik.de --- 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 | 10 ++- drivers/bootcount/bootcount_at91.c | 43 .../bootcount/bootcount_blackfin.c |0 drivers/bootcount/bootcount_davinci.c | 72 drivers/bootcount/bootcount_ram.c | 72 include/configs/calimain.h |1 + include/configs/km/km_arm.h|2 + 17 files changed, 248 insertions(+), 198 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 (92%) 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 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 0x) | (a 0x), - 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 0x) != (BOOTCOUNT_MAGIC 0x)) - return 0; - else - return val 0x; -} - -#endif /* CONFIG_BOOTCOUNT_LIMIT */ diff --git a/arch/arm/cpu/armv7/highbank/Makefile b/arch/arm/cpu/armv7/highbank/Makefile index 917c3a3..76faeb0 100644 --- a/arch/arm/cpu/armv7/highbank/Makefile +++ b/arch/arm/cpu/armv7/highbank/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(SOC).o -COBJS := timer.o bootcount.o +COBJS := timer.o SOBJS := SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/arch/arm/cpu/armv7/highbank/bootcount.c b/arch/arm/cpu/armv7/highbank/bootcount.c deleted file mode 100644 index 9ca0656..000 --- a/arch/arm/cpu/armv7/highbank/bootcount.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2011 Calxeda, Inc. - * - * 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 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,
Re: [U-Boot] [PATCH v2] Consolidate bootcount code into drivers/bootcount
Hi Stefan, On 06/04/2012 02:38 PM, 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. I have tested it on km_kirkwood (km_arm) with the bootcount_ram driver and it works as expected on this platform. Tested-by: Valentin Longchamp valentin.longch...@keymile.com Signed-off-by: Stefan Roese s...@denx.de Cc: Heiko Schocher h...@denx.de Cc: Valentin Longchamp valentin.longch...@keymile.com Cc: Christian Riesch christian.rie...@omicron.at Cc: Manfred Rudigier manfred.rudig...@omicron.at Cc: Mike Frysinger vap...@gentoo.org Cc: Rob Herring rob.herr...@calxeda.com Cc: Reinhard Meyer reinhard.me...@emk-elektronik.de --- 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 | 10 ++- drivers/bootcount/bootcount_at91.c | 43 .../bootcount/bootcount_blackfin.c |0 drivers/bootcount/bootcount_davinci.c | 72 drivers/bootcount/bootcount_ram.c | 72 include/configs/calimain.h |1 + include/configs/km/km_arm.h|2 + 17 files changed, 248 insertions(+), 198 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 (92%) 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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] Consolidate bootcount code into drivers/bootcount
On 06/04/2012 07:38 AM, 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 s...@denx.de Cc: Heiko Schocher h...@denx.de Cc: Valentin Longchamp valentin.longch...@keymile.com Cc: Christian Riesch christian.rie...@omicron.at Cc: Manfred Rudigier manfred.rudig...@omicron.at Cc: Mike Frysinger vap...@gentoo.org Cc: Rob Herring rob.herr...@calxeda.com Cc: Reinhard Meyer reinhard.me...@emk-elektronik.de --- v2: - Added CONFIG_BOOTCOUNT_LE to bootcount_davinci.c and enabled it in calimain.h to select little-endian accessors. highbank is also LE. Why don't you use __BYTE_ORDER rather than a new define? Rob 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 | 10 ++- drivers/bootcount/bootcount_at91.c | 43 .../bootcount/bootcount_blackfin.c |0 drivers/bootcount/bootcount_davinci.c | 72 drivers/bootcount/bootcount_ram.c | 72 include/configs/calimain.h |1 + include/configs/km/km_arm.h|2 + 17 files changed, 248 insertions(+), 198 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 (92%) 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 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 0x) | (a 0x), - 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 0x) != (BOOTCOUNT_MAGIC 0x)) - return 0; - else - return val 0x; -} - -#endif /* CONFIG_BOOTCOUNT_LIMIT */ diff --git a/arch/arm/cpu/armv7/highbank/Makefile b/arch/arm/cpu/armv7/highbank/Makefile index 917c3a3..76faeb0 100644 --- a/arch/arm/cpu/armv7/highbank/Makefile +++ b/arch/arm/cpu/armv7/highbank/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -COBJS:= timer.o bootcount.o +COBJS:= timer.o SOBJS:= SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/arch/arm/cpu/armv7/highbank/bootcount.c b/arch/arm/cpu/armv7/highbank/bootcount.c deleted file mode 100644 index 9ca0656..000 --- a/arch/arm/cpu/armv7/highbank/bootcount.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2011 Calxeda, Inc. - * - * 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 it will be useful, but WITHOUT - * ANY WARRANTY; without even
Re: [U-Boot] [PATCH v2] Consolidate bootcount code into drivers/bootcount
On Monday 04 June 2012 15:03:27 Rob Herring wrote: On 06/04/2012 07:38 AM, 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 s...@denx.de Cc: Heiko Schocher h...@denx.de Cc: Valentin Longchamp valentin.longch...@keymile.com Cc: Christian Riesch christian.rie...@omicron.at Cc: Manfred Rudigier manfred.rudig...@omicron.at Cc: Mike Frysinger vap...@gentoo.org Cc: Rob Herring rob.herr...@calxeda.com Cc: Reinhard Meyer reinhard.me...@emk-elektronik.de --- v2: - Added CONFIG_BOOTCOUNT_LE to bootcount_davinci.c and enabled it in calimain.h to select little-endian accessors. highbank is also LE. Yes, sure. I could move those inline functions to a header, so that they can be used by the other drivers as well. Okay? Why don't you use __BYTE_ORDER rather than a new define? Unfortunately not. There are LE platforms that use BE accessors for the bootcounter already (Davinci enbw_cmc). Mostly historical reasons I assume, since the original bootcount implementation was powerpc specific with those be32() functions. Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] Consolidate bootcount code into drivers/bootcount
Hi, On Mon, Jun 4, 2012 at 3:14 PM, Stefan Roese s...@denx.de wrote: On Monday 04 June 2012 15:03:27 Rob Herring wrote: On 06/04/2012 07:38 AM, 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 s...@denx.de Cc: Heiko Schocher h...@denx.de Cc: Valentin Longchamp valentin.longch...@keymile.com Cc: Christian Riesch christian.rie...@omicron.at Cc: Manfred Rudigier manfred.rudig...@omicron.at Cc: Mike Frysinger vap...@gentoo.org Cc: Rob Herring rob.herr...@calxeda.com Cc: Reinhard Meyer reinhard.me...@emk-elektronik.de --- v2: - Added CONFIG_BOOTCOUNT_LE to bootcount_davinci.c and enabled it Thanks a lot! I will test it on the calimain board. in calimain.h to select little-endian accessors. highbank is also LE. Yes, sure. I could move those inline functions to a header, so that they can be used by the other drivers as well. Okay? I don't think this is necessary. As long as a board uses its native endianess to store the boot counter, nothing special is needed. Regards, Christian Why don't you use __BYTE_ORDER rather than a new define? Unfortunately not. There are LE platforms that use BE accessors for the bootcounter already (Davinci enbw_cmc). Mostly historical reasons I assume, since the original bootcount implementation was powerpc specific with those be32() functions. Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] Consolidate bootcount code into drivers/bootcount
Hi Stefan, On Mon, Jun 4, 2012 at 2:38 PM, Stefan Roese s...@denx.de 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. For the calimain board Tested-by: Christian Riesch christian.rie...@omicron.at Thanks, Christian Signed-off-by: Stefan Roese s...@denx.de Cc: Heiko Schocher h...@denx.de Cc: Valentin Longchamp valentin.longch...@keymile.com Cc: Christian Riesch christian.rie...@omicron.at Cc: Manfred Rudigier manfred.rudig...@omicron.at Cc: Mike Frysinger vap...@gentoo.org Cc: Rob Herring rob.herr...@calxeda.com Cc: Reinhard Meyer reinhard.me...@emk-elektronik.de --- 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 | 10 ++- drivers/bootcount/bootcount_at91.c | 43 .../bootcount/bootcount_blackfin.c | 0 drivers/bootcount/bootcount_davinci.c | 72 drivers/bootcount/bootcount_ram.c | 72 include/configs/calimain.h | 1 + include/configs/km/km_arm.h | 2 + 17 files changed, 248 insertions(+), 198 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 (92%) 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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] Consolidate bootcount code into drivers/bootcount
Rob, On Monday 04 June 2012 15:03:27 Rob Herring wrote: On 06/04/2012 07:38 AM, 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 s...@denx.de Cc: Heiko Schocher h...@denx.de Cc: Valentin Longchamp valentin.longch...@keymile.com Cc: Christian Riesch christian.rie...@omicron.at Cc: Manfred Rudigier manfred.rudig...@omicron.at Cc: Mike Frysinger vap...@gentoo.org Cc: Rob Herring rob.herr...@calxeda.com Cc: Reinhard Meyer reinhard.me...@emk-elektronik.de --- v2: - Added CONFIG_BOOTCOUNT_LE to bootcount_davinci.c and enabled it in calimain.h to select little-endian accessors. highbank is also LE. Why don't you use __BYTE_ORDER rather than a new define? I just noticed, that highbank only uses one lword as bootcounter storage. So CONFIG_SYS_BOOTCOUNT_SINGLEWORD needs to be set for the generic bootcount driver to work here. I'll fix this in v3 after a short delay for further review comments. Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot