2 * (C) Copyright 2000-2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <asm/processor.h>
28 /* ------------------------------------------------------------------------- */
30 /* Bus-to-Core Multipliers */
32 static int bus2core[] = {
33 3, 2, 2, 2, 4, 4, 5, 9,
34 6, 11, 8, 10, 3, 12, 7, 0,
35 6, 5, 13, 2, 14, 4, 15, 9,
36 0, 11, 8, 10, 16, 12, 7, 0
38 /* ------------------------------------------------------------------------- */
46 DECLARE_GLOBAL_DATA_PTR;
50 #if !defined(CFG_MPC5XXX_CLKIN)
51 #error clock measuring not implemented yet - define CFG_MPC5XXX_CLKIN
54 val = *(vu_long *)MPC5XXX_CDM_PORCFG;
56 vco = CFG_MPC5XXX_CLKIN * 12;
58 vco = CFG_MPC5XXX_CLKIN * 16;
61 gd->bus_clk = vco / 8;
63 gd->bus_clk = vco / 4;
65 gd->cpu_clk = gd->bus_clk * bus2core[val & 0x1f] / 2;
67 val = *(vu_long *)MPC5XXX_CDM_CFG;
69 gd->ipb_clk = gd->bus_clk / 2;
71 gd->ipb_clk = gd->bus_clk;
74 case 0: gd->pci_clk = gd->ipb_clk; break;
75 case 1: gd->pci_clk = gd->ipb_clk / 2; break;
76 default: gd->pci_clk = gd->bus_clk / 4; break;
82 int prt_mpc5xxx_clks (void)
84 DECLARE_GLOBAL_DATA_PTR;
86 printf(" Bus %ld MHz, IPB %ld MHz, PCI %ld MHz\n",
87 gd->bus_clk / 1000000, gd->ipb_clk / 1000000,
88 gd->pci_clk / 1000000);
93 /* ------------------------------------------------------------------------- */