From 240bf1625edcc439b62aea43a0983f8207b541b1 Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 28 Jun 2008 19:53:41 +0000 Subject: move ifxmips uboot to package/ git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11601 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/cpu/mips/danube/ifx_clock.c | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 package/uboot-ifxmips/files/cpu/mips/danube/ifx_clock.c (limited to 'package/uboot-ifxmips/files/cpu/mips/danube/ifx_clock.c') diff --git a/package/uboot-ifxmips/files/cpu/mips/danube/ifx_clock.c b/package/uboot-ifxmips/files/cpu/mips/danube/ifx_clock.c new file mode 100644 index 000000000..0a1cdacdc --- /dev/null +++ b/package/uboot-ifxmips/files/cpu/mips/danube/ifx_clock.c @@ -0,0 +1,91 @@ +/* + * (C) Copyright 2003 + * 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 +#include + + + +/******************************************************************************* +* +* get_cpuclk - returns the frequency of the CPU. +* +* NOTE: +* This functions should be used by the hardware driver to get the correct +* frequency of the CPU. +*/ + +unsigned int danube_get_ddr_hz(void) +{ + switch((*DANUBE_CGU_SYS) & 0x3){ + case 0: + return 166666667; + case 1: + return 133333333; + case 2: + return 111111111; + case 3: + return 83333333; + } +} + + +uint danube_get_cpuclk(void) +{ +#ifdef CONFIG_USE_EMULATOR + return EMULATOR_CPU_SPEED; +#else //NOT CONFIG_USE_EMULATOR + unsigned int ddr_clock=danube_get_ddr_hz(); + switch((*DANUBE_CGU_SYS) & 0xc){ + case 0: + return 333333333; + case 4: + return ddr_clock; + case 8: + return ddr_clock << 1; + default: + break; + /*reserved*/ + } +#endif + +} + + +uint danube_get_fpiclk(void) +{ +#ifdef CONFIG_USE_EMULATOR + unsigned int clkCPU; + clkCPU = danube_get_cpu_hz(); + return clkCPU >> 2; +#else //NOT CONFIG_USE_EMULATOR + unsigned int ddr_clock=danube_get_ddr_hz(); + if ((*DANUBE_CGU_SYS) & 0x40){ + return ddr_clock >> 1; + } + return ddr_clock; +#endif + +} + + -- cgit v1.2.3