upstream u-boot with additional patches for our devices/boards:
https://lists.denx.de/pipermail/u-boot/2017-March/282789.html (AXP crashes) ;
Gbit ethernet patch for some LIME2 revisions ;
with SPI flash support
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
3.8 KiB
164 lines
3.8 KiB
19 years ago
|
/*
|
||
|
* Copyright 2004 Freescale Semiconductor.
|
||
19 years ago
|
* Jeff Brown
|
||
19 years ago
|
* Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
|
||
|
*
|
||
|
* (C) Copyright 2000-2002
|
||
|
* 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
|
||
|
*/
|
||
|
|
||
|
#include <common.h>
|
||
|
#include <mpc86xx.h>
|
||
|
#include <asm/processor.h>
|
||
16 years ago
|
#include <asm/io.h>
|
||
19 years ago
|
|
||
17 years ago
|
DECLARE_GLOBAL_DATA_PTR;
|
||
19 years ago
|
|
||
17 years ago
|
/* used in some defintiions of CONFIG_SYS_CLK_FREQ */
|
||
|
extern unsigned long get_board_sys_clk(unsigned long dummy);
|
||
|
|
||
19 years ago
|
void get_sys_info(sys_info_t *sysInfo)
|
||
19 years ago
|
{
|
||
16 years ago
|
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
|
||
19 years ago
|
volatile ccsr_gur_t *gur = &immap->im_gur;
|
||
|
uint plat_ratio, e600_ratio;
|
||
16 years ago
|
uint lcrr_div;
|
||
19 years ago
|
|
||
19 years ago
|
plat_ratio = (gur->porpllsr) & 0x0000003e;
|
||
19 years ago
|
plat_ratio >>= 1;
|
||
19 years ago
|
|
||
19 years ago
|
switch (plat_ratio) {
|
||
19 years ago
|
case 0x0:
|
||
19 years ago
|
sysInfo->freqSystemBus = 16 * CONFIG_SYS_CLK_FREQ;
|
||
|
break;
|
||
|
case 0x02:
|
||
|
case 0x03:
|
||
|
case 0x04:
|
||
|
case 0x05:
|
||
|
case 0x06:
|
||
|
case 0x08:
|
||
|
case 0x09:
|
||
|
case 0x0a:
|
||
|
case 0x0c:
|
||
19 years ago
|
case 0x10:
|
||
|
sysInfo->freqSystemBus = plat_ratio * CONFIG_SYS_CLK_FREQ;
|
||
|
break;
|
||
19 years ago
|
default:
|
||
19 years ago
|
sysInfo->freqSystemBus = 0;
|
||
19 years ago
|
break;
|
||
|
}
|
||
|
|
||
|
e600_ratio = (gur->porpllsr) & 0x003f0000;
|
||
|
e600_ratio >>= 16;
|
||
19 years ago
|
|
||
|
switch (e600_ratio) {
|
||
19 years ago
|
case 0x10:
|
||
19 years ago
|
sysInfo->freqProcessor = 2 * sysInfo->freqSystemBus;
|
||
19 years ago
|
break;
|
||
19 years ago
|
case 0x19:
|
||
19 years ago
|
sysInfo->freqProcessor = 5 * sysInfo->freqSystemBus / 2;
|
||
19 years ago
|
break;
|
||
|
case 0x20:
|
||
19 years ago
|
sysInfo->freqProcessor = 3 * sysInfo->freqSystemBus;
|
||
19 years ago
|
break;
|
||
19 years ago
|
case 0x39:
|
||
19 years ago
|
sysInfo->freqProcessor = 7 * sysInfo->freqSystemBus / 2;
|
||
19 years ago
|
break;
|
||
|
case 0x28:
|
||
19 years ago
|
sysInfo->freqProcessor = 4 * sysInfo->freqSystemBus;
|
||
19 years ago
|
break;
|
||
|
case 0x1d:
|
||
19 years ago
|
sysInfo->freqProcessor = 9 * sysInfo->freqSystemBus / 2;
|
||
19 years ago
|
break;
|
||
19 years ago
|
default:
|
||
19 years ago
|
sysInfo->freqProcessor = e600_ratio + sysInfo->freqSystemBus;
|
||
19 years ago
|
break;
|
||
|
}
|
||
16 years ago
|
|
||
|
#if defined(CONFIG_SYS_LBC_LCRR)
|
||
|
/* We will program LCRR to this value later */
|
||
|
lcrr_div = CONFIG_SYS_LBC_LCRR & LCRR_CLKDIV;
|
||
|
#else
|
||
|
{
|
||
|
volatile ccsr_lbc_t *lbc = &immap->im_lbc;
|
||
|
lcrr_div = in_be32(&lbc->lcrr) & LCRR_CLKDIV;
|
||
|
}
|
||
|
#endif
|
||
|
if (lcrr_div == 2 || lcrr_div == 4 || lcrr_div == 8) {
|
||
|
sysInfo->freqLocalBus = sysInfo->freqSystemBus / (lcrr_div * 2);
|
||
|
} else {
|
||
|
/* In case anyone cares what the unknown value is */
|
||
|
sysInfo->freqLocalBus = lcrr_div;
|
||
|
}
|
||
19 years ago
|
}
|
||
|
|
||
|
|
||
|
/*
|
||
|
* Measure CPU clock speed (core clock GCLK1, GCLK2)
|
||
|
* (Approx. GCLK frequency in Hz)
|
||
|
*/
|
||
|
|
||
19 years ago
|
int get_clocks(void)
|
||
19 years ago
|
{
|
||
|
sys_info_t sys_info;
|
||
|
|
||
19 years ago
|
get_sys_info(&sys_info);
|
||
19 years ago
|
gd->cpu_clk = sys_info.freqProcessor;
|
||
|
gd->bus_clk = sys_info.freqSystemBus;
|
||
16 years ago
|
gd->lbc_clk = sys_info.freqLocalBus;
|
||
17 years ago
|
|
||
|
/*
|
||
|
* The base clock for I2C depends on the actual SOC. Unfortunately,
|
||
|
* there is no pattern that can be used to determine the frequency, so
|
||
|
* the only choice is to look up the actual SOC number and use the value
|
||
|
* for that SOC. This information is taken from application note
|
||
|
* AN2919.
|
||
|
*/
|
||
|
#ifdef CONFIG_MPC8610
|
||
17 years ago
|
gd->i2c1_clk = sys_info.freqSystemBus;
|
||
17 years ago
|
#else
|
||
|
gd->i2c1_clk = sys_info.freqSystemBus / 2;
|
||
|
#endif
|
||
|
gd->i2c2_clk = gd->i2c1_clk;
|
||
19 years ago
|
|
||
|
if (gd->cpu_clk != 0)
|
||
|
return 0;
|
||
|
else
|
||
|
return 1;
|
||
19 years ago
|
}
|
||
|
|
||
19 years ago
|
|
||
|
/*
|
||
19 years ago
|
* get_bus_freq
|
||
19 years ago
|
* Return system bus freq in Hz
|
||
|
*/
|
||
19 years ago
|
|
||
19 years ago
|
ulong get_bus_freq(ulong dummy)
|
||
19 years ago
|
{
|
||
|
ulong val;
|
||
|
sys_info_t sys_info;
|
||
|
|
||
19 years ago
|
get_sys_info(&sys_info);
|
||
19 years ago
|
val = sys_info.freqSystemBus;
|
||
|
|
||
|
return val;
|
||
|
}
|