armada: enabled cpu watchdog in u-boot

BugzID: 50909
This commit is contained in:
Marcel Reichmuth 2018-08-17 18:00:29 +02:00
parent 1f108c8856
commit 68f6e97304
5 changed files with 50 additions and 1 deletions

4
Makefile Normal file → Executable file
View File

@ -363,6 +363,10 @@ KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
KBUILD_CFLAGS += -fshort-wchar
KBUILD_AFLAGS := -D__ASSEMBLY__
ifeq "$(UBOOT_USER_BUILD)" "1"
KBUILD_CFLAGS += -DUBOOT_USER_BUILD
endif
# Read UBOOTRELEASE from include/config/uboot.release (if it exists)
UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)

View File

@ -17,6 +17,7 @@
#include <environment.h>
#include <fdt_support.h>
#include <dm.h>
#include <wdt.h>
#include <asm/gpio.h>
@ -206,7 +207,6 @@ static int init_console(void)
uclass_next_device(&dev);
}
set_console();
/* Don't use external console, if we have no FPGA,
@ -330,6 +330,38 @@ struct hws_topology_map *ddr3_get_topology_map(void)
return &board_topology_map;
}
#if defined(CONFIG_WATCHDOG)
void watchdog_init(void)
{
/* NOTE: Global watchdog counter register is at 0xf1020334
Could not find this in the manual. */
if (uclass_get_device(UCLASS_WDT, 0, (struct udevice **)&(gd->watchdog))) {
puts("Cannot enable watchdog!\n");
} else {
puts("Enabling watchdog\n");
wdt_start(gd->watchdog, (u32) 25000000 * 150, 0); /* Timer runs at 25 MHz */
}
}
/* Called by macro WATCHDOG_RESET */
void watchdog_reset(void)
{
static ulong next_reset = 0;
ulong now;
if (!(gd->watchdog)) return;
now = timer_get_us();
/* Do not reset the watchdog too often */
if (now > next_reset) {
wdt_reset(gd->watchdog);
next_reset = now + 1000000;
}
}
#endif
int board_early_init_f(void)
{
/* Configure MPP */
@ -417,6 +449,10 @@ static void pass_hw_rev(void)
int board_init(void)
{
#if defined(CONFIG_WATCHDOG)
watchdog_init();
#endif
/* adress of boot parameters */
gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;

View File

@ -68,3 +68,5 @@ CONFIG_MVEBU_GPIO=y
CONFIG_DM_GPIO=y
CONFIG_CMD_EEPROM=y
CONFIG_ENV_IS_IN_EEPROM=y
CONFIG_WDT=y
CONFIG_WDT_ORION=y

3
include/asm-generic/global_data.h Normal file → Executable file
View File

@ -114,6 +114,9 @@ typedef struct global_data {
struct bootstage_data *bootstage; /* Bootstage information */
struct bootstage_data *new_bootstage; /* Relocated bootstage info */
#endif
#if defined(CONFIG_WATCHDOG)
struct udevice *watchdog;
#endif
} gd_t;
#endif

View File

@ -80,6 +80,10 @@
#define CONFIG_PCI_SCAN_SHOW
#endif
#if !defined(UBOOT_USER_BUILD) && !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT_ORION)
#define CONFIG_WATCHDOG
#endif
#define CONFIG_SYS_ALT_MEMTEST
#ifndef CONFIG_SPL_BUILD