rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [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 | |
| 18 | #include <plat/map-base.h> |
| 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 | |
| 30 | void __init s3c64xx_init_cpu(void) |
| 31 | { |
| 32 | samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0x118); |
| 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 | */ |
| 38 | writel_relaxed(0x0, S3C_VA_SYS + 0xA1C); |
| 39 | samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0xA1C); |
| 40 | } |
| 41 | |
| 42 | samsung_cpu_rev = 0; |
| 43 | |
| 44 | pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id); |
| 45 | } |
| 46 | |
| 47 | void __init s5p_init_cpu(const void __iomem *cpuid_addr) |
| 48 | { |
| 49 | samsung_cpu_id = readl_relaxed(cpuid_addr); |
| 50 | samsung_cpu_rev = samsung_cpu_id & 0xFF; |
| 51 | |
| 52 | pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id); |
| 53 | } |