blob: a107b3a0b095dc58877b33ce2a8851c65414fdbf [file] [log] [blame]
Kukjin Kime6d1cb92011-08-20 12:18:07 +09001/* linux/arch/arm/plat-samsung/cpu.c
2 *
3 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Samsung CPU Support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/io.h>
17
Tomasz Figaaa425872014-07-03 13:17:12 +020018#include <plat/map-base.h>
Kukjin Kime6d1cb92011-08-20 12:18:07 +090019#include <plat/cpu.h>
20
21unsigned long samsung_cpu_id;
22static unsigned int samsung_cpu_rev;
23
24unsigned int samsung_rev(void)
25{
26 return samsung_cpu_rev;
27}
28EXPORT_SYMBOL(samsung_rev);
29
Kukjin Kime6d1cb92011-08-20 12:18:07 +090030void __init s3c64xx_init_cpu(void)
31{
Ben Dooksf4c24f32016-06-21 11:20:23 +010032 samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0x118);
Kukjin Kime6d1cb92011-08-20 12:18:07 +090033 if (!samsung_cpu_id) {
34 /*
35 * S3C6400 has the ID register in a different place,
36 * and needs a write before it can be read.
37 */
Ben Dooksf4c24f32016-06-21 11:20:23 +010038 writel_relaxed(0x0, S3C_VA_SYS + 0xA1C);
39 samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0xA1C);
Kukjin Kime6d1cb92011-08-20 12:18:07 +090040 }
41
42 samsung_cpu_rev = 0;
Olof Johansson1a14f532014-11-26 15:43:35 +090043
44 pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id);
Kukjin Kime6d1cb92011-08-20 12:18:07 +090045}
46
Krzysztof Kozlowski9251e1d2016-07-05 15:56:54 +020047void __init s5p_init_cpu(const void __iomem *cpuid_addr)
Kukjin Kime6d1cb92011-08-20 12:18:07 +090048{
Ben Dooksf4c24f32016-06-21 11:20:23 +010049 samsung_cpu_id = readl_relaxed(cpuid_addr);
Kukjin Kime6d1cb92011-08-20 12:18:07 +090050 samsung_cpu_rev = samsung_cpu_id & 0xFF;
Olof Johansson1a14f532014-11-26 15:43:35 +090051
52 pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id);
Kukjin Kime6d1cb92011-08-20 12:18:07 +090053}