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.
124 lines
3.1 KiB
124 lines
3.1 KiB
20 years ago
|
/*
|
||
|
* (C) Copyright 2004, Freescale, Inc
|
||
|
* TsiChung Liew, Tsi-Chung.Liew@freescale.com.
|
||
|
*
|
||
|
* 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 <mpc8220.h>
|
||
|
#include <asm/processor.h>
|
||
|
|
||
19 years ago
|
DECLARE_GLOBAL_DATA_PTR;
|
||
|
|
||
20 years ago
|
typedef struct pllmultiplier {
|
||
|
u8 hid1;
|
||
|
int multi;
|
||
|
int vco_div;
|
||
|
} pllcfg_t;
|
||
|
|
||
|
/* ------------------------------------------------------------------------- */
|
||
|
|
||
|
/*
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
int get_clocks (void)
|
||
|
{
|
||
|
pllcfg_t bus2core[] = {
|
||
20 years ago
|
{0x02, 2, 8}, /* 1 */
|
||
|
{0x01, 2, 4},
|
||
|
{0x0C, 3, 8}, /* 1.5 */
|
||
20 years ago
|
{0x00, 3, 4},
|
||
20 years ago
|
{0x18, 3, 2},
|
||
|
{0x05, 4, 4}, /* 2 */
|
||
|
{0x04, 4, 2},
|
||
|
{0x11, 5, 4}, /* 2.5 */
|
||
|
{0x06, 5, 2},
|
||
|
{0x10, 6, 4}, /* 3 */
|
||
|
{0x08, 6, 2},
|
||
|
{0x0E, 7, 2}, /* 3.5 */
|
||
|
{0x0A, 8, 2}, /* 4 */
|
||
|
{0x07, 9, 2}, /* 4.5 */
|
||
|
{0x0B, 10, 2}, /* 5 */
|
||
|
{0x09, 11, 2}, /* 5.5 */
|
||
|
{0x0D, 12, 2}, /* 6 */
|
||
|
{0x12, 13, 2}, /* 6.5 */
|
||
|
{0x14, 14, 2}, /* 7 */
|
||
|
{0x16, 15, 2}, /* 7.5 */
|
||
|
{0x1C, 16, 2} /* 8 */
|
||
20 years ago
|
};
|
||
|
u32 hid1;
|
||
20 years ago
|
int i, size, pci2bus;
|
||
20 years ago
|
|
||
16 years ago
|
#if !defined(CONFIG_SYS_MPC8220_CLKIN)
|
||
|
#error clock measuring not implemented yet - define CONFIG_SYS_MPC8220_CLKIN
|
||
20 years ago
|
#endif
|
||
|
|
||
16 years ago
|
gd->inp_clk = CONFIG_SYS_MPC8220_CLKIN;
|
||
20 years ago
|
|
||
20 years ago
|
/* Read XLB to PCI(INP) clock multiplier */
|
||
20 years ago
|
pci2bus = (*((volatile u32 *)PCI_REG_PCIGSCR) &
|
||
20 years ago
|
PCI_REG_PCIGSCR_PCI2XLB_CLK_MASK)>>PCI_REG_PCIGSCR_PCI2XLB_CLK_BIT;
|
||
|
|
||
|
/* XLB bus clock */
|
||
16 years ago
|
gd->bus_clk = CONFIG_SYS_MPC8220_CLKIN * pci2bus;
|
||
20 years ago
|
|
||
|
/* PCI clock is same as input clock */
|
||
16 years ago
|
gd->pci_clk = CONFIG_SYS_MPC8220_CLKIN;
|
||
20 years ago
|
|
||
|
/* FlexBus is temporary set as the same as input clock */
|
||
|
/* will do dynamic in the future */
|
||
16 years ago
|
gd->flb_clk = CONFIG_SYS_MPC8220_CLKIN;
|
||
20 years ago
|
|
||
|
/* CPU Clock - Read HID1 */
|
||
|
asm volatile ("mfspr %0, 1009":"=r" (hid1):);
|
||
|
|
||
|
size = sizeof (bus2core) / sizeof (pllcfg_t);
|
||
20 years ago
|
|
||
|
hid1 >>= 27;
|
||
20 years ago
|
|
||
|
for (i = 0; i < size; i++)
|
||
|
if (hid1 == bus2core[i].hid1) {
|
||
|
gd->cpu_clk = (bus2core[i].multi * gd->bus_clk) >> 1;
|
||
16 years ago
|
gd->vco_clk = CONFIG_SYS_MPC8220_SYSPLL_VCO_MULTIPLIER * (gd->pci_clk * bus2core[i].vco_div)/2;
|
||
20 years ago
|
break;
|
||
|
}
|
||
|
|
||
|
/* hardcoded 81MHz for now */
|
||
|
gd->pev_clk = 81000000;
|
||
|
|
||
|
return (0);
|
||
|
}
|
||
|
|
||
|
int prt_mpc8220_clks (void)
|
||
|
{
|
||
16 years ago
|
char buf1[32], buf2[32], buf3[32], buf4[32];
|
||
|
|
||
|
printf (" Bus %s MHz, CPU %s MHz, PCI %s MHz, VCO %s MHz\n",
|
||
|
strmhz(buf1, gd->bus_clk),
|
||
|
strmhz(buf2, gd->cpu_clk),
|
||
|
strmhz(buf3, gd->pci_clk),
|
||
|
strmhz(buf4, gd->vco_clk)
|
||
|
);
|
||
20 years ago
|
return (0);
|
||
|
}
|
||
|
|
||
|
/* ------------------------------------------------------------------------- */
|