/*
 * MOUSSE Board Support
 *
 * (C) Copyright 2000
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * (C) Copyright 2001
 * James Dougherty, jfd@cs.stanford.edu
 *
 * 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
 */

#include <common.h>
#include <mpc824x.h>
#include <asm/processor.h>

#include "mousse.h"
#include "m48t59y.h"
#include <pci.h>


int checkboard (void)
{
	ulong busfreq = get_bus_freq (0);
	char buf[32];

	puts ("Board: MOUSSE MPC8240/KAHLUA - CHRP (MAP B)\n");
	printf ("Built: %s at %s\n", __DATE__, __TIME__);
	printf ("MPLD:  Revision %d\n", SYS_REVID_GET ());
	printf ("Local Bus:  %s MHz\n", strmhz (buf, busfreq));

	return 0;
}

int checkflash (void)
{
	printf ("checkflash\n");
	flash_init ();
	return 0;
}

phys_size_t initdram (int board_type)
{
	return CFG_RAM_SIZE;
}


void get_tod (void)
{
	int year, month, day, hour, minute, second;

	m48_tod_get (&year, &month, &day, &hour, &minute, &second);

	printf ("  Current date/time: %d/%d/%d %d:%d:%d \n",
		month, day, year, hour, minute, second);

}

/*
 * EPIC, PCI, and I/O devices.
 * Initialize Mousse Platform, probe for PCI devices,
 * Query configuration parameters if not set.
 */
int misc_init_f (void)
{
	m48_tod_init ();	/* Init SGS M48T59Y TOD/NVRAM */
	printf ("RTC:   M48T589 TOD/NVRAM (%d) bytes\n", TOD_NVRAM_SIZE);
	get_tod ();
	return 0;
}
