
25 Oct
2004
25 Oct
'04
4:27 p.m.
Hi there,
as mentioned on list before some boards/cpus might need some extra code to be executed _before_ rebooting. E.g. the i.MX hangs when doing "reset" while the LCD controller is still enabled.
That is why I'd like to introduce CONFIG_BOARD_PRE_RESET and board_pre_reset(). The attached does exactly that. But only for cpu/arm920t. If wished I'll add the appropriate code to all cpu/$(CPU)/cpu.c files.
* Patch by Steven Scholz, 25 Oct 2004: - Introducing CONFIG_BOARD_PRE_RESET and board_pre_reset() to allow code to be executed before actually rebooting
--
Steven Scholz
Index: board/mx1fs2/mx1fs2.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/board/mx1fs2/mx1fs2.c,v
retrieving revision 1.2
diff -p -u -r1.2 mx1fs2.c
--- board/mx1fs2/mx1fs2.c 10 Oct 2004 18:41:10 -0000 1.2
+++ board/mx1fs2/mx1fs2.c 25 Oct 2004 13:32:14 -0000
@@ -123,3 +123,14 @@ show_boot_progress(int status)
#endif
return;
}
+
+#ifdef CONFIG_BOARD_PRE_RESET
+void board_pre_reset(void)
+{
+ /* we must disable the LCD controller before reboot
+ * otherwise the processor might hang */
+ DR(3) &= ~0x00001000;
+ LCDC_RMCR &= ~RMCR_LCDC_EN;
+}
+#endif
+
Index: cpu/arm920t/cpu.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/cpu/arm920t/cpu.c,v
retrieving revision 1.3
diff -p -u -r1.3 cpu.c
--- cpu/arm920t/cpu.c 8 Feb 2004 19:38:43 -0000 1.3
+++ cpu/arm920t/cpu.c 25 Oct 2004 13:32:14 -0000
@@ -127,6 +127,9 @@ int do_reset (cmd_tbl_t *cmdtp, int flag
{
extern void reset_cpu (ulong addr);
disable_interrupts ();
+#ifdef CONFIG_BOARD_PRE_RESET
+ board_pre_reset();
+#endif
reset_cpu (0);
/*NOTREACHED*/
Index: include/common.h
===================================================================
RCS file: /cvsroot/u-boot/u-boot/include/common.h,v
retrieving revision 1.46
diff -p -u -r1.46 common.h
--- include/common.h 10 Oct 2004 18:41:14 -0000 1.46
+++ include/common.h 25 Oct 2004 13:32:15 -0000
@@ -318,6 +318,7 @@ int board_late_init (void);
int board_postclk_init (void); /* after clocks/timebase, before env/serial */
int board_early_init_r (void);
void board_poweroff (void);
+void board_pre_reset (void);
#if defined(CFG_DRAM_TEST)
int testdram(void);
Index: include/configs/mx1fs2.h
===================================================================
RCS file: /cvsroot/u-boot/u-boot/include/configs/mx1fs2.h,v
retrieving revision 1.1
diff -p -u -r1.1 mx1fs2.h
--- include/configs/mx1fs2.h 1 Aug 2004 22:48:22 -0000 1.1
+++ include/configs/mx1fs2.h 25 Oct 2004 13:32:15 -0000
@@ -114,6 +114,7 @@
#define AUTOREFRESH_CMD 0xa10a8300
#define CONFIG_INIT_CRITICAL
+#define CONFIG_BOARD_PRE_RESET 1
#define BUS32BIT_VERSION
/*