Hi,all
Since my board hardware problem, I need to a warm reset my board with the WDOG1, like uboot "reset", only reset POR.
freescale code default support WDOG2,a cold reset.Third-party kernel like openwrt imx6q kernel linux-3.10.32 support warm reset.
In imx6q linux3.0.35,I modify some code below:
1.arch/arm/mach-mx6/cpu.c
/* Disable SRC warm reset to work aound system reboot issue */
base = IO_ADDRESS(SRC_BASE_ADDR);
reg = __raw_readl(base);
//reg &= ~0x1;
reg |=0x1;//force SRC warm reset
__raw_writel(reg, base);
2.arch/arm/plat-mxc/system.c
//add
#define SRC_SCR 0x000
#define SRC_GPR1 0x020
#define BP_SRC_SCR_WARM_RESET_ENABLE 0
#define BP_SRC_SCR_CORE1_RST 14
#define BP_SRC_SCR_CORE1_ENABLE 22
void imx_src_prepare_restart(void)
{
u16 val;
/* clear enable bits of secondary cores */
val = __raw_readw(IO_ADDRESS(0x20d8000));//src_scr
val &= ~(0x7<< BP_SRC_SCR_CORE1_ENABLE);
printk("SRC_SCR=0x%x\n",val);//val=0x521
//__raw_writew(0,IO_ADDRESS(0x20bc008));//WDOG_WMCR diable counter optertion
/* clear persistent entry register of primary core */
__raw_writew(0,IO_ADDRESS(0x20d8020));//src_gpr1 core1
__raw_writew(0,IO_ADDRESS(0x20d8024));
__raw_writew(0,IO_ADDRESS(0x20d8028));//core2
__raw_writew(0,IO_ADDRESS(0x20d802c));
__raw_writew(0,IO_ADDRESS(0x20d8030));
__raw_writew(0,IO_ADDRESS(0x20d8034));//core3
__raw_writew(0,IO_ADDRESS(0x20d8038));
__raw_writew(0,IO_ADDRESS(0x20d803c));//core4
}
void arch_reset(char mode, const char *cmd)
{
unsigned int wcr_enable;
printk("%s\n",__FILE__);
arch_reset_special_mode(mode, cmd);
imx_src_prepare_restart();
#ifdef CONFIG_ARCH_MX6
#if 0
/* wait for reset to assert... */
if (enable_ldo_mode == LDO_MODE_BYPASSED) {
/*On Sabresd board use WDOG2 to reset external PMIC, so here do
* more WDOG2 reset.*/
printk("WDOG2\n");
wcr_enable = 0x14;
__raw_writew(wcr_enable, IO_ADDRESS(MX6Q_WDOG2_BASE_ADDR));
__raw_writew(wcr_enable, IO_ADDRESS(MX6Q_WDOG2_BASE_ADDR));
} else
#endif
wcr_enable = 0x4;
__raw_writew(wcr_enable, wdog_base);
/* errata TKT039676, SRS bit may be missed when
SRC sample it, need to write the wdog controller
twice to avoid it */
__raw_writew(wcr_enable, wdog_base);
/* wait for reset to assert... */
mdelay(500);
printk(KERN_ERR "Watchdog reset failed to assert reset\n");
mdelay(500);
return;
#endif
}
But also not reboot the system!! imx6q linux 3.0.35 can support software warm reset or not?
If can,what should I do?
Hi mrleo,
Our experts has replied to you in another thread you created, please have a check and close this thread for us. Thanks.
Have a great day
Best Regards
Dan