mirror of
https://github.com/Fishwaldo/build.git
synced 2025-03-31 11:11:49 +00:00
68 lines
2 KiB
Text
68 lines
2 KiB
Text
From a82c6733b2a61e20ea9921fc871f7f0eefd8cb56 Mon Sep 17 00:00:00 2001
|
|
From: tom_shen <tom_shen@asus.com>
|
|
Date: Wed, 5 Jul 2017 10:51:37 +0800
|
|
Subject: [PATCH] Fix "000000.." serial number of cpu by /proc/cpuinfo
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Change-Id: I51764bcfa8015a004319a1ddd6fd02a4a1153678
|
|
Reviewed-on: https://tp-biosrd-v02/gerrit/80049
|
|
Reviewed-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
|
|
Tested-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
|
|
---
|
|
drivers/nvmem/rockchip-efuse.c | 21 +++++++++++++++++++++
|
|
1 file changed, 21 insertions(+)
|
|
|
|
diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c
|
|
index 9fcfedf3200e..820db7e111f4 100644
|
|
--- a/drivers/nvmem/rockchip-efuse.c
|
|
+++ b/drivers/nvmem/rockchip-efuse.c
|
|
@@ -23,6 +23,8 @@
|
|
#include <linux/of_platform.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/rockchip/rockchip_sip.h>
|
|
+#include <asm/system_info.h>
|
|
+#include <linux/crc32.h>
|
|
|
|
#define RK3128_A_SHIFT 7
|
|
#define RK3288_A_SHIFT 6
|
|
@@ -93,12 +95,26 @@ static const struct of_device_id rockchip_efuse_match[] = {
|
|
{ /* sentinel */},
|
|
};
|
|
MODULE_DEVICE_TABLE(of, rockchip_efuse_match);
|
|
+static u8 efuse_buf[32] = {};
|
|
+static void rk3288_set_system_serial(void) {
|
|
+ int i;
|
|
+ u8 buf[16];
|
|
+
|
|
+ for (i = 0; i < 8; i++) {
|
|
+ buf[i] = efuse_buf[8 + (i << 1)];
|
|
+ buf[i + 8] = efuse_buf[7 + (i << 1)];
|
|
+ }
|
|
+
|
|
+ system_serial_low = crc32(0, buf, 8);
|
|
+ system_serial_high = crc32(system_serial_low, buf + 8, 8);
|
|
+}
|
|
|
|
static int __init rockchip_efuse_probe(struct platform_device *pdev)
|
|
{
|
|
struct resource *res;
|
|
struct nvmem_device *nvmem;
|
|
struct rockchip_efuse_chip *efuse;
|
|
+ int ret;
|
|
const struct of_device_id *match;
|
|
struct device *dev = &pdev->dev;
|
|
|
|
@@ -124,6 +140,11 @@ static int __init rockchip_efuse_probe(struct platform_device *pdev)
|
|
return PTR_ERR(nvmem);
|
|
|
|
platform_set_drvdata(pdev, nvmem);
|
|
+ ret = rockchip_efuse_read(efuse, 0, efuse_buf, 32);
|
|
+ if (ret < 0) {
|
|
+ printk(" failed to rockchip_efuse_read\n");
|
|
+ }
|
|
+ rk3288_set_system_serial();
|
|
|
|
return 0;
|
|
}
|