# Rockchip Soc drivers
#
config ROCKCHIP_CPUINFO
- tristate "Rockchip cpuinfo support"
+ bool "Rockchip cpuinfo support"
depends on ROCKCHIP_EFUSE && (ARM64 || ARM)
+ default y
help
Say y here to enable Rockchip cpuinfo support.
Set system_serial_low/high from eFuse ID.
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <asm/system_info.h>
+#include <linux/rockchip/cpu.h>
+
+unsigned long rockchip_soc_id;
+EXPORT_SYMBOL(rockchip_soc_id);
static int rockchip_cpuinfo_probe(struct platform_device *pdev)
{
size_t len;
int i;
+ cell = nvmem_cell_get(dev, "cpu-version");
+ if (!IS_ERR(cell)) {
+ efuse_buf = nvmem_cell_read(cell, &len);
+ nvmem_cell_put(cell);
+
+ if (len == 1)
+ rockchip_set_cpu_version(efuse_buf[0]);
+ kfree(efuse_buf);
+ }
+
cell = nvmem_cell_get(dev, "id");
if (IS_ERR(cell)) {
dev_err(dev, "failed to get id cell: %ld\n", PTR_ERR(cell));
.of_match_table = rockchip_cpuinfo_of_match,
},
};
-module_platform_driver(rockchip_cpuinfo_driver);
+
+static int __init rockchip_cpuinfo_init(void)
+{
+ return platform_driver_register(&rockchip_cpuinfo_driver);
+}
+subsys_initcall_sync(rockchip_cpuinfo_init);
#ifndef __MACH_ROCKCHIP_CPU_H
#define __MACH_ROCKCHIP_CPU_H
+#ifdef CONFIG_ROCKCHIP_CPUINFO
+
extern unsigned long rockchip_soc_id;
static inline bool cpu_is_rockchip(void)
(ver << ROCKCHIP_CPU_VERION_SHIFT) & ROCKCHIP_CPU_VERION_MASK;
}
+#else
+
+static inline bool cpu_is_rockchip(void)
+{
+ return true;
+}
+
+static inline unsigned long rockchip_get_cpu_version(void)
+{
+ return 0;
+}
+
+static inline void rockchip_set_cpu_version(unsigned long ver)
+{
+}
+
+#endif
+
#define ROCKCHIP_CPU_MASK 0xffff0000
#define ROCKCHIP_CPU_RK2928 0x29280000
#define ROCKCHIP_CPU_RK3026 0x30260000
#define ROCKCHIP_CPU_RK3288 0x32880000
#define ROCKCHIP_CPU_RK3228 0x32280000
-#ifdef CONFIG_ARM
+#ifdef CONFIG_ROCKCHIP_CPUINFO
#define ROCKCHIP_CPU(id, ID) \
static inline bool cpu_is_rk##id(void) \
{ \
#define ROCKCHIP_SOC_RK3288 (ROCKCHIP_CPU_RK3288 | 0x00)
#define ROCKCHIP_SOC_RK3228 (ROCKCHIP_CPU_RK3228 | 0x00)
-#ifdef CONFIG_ARM
+#ifdef CONFIG_ROCKCHIP_CPUINFO
#define ROCKCHIP_SOC(id, ID) \
static inline bool soc_is_rk##id(void) \
{ \