/**********************************************/
1.u-boot中reset的流程
reset-->do_reset(打印 resetting-->延时50ms-->disable_interrupts)-->reset_cpu-->操作看门狗-->系统复位
2.imx6板子的rest_cpu在/board/wandboard/wandboard_spl.c中,代码如下:
/**********************************************/
void reset_cpu(ulong addr)
{
__REG16(WDOG1_BASE_ADDR) = 4;
}
/**********************************************/
#define __REG16(x) (*((volatile u16 *)(x)))
#define unsigned short u16
/**********************************************/
#define WDOG1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x3C000)
#define AIPS1_OFF_BASE_ADDR (ATZ1_BASE_ADDR + 0x80000)
#define ATZ1_BASE_ADDR AIPS1_ARB_BASE_ADDR
#define AIPS1_ARB_BASE_ADDR 0x02000000
/**********************************************/
int disable_interrupts (void)
{
unsigned long old,temp;
__asm__ __volatile__("mrs %0, cpsr\n"
"orr %1, %0, #0xc0\n"
"msr cpsr_c, %1"
: "=r" (old), "=r" (temp)
:
: "memory");
return (old & 0x80) == 0;
}
/**********************************************/
#define CONFIGURE_INIT
#include "system.h"
#include
/*
* 实现软重启
*/
#define WDOG1_BASE_ADDR (AIPS1_OFF_BASE_ADDR + 0x3C000)
#define AIPS1_OFF_BASE_ADDR (ATZ1_BASE_ADDR + 0x80000)
#define ATZ1_BASE_ADDR AIPS1_ARB_BASE_ADDR
#define AIPS1_ARB_BASE_ADDR 0x02000000
#define __REG16(x) (*((volatile u16 *)(x)))
int disable_interrupts (void)
{
unsigned long old,temp;
__asm__ __volatile__("mrs %0, cpsr\n"
"orr %1, %0, #0xc0\n"
"msr cpsr_c, %1"
: "=r" (old), "=r" (temp)
:
: "memory");
return (old & 0x80) == 0;
}
void my_reset()
{
printf("resetting...\n");
disable_interrupts();
__REG16(WDOG1_BASE_ADDR) = 4;
}