]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
86xx: Reset update
authorPeter Tyser <ptyser@xes-inc.com>
Thu, 5 Feb 2009 17:25:25 +0000 (11:25 -0600)
committerAndy Fleming <afleming@freescale.com>
Tue, 17 Feb 2009 00:05:56 +0000 (18:05 -0600)
Update the 86xx reset sequence to try executing a board-specific reset
function.  If the board-specific reset is not implemented or does not
succeed, then assert #HRESET_REQ.  Using #HRESET_REQ is a more standard
reset procedure than the previous method and allows all board
peripherals to be reset if needed.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
board/freescale/mpc8610hpcd/mpc8610hpcd.c
board/freescale/mpc8641hpcn/mpc8641hpcn.c
board/sbc8641d/sbc8641d.c
cpu/mpc86xx/cpu.c
include/configs/MPC8610HPCD.h
include/configs/MPC8641HPCN.h

index a2097a5aff790bfc63ac6f79ccae1fe34bc100aa..b419dcc5b50ba17490dc6a15d79b2f073a9c7d48 100644 (file)
@@ -484,3 +484,11 @@ int board_eth_init(bd_t *bis)
 {
        return pci_eth_init(bis);
 }
+
+void board_reset(void)
+{
+       out8(PIXIS_BASE + PIXIS_RST, 0);
+
+       while (1)
+               ;
+}
index 28c16833dc9bb7ebd4725724bf1f979933920f55..49718dac6cad05e9c491a5126ab0fa4e18305c3a 100644 (file)
@@ -363,3 +363,11 @@ int board_eth_init(bd_t *bis)
        cpu_eth_init(bis);
        return pci_eth_init(bis);
 }
+
+void board_reset(void)
+{
+       out8(PIXIS_BASE + PIXIS_RST, 0);
+
+       while (1)
+               ;
+}
index 508bdc5dd8259c3ce36dc51f09eb3d29f8518cdd..52ad2d86c9d42bc5b415157181f302b114b25a55 100644 (file)
@@ -384,3 +384,32 @@ unsigned long get_board_sys_clk (ulong dummy)
 
        return val;
 }
+
+void board_reset(void)
+{
+#ifdef CONFIG_SYS_RESET_ADDRESS
+       ulong addr = CONFIG_SYS_RESET_ADDRESS;
+
+       /* flush and disable I/D cache */
+       __asm__ __volatile__ ("mfspr    3, 1008"        ::: "r3");
+       __asm__ __volatile__ ("ori      5, 5, 0xcc00"   ::: "r5");
+       __asm__ __volatile__ ("ori      4, 3, 0xc00"    ::: "r4");
+       __asm__ __volatile__ ("andc     5, 3, 5"        ::: "r5");
+       __asm__ __volatile__ ("sync");
+       __asm__ __volatile__ ("mtspr    1008, 4");
+       __asm__ __volatile__ ("isync");
+       __asm__ __volatile__ ("sync");
+       __asm__ __volatile__ ("mtspr    1008, 5");
+       __asm__ __volatile__ ("isync");
+       __asm__ __volatile__ ("sync");
+
+       /*
+        * SRR0 has system reset vector, SRR1 has default MSR value
+        * rfi restores MSR from SRR1 and sets the PC to the SRR0 value
+        */
+       __asm__ __volatile__ ("mtspr    26, %0"         :: "r" (addr));
+       __asm__ __volatile__ ("li       4, (1 << 6)"    ::: "r4");
+       __asm__ __volatile__ ("mtspr    27, 4");
+       __asm__ __volatile__ ("rfi");
+#endif
+}
index dc53bee588d46dc10a9fa3f51f4602666e347f7c..b2a107d3bf0fc2f44b0d25d4ada9e528c8b48cc5 100644 (file)
 #include <asm/fsl_law.h>
 
 
+/*
+ * Default board reset function
+ */
+static void
+__board_reset(void)
+{
+       /* Do nothing */
+}
+void board_reset(void) __attribute((weak, alias("__board_reset")));
+
+
 int
 checkcpu(void)
 {
@@ -115,73 +126,20 @@ checkcpu(void)
 }
 
 
-static inline void
-soft_restart(unsigned long addr)
-{
-#if !defined(CONFIG_MPC8641HPCN) && !defined(CONFIG_MPC8610HPCD)
-
-       /*
-        * SRR0 has system reset vector, SRR1 has default MSR value
-        * rfi restores MSR from SRR1 and sets the PC to the SRR0 value
-        */
-
-       __asm__ __volatile__ ("mtspr    26, %0"         :: "r" (addr));
-       __asm__ __volatile__ ("li       4, (1 << 6)"    ::: "r4");
-       __asm__ __volatile__ ("mtspr    27, 4");
-       __asm__ __volatile__ ("rfi");
-
-#else /* CONFIG_MPC8641HPCN */
-
-       out8(PIXIS_BASE + PIXIS_RST, 0);
-
-#endif /* !CONFIG_MPC8641HPCN */
-
-       while (1) ;             /* not reached */
-}
-
-
-/*
- * No generic way to do board reset. Simply call soft_reset.
- */
 void
 do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-#if !defined(CONFIG_MPC8641HPCN) && !defined(CONFIG_MPC8610HPCD)
-
-#ifdef CONFIG_SYS_RESET_ADDRESS
-       ulong addr = CONFIG_SYS_RESET_ADDRESS;
-#else
-       /*
-        * note: when CONFIG_SYS_MONITOR_BASE points to a RAM address,
-        * CONFIG_SYS_MONITOR_BASE - sizeof (ulong) is usually a valid
-        * address. Better pick an address known to be invalid on your
-        * system and assign it to CONFIG_SYS_RESET_ADDRESS.
-        */
-       ulong addr = CONFIG_SYS_MONITOR_BASE - sizeof(ulong);
-#endif
-
-       /* flush and disable I/D cache */
-       __asm__ __volatile__ ("mfspr    3, 1008"        ::: "r3");
-       __asm__ __volatile__ ("ori      5, 5, 0xcc00"   ::: "r5");
-       __asm__ __volatile__ ("ori      4, 3, 0xc00"    ::: "r4");
-       __asm__ __volatile__ ("andc     5, 3, 5"        ::: "r5");
-       __asm__ __volatile__ ("sync");
-       __asm__ __volatile__ ("mtspr    1008, 4");
-       __asm__ __volatile__ ("isync");
-       __asm__ __volatile__ ("sync");
-       __asm__ __volatile__ ("mtspr    1008, 5");
-       __asm__ __volatile__ ("isync");
-       __asm__ __volatile__ ("sync");
-
-       soft_restart(addr);
-
-#else /* CONFIG_MPC8641HPCN */
+       volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
+       volatile ccsr_gur_t *gur = &immap->im_gur;
 
-       out8(PIXIS_BASE + PIXIS_RST, 0);
+       /* Attempt board-specific reset */
+       board_reset();
 
-#endif /* !CONFIG_MPC8641HPCN */
+       /* Next try asserting HRESET_REQ */
+       out_be32(&gur->rstcr, MPC86xx_RSTCR_HRST_REQ);
 
-       while (1) ;             /* not reached */
+       while (1)
+               ;
 }
 
 
index 4bd3e0bd3d836247bd9b4cceaf3f98233b194b47..7a9e57fdc57a91f86dd618c6ef40b41fcfa50113 100644 (file)
@@ -34,8 +34,6 @@
 #define CONFIG_SYS_DIAG_ADDR           0xff800000
 #endif
 
-#define CONFIG_SYS_RESET_ADDRESS       0xfff00100
-
 /*
  * virtual address to be used for temporary mappings.  There
  * should be 128k free at this VA.
index f1b7eb5a264bbae2845c64571a4bf58a14693e56..9a1b84756c8aee9c77265d182f180170305fdcb9 100644 (file)
@@ -45,8 +45,6 @@
 #define CONFIG_SYS_DIAG_ADDR        CONFIG_SYS_FLASH_BASE
 #endif
 
-#define CONFIG_SYS_RESET_ADDRESS    0xfff00100
-
 /*
  * virtual address to be used for temporary mappings.  There
  * should be 128k free at this VA.