U-Boot的复位命令reset通过do_reset函数实现: arch/arm/lib/reset.c - 42 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-
43 {
-
44 puts ("resetting ...\n");
-
45
-
46 udelay (50000); /* wait 50 ms */
-
47
-
48 disable_interrupts();
-
49 reset_cpu(0);
-
50
-
51 /*NOTREACHED*/
-
52 return 0;
-
53 }
reset_cpu(0)的函数原型是reset_cpu(ulong),一般在具体CPU中实现,可采取内狗超时实现复位: arch/arm/cpu/arm926ejs/at91/reset.c - 4 void reset_cpu(ulong ignored)
-
5 {
-
6 at91_rstc_t *rstc = (at91_rstc_t *) AT91_RSTC_BASE;
-
7
-
8 /* this is the way Linux does it */
-
9
-
10 writel(AT91_RSTC_KEY | AT91_RSTC_CR_PROCRST | AT91_RSTC_CR_PERRST,
-
11 &rstc->cr);
-
12
-
13 while (1);
-
14 /* Never reached */
-
15 }
LPC3250的reset_cpu()实现: arch/arm/cpu/arm926ejs/lpc3250/reset.c 也可以在其它地方实现./board/zhiyuan/m3250evb/m3250evb.c - 76 /*
-
77 * Use the watchdog timer to reset the system
-
78 */
-
79 void reset_cpu(ulong addr)
-
80 {
-
81 /* Enable the WDT clock */
-
82 CLKPWR->clkpwr_timer_clk_ctrl |= CLKPWR_PWMCLK_WDOG_EN;
-
83
-
84 /* Instant assert of RESETOUT_N with pulse length 1mS */
-
85 WDT->wdtim_pulse = 13000;
-
86 WDT->wdtim_mctrl = 0x70;
-
87 /* Wait forever */
-
88 while (1);
-
89 }
|