* [U-Boot] [PATCH] 83xx: Added a weak board_reset function to allow custom reset.
@ 2009-10-26 18:43 Richard Retanubun
2009-10-26 21:24 ` Wolfgang Denk
0 siblings, 1 reply; 2+ messages in thread
From: Richard Retanubun @ 2009-10-26 18:43 UTC (permalink / raw)
To: u-boot
From 2b9f89f5d0538e44ebbe66236cd9b6be4ee902e3 Mon Sep 17 00:00:00 2001
From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
Date: Mon, 26 Oct 2009 14:16:03 -0400
Subject: [PATCH] Added a weak board_reset function to allow custom reset.
This patch adds a board_reset function to allow boards to specify
their own custom reset sequence (e.g. resetting by timing out watchdog).
Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
---
Based on Mike Frysinger's suggestion on:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/70304
cpu/mpc83xx/cpu.c | 6 ++++++
cpu/mpc83xx/cpu.h | 33 +++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)
create mode 100644 cpu/mpc83xx/cpu.h
diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
index e38a372..ebda4b0 100644
--- a/cpu/mpc83xx/cpu.c
+++ b/cpu/mpc83xx/cpu.c
@@ -39,6 +39,7 @@
#include <asm/immap_qe.h>
#include <asm/io.h>
#endif
+#include "cpu.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -199,6 +200,11 @@ do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
+ /* Call the board specific reset actions first. */
+ if(board_reset) {
+ board_reset();
+ }
+
#ifdef MPC83xx_RESET
/* Interrupts and MMU off */
__asm__ __volatile__ ("mfmsr %0":"=r" (msr):);
diff --git a/cpu/mpc83xx/cpu.h b/cpu/mpc83xx/cpu.h
new file mode 100644
index 0000000..c1227eb
--- /dev/null
+++ b/cpu/mpc83xx/cpu.h
@@ -0,0 +1,33 @@
+/*
+ * cpu.h
+ *
+ * Copyright (c) 2009 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _CPU_H_
+#define _CPU_H_
+
+#include <command.h>
+
+/* Use this to create board specific reset functions */
+void board_reset(void) __attribute__((__weak__));
+
+#endif /* _CPU_H_ */
--
1.6.2.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* [U-Boot] [PATCH] 83xx: Added a weak board_reset function to allow custom reset.
2009-10-26 18:43 [U-Boot] [PATCH] 83xx: Added a weak board_reset function to allow custom reset Richard Retanubun
@ 2009-10-26 21:24 ` Wolfgang Denk
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2009-10-26 21:24 UTC (permalink / raw)
To: u-boot
Dear Richard Retanubun,
In message <4AE5EDCC.5050205@RuggedCom.com> you wrote:
> From 2b9f89f5d0538e44ebbe66236cd9b6be4ee902e3 Mon Sep 17 00:00:00 2001
> From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
> Date: Mon, 26 Oct 2009 14:16:03 -0400
> Subject: [PATCH] Added a weak board_reset function to allow custom reset.
>
> This patch adds a board_reset function to allow boards to specify
> their own custom reset sequence (e.g. resetting by timing out watchdog).
>
> Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
> ---
>
> Based on Mike Frysinger's suggestion on:
> http://article.gmane.org/gmane.comp.boot-loaders.u-boot/70304
>
> cpu/mpc83xx/cpu.c | 6 ++++++
> cpu/mpc83xx/cpu.h | 33 +++++++++++++++++++++++++++++++++
> 2 files changed, 39 insertions(+), 0 deletions(-)
> create mode 100644 cpu/mpc83xx/cpu.h
Instead of adding yet another implementation of the same code I would
like to see at least common code being used within an architecture;
for PowerPC, we already have different implementations in
"cpu/ppc4xx/cpu.c" and in "cpu/mpc86xx/cpu.c".
Not to mention that "cpu/arm920t/at91rm9200/reset.c" and
"cpu/blackfin/cpu.h" / "cpu/blackfin/reset.c" have such code, too.
Can we please come up with one common implementation?
Thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Extended Epstein-Heisenberg Principle: In an R & D orbit, only 2 of
the existing 3 parameters can be defined simultaneously. The parame-
ters are: task, time and resources ($).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-26 21:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-26 18:43 [U-Boot] [PATCH] 83xx: Added a weak board_reset function to allow custom reset Richard Retanubun
2009-10-26 21:24 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox