]> git.sur5r.net Git - u-boot/commitdiff
Improve "reset" command's interaction with watchdog.
authorHaiying Wang <Haiying.Wang@freescale.com>
Tue, 30 May 2006 14:10:32 +0000 (09:10 -0500)
committerJon Loeliger <jdl@jdl.com>
Tue, 30 May 2006 14:10:32 +0000 (09:10 -0500)
    "reset altbank" will reset another bank WITHOUT watch dog timer enabled
    "reset altbank wd" will reset another bank WITH watch dog enabled
    "diswd" will disable watch dog after u-boot boots up successfully

Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
cpu/mpc86xx/cpu.c

index 36da7774eaf4f47132b53a6752ea008a8e9a7bac..5c6c2ee40acc3cfb8cf199cc7ee720b01b9e878d 100644 (file)
@@ -169,7 +169,7 @@ soft_restart(unsigned long addr)
 
 int set_px_sysclk(ulong sysclk)
 {
-         u8 sysclk_s, sysclk_r, sysclk_v, vclkh, vclkl, sysclk_aux,tmp;
+         u8 sysclk_s, sysclk_r, sysclk_v, vclkh, vclkl, sysclk_aux;
 
          /* Per table 27, page 58 of MPC8641HPCN spec*/
          switch(sysclk)
@@ -354,6 +354,24 @@ void set_px_go_with_watchdog(void)
          out8(PIXIS_BASE+PIXIS_VCTL,tmp);
 }
 
+int disable_watchdog(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       u8 tmp;
+       tmp = in8(PIXIS_BASE+PIXIS_VCTL);
+       tmp = tmp & 0x1E;
+       out8(PIXIS_BASE+PIXIS_VCTL,tmp);
+       tmp = in8(PIXIS_BASE + PIXIS_VCTL);
+       tmp &= ~ 0x08; /* setting VCTL[WDEN] to 0 to disable watch dog */
+       out8(PIXIS_BASE + PIXIS_VCTL, tmp);
+       return 0;
+}
+
+U_BOOT_CMD(
+       diswd, 1, 0, disable_watchdog,
+       "diswd  - Disable watchdog timer \n",
+       NULL
+);
+
 /* This function takes the non-integral cpu:mpx pll ratio
  * and converts it to an integer that can be used to assign
  * FPGA register values.
@@ -509,18 +527,27 @@ do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                                        goto my_usage;
 
                                while(1); /* Not reached */
-                       } else {
-                               /* Reset from next bank without changing frequencies */
+                       } else if(argv[2][1] == 'd'){
+                               /* Reset from next bank without changing frequencies but with watchdog timer enabled */
                                read_from_px_regs(0);
                                read_from_px_regs_altbank(0);
-                               if(argc > 2)
-                                       goto my_usage;
                                printf("Setting registers VCFGEN1, VBOOT, and VCTL\n");
                                set_altbank();
                                read_from_px_regs_altbank(1);
                                printf("Enabling watchdog timer on the FPGA and resetting board to boot from the other bank....\n");
                                set_px_go_with_watchdog();
                                while(1); /* Not reached */
+                       } else {
+                               /* Reset from next bank without changing frequency and without watchdog timer enabled */
+                               read_from_px_regs(0);
+                               read_from_px_regs_altbank(0);
+                               if(argc > 2)
+                                       goto my_usage;
+                               printf("Setting registers VCFGNE1, VBOOT, and VCTL\n");
+                               set_altbank();
+                               read_from_px_regs_altbank(1);
+                               printf("Resetting board to boot from the other bank....\n");
+                               set_px_go();
                        }
 
                default: