fix maintainer flag
[openwrt/openwrt.git] / package / uboot-lantiq / files / cpu / mips / ar9-clock.c
1 /*
2 * (C) Copyright 2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
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.
12 *
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.
17 *
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,
21 * MA 02111-1307 USA
22 */
23
24 #include <common.h>
25 #include <asm/ar9.h>
26
27 ulong ifx_get_ddr_hz(void)
28 {
29 switch((*AR9_CGU_SYS) & 0x05) {
30 case 0x01:
31 case 0x05:
32 return CLOCK_111M;
33
34 case 0x00:
35 case 0x04:
36 return CLOCK_166M;
37 }
38
39 return 0;
40 }
41
42 ulong ifx_get_cpuclk(void)
43 {
44 switch((*AR9_CGU_SYS) & 0x05) {
45 case 0x00:
46 case 0x01:
47 return CLOCK_333M;
48
49 case 0x04:
50 return CLOCK_166M;
51
52 case 0x05:
53 return CLOCK_111M;
54 }
55
56 return 0;
57 }
58
59 ulong get_bus_freq(ulong dummy)
60 {
61 unsigned int ddr_clock=ifx_get_ddr_hz();
62 if((*AR9_CGU_SYS) & 0x40){
63 return ddr_clock/2;
64 } else {
65 return ddr_clock;
66 }
67 }