如果没有实现底层reboot支持,输入reboot命令不能重启系统,或者会引起系统出错。
 
需要实现体系结构的arch_reset(char mode)函数。
 
文件:arch/arm/mach-lpc32xx/include/mach/system.h
 1 static inline void arch_reset(char mode)
 2 {
 3 // cpu_reset(0);
 4     extern void lpc32xx_watchdog_reset(void);
 5 
 6     switch (mode) {
 7     case 's':
 8     case 'h':
 9         printk(KERN_CRIT "RESET: Rebooting system\n");
10         /* Disable interrupts */
11         local_irq_disable();
12         lpc32xx_watchdog_reset();
13         break;
14 
15     default:
16         /* Do nothing */
17         break;
18     }
19 
20     /* Wait for watchdog to reset system */
21     while (1)
22         ;
23 }
可以看到,是通过看门狗实现系统复位的,所以必须实现看门狗的操作。
 
文件:arch/arm/mach-lpc32xx/arch-lpc32xx.c
/*
 * System reset via the watchdog timer
 */
void lpc32xx_watchdog_reset(void)
{
    /* Make sure WDT clocks are enabled */
    __raw_writel(CLKPWR_PWMCLK_WDOG_EN,
            CLKPWR_TIMER_CLK_CTRL(CLKPWR_IOBASE));

    /* Instant assert of RESETOUT_N with pulse length 1mS */
    __raw_writel(13000, io_p2v(WDTIM_BASE + 0x18));
    __raw_writel(0x70, io_p2v(WDTIM_BASE + 0xC));
}

这样的内核就能使用reboot命令而不会出错了。

posted on 2012-04-28 16:05  风行雪舞  阅读(312)  评论(0编辑  收藏  举报
无觅相关文章插件,快速提升流量