Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
[linux-2.6-block.git] / arch / arm / mach-ks8695 / cpu.c
CommitLineData
c53c9cf6
AV
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>
fced80c7 27#include <linux/io.h>
c53c9cf6 28
a09e64fb 29#include <mach/hardware.h>
c53c9cf6
AV
30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
32
d8b2823e 33#include "regs-sys.h"
a09e64fb 34#include <mach/regs-misc.h>
c53c9cf6
AV
35
36
6ad7313b 37static struct map_desc ks8695_io_desc[] __initdata = {
c53c9cf6 38 {
c72ecbec 39 .virtual = (unsigned long)KS8695_IO_VA,
c53c9cf6
AV
40 .pfn = __phys_to_pfn(KS8695_IO_PA),
41 .length = KS8695_IO_SIZE,
42 .type = MT_DEVICE,
43 }
44};
45
46static 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
56static unsigned int sysclk[8] = { 125000000, 100000000, 62500000, 50000000, 41700000, 33300000, 31300000, 25000000 };
57static unsigned int cpuclk[8] = { 166000000, 166000000, 83000000, 83000000, 55300000, 55300000, 41500000, 41500000 };
58
59static 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
67void __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}