www.pudn.com > mizi_vivi.rar > proc.c


/*
 * vivi/arch/s3c2400/proc.c: ÇÁ·Î¼¼¼­ÇÏ°í °ü·ÃµÈ ³ðµé
 *
 * Copyright (C) 2002 MIZI Research, Inc.
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * 
 * Author: Janghoon Lyu 
 * Date  : $Date: 2002/08/10 07:47:07 $
 *
 * $Revision: 1.3 $
 * $Id: proc.c,v 1.3 2002/08/10 07:47:07 nandy Exp $
 *
 *
 * History
 *
 * 2002-07-12: Janghoon Lyu 
 *    - Initial code
 *
 */

#include "config.h"
#include "mmu.h"
#include "command.h"
#include 

static void 
temp_udelay(unsigned long u)
{
	unsigned long i, j;

	for (j = 0; j < u; j++) {
		for (i = 0; i < 100; i++) ;
	}
}

void
arch_udelay(unsigned long usec)
{
	temp_udelay(usec);
}

void
arch_mdelay(unsigned long msec)
{
	temp_udelay(msec * 1000);
}

/*
 * Perform a soft reset of the system.  Put the CPU into the
 * same state as it would be if it had been reset, and branch
 * to what would be the reset vector.
 *
 * loc: location to jump to for soft reset
 */
void processor_reset(unsigned long loc)
{
	cache_clean_invalidate();
	tlb_invalidate();

__asm__(
	"mov	ip, #0\n"
	"mcr	p15, 0, ip, c7, c7, 0\n"	/* invalidate I,D caches */
	"mcr	p15, 0, ip, c7, c10, 4\n"	/* drain WB */
	"mcr	p15, 0, ip, c8, c7, 0\n"	/* invalidate I & D TLBs */
	"mrc	p15, 0, ip, c1, c0, 0\n"	/* ctrl register */
	"bic	ip, ip, #0x000f\n"		/* ............wcam */
	"bic	ip, ip, #0x1100\n"		/* ...i...s........ */
	"mcr	p15, 0, ip, c1, c0, 0\n"	/* ctrl register */
	"mov	pc, %0\n"
	: : "r" (loc) );
}

void command_reset(int argc, const char **argv)
{
	processor_reset(0);
}

user_command_t reset_cmd = {
	"reset",
	command_reset,
	NULL,
	"reset -- Reset the System"
};