]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - board/keymile/kmp204x/kmp204x.c
Merge branch 'zynq' of git://www.denx.de/git/u-boot-microblaze
[karo-tx-uboot.git] / board / keymile / kmp204x / kmp204x.c
index 6bc8eb85eaa9a9c58ec6da57c054c137c0464e9c..4a736137e3fcffd72e3846f4a218542733d1270d 100644 (file)
@@ -80,21 +80,36 @@ int get_scl(void)
 
 #define ZL30158_RST    8
 #define BFTIC4_RST     0
+#define RSTRQSR1_WDT_RR        0x00200000
+#define RSTRQSR1_SW_RR 0x00100000
 
 int board_early_init_f(void)
 {
        ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+       bool cpuwd_flag = false;
+
+       /* configure mode for uP reset request */
+       qrio_uprstreq(UPREQ_CORE_RST);
 
        /* board only uses the DDR_MCK0, so disable the DDR_MCK1/2/3 */
        setbits_be32(&gur->ddrclkdr, 0x001f000f);
 
+       /* set reset reason according CPU register */
+       if ((gur->rstrqsr1 & (RSTRQSR1_WDT_RR | RSTRQSR1_SW_RR)) ==
+           RSTRQSR1_WDT_RR)
+               cpuwd_flag = true;
+
+       qrio_cpuwd_flag(cpuwd_flag);
+       /* clear CPU bits by writing 1 */
+       setbits_be32(&gur->rstrqsr1, RSTRQSR1_WDT_RR | RSTRQSR1_SW_RR);
+
        /* set the BFTIC's prstcfg to reset at power-up and unit reset only */
        qrio_prstcfg(BFTIC4_RST, PRSTCFG_POWUP_UNIT_RST);
        /* and enable WD on it */
        qrio_wdmask(BFTIC4_RST, true);
 
-       /* set the ZL30138's prstcfg to reset at power-up and unit reset only */
-       qrio_prstcfg(ZL30158_RST, PRSTCFG_POWUP_UNIT_RST);
+       /* set the ZL30138's prstcfg to reset at power-up only */
+       qrio_prstcfg(ZL30158_RST, PRSTCFG_POWUP_RST);
        /* and take it out of reset as soon as possible (needed for Hooper) */
        qrio_prst(ZL30158_RST, false, false);
 
@@ -143,8 +158,8 @@ int misc_init_f(void)
        qrio_prstcfg(ETH_FRONT_PHY_RST, PRSTCFG_POWUP_UNIT_CORE_RST);
        qrio_prst(ETH_FRONT_PHY_RST, false, false);
 
-       /* set the ZL30343 prstcfg to reset at power-up and unit reset only */
-       qrio_prstcfg(ZL30343_RST, PRSTCFG_POWUP_UNIT_RST);
+       /* set the ZL30343 prstcfg to reset at power-up only */
+       qrio_prstcfg(ZL30343_RST, PRSTCFG_POWUP_RST);
        /* and enable the WD on it */
        qrio_wdmask(ZL30343_RST, true);