Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 1 | /* 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 Figa | aa42587 | 2014-07-03 13:17:12 +0200 | [diff] [blame] | 18 | #include <plat/map-base.h> |
Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 19 | #include <plat/cpu.h> |
| 20 | |
| 21 | unsigned long samsung_cpu_id; |
| 22 | static unsigned int samsung_cpu_rev; |
| 23 | |
| 24 | unsigned int samsung_rev(void) |
| 25 | { |
| 26 | return samsung_cpu_rev; |
| 27 | } |
| 28 | EXPORT_SYMBOL(samsung_rev); |
| 29 | |
Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 30 | void __init s3c64xx_init_cpu(void) |
| 31 | { |
Ben Dooks | f4c24f3 | 2016-06-21 11:20:23 +0100 | [diff] [blame] | 32 | samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0x118); |
Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 33 | 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 Dooks | f4c24f3 | 2016-06-21 11:20:23 +0100 | [diff] [blame] | 38 | writel_relaxed(0x0, S3C_VA_SYS + 0xA1C); |
| 39 | samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0xA1C); |
Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | samsung_cpu_rev = 0; |
Olof Johansson | 1a14f53 | 2014-11-26 15:43:35 +0900 | [diff] [blame] | 43 | |
| 44 | pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id); |
Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 45 | } |
| 46 | |
Krzysztof Kozlowski | 9251e1d | 2016-07-05 15:56:54 +0200 | [diff] [blame] | 47 | void __init s5p_init_cpu(const void __iomem *cpuid_addr) |
Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 48 | { |
Ben Dooks | f4c24f3 | 2016-06-21 11:20:23 +0100 | [diff] [blame] | 49 | samsung_cpu_id = readl_relaxed(cpuid_addr); |
Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 50 | samsung_cpu_rev = samsung_cpu_id & 0xFF; |
Olof Johansson | 1a14f53 | 2014-11-26 15:43:35 +0900 | [diff] [blame] | 51 | |
| 52 | pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id); |
Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 53 | } |