Re: [U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
Hi Stefan, On Monday, August 13, 2012, 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 > > Cc: Heiko Schocher > > Cc: Valentin Longchamp > > Cc: Christian Riesch > > Cc: Manfred Rudigier > > Cc: Mike Frysinger > > Cc: Rob Herring > > Cc: Reinhard Meyer > > Tested-by: Valentin Longchamp > > > Tested-by: Christian Riesch > I tested v2 and v3 of this patch, but not v4. I can do this on Friday when I am back from my vacation. Regards, Christian > Acked-by: Rob Herring > > --- > v4: > - Rebased against TOT > - Addressed Mike's comments > > 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 | 1 + > 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 | 45 ++ > .../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| 51 +++ > include/configs/calimain.h | 1 + > include/configs/enbw_cmc.h | 1 + > include/configs/highbank.h | 2 + > include/configs/km/km_arm.h| 2 + > 20 files changed, 282 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 (82%) > 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 5ce5cc3..2b662b4 100644 > --- a/Makefile > +++ b/Makefile > @@ -249,6 +249,7 @@ LIBS-y += net/libnet.o > LIBS-y += disk/libdisk.o > LIBS-y += drivers/bios_emulator/libatibiosemu.o > LIBS-y += drivers/block/libblock.o > +LIBS-$(CONFIG_BOOTCOUNT_LIMIT) += drivers/bootcount/libbootcount.o > LIBS-y += drivers/dma/libdma.o > LIBS-y += drivers/fpga/libfpga.o > LIBS-y += 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/ar
Re: [U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
Hi Stefan, On 13.08.2012 16:51, Stefan Roese wrote: > Hi Andreas, > > On 08/13/2012 03:48 PM, Andreas Bießmann wrote: > +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. >>> >>> Then we should choose a different CONFIG_ option here. One that selects >>> all AT91 boards potentially supporting this feature. You are the expert >>> here, please make a suggestion. >> >> Unfortunately there is no such config option yet. We could add all the >> SoC explicitly like this: >> >> ---8<--- >> | +COBJS-$(CONFIG_AT91SAM9260)+= bootcount_at91.o >> | +COBJS-$(CONFIG_AT91SAM9261)+= bootcount_at91.o >> | +COBJS-$(CONFIG_AT91SAM9263)+= bootcount_at91.o >> | +COBJS-$(CONFIG_AT91SAM9G10)+= bootcount_at91.o >> | +COBJS-$(CONFIG_AT91SAM9G20)+= bootcount_at91.o >> | +COBJS-$(CONFIG_AT91SAM9M10G45) += bootcount_at91.o >> | +COBJS-$(CONFIG_AT91SAM9RL) += bootcount_at91.o >> | COBJS-$(CONFIG_AT91SAM9XE) += bootcount_at91.o >> | +COBJS-$(CONFIG_AT91SAM9G20)+= bootcount_at91.o >> --->8--- >> >> Maybe there is some make foo to get this easier? > > Maybe. But nothing I can think of quickly. The better solution would be > to add a new common CONFIG_AT91 (or similar) define, which is defined > for all at91 platforms. Might be helpful in other places as well. > > Not sure, how to best add this global AT91 define though. Easy wold be > to add it to config header files. I think we put it in the asm/arch/hardware.h files, something like CONFIG_AT91_GPBR. I fear we may break some not mainline boards here. >>> >>> Maybe. But we usually don't care about out-of-tree ports. >> >> That is true, we could just wait for patches adding this feature to >> other at91 SoC. >> 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. >>> >>> Okay. But I would really like to see this patch go in soon. I still have >>> a new board support patch waiting here for quite a long time depending >>> on this bootcount stuff. >> >> I'm with you, do you have a suggestion how to do the make foo nice? > > See above. Perhaps somebody else has other suggestions. > > Nevertheless I think we can postpone this "AT91 bootcount tuning" to a > follow-up patch. This is ok for me. Just realized there is a v4 on patchwork (but did not hit my MUA ...). Just add a Acked-by: Andreas Bießmann to v4. Best regards Andreas Bießmann ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
Hi Andreas, On 08/13/2012 03:48 PM, Andreas Bießmann wrote: +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. >> >> Then we should choose a different CONFIG_ option here. One that selects >> all AT91 boards potentially supporting this feature. You are the expert >> here, please make a suggestion. > > Unfortunately there is no such config option yet. We could add all the > SoC explicitly like this: > > ---8<--- > | +COBJS-$(CONFIG_AT91SAM9260)+= bootcount_at91.o > | +COBJS-$(CONFIG_AT91SAM9261)+= bootcount_at91.o > | +COBJS-$(CONFIG_AT91SAM9263)+= bootcount_at91.o > | +COBJS-$(CONFIG_AT91SAM9G10)+= bootcount_at91.o > | +COBJS-$(CONFIG_AT91SAM9G20)+= bootcount_at91.o > | +COBJS-$(CONFIG_AT91SAM9M10G45) += bootcount_at91.o > | +COBJS-$(CONFIG_AT91SAM9RL) += bootcount_at91.o > | COBJS-$(CONFIG_AT91SAM9XE) += bootcount_at91.o > | +COBJS-$(CONFIG_AT91SAM9G20)+= bootcount_at91.o > --->8--- > > Maybe there is some make foo to get this easier? Maybe. But nothing I can think of quickly. The better solution would be to add a new common CONFIG_AT91 (or similar) define, which is defined for all at91 platforms. Might be helpful in other places as well. Not sure, how to best add this global AT91 define though. Easy wold be to add it to config header files. >>> I fear we may break some not mainline boards >>> here. >> >> Maybe. But we usually don't care about out-of-tree ports. > > That is true, we could just wait for patches adding this feature to > other at91 SoC. > >>> 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. >> >> Okay. But I would really like to see this patch go in soon. I still have >> a new board support patch waiting here for quite a long time depending >> on this bootcount stuff. > > I'm with you, do you have a suggestion how to do the make foo nice? See above. Perhaps somebody else has other suggestions. Nevertheless I think we can postpone this "AT91 bootcount tuning" to a follow-up patch. Best regards, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
Hi Stefan, On 13.08.2012 15:37, Stefan Roese wrote: > Hi Andreas, > > On 08/13/2012 03:11 PM, Andreas Bießmann wrote: >>> +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. > > Then we should choose a different CONFIG_ option here. One that selects > all AT91 boards potentially supporting this feature. You are the expert > here, please make a suggestion. Unfortunately there is no such config option yet. We could add all the SoC explicitly like this: ---8<--- | +COBJS-$(CONFIG_AT91SAM9260)+= bootcount_at91.o | +COBJS-$(CONFIG_AT91SAM9261)+= bootcount_at91.o | +COBJS-$(CONFIG_AT91SAM9263)+= bootcount_at91.o | +COBJS-$(CONFIG_AT91SAM9G10)+= bootcount_at91.o | +COBJS-$(CONFIG_AT91SAM9G20)+= bootcount_at91.o | +COBJS-$(CONFIG_AT91SAM9M10G45) += bootcount_at91.o | +COBJS-$(CONFIG_AT91SAM9RL) += bootcount_at91.o | COBJS-$(CONFIG_AT91SAM9XE) += bootcount_at91.o | +COBJS-$(CONFIG_AT91SAM9G20)+= bootcount_at91.o --->8--- Maybe there is some make foo to get this easier? >> I fear we may break some not mainline boards >> here. > > Maybe. But we usually don't care about out-of-tree ports. That is true, we could just wait for patches adding this feature to other at91 SoC. >> 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. > > Okay. But I would really like to see this patch go in soon. I still have > a new board support patch waiting here for quite a long time depending > on this bootcount stuff. I'm with you, do you have a suggestion how to do the make foo nice? Best regards Andreas Bießmann ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
Hi Andreas, On 08/13/2012 03:11 PM, Andreas Bießmann wrote: >> +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. Then we should choose a different CONFIG_ option here. One that selects all AT91 boards potentially supporting this feature. You are the expert here, please make a suggestion. > I fear we may break some not mainline boards > here. Maybe. But we usually don't care about out-of-tree ports. > 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. Okay. But I would really like to see this patch go in soon. I still have a new board support patch waiting here for quite a long time depending on this bootcount stuff. Best regards, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
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 > Cc: Heiko Schocher > Cc: Valentin Longchamp > Cc: Christian Riesch > Cc: Manfred Rudigier > Cc: Mike Frysinger > Cc: Rob Herring > Cc: Reinhard Meyer > Tested-by: Valentin Longchamp > Tested-by: Christian Riesch > --- > 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 & 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/drivers/bootcount/Makefile b/drivers/bootcount/Makefile > new file mode 100644 > index 000..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 > +# MERCHANTAB
Re: [U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
On 08/11/2012 06:20 PM, Mike Frysinger wrote: > On Tuesday 05 June 2012 02:37:55 Stefan Roese wrote: >> --- /dev/null >> +++ b/drivers/bootcount/Makefile >> >> +COBJS-$(CONFIG_BFIN_CPU)+= bootcount_blackfin.o > > needs to be CONFIG_BLACKFIN Okay. >> +all:$(LIB) > > unused rule -> delete Okay. >> --- /dev/null >> +++ b/include/bootcount.h >> >> +#ifdef CONFIG_SYS_BOOTCOUNT_LE >> +static inline void bc_out32(volatile u32 *addr, u32 data) > > the bc_xxx names are a little confusing since they overlap so much with the > existing io.h api. how about "raw_bootcount_store" ? Okay. >> +{ >> +out_le32(addr, data); >> +} >> + >> +static inline u32 bc_in32(volatile u32 *addr) >> +{ >> +return in_le32(addr); >> +} >> +#else >> +static inline void bc_out32(volatile u32 *addr, u32 data) >> +{ >> +out_be32(addr, bdata); >> +} >> + >> +static inline u32 bc_in32(volatile u32 *addr) >> +{ >> +return in_be32(addr); >> +} >> +#endif > > i'm not a big fan of defaulting to an endian regardless of the host. in this > case, it appears to benefit ppc only. > > what about: > #include > #if !defined(CONFIG_SYS_BOOTCOUNT_LE) && !defined(CONFIG_SYS_BOOTCOUNT_BE) > # if __BYTE_ORDER == __LITTLE_ENDIAN > # define CONFIG_SYS_BOOTCOUNT_LE > # else > # define CONFIG_SYS_BOOTCOUNT_BE > # endif > #endif > > or if you're not a fan of that, then: > #if defined(CONFIG_SYS_BOOTCOUNT_LE) > ... current in_le logic ... > #elif defined(CONFIG_SYS_BOOTCOUNT_BE) > ... current in_be logic ... > #else > # error "please select one of CONFIG_SYS_BOOTCOUNT_{L,B}E" > #endif > > and then add a default to arch/powerpc/include/asm/config.h Good idea. I'll send a new version with the 2nd approach later today. Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
On Tuesday 05 June 2012 02:37:55 Stefan Roese wrote: > --- /dev/null > +++ b/drivers/bootcount/Makefile > > +COBJS-$(CONFIG_BFIN_CPU) += bootcount_blackfin.o needs to be CONFIG_BLACKFIN > +all: $(LIB) unused rule -> delete > --- /dev/null > +++ b/include/bootcount.h > > +#ifdef CONFIG_SYS_BOOTCOUNT_LE > +static inline void bc_out32(volatile u32 *addr, u32 data) the bc_xxx names are a little confusing since they overlap so much with the existing io.h api. how about "raw_bootcount_store" ? > +{ > + out_le32(addr, data); > +} > + > +static inline u32 bc_in32(volatile u32 *addr) > +{ > + return in_le32(addr); > +} > +#else > +static inline void bc_out32(volatile u32 *addr, u32 data) > +{ > + out_be32(addr, data); > +} > + > +static inline u32 bc_in32(volatile u32 *addr) > +{ > + return in_be32(addr); > +} > +#endif i'm not a big fan of defaulting to an endian regardless of the host. in this case, it appears to benefit ppc only. what about: #include #if !defined(CONFIG_SYS_BOOTCOUNT_LE) && !defined(CONFIG_SYS_BOOTCOUNT_BE) # if __BYTE_ORDER == __LITTLE_ENDIAN # define CONFIG_SYS_BOOTCOUNT_LE # else # define CONFIG_SYS_BOOTCOUNT_BE # endif #endif or if you're not a fan of that, then: #if defined(CONFIG_SYS_BOOTCOUNT_LE) ... current in_le logic ... #elif defined(CONFIG_SYS_BOOTCOUNT_BE) ... current in_be logic ... #else # error "please select one of CONFIG_SYS_BOOTCOUNT_{L,B}E" #endif and then add a default to arch/powerpc/include/asm/config.h -mike signature.asc Description: This is a digitally signed message part. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
Dear Stefan Roese, In message <1338878275-1918-1-git-send-email...@denx.de> you 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 > Cc: Heiko Schocher > Cc: Valentin Longchamp > Cc: Christian Riesch > Cc: Manfred Rudigier > Cc: Mike Frysinger > Cc: Rob Herring > Cc: Reinhard Meyer > Tested-by: Valentin Longchamp > Tested-by: Christian Riesch Sorry, this does not apply any more: Applying patch #163024 to current directory Description: [U-Boot,v3] Consolidate bootcount code into drivers/bootcount Applying: Consolidate bootcount code into drivers/bootcount fatal: sha1 information is lacking or useless (Makefile). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 Consolidate bootcount code into drivers/bootcount Can you please rebase? Thanks! 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 I perceive a possibility of an immediate chronological sequence of events which includes a violence. - Terry Pratchett, _The Dark Side of the Sun_ ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] Consolidate bootcount code into drivers/bootcount
On 06/05/2012 01:37 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 > Cc: Heiko Schocher > Cc: Valentin Longchamp > Cc: Christian Riesch > Cc: Manfred Rudigier > Cc: Mike Frysinger > Cc: Rob Herring > Cc: Reinhard Meyer > Tested-by: Valentin Longchamp > Tested-by: Christian Riesch For highbank: Acked-by: Rob Herring > --- > 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 & 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 @@ > -/* > -
[U-Boot] [PATCH v3] 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 Cc: Heiko Schocher Cc: Valentin Longchamp Cc: Christian Riesch Cc: Manfred Rudigier Cc: Mike Frysinger Cc: Rob Herring Cc: Reinhard Meyer Tested-by: Valentin Longchamp Tested-by: Christian Riesch --- 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 & 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 hop