[U-Boot] Zynq: CONFIG_BOARD_RESET or reset_misc(), or ...?
Leon Woestenberg
leon at sidebranch.com
Thu May 17 21:40:50 UTC 2018
Hello all,
for a Zynq (7-series) ARM based system I would like to implement a
board-specific reset function.
There are a few existing slightly different methods in place (see
below). What is the preferred way and place?
My current feeling is overriding reset_misc() in board.c, i.e. method
#4 from the existings methods I found in U-Boot, see below.
1) There used to be a call-out from the CPU reset to the board_reset()
if CONFIG_BOARD_RESET was defined non-zero, like this:
arch/powerpc/cpu/ppc4xx/cpu.c:
<...>
void board_reset(void);
<...>
int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
#if defined(CONFIG_BOARD_RESET)
board_reset();
<...>
This only existed for ppc4xx (which I think has been obsoleted now).
2) Blackfin seems to define a weak label "board_reset", and this
(function) pointer is compared against non-NULL, called if non-NULL.
arch/blackfin/cpu/reset.c:88: if (board_reset)
arch/blackfin/cpu/reset.c:89: board_reset();
arch/blackfin/cpu/cpu.h:14:void board_reset(void) __attribute__((__weak__));
3) PowerPC MPC85xx seems to define a weak label, and alias it to a
__board_reset();
arch/powerpc/cpu/mpc85xx/cpu.c:33:__board_reset(void)
arch/powerpc/cpu/mpc85xx/cpu.c:37:void board_reset(void)
__attribute__((weak, alias("__board_reset")));
arch/powerpc/cpu/mpc85xx/cpu.c:315: board_reset();
/*
* Default board reset function
*/
static void
__board_reset(void)
{
/* Do nothing */
}
void board_reset(void) __attribute__((weak, alias("__board_reset")));
4) Similarly but a bit hidden for my "grep board_reset", is
reset_misc() in arch/arm/lib/reset.c:
#include <common.h>
__weak void reset_misc(void)
{
}
int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
puts ("resetting ...\n");
udelay (50000); /* wait 50 ms */
disable_interrupts();
reset_misc();
Thanks,
Leon.
--
Leon Woestenberg
More information about the U-Boot
mailing list