2002-11-18 00:14:45 +00:00
|
|
|
/*
|
2011-04-13 09:43:26 +00:00
|
|
|
* (C) Copyright 2008-2011
|
|
|
|
* Graeme Russ, <graeme.russ@gmail.com>
|
|
|
|
*
|
2002-11-18 00:14:45 +00:00
|
|
|
* (C) Copyright 2002
|
2011-08-04 16:45:45 +00:00
|
|
|
* Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
|
2002-11-18 00:14:45 +00:00
|
|
|
*
|
|
|
|
* 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 <asm/io.h>
|
2011-02-12 04:11:32 +00:00
|
|
|
#include <asm/processor-flags.h>
|
2011-08-04 12:05:09 +00:00
|
|
|
#include <asm/arch/sc520.h>
|
2002-11-18 00:14:45 +00:00
|
|
|
|
2006-03-31 16:32:53 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2011-02-12 04:11:36 +00:00
|
|
|
sc520_mmcr_t *sc520_mmcr = (sc520_mmcr_t *)SC520_MMCR_BASE;
|
2002-11-18 00:14:45 +00:00
|
|
|
|
2011-02-12 04:11:35 +00:00
|
|
|
int cpu_init_f(void)
|
2002-11-18 00:14:45 +00:00
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
if (CONFIG_SYS_SC520_HIGH_SPEED) {
|
2010-10-07 09:03:21 +00:00
|
|
|
/* set it to 133 MHz and write back */
|
|
|
|
writeb(0x02, &sc520_mmcr->cpuctl);
|
2002-11-18 00:14:45 +00:00
|
|
|
gd->cpu_clk = 133000000;
|
|
|
|
} else {
|
2010-10-07 09:03:21 +00:00
|
|
|
/* set it to 100 MHz and write back */
|
|
|
|
writeb(0x01, &sc520_mmcr->cpuctl);
|
2002-11-18 00:14:45 +00:00
|
|
|
gd->cpu_clk = 100000000;
|
|
|
|
}
|
2003-06-27 21:31:46 +00:00
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
/* wait at least one millisecond */
|
2010-10-07 09:03:21 +00:00
|
|
|
asm("movl $0x2000, %%ecx\n"
|
2009-08-23 02:59:46 +00:00
|
|
|
"0: pushl %%ecx\n"
|
2002-11-18 00:14:45 +00:00
|
|
|
"popl %%ecx\n"
|
2011-11-08 02:33:14 +00:00
|
|
|
"loop 0b\n" : : : "ecx");
|
2002-11-18 00:14:45 +00:00
|
|
|
|
2011-02-12 04:11:35 +00:00
|
|
|
return x86_cpu_init_f();
|
2002-11-18 00:14:45 +00:00
|
|
|
}
|
|
|
|
|
2011-02-12 04:12:12 +00:00
|
|
|
int cpu_init_r(void)
|
|
|
|
{
|
|
|
|
/* Disable the PAR used for CAR */
|
|
|
|
writel(0x0000000, &sc520_mmcr->par[2]);
|
|
|
|
|
|
|
|
/* turn on the SDRAM write buffer */
|
|
|
|
writeb(0x11, &sc520_mmcr->dbctl);
|
|
|
|
|
|
|
|
return x86_cpu_init_r();
|
|
|
|
}
|