mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-10 12:39:22 -04:00
blackfin: Move blackfin watchdog driver out of the blackfin arch folder.
- Enable hw_watchdog_init() in watchdog.h if CONFIG_HW_WATCHDOG is defined. - Move blackfin hw watchdog driver to the generic driver folder. - Call hw_watchdog_init() from blackfin board init code. - Reuse macro CONFIG_WATCHDOG_TIMEOUT_MSECS - Update README.watchdog accordingly Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
This commit is contained in:
parent
13262d4cda
commit
e9a389a184
@ -25,7 +25,6 @@ COBJS-y += os_log.o
|
|||||||
COBJS-y += reset.o
|
COBJS-y += reset.o
|
||||||
COBJS-y += serial.o
|
COBJS-y += serial.o
|
||||||
COBJS-y += traps.o
|
COBJS-y += traps.o
|
||||||
COBJS-$(CONFIG_HW_WATCHDOG) += watchdog.o
|
|
||||||
|
|
||||||
SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
|
SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
|
||||||
OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
|
OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <asm/blackfin.h>
|
#include <asm/blackfin.h>
|
||||||
|
#include <asm/mach-common/bits/watchdog.h>
|
||||||
#include <asm/mach-common/bits/bootrom.h>
|
#include <asm/mach-common/bits/bootrom.h>
|
||||||
#include <asm/mach-common/bits/core.h>
|
#include <asm/mach-common/bits/core.h>
|
||||||
|
|
||||||
@ -468,9 +469,11 @@ program_early_devices(ADI_BOOT_DATA *bs, uint *sdivB, uint *divB, uint *vcoB)
|
|||||||
bfin_write_SEC_GCTL(0x1);
|
bfin_write_SEC_GCTL(0x1);
|
||||||
bfin_write_SEC_CCTL(0x1);
|
bfin_write_SEC_CCTL(0x1);
|
||||||
#endif
|
#endif
|
||||||
|
bfin_write_WDOG_CTL(WDDIS);
|
||||||
|
SSYNC();
|
||||||
bfin_write_WDOG_CNT(MSEC_TO_SCLK(CONFIG_HW_WATCHDOG_TIMEOUT_INITCODE));
|
bfin_write_WDOG_CNT(MSEC_TO_SCLK(CONFIG_HW_WATCHDOG_TIMEOUT_INITCODE));
|
||||||
#if CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_UART
|
#if CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_UART
|
||||||
bfin_write_WDOG_CTL(0);
|
bfin_write_WDOG_CTL(WDEN);
|
||||||
#endif
|
#endif
|
||||||
serial_putc('f');
|
serial_putc('f');
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <asm/blackfin.h>
|
#include <asm/blackfin.h>
|
||||||
|
#include <asm/mach-common/bits/watchdog.h>
|
||||||
#include <asm/mach-common/bits/core.h>
|
#include <asm/mach-common/bits/core.h>
|
||||||
#include <asm/mach-common/bits/pll.h>
|
#include <asm/mach-common/bits/pll.h>
|
||||||
|
|
||||||
@ -65,20 +66,29 @@ ENTRY(_start)
|
|||||||
p5.h = HI(COREMMR_BASE);
|
p5.h = HI(COREMMR_BASE);
|
||||||
|
|
||||||
#ifdef CONFIG_HW_WATCHDOG
|
#ifdef CONFIG_HW_WATCHDOG
|
||||||
#ifndef __ADSPBF60x__
|
/* Program the watchdog with default timeout of ~5 seconds.
|
||||||
# ifndef CONFIG_HW_WATCHDOG_TIMEOUT_START
|
|
||||||
# define CONFIG_HW_WATCHDOG_TIMEOUT_START 5000
|
|
||||||
# endif
|
|
||||||
/* Program the watchdog with an initial timeout of ~5 seconds.
|
|
||||||
* That should be long enough to bootstrap ourselves up and
|
* That should be long enough to bootstrap ourselves up and
|
||||||
* then the common u-boot code can take over.
|
* then the common u-boot code can take over.
|
||||||
*/
|
*/
|
||||||
|
r1 = WDDIS;
|
||||||
|
# ifdef __ADSPBF60x__
|
||||||
|
[p4 + (WDOG_CTL - SYSMMR_BASE)] = r1;
|
||||||
|
# else
|
||||||
|
W[p4 + (WDOG_CTL - SYSMMR_BASE)] = r1;
|
||||||
|
# endif
|
||||||
|
SSYNC;
|
||||||
r0 = 0;
|
r0 = 0;
|
||||||
r0.h = HI(MSEC_TO_SCLK(CONFIG_HW_WATCHDOG_TIMEOUT_START));
|
r0.h = HI(MSEC_TO_SCLK(CONFIG_WATCHDOG_TIMEOUT_MSECS));
|
||||||
[p4 + (WDOG_CNT - SYSMMR_BASE)] = r0;
|
[p4 + (WDOG_CNT - SYSMMR_BASE)] = r0;
|
||||||
|
SSYNC;
|
||||||
|
r1 = WDEN;
|
||||||
/* fire up the watchdog - R0.L above needs to be 0x0000 */
|
/* fire up the watchdog - R0.L above needs to be 0x0000 */
|
||||||
W[p4 + (WDOG_CTL - SYSMMR_BASE)] = r0;
|
# ifdef __ADSPBF60x__
|
||||||
#endif
|
[p4 + (WDOG_CTL - SYSMMR_BASE)] = r1;
|
||||||
|
# else
|
||||||
|
W[p4 + (WDOG_CTL - SYSMMR_BASE)] = r1;
|
||||||
|
# endif
|
||||||
|
SSYNC;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Turn on the serial for debugging the init process */
|
/* Turn on the serial for debugging the init process */
|
||||||
|
@ -279,9 +279,9 @@ void board_init_f(ulong bootflag)
|
|||||||
dcache_enable();
|
dcache_enable();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_WATCHDOG
|
#ifdef CONFIG_HW_WATCHDOG
|
||||||
serial_early_puts("Setting up external watchdog\n");
|
serial_early_puts("Setting up external watchdog\n");
|
||||||
watchdog_init();
|
hw_watchdog_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -30,3 +30,6 @@ CONFIG_IMX_WATCHDOG
|
|||||||
|
|
||||||
CONFIG_XILINX_TB_WATCHDOG
|
CONFIG_XILINX_TB_WATCHDOG
|
||||||
Available for Xilinx Axi platforms to service timebase watchdog timer.
|
Available for Xilinx Axi platforms to service timebase watchdog timer.
|
||||||
|
|
||||||
|
CONFIG_BFIN_WATCHDOG
|
||||||
|
Available for bf5xx and bf6xx to service the watchdog.
|
||||||
|
@ -33,6 +33,7 @@ endif
|
|||||||
COBJS-$(CONFIG_TNETV107X_WATCHDOG) += tnetv107x_wdt.o
|
COBJS-$(CONFIG_TNETV107X_WATCHDOG) += tnetv107x_wdt.o
|
||||||
COBJS-$(CONFIG_S5P) += s5p_wdt.o
|
COBJS-$(CONFIG_S5P) += s5p_wdt.o
|
||||||
COBJS-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o
|
COBJS-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o
|
||||||
|
COBJS-$(CONFIG_BFIN_WATCHDOG) += bfin_wdt.o
|
||||||
|
|
||||||
COBJS := $(COBJS-y)
|
COBJS := $(COBJS-y)
|
||||||
SRCS := $(COBJS:.o=.c)
|
SRCS := $(COBJS:.o=.c)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
#include <asm/blackfin.h>
|
#include <asm/blackfin.h>
|
||||||
|
#include <asm/mach-common/bits/watchdog.h>
|
||||||
|
|
||||||
void hw_watchdog_reset(void)
|
void hw_watchdog_reset(void)
|
||||||
{
|
{
|
||||||
@ -17,7 +18,9 @@ void hw_watchdog_reset(void)
|
|||||||
|
|
||||||
void hw_watchdog_init(void)
|
void hw_watchdog_init(void)
|
||||||
{
|
{
|
||||||
bfin_write_WDOG_CNT(5 * get_sclk()); /* 5 second timeout */
|
bfin_write_WDOG_CTL(WDDIS);
|
||||||
|
SSYNC();
|
||||||
|
bfin_write_WDOG_CNT(CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000 * get_sclk());
|
||||||
hw_watchdog_reset();
|
hw_watchdog_reset();
|
||||||
bfin_write_WDOG_CTL(0x0);
|
bfin_write_WDOG_CTL(WDEN);
|
||||||
}
|
}
|
@ -314,5 +314,11 @@
|
|||||||
#define CONFIG_BFIN_SPI_GPIO_CS /* Only matters if BFIN_SPI is enabled */
|
#define CONFIG_BFIN_SPI_GPIO_CS /* Only matters if BFIN_SPI is enabled */
|
||||||
#define CONFIG_LZMA
|
#define CONFIG_LZMA
|
||||||
#define CONFIG_MONITOR_IS_IN_RAM
|
#define CONFIG_MONITOR_IS_IN_RAM
|
||||||
|
#ifdef CONFIG_HW_WATCHDOG
|
||||||
|
# define CONFIG_BFIN_WATCHDOG
|
||||||
|
# ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS
|
||||||
|
# define CONFIG_WATCHDOG_TIMEOUT_MSECS 5000
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -108,8 +108,7 @@ int init_func_watchdog_reset(void);
|
|||||||
void reset_4xx_watchdog(void);
|
void reset_4xx_watchdog(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Freescale i.MX */
|
#if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__)
|
||||||
#if defined(CONFIG_IMX_WATCHDOG) && !defined(__ASSEMBLY__)
|
|
||||||
void hw_watchdog_init(void);
|
void hw_watchdog_init(void);
|
||||||
#endif
|
#endif
|
||||||
#endif /* _WATCHDOG_H_ */
|
#endif /* _WATCHDOG_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user