Skip to content

Commit a82c673

Browse files
tom-shen-asusjamess-huang
authored andcommitted
Fix "000000.." serial number of cpu by /proc/cpuinfo
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>
1 parent 119865e commit a82c673

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

drivers/nvmem/rockchip-efuse.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <linux/slab.h>
2424
#include <linux/of.h>
2525
#include <linux/platform_device.h>
26+
#include <asm/system_info.h>
27+
#include <linux/crc32.h>
2628

2729
#define EFUSE_A_SHIFT 6
2830
#define EFUSE_A_MASK 0x3ff
@@ -93,12 +95,26 @@ static const struct of_device_id rockchip_efuse_match[] = {
9395
{ /* sentinel */},
9496
};
9597
MODULE_DEVICE_TABLE(of, rockchip_efuse_match);
98+
static u8 efuse_buf[32] = {};
99+
static void rk3288_set_system_serial(void) {
100+
int i;
101+
u8 buf[16];
102+
103+
for (i = 0; i < 8; i++) {
104+
buf[i] = efuse_buf[8 + (i << 1)];
105+
buf[i + 8] = efuse_buf[7 + (i << 1)];
106+
}
107+
108+
system_serial_low = crc32(0, buf, 8);
109+
system_serial_high = crc32(system_serial_low, buf + 8, 8);
110+
}
96111

97112
static int __init rockchip_efuse_probe(struct platform_device *pdev)
98113
{
99114
struct resource *res;
100115
struct nvmem_device *nvmem;
101116
struct rockchip_efuse_chip *efuse;
117+
int ret;
102118

103119
efuse = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_efuse_chip),
104120
GFP_KERNEL);
@@ -124,6 +140,11 @@ static int __init rockchip_efuse_probe(struct platform_device *pdev)
124140
return PTR_ERR(nvmem);
125141

126142
platform_set_drvdata(pdev, nvmem);
143+
ret = rockchip_efuse_read(efuse, 0, efuse_buf, 32);
144+
if (ret < 0) {
145+
printk(" failed to rockchip_efuse_read\n");
146+
}
147+
rk3288_set_system_serial();
127148

128149
return 0;
129150
}

0 commit comments

Comments
 (0)