arm64: dts: qcom: Add Lenovo Yoga C630
[sfrench/cifs-2.6.git] / arch / arm / mach-ks8695 / cpu.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * arch/arm/mach-ks8695/cpu.c
4  *
5  * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
6  * Copyright (C) 2006 Simtec Electronics
7  *
8  * KS8695 CPU support
9  */
10
11 #include <linux/kernel.h>
12 #include <linux/module.h>
13 #include <linux/init.h>
14 #include <linux/io.h>
15
16 #include <mach/hardware.h>
17 #include <asm/mach/arch.h>
18 #include <asm/mach/map.h>
19
20 #include "regs-sys.h"
21 #include <mach/regs-misc.h>
22
23
24 static struct map_desc ks8695_io_desc[] __initdata = {
25         {
26                 .virtual        = (unsigned long)KS8695_IO_VA,
27                 .pfn            = __phys_to_pfn(KS8695_IO_PA),
28                 .length         = KS8695_IO_SIZE,
29                 .type           = MT_DEVICE,
30         }
31 };
32
33 static void __init ks8695_processor_info(void)
34 {
35         unsigned long id, rev;
36
37         id = __raw_readl(KS8695_MISC_VA + KS8695_DID);
38         rev = __raw_readl(KS8695_MISC_VA + KS8695_RID);
39
40         printk("KS8695 ID=%04lx  SubID=%02lx  Revision=%02lx\n", (id & DID_ID), (rev & RID_SUBID), (rev & RID_REVISION));
41 }
42
43 static unsigned int sysclk[8] = { 125000000, 100000000, 62500000, 50000000, 41700000, 33300000, 31300000, 25000000 };
44 static unsigned int cpuclk[8] = { 166000000, 166000000, 83000000, 83000000, 55300000, 55300000, 41500000, 41500000 };
45
46 static void __init ks8695_clock_info(void)
47 {
48         unsigned int scdc = __raw_readl(KS8695_SYS_VA + KS8695_CLKCON) & CLKCON_SCDC;
49
50         printk("Clocks: System %u MHz, CPU %u MHz\n",
51                         sysclk[scdc] / 1000000, cpuclk[scdc] / 1000000);
52 }
53
54 void __init ks8695_map_io(void)
55 {
56         iotable_init(ks8695_io_desc, ARRAY_SIZE(ks8695_io_desc));
57
58         ks8695_processor_info();
59         ks8695_clock_info();
60 }