public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] MCF5271-only: Added a weak board_reset function to allow custom reset.
Date: Mon, 26 Oct 2009 14:41:52 -0400	[thread overview]
Message-ID: <4AE5ED70.4000004@RuggedCom.com> (raw)

 From 304334adbbc3b7e70366fed0495af46536a7941f Mon Sep 17 00:00:00 2001
From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
Date: Mon, 26 Oct 2009 14:19:17 -0400
Subject: [PATCH] MCF5271-only: 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).
Tested only on MCF5271, can be expanded if needed.

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/mcf52x2/cpu.c |    6 ++++++
  cpu/mcf52x2/cpu.h |   33 +++++++++++++++++++++++++++++++++
  2 files changed, 39 insertions(+), 0 deletions(-)
  create mode 100644 cpu/mcf52x2/cpu.h

diff --git a/cpu/mcf52x2/cpu.c b/cpu/mcf52x2/cpu.c
index 2cfe631..c4c5d50 100644
--- a/cpu/mcf52x2/cpu.c
+++ b/cpu/mcf52x2/cpu.c
@@ -33,6 +33,7 @@
  #include <command.h>
  #include <asm/immap.h>
  #include <netdev.h>
+#include "cpu.h"

  DECLARE_GLOBAL_DATA_PTR;

@@ -143,6 +144,11 @@ int checkcpu(void)

  int do_reset(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[])
  {
+       /* Call the board specific reset actions first. */
+       if(board_reset) {
+               board_reset();
+       }
+
         mbar_writeByte(MCF_RCM_RCR,
                        MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT);
         return 0;
diff --git a/cpu/mcf52x2/cpu.h b/cpu/mcf52x2/cpu.h
new file mode 100644
index 0000000..c1227eb
--- /dev/null
+++ b/cpu/mcf52x2/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

                 reply	other threads:[~2009-10-26 18:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AE5ED70.4000004@RuggedCom.com \
    --to=richardretanubun@ruggedcom.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox