2003-03-31 17:27:09 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2003 Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
|
|
|
*
|
|
|
|
* 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
|
2003-06-27 21:31:46 +00:00
|
|
|
* Foundation,
|
2003-03-31 17:27:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* File: cpu_init.c
|
2003-06-27 21:31:46 +00:00
|
|
|
*
|
2003-03-31 17:27:09 +00:00
|
|
|
* Discription: Contains initialisation functions to setup
|
2008-05-20 14:00:29 +00:00
|
|
|
* the cpu properly
|
2003-03-31 17:27:09 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <mpc5xx.h>
|
|
|
|
#include <watchdog.h>
|
|
|
|
|
|
|
|
/*
|
2003-06-27 21:31:46 +00:00
|
|
|
* Setup essential cpu registers to run
|
2003-03-31 17:27:09 +00:00
|
|
|
*/
|
|
|
|
void cpu_init_f (volatile immap_t * immr)
|
|
|
|
{
|
|
|
|
volatile memctl5xx_t *memctl = &immr->im_memctl;
|
|
|
|
ulong reg;
|
|
|
|
|
|
|
|
/* SYPCR - contains watchdog control. This will enable watchdog */
|
|
|
|
/* if CONFIG_WATCHDOG is set */
|
2008-10-16 13:01:15 +00:00
|
|
|
immr->im_siu_conf.sc_sypcr = CONFIG_SYS_SYPCR;
|
2003-03-31 17:27:09 +00:00
|
|
|
|
|
|
|
#if defined(CONFIG_WATCHDOG)
|
|
|
|
reset_5xx_watchdog (immr);
|
2003-06-27 21:31:46 +00:00
|
|
|
#endif
|
2003-03-31 17:27:09 +00:00
|
|
|
|
|
|
|
/* SIUMCR - contains debug pin configuration */
|
2008-10-16 13:01:15 +00:00
|
|
|
immr->im_siu_conf.sc_siumcr |= CONFIG_SYS_SIUMCR;
|
2003-03-31 17:27:09 +00:00
|
|
|
|
|
|
|
/* Initialize timebase. Unlock TBSCRK */
|
|
|
|
immr->im_sitk.sitk_tbscrk = KAPWR_KEY;
|
2008-10-16 13:01:15 +00:00
|
|
|
immr->im_sit.sit_tbscr = CONFIG_SYS_TBSCR;
|
2003-03-31 17:27:09 +00:00
|
|
|
|
|
|
|
/* Full IMB bus speed */
|
2008-10-16 13:01:15 +00:00
|
|
|
immr->im_uimb.uimb_umcr = CONFIG_SYS_UMCR;
|
2003-06-27 21:31:46 +00:00
|
|
|
|
2003-03-31 17:27:09 +00:00
|
|
|
/* Time base and decrementer will be enables (TBE) */
|
|
|
|
/* in init_timebase() in time.c called from board_init_f(). */
|
2003-06-27 21:31:46 +00:00
|
|
|
|
2003-03-31 17:27:09 +00:00
|
|
|
/* Initialize the PIT. Unlock PISCRK */
|
|
|
|
immr->im_sitk.sitk_piscrk = KAPWR_KEY;
|
2008-10-16 13:01:15 +00:00
|
|
|
immr->im_sit.sit_piscr = CONFIG_SYS_PISCR;
|
2003-03-31 17:27:09 +00:00
|
|
|
|
2004-01-02 16:05:07 +00:00
|
|
|
#if !defined(CONFIG_PATI)
|
|
|
|
/* PATI sest PLL in start.S */
|
2003-03-31 17:27:09 +00:00
|
|
|
/* PLL (CPU clock) settings */
|
|
|
|
immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
/* If CONFIG_SYS_PLPRCR (set in the various *_config.h files) tries to
|
|
|
|
* set the MF field, then just copy CONFIG_SYS_PLPRCR over car_plprcr,
|
|
|
|
* otherwise OR in CONFIG_SYS_PLPRCR so we do not change the currentMF
|
2003-03-31 17:27:09 +00:00
|
|
|
* field value.
|
|
|
|
*/
|
2008-10-16 13:01:15 +00:00
|
|
|
#if ((CONFIG_SYS_PLPRCR & PLPRCR_MF_MSK) != 0)
|
|
|
|
reg = CONFIG_SYS_PLPRCR; /* reset control bits */
|
2003-03-31 17:27:09 +00:00
|
|
|
#else
|
|
|
|
reg = immr->im_clkrst.car_plprcr;
|
|
|
|
reg &= PLPRCR_MF_MSK; /* isolate MF field */
|
2008-10-16 13:01:15 +00:00
|
|
|
reg |= CONFIG_SYS_PLPRCR; /* reset control bits */
|
2003-03-31 17:27:09 +00:00
|
|
|
#endif
|
|
|
|
immr->im_clkrst.car_plprcr = reg;
|
|
|
|
|
2004-01-02 16:05:07 +00:00
|
|
|
#endif /* !defined(CONFIG_PATI) */
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
/* System integration timers. CONFIG_SYS_MASK has EBDF configuration */
|
2003-03-31 17:27:09 +00:00
|
|
|
immr->im_clkrstk.cark_sccrk = KAPWR_KEY;
|
|
|
|
reg = immr->im_clkrst.car_sccr;
|
|
|
|
reg &= SCCR_MASK;
|
2008-10-16 13:01:15 +00:00
|
|
|
reg |= CONFIG_SYS_SCCR;
|
2003-03-31 17:27:09 +00:00
|
|
|
immr->im_clkrst.car_sccr = reg;
|
|
|
|
|
|
|
|
/* Memory Controller */
|
2008-10-16 13:01:15 +00:00
|
|
|
memctl->memc_br0 = CONFIG_SYS_BR0_PRELIM;
|
|
|
|
memctl->memc_or0 = CONFIG_SYS_OR0_PRELIM;
|
2003-03-31 17:27:09 +00:00
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#if (defined(CONFIG_SYS_OR1_PRELIM) && defined(CONFIG_SYS_BR1_PRELIM))
|
|
|
|
memctl->memc_or1 = CONFIG_SYS_OR1_PRELIM;
|
|
|
|
memctl->memc_br1 = CONFIG_SYS_BR1_PRELIM;
|
2003-03-31 17:27:09 +00:00
|
|
|
#endif
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM)
|
|
|
|
memctl->memc_or2 = CONFIG_SYS_OR2_PRELIM;
|
|
|
|
memctl->memc_br2 = CONFIG_SYS_BR2_PRELIM;
|
2003-03-31 17:27:09 +00:00
|
|
|
#endif
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#if defined(CONFIG_SYS_OR3_PRELIM) && defined(CONFIG_SYS_BR3_PRELIM)
|
|
|
|
memctl->memc_or3 = CONFIG_SYS_OR3_PRELIM;
|
|
|
|
memctl->memc_br3 = CONFIG_SYS_BR3_PRELIM;
|
2003-03-31 17:27:09 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize higher level parts of cpu
|
|
|
|
*/
|
|
|
|
int cpu_init_r (void)
|
|
|
|
{
|
2008-05-20 14:00:29 +00:00
|
|
|
/* Nothing to do at the moment */
|
2003-03-31 17:27:09 +00:00
|
|
|
return (0);
|
|
|
|
}
|