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.

Based on Mike Frysinger's suggestion on:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/70304

Signed-off-by: Richard Retanubun <RichardRetanubun at RuggedCom.com>
This commit is contained in:
Richard Retanubun 2009-10-26 14:19:17 -04:00 committed by TsiChung Liew
parent 992d712950
commit bb907ab51f
2 changed files with 39 additions and 0 deletions

View file

@ -33,6 +33,7 @@
#include <command.h> #include <command.h>
#include <asm/immap.h> #include <asm/immap.h>
#include <netdev.h> #include <netdev.h>
#include "cpu.h"
DECLARE_GLOBAL_DATA_PTR; 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[]) 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, mbar_writeByte(MCF_RCM_RCR,
MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT); MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT);
return 0; return 0;

33
cpu/mcf52x2/cpu.h Normal file
View file

@ -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_ */