[U-Boot] [PATCH V3] Nomadik: fix reset_timer()
From: Alessandro Rubini rub...@unipv.it Previous code was failing when reading back the timer less than 400us after resetting it. This lead nand operations to incorrectly timeout any now and then. This changes READ_TIMER from negation to subtraction, so after writing 0 to reset it, an immediate read is correctly reported as 0 elapsed ticks. Signed-off-by: Alessandro Rubini rub...@unipv.it Acked-by: Andrea Gallo andrea.ga...@stericsson.com --- This is an alternative to V2, which is being posted at the same time. I prefer this approach to that one, as it fixes the problem without switching subsequent code to negative logic. cpu/arm926ejs/nomadik/timer.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/arm926ejs/nomadik/timer.c b/cpu/arm926ejs/nomadik/timer.c index 16067c9..991752d 100644 --- a/cpu/arm926ejs/nomadik/timer.c +++ b/cpu/arm926ejs/nomadik/timer.c @@ -34,8 +34,8 @@ #define TICKS_PER_HZ (TIMER_CLOCK / CONFIG_SYS_HZ) #define TICKS_TO_HZ(x) ((x) / TICKS_PER_HZ) -/* macro to read the 32 bit timer: since it decrements, we invert read value */ -#define READ_TIMER() (~readl(CONFIG_SYS_TIMERBASE + MTU_VAL(0))) +/* macro to read the decrementing 32 bit timer as an increasing count */ +#define READ_TIMER() (0 - readl(CONFIG_SYS_TIMERBASE + MTU_VAL(0))) /* Configure a free-running, auto-wrap counter with no prescaler */ int timer_init(void) -- 1.6.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH V2] Nomadik: fix reset_timer()
From: Alessandro Rubini rub...@unipv.it Previously the code wrote 0 to reset the counter and used negation to read an increasing value from the register. However, a readback before 400us still returned 0, which was reported as 1780 seconds, thus nand failed to work any now and then. As suggested by Wolfgang Denk, this changes READ_TIMER to just return the hardware counter (a declerasing one) and changes code using the value. Compile-tested only, at this point. Signed-off-by: Alessandro Rubini rub...@unipv.it Acked-by: Andrea Gallo andrea.ga...@stericsson.com --- Please note that V3 is being posted at the same time. I prefer V3 to this V2, but V2 is how I've been asked to do things. cpu/arm926ejs/nomadik/timer.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cpu/arm926ejs/nomadik/timer.c b/cpu/arm926ejs/nomadik/timer.c index 16067c9..c7dd65d 100644 --- a/cpu/arm926ejs/nomadik/timer.c +++ b/cpu/arm926ejs/nomadik/timer.c @@ -34,8 +34,8 @@ #define TICKS_PER_HZ (TIMER_CLOCK / CONFIG_SYS_HZ) #define TICKS_TO_HZ(x) ((x) / TICKS_PER_HZ) -/* macro to read the 32 bit timer: since it decrements, we invert read value */ -#define READ_TIMER() (~readl(CONFIG_SYS_TIMERBASE + MTU_VAL(0))) +/* macro to read the 32 bit timer: note however that the count decreases */ +#define READ_TIMER() readl(CONFIG_SYS_TIMERBASE + MTU_VAL(0)) /* Configure a free-running, auto-wrap counter with no prescaler */ int timer_init(void) @@ -46,7 +46,7 @@ int timer_init(void) return 0; } -/* Restart counting from 0 */ +/* Restart counting from 0 (still, it is a decrementing counter) */ void reset_timer(void) { writel(0, CONFIG_SYS_TIMERBASE + MTU_LR(0)); /* Immediate effect */ @@ -55,7 +55,7 @@ void reset_timer(void) /* Return how many HZ passed since base */ ulong get_timer(ulong base) { - return TICKS_TO_HZ(READ_TIMER()) - base; + return TICKS_TO_HZ(-READ_TIMER()) - base; } /* Delay x useconds */ @@ -63,8 +63,8 @@ void udelay(unsigned long usec) { ulong ini, end; - ini = READ_TIMER(); - end = ini + USEC_TO_COUNT(usec); - while ((signed)(end - READ_TIMER()) 0) + ini = READ_TIMER(); /* decrementing value */ + end = ini - USEC_TO_COUNT(usec); + while ((signed)(READ_TIMER() - end) 0) ; } -- 1.6.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] ppc/85xx: Add PIB/ATM support for MPC8569mds
Signed-off-by: Liu Yu yu@freescale.com --- board/freescale/common/pq-mds-pib.c |2 +- board/freescale/mpc8569mds/mpc8569mds.c |7 +++ include/configs/MPC8569MDS.h|3 +++ 3 files changed, 11 insertions(+), 1 deletions(-) diff --git a/board/freescale/common/pq-mds-pib.c b/board/freescale/common/pq-mds-pib.c index 6c72aa1..5f7a67d 100644 --- a/board/freescale/common/pq-mds-pib.c +++ b/board/freescale/common/pq-mds-pib.c @@ -63,7 +63,7 @@ int pib_init(void) #endif #if defined(CONFIG_PQ_MDS_PIB_ATM) -#if defined(CONFIG_MPC8360EMDS) +#if defined(CONFIG_MPC8360EMDS) || defined(CONFIG_MPC8569MDS) val8 = 0; i2c_write(0x20, 0x6, 1, val8, 1); i2c_write(0x20, 0x7, 1, val8, 1); diff --git a/board/freescale/mpc8569mds/mpc8569mds.c b/board/freescale/mpc8569mds/mpc8569mds.c index cdd7813..02e6920 100644 --- a/board/freescale/mpc8569mds/mpc8569mds.c +++ b/board/freescale/mpc8569mds/mpc8569mds.c @@ -39,6 +39,9 @@ #include fsl_esdhc.h #include bcsr.h +#if defined(CONFIG_PQ_MDS_PIB) +#include ../common/pq-mds-pib.h +#endif phys_size_t fixed_sdram(void); @@ -542,6 +545,10 @@ pci_init_board(void) r = hose-regions; pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_1, io_sel); +#if defined(CONFIG_PQ_MDS_PIB) + pib_init(); +#endif + if (pcie_configured !(gur-devdisr MPC85xx_DEVDISR_PCIE)){ printf (\nPCIE connected to slot as %s (base address %x), pcie_ep ? End Point : Root Complex, diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h index 17ea3bb..7462abb 100644 --- a/include/configs/MPC8569MDS.h +++ b/include/configs/MPC8569MDS.h @@ -44,6 +44,9 @@ #define CONFIG_ENV_OVERWRITE #define CONFIG_FSL_LAW 1 /* Use common FSL init code */ +#define CONFIG_PQ_MDS_PIB +#define CONFIG_PQ_MDS_PIB_ATM + /* * When initializing flash, if we cannot find the manufacturer ID, * assume this is the AMD flash associated with the MDS board. -- 1.6.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] s3c64xx: move s3c64xx header files to include/asm-arm/arch-s3c64xx
2009/11/5 Tom tom@windriver.com: Minkyu Kang wrote: This patch moves the s3c64xx header files from include/ to include/asm-arm/arch-s3c64xx Signed-off-by: Minkyu Kang mk7.k...@samsung.com --- Thanks! Please send me a pull request when convenient Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot applied to u-boot-samsung Thanks Minkyu Kang -- from. prom. www.promsoft.net ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Build breaks on some OMAP3 configs
-Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Gadiyar, Anand Sent: Friday, October 30, 2009 10:25 PM To: u-boot@lists.denx.de Subject: Re: [U-Boot] Build breaks on some OMAP3 configs Hi, I was trying to build u-boot for omap3_3430sdp and omap3_zoom2, and the build fails with the error below. I'm on commit f2b4bc0 from the master branch. I'm using CodeSourcery's 2008q3 toolchain. The commands I ran were: make CROSS_COMPILE=arm-none-linux-gnueabi- omap3_3430sdp_config; make CROSS_COMPILE=arm-none-linux-gnueabi- Any ideas what I'm doing wrong? make -C examples/standalone all make[1]: Entering directory `/data/git/denx-uboot/u-boot/examples/standalone' arm-none-linux-gnueabi-gcc -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x80e8 -I/data/git/denx-uboot/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /data/arm-2008q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/i nclude -pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork -march=armv5 -Wall -Wstrict-prototypes -fno-stack-protector -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x80e8 -I/data/git/denx-uboot/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /data/arm-2008q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/i nclude -pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork -march=armv5 -I.. -Bstatic -T u-boot.lds -Ttext 0x80e8 -o .c arm-none-linux-gnueabi-gcc: no input files make[1]: *** [.c] Error 1 make[1]: Leaving directory `/data/git/denx-uboot/u-boot/examples/standalone' make: *** [examples/standalone] Error 2 I took a look at examples/standalone/Makefile: The patch below gets things going again. So looks like something clobbered $(ELF-y). Any ideas what it could be? Thanks in advance, Anand diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index 5e2f2bc..73b19e9 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -39,6 +39,7 @@ ELF-ppc += sched ELF-oxc += eepro100_eeprom ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)) +ELF := hello_world [sp] This will break the earlier definition for ELF. I am submitting the right fix in few mins.. ~sanjeev SREC = $(addsuffix .srec,$(ELF)) BIN = $(addsuffix .bin,$(ELF)) ___ 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] Build breaks on some OMAP3 configs
Hi, I was trying to build u-boot for omap3_3430sdp and omap3_zoom2, and the build fails with the error below. I'm on commit f2b4bc0 from the master branch. I'm using CodeSourcery's 2008q3 toolchain. The commands I ran were: make CROSS_COMPILE=arm-none-linux-gnueabi- omap3_3430sdp_config; make CROSS_COMPILE=arm-none-linux-gnueabi- Any ideas what I'm doing wrong? make -C examples/standalone all make[1]: Entering directory `/data/git/denx-uboot/u-boot/examples/standalone' arm-none-linux-gnueabi-gcc -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x80e8 -I/data/git/denx-uboot/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /data/arm-2008q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/include -pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork -march=armv5 -Wall -Wstrict-prototypes -fno-stack-protector -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x80e8 -I/data/git/denx-uboot/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /data/arm-2008q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/include -pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork -march=armv5 -I.. -Bstatic -T u-boot.lds -Ttext 0x80e8 -o .c arm-none-linux-gnueabi-gcc: no input files make[1]: *** [.c] Error 1 make[1]: Leaving directory `/data/git/denx-uboot/u-boot/examples/standalone' make: *** [examples/standalone] Error 2 I took a look at examples/standalone/Makefile: The patch below gets things going again. So looks like something clobbered $(ELF-y). Any ideas what it could be? Thanks in advance, Anand diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index 5e2f2bc..73b19e9 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -39,6 +39,7 @@ ELF-ppc += sched ELF-oxc += eepro100_eeprom ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)) +ELF := hello_world [sp] This will break the earlier definition for ELF. I am submitting the right fix in few mins.. Yes, I know. This was not meant to be applied. It was just to provide an observation. Not having any u-boot code expertise, I had no idea where to look. Thanks for finding a fix. I'm glad to know I wasn't the only one affected. - Anand ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] Fix build failure in examples/standalone
The variable ELF contains many leading spaces. This adds a 'fake' source file variable COBJS. It leads to build failure as below: make[1]: Entering directory `/home/sanjeev/u-boot/examples/standalone' arm-none-linux-gnueabi-gcc -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x80e8 -I/home/sanjeev/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/codesourcery/2009q1- 203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/include -pipe -DCONFIG_ ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork -march=armv5 -Wall -Wstrict-prototypes -fno-stack-protector -g -Os -fno-common -ff ixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x80e8 -I/home/sanje ev/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/co desourcery/2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/includ e -pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-inte rwork -march=armv5 -I.. -Bstatic -T u-boot.lds -Ttext 0x80e8 -o .c arm-none-linux-gnueabi-gcc: no input files make[1]: *** [.c] Error 1 make[1]: Leaving directory `/home/sanjeev/u-boot/examples/standalone' make: *** [examples/standalone] Error 2 premi # Signed-off-by: Sanjeev Premi pr...@ti.com --- examples/standalone/Makefile |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index 5e2f2bc..61f3be1 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -38,7 +38,7 @@ ELF-mpc8260 += mem_to_mem_idma2intr ELF-ppc += sched ELF-oxc += eepro100_eeprom -ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)) +ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU))) SREC = $(addsuffix .srec,$(ELF)) BIN = $(addsuffix .bin,$(ELF)) -- 1.6.2.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Fix build failure in examples/standalone
On 06/11/09 09:16, Sanjeev Premi wrote: The variable ELF contains many leading spaces. This adds a 'fake' source file variable COBJS. It leads to build failure as below: make[1]: Entering directory `/home/sanjeev/u-boot/examples/standalone' arm-none-linux-gnueabi-gcc -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x80e8 -I/home/sanjeev/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/codesourcery/2009q1- 203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/include -pipe -DCONFIG_ ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork -march=armv5 -Wall -Wstrict-prototypes -fno-stack-protector -g -Os -fno-common -ff ixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x80e8 -I/home/sanje ev/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/co desourcery/2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/includ e -pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-inte rwork -march=armv5 -I.. -Bstatic -T u-boot.lds -Ttext 0x80e8 -o .c arm-none-linux-gnueabi-gcc: no input files make[1]: *** [.c] Error 1 make[1]: Leaving directory `/home/sanjeev/u-boot/examples/standalone' make: *** [examples/standalone] Error 2 premi # Signed-off-by: Sanjeev Premi pr...@ti.com --- examples/standalone/Makefile |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index 5e2f2bc..61f3be1 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -38,7 +38,7 @@ ELF-mpc8260 += mem_to_mem_idma2intr ELF-ppc += sched ELF-oxc += eepro100_eeprom -ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)) +ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU))) SREC = $(addsuffix .srec,$(ELF)) BIN = $(addsuffix .bin,$(ELF)) What version of make do you have? I have seen this issue when I tried to use make 3.80, but it doesn't seem to be a problem in 3.81 Nick. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/2]: common: Add a watchdog CLI command
(Ping!) On Thu, 29 Oct 2009 09:09:23 +0100 Simon Kagstrom simon.kagst...@netinsight.net wrote: A watchdog command to enable the watchdog with a timeout from the CLI can sometimes be useful. Add that. This also adds a common API for enabling watchdogs. The API is simple: int watchdog_enable(unsigned int timeout); the timeout range vary depending on hardware, and the driver should return a negative value if the call failed. Wolfgang: Do you have any additional comments on this patch? // Simon Signed-off-by: Simon Kagstrom simon.kagst...@netinsight.net --- ChangeLog: v2: * Passing zero as timeout is invalid (Prafulla) * Add return value from watchdog_enable(), negative means failure (Prafulla, Wolfgang) * Remove watchdog_disable() (Wolfgang) * Use weak default function for watchdog_enable() (Wolfgang) * Provide friendly and helpful printouts when invalid parameters are passed to the CLI command common/Makefile |1 + common/cmd_watchdog.c | 62 + common/main.c |7 + include/watchdog.h|2 + 4 files changed, 72 insertions(+), 0 deletions(-) create mode 100644 common/cmd_watchdog.c diff --git a/common/Makefile b/common/Makefile index 3781738..f14ba0e 100644 --- a/common/Makefile +++ b/common/Makefile @@ -160,6 +160,7 @@ COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o COBJS-$(CONFIG_UPDATE_TFTP) += update.o COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o +COBJS-$(CONFIG_CMD_WATCHDOG) += cmd_watchdog.o COBJS:= $(sort $(COBJS-y)) diff --git a/common/cmd_watchdog.c b/common/cmd_watchdog.c new file mode 100644 index 000..ca1a8fd --- /dev/null +++ b/common/cmd_watchdog.c @@ -0,0 +1,62 @@ +/* + * (C) Copyright 2009 + * Net Insight www.netinsight.net + * Written-by: Simon Kagstrom simon.kagst...@netinsight.net + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include common.h +#include watchdog.h + +static int do_watchdog(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + const char *cmd; + char *endp; + unsigned long timeout; + + /* need one argument */ + if (argc != 2) + goto usage; + + cmd = argv[1]; + timeout = simple_strtoul(cmd, endp, 0); + if (endp == cmd) { + printf(Error: Could not convert `%s' to a number\n\n, cmd); + goto usage; + } + if (timeout 1) { + printf(Error: zero timeouts are invalid\n\n); + goto usage; + } + + /* Everything fine, enable the watchdog */ + if (watchdog_enable(timeout) 0) { + printf(Error: Could not enable watchdog, check timeout parameter\n\n); + goto usage; + } + + return 0; +usage: + cmd_usage(cmdtp); + return 1; +} + +U_BOOT_CMD( + watchdog, 2, 0, do_watchdog, + Watchdog commands, + timeout - start the watchdog with `timeout' seconds timeout\n +); diff --git a/common/main.c b/common/main.c index 10d8904..47e867b 100644 --- a/common/main.c +++ b/common/main.c @@ -1446,3 +1446,10 @@ int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 0; } #endif + + +inline int __watchdog_enable(unsigned int timeout_secs) +{ + return -1; +} +int watchdog_enable(unsigned int timeout_secs) __attribute__((weak, alias(__watchdog_enable))); diff --git a/include/watchdog.h b/include/watchdog.h index 9265be9..74c2bda 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -70,6 +70,8 @@ #endif /* CONFIG_WATCHDOG !__ASSEMBLY__ */ #endif /* CONFIG_HW_WATCHDOG */ +extern int watchdog_enable(unsigned int timeout_secs); + /* * Prototypes from $(CPU)/cpu.c. */ ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/2]: common: Add a watchdog CLI command
-Original Message- From: Simon Kagstrom [mailto:simon.kagst...@netinsight.net] Sent: Friday, November 06, 2009 2:58 PM To: U-Boot ML; Wolfgang Denk Cc: Prafulla Wadaskar Subject: Re: [PATCH v2 1/2]: common: Add a watchdog CLI command (Ping!) On Thu, 29 Oct 2009 09:09:23 +0100 Simon Kagstrom simon.kagst...@netinsight.net wrote: A watchdog command to enable the watchdog with a timeout from the CLI can sometimes be useful. Add that. This also adds a common API for enabling watchdogs. The API is simple: int watchdog_enable(unsigned int timeout); the timeout range vary depending on hardware, and the driver should return a negative value if the call failed. Wolfgang: Do you have any additional comments on this patch? // Simon Signed-off-by: Simon Kagstrom simon.kagst...@netinsight.net --- ChangeLog: v2: * Passing zero as timeout is invalid (Prafulla) * Add return value from watchdog_enable(), negative means failure (Prafulla, Wolfgang) * Remove watchdog_disable() (Wolfgang) * Use weak default function for watchdog_enable() (Wolfgang) * Provide friendly and helpful printouts when invalid parameters are passed to the CLI command common/Makefile |1 + common/cmd_watchdog.c | 62 + common/main.c |7 + include/watchdog.h|2 + 4 files changed, 72 insertions(+), 0 deletions(-) create mode 100644 common/cmd_watchdog.c diff --git a/common/Makefile b/common/Makefile index 3781738..f14ba0e 100644 --- a/common/Makefile +++ b/common/Makefile @@ -160,6 +160,7 @@ COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o COBJS-$(CONFIG_UPDATE_TFTP) += update.o COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o +COBJS-$(CONFIG_CMD_WATCHDOG) += cmd_watchdog.o COBJS := $(sort $(COBJS-y)) diff --git a/common/cmd_watchdog.c b/common/cmd_watchdog.c new file mode 100644 index 000..ca1a8fd --- /dev/null +++ b/common/cmd_watchdog.c @@ -0,0 +1,62 @@ +/* + * (C) Copyright 2009 + * Net Insight www.netinsight.net + * Written-by: Simon Kagstrom simon.kagst...@netinsight.net + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include common.h +#include watchdog.h + +static int do_watchdog(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + const char *cmd; + char *endp; + unsigned long timeout; + + /* need one argument */ + if (argc != 2) + goto usage; + + cmd = argv[1]; + timeout = simple_strtoul(cmd, endp, 0); + if (endp == cmd) { + printf(Error: Could not convert `%s' to a number\n\n, cmd); + goto usage; + } + if (timeout 1) { + printf(Error: zero timeouts are invalid\n\n); + goto usage; + } + + /* Everything fine, enable the watchdog */ + if (watchdog_enable(timeout) 0) { + printf(Error: Could not enable watchdog, check timeout parameter\n\n); + goto usage; + } + + return 0; +usage: + cmd_usage(cmdtp); + return 1; +} + +U_BOOT_CMD( + watchdog, 2, 0, do_watchdog, + Watchdog commands, + timeout - start the watchdog with `timeout' seconds timeout\n +); diff --git a/common/main.c b/common/main.c index 10d8904..47e867b 100644 --- a/common/main.c +++ b/common/main.c @@ -1446,3 +1446,10 @@ int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 0; } #endif + + Apart from this additional line It is okay for me, If you can provide v3 for this it is good. I am waiting for Tom/wolfgang's flag so that I can pull it. Regards.. Prafulla . . +inline int __watchdog_enable(unsigned int timeout_secs) +{ + return -1; +} +int watchdog_enable(unsigned int timeout_secs) __attribute__((weak, alias(__watchdog_enable))); diff --git a/include/watchdog.h b/include/watchdog.h index 9265be9..74c2bda 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -70,6 +70,8 @@ #endif /* CONFIG_WATCHDOG !__ASSEMBLY__ */ #endif /* CONFIG_HW_WATCHDOG */ +extern int
Re: [U-Boot] AT91 runnable out of RAM ?
Hi Tom, 2009/11/6 Tom Rix t...@bumblecow.com: Remy Bohmer wrote: Hi Tom, I would rather keep the patch set together. OK. My current work depends on it. I am working with the usb/cdc branch to added gadget support for omap and ultimately help mainline the usb/cdc branch. I am trying to connect a at91sam9g20 the gadget code so I can have a working example of a driver to compare against the omap side that I am writing. The problem I am having is trying to the at91 out of ram doing something like # d .. downloads the u-boot.bin image # g 2200 ... seems to load the flash image ... gets stuck somewhere after flash enumeration It would help if you would post at least the terminal logging. Otherwise I have no idea what happens... Kind regards, Remy ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot