@@ -131,7 +131,8 @@ static int API_puts(va_list ap)
*/
static int API_reset(va_list ap)
{
- do_reset(NULL, 0, 0, NULL);
+ if (system_reset())
+ return API_ENODEV;
/* NOT REACHED */
return 0;
@@ -35,11 +35,6 @@
#include <asm/arch/hardware.h>
#include <asm/arch/at91_st.h>
-void __attribute__((weak)) board_reset(void)
-{
- /* true empty function for defining weak symbol */
-}
-
void reset_cpu(ulong ignored)
{
at91_st_t *st = (at91_st_t *) AT91_ST_BASE;
@@ -33,8 +33,6 @@
#include <common.h>
#include <asm/arch/hardware.h>
-void board_reset(void) __attribute__((__weak__));
-
/*
* Reset the cpu by setting up the watchdog timer and let him time out
* or toggle a GPIO pin on the AT91RM9200DK board
@@ -39,7 +39,7 @@
#include <common.h>
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
puts ("resetting ...\n");
@@ -76,7 +76,7 @@ void prepare_to_boot(void)
"sync 0" : : "r"(0) : "memory");
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
/* This will reset the CPU core, caches, MMU and all internal busses */
__builtin_mtdr(8, 1 << 13); /* set DC:DBE */
@@ -27,7 +27,6 @@
#include <command.h>
-void board_reset(void) __attribute__((__weak__));
void bfin_reset_or_hang(void) __attribute__((__noreturn__));
void bfin_dump(struct pt_regs *reg);
void bfin_panic(struct pt_regs *reg);
@@ -75,32 +75,24 @@ static void bfin_reset(void)
asm("raise 1");
}
-/* We need to trampoline ourselves up into L1 since our linker
- * does not have relaxtion support and will only generate a
- * PC relative call with a 25 bit immediate. This is not enough
- * to get us from the top of SDRAM into L1.
- */
-__attribute__ ((__noreturn__))
-static inline void bfin_reset_trampoline(void)
-{
- if (board_reset)
- board_reset();
- while (1)
- asm("jump (%0);" : : "a" (bfin_reset));
-}
-
__attribute__ ((__noreturn__))
void bfin_reset_or_hang(void)
{
#ifdef CONFIG_PANIC_HANG
hang();
#else
- bfin_reset_trampoline();
+ system_reset();
#endif
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+/* We need to trampoline ourselves up into L1 since our linker
+ * does not have relaxtion support and will only generate a
+ * PC relative call with a 25 bit immediate. This is not enough
+ * to get us from the top of SDRAM into L1.
+ */
+__attribute__ ((__noreturn__))
+int arch_reset(void)
{
- bfin_reset_trampoline();
- return 0;
+ while (1)
+ asm("jump (%0);" : : "a" (bfin_reset));
}
@@ -113,7 +113,7 @@ int cpu_init_r(void)
return 0;
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
printf ("resetting ...\n");
udelay(50000); /* wait 50 ms */
@@ -33,7 +33,7 @@
DECLARE_GLOBAL_DATA_PTR;
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
volatile rcm_t *rcm = (rcm_t *) (MMAP_RCM);
udelay(1000);
@@ -34,7 +34,7 @@
DECLARE_GLOBAL_DATA_PTR;
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
volatile ccm_t *ccm = (ccm_t *) MMAP_CCM;
@@ -33,12 +33,11 @@
#include <command.h>
#include <asm/immap.h>
#include <netdev.h>
-#include "cpu.h"
DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_M5208
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
volatile rcm_t *rcm = (rcm_t *)(MMAP_RCM);
@@ -141,13 +140,8 @@ int checkcpu(void)
return 0;
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
- /* Call the board specific reset actions first. */
- if(board_reset) {
- board_reset();
- }
-
mbar_writeByte(MCF_RCM_RCR,
MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT);
return 0;
@@ -176,7 +170,7 @@ int watchdog_init(void)
#endif
#ifdef CONFIG_M5272
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
@@ -256,7 +250,7 @@ int watchdog_init(void)
#endif /* #ifdef CONFIG_M5272 */
#ifdef CONFIG_M5275
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
volatile rcm_t *rcm = (rcm_t *)(MMAP_RCM);
@@ -336,7 +330,7 @@ int checkcpu(void)
return 0;
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
MCFRESET_RCR = MCFRESET_RCR_SOFTRST;
return 0;
@@ -353,7 +347,7 @@ int checkcpu(void)
return 0;
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
/* enable watchdog, set timeout to 0 and wait */
mbar_writeByte(MCFSIM_SYPCR, 0xc0);
@@ -383,7 +377,7 @@ int checkcpu(void)
return 0;
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
/* enable watchdog, set timeout to 0 and wait */
mbar_writeByte(SIM_SYPCR, 0xc0);
deleted file mode 100644
@@ -1,33 +0,0 @@
-/*
- * cpu.h
- *
- * Copyright (c) 2009 Freescale Semiconductor, Inc.
- *
- * 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
- * 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 St, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef _CPU_H_
-#define _CPU_H_
-
-#include <command.h>
-
-/* Use this to create board specific reset functions */
-void board_reset(void) __attribute__((__weak__));
-
-#endif /* _CPU_H_ */
@@ -34,7 +34,7 @@
DECLARE_GLOBAL_DATA_PTR;
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
volatile rcm_t *rcm = (rcm_t *) (MMAP_RCM);
@@ -34,7 +34,7 @@
DECLARE_GLOBAL_DATA_PTR;
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
volatile rcm_t *rcm = (rcm_t *) (MMAP_RCM);
udelay(1000);
@@ -34,7 +34,7 @@
DECLARE_GLOBAL_DATA_PTR;
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
volatile gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);
@@ -42,7 +42,7 @@ void __attribute__((weak)) _machine_restart(void)
{
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
_machine_restart();
@@ -40,7 +40,7 @@ int checkcpu (void)
return (0);
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
disable_interrupts();
/* indirect call to go beyond 256MB limitation of toolchain */
@@ -234,7 +234,7 @@ soft_restart(unsigned long addr)
!defined(CONFIG_ELPPC) && \
!defined(CONFIG_PPMC7XX)
/* no generic way to do board reset. simply call soft_reset. */
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
ulong addr;
/* flush and disable I/D cache */
@@ -74,8 +74,7 @@ int checkcpu (void)
}
-int
-do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
ulong msr;
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
@@ -138,7 +138,7 @@ int dcache_status (void)
/*
* Reset board
*/
-int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
#if defined(CONFIG_PATI)
volatile ulong *addr = (ulong *) CONFIG_SYS_RESET_ADDRESS;
@@ -77,8 +77,7 @@ int checkcpu (void)
/* ------------------------------------------------------------------------- */
-int
-do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
ulong msr;
/* Interrupts and MMU off */
@@ -52,7 +52,7 @@ int checkcpu (void)
/* ------------------------------------------------------------------------- */
-int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
volatile gptmr8220_t *gptmr = (volatile gptmr8220_t *) MMAP_GPTMR;
ulong msr;
@@ -92,7 +92,7 @@ int checkdcache (void)
/*------------------------------------------------------------------- */
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
ulong msr, addr;
@@ -236,9 +236,7 @@ void upmconfig (uint upm, uint * table, uint size)
/* ------------------------------------------------------------------------- */
-#if !defined(CONFIG_HAVE_OWN_RESET)
-int
-do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
ulong msr, addr;
@@ -270,7 +268,6 @@ do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
return 1;
}
-#endif /* CONFIG_HAVE_OWN_RESET */
/* ------------------------------------------------------------------------- */
@@ -126,8 +126,7 @@ int checkcpu(void)
return 0;
}
-int
-do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
ulong msr;
#ifndef MPC83xx_RESET
@@ -202,11 +202,10 @@ int checkcpu (void)
/* ------------------------------------------------------------------------- */
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-/* Everything after the first generation of PQ3 parts has RSTCR */
#if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
defined(CONFIG_MPC8555) || defined(CONFIG_MPC8560)
+int arch_reset(void)
+{
unsigned long val, msr;
/*
@@ -220,14 +219,18 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
val = mfspr(DBCR0);
val |= 0x70000000;
mtspr(DBCR0,val);
+ return 1;
+}
#else
- volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+int arch_reset(void)
+{
+ /* Everything after the first generation of PQ3 parts has RSTCR */
+ ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
out_be32(&gur->rstcr, 0x2); /* HRESET_REQ */
udelay(100);
-#endif
-
return 1;
}
+#endif
/*
@@ -32,17 +32,6 @@
DECLARE_GLOBAL_DATA_PTR;
-/*
- * Default board reset function
- */
-static void
-__board_reset(void)
-{
- /* Do nothing */
-}
-void board_reset(void) __attribute__((weak, alias("__board_reset")));
-
-
int
checkcpu(void)
{
@@ -123,15 +112,12 @@ checkcpu(void)
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
- volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
- volatile ccsr_gur_t *gur = &immap->im_gur;
-
- /* Attempt board-specific reset */
- board_reset();
+ immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
+ ccsr_gur_t *gur = &immap->im_gur;
- /* Next try asserting HRESET_REQ */
+ /* Try asserting HRESET_REQ */
out_be32(&gur->rstcr, MPC86xx_RSTCR_HRST_REQ);
while (1)
@@ -478,7 +478,7 @@ void upmconfig (uint upm, uint * table, uint size)
#ifndef CONFIG_LWMON
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
ulong msr, addr;
@@ -521,7 +521,7 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* and thus too short to reset the external hardware. So we use the
* watchdog to reset the board.
*/
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
/* prevent triggering the watchdog */
disable_interrupts ();
@@ -40,8 +40,6 @@
DECLARE_GLOBAL_DATA_PTR;
-void board_reset(void);
-
/*
* To provide an interface to detect CPU number for boards that support
* more then one CPU, we implement the "weak" default functions here.
@@ -699,11 +697,8 @@ int ppc440spe_revB() {
/* ------------------------------------------------------------------------- */
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
-#if defined(CONFIG_BOARD_RESET)
- board_reset();
-#else
#if defined(CONFIG_SYS_4xx_RESET_TYPE)
mtspr(SPRN_DBCR0, CONFIG_SYS_4xx_RESET_TYPE << 28);
#else
@@ -712,8 +707,6 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
*/
mtspr(SPRN_DBCR0, 0x30000000);
#endif /* defined(CONFIG_SYS_4xx_RESET_TYPE) */
-#endif /* defined(CONFIG_BOARD_RESET) */
-
return 1;
}
@@ -59,7 +59,7 @@ int cleanup_before_linux(void)
return 0;
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
disable_interrupts();
reset_cpu(0);
@@ -45,7 +45,7 @@ int cleanup_before_linux(void)
return 0;
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
disable_interrupts();
reset_cpu(0);
@@ -44,7 +44,7 @@ int cleanup_before_linux (void)
return 0;
}
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
disable_interrupts();
reset_cpu (0);
@@ -49,10 +49,9 @@ void cpu_reset(void)
_reset_reloc();
}
-int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
cpu_reset();
-
return 1;
}
@@ -52,12 +52,10 @@ void cpu_reset(void)
_reset_reloc();
}
-int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
cpu_reset();
-
return 1;
-
}
u64 flash_read64(void *addr)
@@ -111,7 +111,6 @@ int misc_init_r(void)
}
}
#endif
- gd->jt[XF_do_reset] = (void *) do_reset;
#ifdef CONFIG_STATUS_LED
status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
@@ -365,8 +365,9 @@ void hw_watchdog_reset(void)
}
#endif
-void board_reset(void)
+int board_reset(void)
{
/* give reset to BCSR */
*(unsigned char *)(CONFIG_SYS_BCSR_BASE | 0x06) = 0x09;
+ return 0;
}
@@ -60,7 +60,7 @@ int board_init (void)
return 0;
}
-void board_reset (void)
+int board_reset(void)
{
AT91PS_PIO pio = AT91C_BASE_PIOA;
@@ -68,6 +68,7 @@ void board_reset (void)
writel(0x00080000, pio->PIO_CODR);
writel(0x00080000, pio->PIO_OER);
writel(0x00080000, pio->PIO_PER);
+ return 0;
}
int dram_init (void)
@@ -43,11 +43,12 @@ int checkboard(void)
return 0;
}
-void board_reset(void)
+int board_reset(void)
{
/* workaround for weak pull ups on ssel */
if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)
bfin_reset_boot_spi_cs(GPIO_PF10);
+ return 0;
}
#ifdef CONFIG_BFIN_MAC
@@ -103,7 +103,7 @@ int misc_init_r (void)
dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
if (gunzip (dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
printf ("GUNZIP ERROR - must RESET board to recover\n");
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
status = fpga_boot(dst, len);
@@ -136,7 +136,7 @@ int misc_init_r (void)
udelay(1000);
}
putc ('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
puts("FPGA: ");
@@ -181,10 +181,10 @@ void after_reloc (ulong dest_addr)
/* ------------------------------------------------------------------------- */
/*
- * do_reset is done here because in this case it is board specific, since the
- * 7xx CPUs can only be reset by external HW (the RTC in this case).
+ * Board-specific reset, since the 7xx CPUs can only be reset by external HW
+ * (the RTC in this case).
*/
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int board_reset(void)
{
#if defined(CONFIG_RTC_MK48T59)
/* trigger watchdog immediately */
@@ -117,7 +117,7 @@ phys_size_t initdram (int board_type)
* Register PI in the MPC 107 (at offset 0x41090 of the Embedded Utilities
* Memory Block).
*/
-int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int board_reset(void)
{
out8 (MPC107_EUMB_PI, 1);
return (0);
@@ -219,7 +219,7 @@ int misc_init_r(void)
dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
if (gunzip(dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
printf("GUNZIP ERROR - must RESET board to recover\n");
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
status = fpga_boot(dst, len);
@@ -255,7 +255,7 @@ int misc_init_r(void)
udelay(1000);
}
putc('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
/* restore gpio/cs settings */
@@ -112,7 +112,7 @@ int board_early_init_f (void)
udelay (1000);
}
putc ('\n');
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
}
@@ -88,7 +88,7 @@ int misc_init_r (void)
dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
if (gunzip (dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
printf ("GUNZIP ERROR - must RESET board to recover\n");
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
status = fpga_boot(dst, len);
@@ -121,7 +121,7 @@ int misc_init_r (void)
udelay(1000);
}
putc ('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
puts("FPGA: ");
@@ -108,7 +108,7 @@ int board_early_init_f (void)
udelay (1000);
}
putc ('\n');
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
/*
@@ -160,7 +160,7 @@ int board_early_init_f(void)
udelay(1000);
}
putc('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
}
#endif /* !CONFIG_CPCI405_VER2 */
@@ -288,7 +288,7 @@ int misc_init_r (void)
if (gunzip(dst, CONFIG_SYS_FPGA_MAX_SIZE,
(uchar *)fpgadata, &len) != 0) {
printf("GUNZIP ERROR - must RESET board to recover\n");
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
status = fpga_boot(dst, len);
@@ -324,7 +324,7 @@ int misc_init_r (void)
udelay(1000);
}
putc('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
/* restore gpio/cs settings */
@@ -106,7 +106,7 @@ int board_early_init_f (void)
udelay (1000);
}
putc ('\n');
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
/*
@@ -106,7 +106,7 @@ int board_early_init_f (void)
udelay (1000);
}
putc ('\n');
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
/*
@@ -417,7 +417,7 @@ int misc_init_r (void)
dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
if (gunzip (dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
printf ("GUNZIP ERROR - must RESET board to recover\n");
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
status = fpga_boot(dst, len);
@@ -450,7 +450,7 @@ int misc_init_r (void)
udelay(1000);
}
putc ('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
puts("FPGA: ");
@@ -198,7 +198,7 @@ int misc_init_r (void)
dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
if (gunzip (dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
printf ("GUNZIP ERROR - must RESET board to recover\n");
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
status = fpga_boot(dst, len);
@@ -231,7 +231,7 @@ int misc_init_r (void)
udelay(1000);
}
putc ('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
puts("FPGA: ");
@@ -121,7 +121,7 @@ int misc_init_r(void)
if (gunzip(dst, CONFIG_SYS_FPGA_MAX_SIZE,
(uchar *)fpgadata, &len) != 0) {
printf("GUNZIP ERROR - must RESET board to recover\n");
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
status = fpga_boot(dst, len);
@@ -157,7 +157,7 @@ int misc_init_r(void)
udelay(1000);
}
putc('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
puts("FPGA: ");
@@ -152,7 +152,7 @@ int misc_init_r (void)
dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
if (gunzip (dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
printf ("GUNZIP ERROR - must RESET board to recover\n");
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
status = fpga_boot(dst, len);
@@ -185,7 +185,7 @@ int misc_init_r (void)
udelay(1000);
}
putc ('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
puts("FPGA: ");
@@ -117,7 +117,7 @@ int misc_init_r (void)
dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
if (gunzip (dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
printf ("GUNZIP ERROR - must RESET board to recover\n");
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
status = fpga_boot(dst, len);
@@ -150,7 +150,7 @@ int misc_init_r (void)
udelay(1000);
}
putc ('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
puts("FPGA: ");
@@ -85,7 +85,7 @@ int misc_init_r (void)
dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
if (gunzip (dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
printf ("GUNZIP ERROR - must RESET board to recover\n");
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
status = fpga_boot(dst, len);
@@ -118,7 +118,7 @@ int misc_init_r (void)
udelay(1000);
}
putc ('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
puts("FPGA: ");
@@ -314,7 +314,7 @@ int board_eth_init(bd_t *bis)
return pci_eth_init(bis);
}
-void board_reset(void)
+int board_reset(void)
{
u8 *pixis_base = (u8 *)PIXIS_BASE;
@@ -252,7 +252,7 @@ int board_eth_init(bd_t *bis)
return pci_eth_init(bis);
}
-void board_reset(void)
+int board_reset(void)
{
u8 *pixis_base = (u8 *)PIXIS_BASE;
@@ -304,9 +304,7 @@ int misc_init_r (void)
return 0;
}
-#if defined(CONFIG_HAVE_OWN_RESET)
-int
-do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int board_reset(void)
{
volatile ioport_t *iop;
@@ -314,7 +312,6 @@ do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
iop->pdat |= 0x00002000; /* PC18 = HW_RESET */
return 1;
}
-#endif /* CONFIG_HAVE_OWN_RESET */
#define ns2clk(ns) (ns / (1000000000 / CONFIG_8260_CLKIN) + 1)
@@ -490,7 +490,8 @@ void video_get_info_str(int line_number, char *info)
#endif /* CONFIG_CONSOLE_EXTRA_INFO */
#endif /* CONFIG_VIDEO */
-void board_reset(void)
+int board_reset(void)
{
gpio_write_bit(CONFIG_SYS_GPIO_BOARD_RESET, 1);
+ return 0;
}
@@ -69,7 +69,7 @@ phys_size_t initdram (int board_type)
return cpc710_ram_init ();
}
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int board_reset(void)
{
out32 (REG (CPC0, SPOR), 0);
iobarrier_rw ();
@@ -84,11 +84,11 @@ int misc_init_r( void )
/*
- * do_reset()
+ * board_reset()
*
- * Shell command to reset the board.
+ * Called from the "reset" shell command.
*/
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int board_reset(void)
{
printf( "Resetting...\n" );
@@ -181,7 +181,7 @@ int do_fpga_boot(unsigned char *fpgadata)
udelay(1000);
}
putc('\n');
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
}
puts("FPGA: ");
@@ -826,7 +826,7 @@ void show_boot_progress (int status)
/*
* Reset the board to retry initialization.
*/
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
}
}
#endif /* CONFIG_SHOW_BOOT_PROGRESS */
@@ -245,9 +245,9 @@ unsigned long get_board_sys_clk (ulong dummy)
return val;
}
-void board_reset(void)
-{
#ifdef CONFIG_SYS_RESET_ADDRESS
+int board_reset(void)
+{
ulong addr = CONFIG_SYS_RESET_ADDRESS;
/* flush and disable I/D cache */
@@ -271,8 +271,9 @@ void board_reset(void)
__asm__ __volatile__ ("li 4, (1 << 6)" ::: "r4");
__asm__ __volatile__ ("mtspr 27, 4");
__asm__ __volatile__ ("rfi");
-#endif
+ return 0;
}
+#endif
#ifdef CONFIG_MP
extern void cpu_mp_lmb_reserve(struct lmb *lmb);
@@ -31,7 +31,7 @@
#include <asm/microblaze_intc.h>
#include <asm/asm.h>
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int arch_reset(void)
{
#ifdef CONFIG_SYS_GPIO_0
*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) =
@@ -372,7 +372,7 @@ int do_chkreset(cmd_tbl_t* cmdtp, int flag, int argc, char * const argv[])
/*
* Reset the board for default to become valid
*/
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
return 0;
}
@@ -392,7 +392,7 @@ int do_chkreset(cmd_tbl_t* cmdtp, int flag, int argc, char * const argv[])
*/
logbuff_reset();
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
return 0;
}
@@ -60,6 +60,23 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* -------------------------------------------------------------------- */
+/* These weak stubs are overridden by individual boards and architectures */
+__attribute__((__weak__)) int board_reset(void)
+{
+ return 0;
+}
+__attribute__((__weak__)) int arch_reset(void)
+{
+ return 0;
+}
+
+/* This is the "official" system reset function */
+int system_reset(void)
+{
+ int ret = board_reset();
+ return ret ? ret : arch_reset();
+}
+
U_BOOT_CMD(
go, CONFIG_SYS_MAXARGS, 1, do_go,
"start application at address 'addr'",
@@ -67,8 +84,12 @@ U_BOOT_CMD(
" passing 'arg' as arguments"
);
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ return system_reset();
+}
U_BOOT_CMD(
- reset, 1, 0, do_reset,
+ reset, 1, 0, do_reset,
"Perform RESET of the CPU",
""
);
@@ -645,7 +645,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (ret < 0) {
if (ret == BOOTM_ERR_RESET)
- do_reset (cmdtp, flag, argc, argv);
+ system_reset();
if (ret == BOOTM_ERR_OVERLAP) {
if (images.legacy_hdr_valid) {
if (image_get_type (&images.legacy_hdr_os_copy) == IH_TYPE_MULTI)
@@ -655,7 +655,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
puts ("ERROR: new format image overwritten - "
"must RESET the board to recover\n");
show_boot_progress (-113);
- do_reset (cmdtp, flag, argc, argv);
+ system_reset();
}
}
if (ret == BOOTM_ERR_UNIMPLEMENTED) {
@@ -702,8 +702,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#ifdef DEBUG
puts ("\n## Control returned to monitor - resetting...\n");
#endif
- do_reset (cmdtp, flag, argc, argv);
-
+ system_reset();
return 1;
}
@@ -1036,7 +1036,7 @@ static void get_user_input(struct in_str *i)
if (n == -2) {
puts("\nTimeout waiting for command\n");
# ifdef CONFIG_RESET_TO_RETRY
- do_reset(NULL, 0, 0, NULL);
+ system_reset();
# else
# error "This currently only works with CONFIG_RESET_TO_RETRY enabled"
# endif
@@ -450,7 +450,7 @@ void main_loop (void)
puts ("\nTimed out waiting for command\n");
# ifdef CONFIG_RESET_TO_RETRY
/* Reinit board to run initialization code again */
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
# else
return; /* retry autoboot */
# endif
@@ -81,7 +81,7 @@ void __udelay(unsigned long usec)
ub_udelay(usec);
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int system_reset(void)
{
ub_reset();
return 0;
@@ -15,7 +15,7 @@ EXPORT_FUNC(free)
EXPORT_FUNC(udelay)
EXPORT_FUNC(get_timer)
EXPORT_FUNC(vprintf)
-EXPORT_FUNC(do_reset)
+EXPORT_FUNC(system_reset)
EXPORT_FUNC(getenv)
EXPORT_FUNC(setenv)
EXPORT_FUNC(simple_strtoul)
@@ -99,7 +99,8 @@ extern int cmd_get_data_size(char* arg, int default_size);
extern int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
#endif
extern int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-extern int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+
+extern int system_reset(void);
#endif /* __ASSEMBLY__ */
@@ -47,9 +47,6 @@
/* have reset_phy_r() function */
#define CONFIG_RESET_PHY_R 1
-/* have special reset function */
-#define CONFIG_HAVE_OWN_RESET 1
-
/* allow serial and ethaddr to be overwritten */
#define CONFIG_ENV_OVERWRITE
@@ -49,7 +49,6 @@
#define CONFIG_BOARD_EARLY_INIT_R /* Call board_early_init_r */
#define CONFIG_BOARD_POSTCLK_INIT /* Call board_postclk_init */
#define CONFIG_MISC_INIT_R /* Call misc_init_r */
-#define CONFIG_BOARD_RESET /* Call board_reset */
/*
* Base addresses -- Note these are effective addresses where the
@@ -51,7 +51,6 @@
#define CONFIG_BOARD_EARLY_INIT_F 1 /* Call board_early_init_f */
#define CONFIG_MISC_INIT_R 1 /* call misc_init_r() */
-#define CONFIG_BOARD_RESET 1 /* call board_reset() */
/*-----------------------------------------------------------------------
* Base addresses -- Note these are effective addresses where the
@@ -674,6 +674,6 @@ void panic(const char *fmt, ...)
hang();
#else
udelay (100000); /* allow messages to go out */
- do_reset (NULL, 0, 0, NULL);
+ system_reset();
#endif
}
The existing do_reset() shell command function is defined and redefined all over the place. Most CPU types have their own default internal reset mechanism, even if it is just to force a triple-fault. In addition, some board designs require the ability to override the native CPU reset due to hardware requirements or limitations. This patch is designed to make it much easier for boards to generically override their CPU-architecture reset routine, as well as to provide a generic entrypoint for common improvements to CPU reset (IE: clean restart of network/storage devices, etc). In particular, this is necessary for the new eXMeritus HWW-1U-1A port. All of the board-specific reset routines are renamed from do_reset() to board_reset(). A few CPUs already had a customized board_reset() hook; those were adjusted to use the new board_reset() prototype. All of the CPU-specific reset routines are renamed from do_reset() to arch_reset(). The name cpu_reset() might better, but that is already in use in various places for SMP support. (IE: Reset one particular CPU). Weak no-ops were created for arch_reset() and board_reset() to support platforms which don't implement one or both of them. A new generic system_reset() function was introduced which simply calls board_reset() and cpu_reset() in that order, and all explicit callers of do_reset() were changed to use system_reset() instead. Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Albert Aribaud <albert.aribaud@free.fr> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Jason Jin <jason.jin@freescale.com> Cc: Michal Simek <monstr@monstr.eu> Cc: Shinya Kuribayashi <skuribay@pobox.com> Cc: Kim Phillips <kim.phillips@freescale.com> Cc: Andy Fleming <afleming@gmail.com> Cc: Kumar Gala <kumar.gala@freescale.com> Cc: Stefan Roese <sr@denx.de> Cc: Daniel Hellstrom <daniel@gaisler.com> Cc: Graeme Russ <graeme.russ@gmail.com> --- v4: Complete rewrite as a fully architecture-independent feature api/api.c | 3 +- arch/arm/cpu/arm920t/at91/reset.c | 5 --- arch/arm/cpu/arm920t/at91rm9200/reset.c | 2 - arch/arm/lib/reset.c | 2 +- arch/avr32/cpu/cpu.c | 2 +- arch/blackfin/cpu/cpu.h | 1 - arch/blackfin/cpu/reset.c | 28 ++++++----------- arch/i386/cpu/cpu.c | 2 +- arch/m68k/cpu/mcf5227x/cpu.c | 2 +- arch/m68k/cpu/mcf523x/cpu.c | 2 +- arch/m68k/cpu/mcf52x2/cpu.c | 20 ++++-------- arch/m68k/cpu/mcf52x2/cpu.h | 33 -------------------- arch/m68k/cpu/mcf532x/cpu.c | 2 +- arch/m68k/cpu/mcf5445x/cpu.c | 2 +- arch/m68k/cpu/mcf547x_8x/cpu.c | 2 +- arch/mips/cpu/cpu.c | 2 +- arch/nios2/cpu/cpu.c | 2 +- arch/powerpc/cpu/74xx_7xx/cpu.c | 2 +- arch/powerpc/cpu/mpc512x/cpu.c | 3 +- arch/powerpc/cpu/mpc5xx/cpu.c | 2 +- arch/powerpc/cpu/mpc5xxx/cpu.c | 3 +- arch/powerpc/cpu/mpc8220/cpu.c | 2 +- arch/powerpc/cpu/mpc824x/cpu.c | 2 +- arch/powerpc/cpu/mpc8260/cpu.c | 5 +-- arch/powerpc/cpu/mpc83xx/cpu.c | 3 +- arch/powerpc/cpu/mpc85xx/cpu.c | 15 +++++--- arch/powerpc/cpu/mpc86xx/cpu.c | 22 ++----------- arch/powerpc/cpu/mpc8xx/cpu.c | 4 +- arch/powerpc/cpu/ppc4xx/cpu.c | 9 +----- arch/sh/cpu/sh2/cpu.c | 2 +- arch/sh/cpu/sh3/cpu.c | 2 +- arch/sh/cpu/sh4/cpu.c | 2 +- arch/sparc/cpu/leon2/cpu.c | 3 +- arch/sparc/cpu/leon3/cpu.c | 4 +-- board/BuS/eb_cpux9k2/cpux9k2.c | 1 - board/amcc/yosemite/yosemite.c | 3 +- board/atmel/at91rm9200dk/at91rm9200dk.c | 3 +- board/bf537-stamp/bf537-stamp.c | 3 +- board/dave/PPChameleonEVB/PPChameleonEVB.c | 4 +- board/eltec/bab7xx/bab7xx.c | 6 ++-- board/eltec/elppc/elppc.c | 2 +- board/esd/apc405/apc405.c | 4 +- board/esd/ar405/ar405.c | 2 +- board/esd/ash405/ash405.c | 4 +- board/esd/canbt/canbt.c | 2 +- board/esd/cpci405/cpci405.c | 6 ++-- board/esd/cpciiser4/cpciiser4.c | 2 +- board/esd/du405/du405.c | 2 +- board/esd/hh405/hh405.c | 4 +- board/esd/pci405/pci405.c | 4 +- board/esd/plu405/plu405.c | 4 +- board/esd/tasreg/tasreg.c | 4 +- board/esd/voh405/voh405.c | 4 +- board/esd/wuh405/wuh405.c | 4 +- board/freescale/mpc8610hpcd/mpc8610hpcd.c | 2 +- board/freescale/mpc8641hpcn/mpc8641hpcn.c | 2 +- board/funkwerk/vovpn-gw/vovpn-gw.c | 5 +-- board/lwmon5/lwmon5.c | 3 +- board/pcippc2/pcippc2.c | 2 +- board/ppmc7xx/ppmc7xx.c | 6 ++-- board/prodrive/pdnb3/pdnb3.c | 2 +- board/sacsng/sacsng.c | 2 +- board/sbc8641d/sbc8641d.c | 7 ++-- .../xilinx/microblaze-generic/microblaze-generic.c | 2 +- board/zeus/zeus.c | 4 +- common/cmd_boot.c | 23 +++++++++++++- common/cmd_bootm.c | 7 ++-- common/hush.c | 2 +- common/main.c | 2 +- examples/api/libgenwrap.c | 2 +- include/_exports.h | 2 +- include/command.h | 3 +- include/configs/VoVPN-GW.h | 3 -- include/configs/lwmon5.h | 1 - include/configs/yosemite.h | 1 - lib/vsprintf.c | 2 +- 76 files changed, 143 insertions(+), 207 deletions(-) delete mode 100644 arch/m68k/cpu/mcf52x2/cpu.h