source: trunk/package/uboot-lantiq/files/cpu/mips/ar9/clock.c @ 20606

Last change on this file since 20606 was 20606, checked in by ralph, 7 years ago

[uboot-lantiq] add preliminary AR9 support
attention: if caches enabled the network is broken
attention: the network of the flash image doesn't work because of enabled caches

File size: 1.4 KB
Line 
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
27ulong 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
42ulong 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
59ulong 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}
Note: See TracBrowser for help on using the repository browser.