Merge branch 'pci-for-jesse' of git://git.kernel.org/pub/scm/linux/kernel/git/tip...
[pandora-kernel.git] / arch / arm / mach-ks8695 / cpu.c
1 /*
2  * arch/arm/mach-ks8695/cpu.c
3  *
4  * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5  * Copyright (C) 2006 Simtec Electronics
6  *
7  * KS8695 CPU support
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #include <linux/kernel.h>
25 #include <linux/module.h>
26 #include <linux/init.h>
27
28 #include <mach/hardware.h>
29 #include <asm/io.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/map.h>
32
33 #include <mach/regs-sys.h>
34 #include <mach/regs-misc.h>
35
36
37 static struct __initdata map_desc ks8695_io_desc[] = {
38         {
39                 .virtual        = KS8695_IO_VA,
40                 .pfn            = __phys_to_pfn(KS8695_IO_PA),
41                 .length         = KS8695_IO_SIZE,
42                 .type           = MT_DEVICE,
43         }
44 };
45
46 static void __init ks8695_processor_info(void)
47 {
48         unsigned long id, rev;
49
50         id = __raw_readl(KS8695_MISC_VA + KS8695_DID);
51         rev = __raw_readl(KS8695_MISC_VA + KS8695_RID);
52
53         printk("KS8695 ID=%04lx  SubID=%02lx  Revision=%02lx\n", (id & DID_ID), (rev & RID_SUBID), (rev & RID_REVISION));
54 }
55
56 static unsigned int sysclk[8] = { 125000000, 100000000, 62500000, 50000000, 41700000, 33300000, 31300000, 25000000 };
57 static unsigned int cpuclk[8] = { 166000000, 166000000, 83000000, 83000000, 55300000, 55300000, 41500000, 41500000 };
58
59 static void __init ks8695_clock_info(void)
60 {
61         unsigned int scdc = __raw_readl(KS8695_SYS_VA + KS8695_CLKCON) & CLKCON_SCDC;
62
63         printk("Clocks: System %u MHz, CPU %u MHz\n",
64                         sysclk[scdc] / 1000000, cpuclk[scdc] / 1000000);
65 }
66
67 void __init ks8695_map_io(void)
68 {
69         iotable_init(ks8695_io_desc, ARRAY_SIZE(ks8695_io_desc));
70
71         ks8695_processor_info();
72         ks8695_clock_info();
73 }