/*
 * (C) Copyright 2003
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * 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., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

/*
 * Boot support
 */
#include <common.h>
#include <command.h>
#include <net.h>		/* for print_IPaddr */

DECLARE_GLOBAL_DATA_PTR;

#if (CONFIG_COMMANDS & CFG_CMD_BDI)

extern unsigned long read_p15_c1(void);
extern void write_p15_c1(unsigned long);

int do_arm920 ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
	int i;

	if (strcmp(argv[1], "cp15c1")) {
		printf("Usage:\n%s\n", cmdtp->usage);
		return 1;
	}
	
	if (!strcmp(argv[2], "write")) {
		ulong val = simple_strtoul(argv[3], NULL, 16);
		printf("setting cp15c1 to 0x%08x\n", val);
		write_p15_c1(val);
	} else if (!strcmp(argv[2], "read"))
		printf("cp15c1 = 0x%08x\n", read_p15_c1());

	return 0;
}

/* -------------------------------------------------------------------- */

U_BOOT_CMD(
	arm920,	4,	1,	do_arm920,
	"arm920_cp15  - print cp15",
	NULL
);
#endif	/* CFG_CMD_BDI */
