mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
soc: rockchip: cpuinfo: Add support to parse 'cpu-code1'
Change-Id: I080efaae76c28fd255c314fc9033efcc02457d4d Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
@@ -29,20 +29,34 @@ static int rockchip_cpuinfo_probe(struct platform_device *pdev)
|
||||
struct device *dev = &pdev->dev;
|
||||
struct nvmem_cell *cell;
|
||||
unsigned char *efuse_buf, buf[16];
|
||||
bool is_cpu_code1_valid = false;
|
||||
size_t len = 0;
|
||||
int i;
|
||||
|
||||
cell = nvmem_cell_get(dev, "cpu-code");
|
||||
cell = nvmem_cell_get(dev, "cpu-code1");
|
||||
if (!IS_ERR(cell)) {
|
||||
efuse_buf = nvmem_cell_read(cell, &len);
|
||||
nvmem_cell_put(cell);
|
||||
if (IS_ERR(efuse_buf))
|
||||
return PTR_ERR(efuse_buf);
|
||||
|
||||
if (len == 2)
|
||||
if (len == 2 && efuse_buf[0] && efuse_buf[1]) {
|
||||
rockchip_set_cpu((efuse_buf[0] << 8 | efuse_buf[1]));
|
||||
is_cpu_code1_valid = true;
|
||||
}
|
||||
kfree(efuse_buf);
|
||||
}
|
||||
if (!is_cpu_code1_valid) {
|
||||
cell = nvmem_cell_get(dev, "cpu-code");
|
||||
if (!IS_ERR(cell)) {
|
||||
efuse_buf = nvmem_cell_read(cell, &len);
|
||||
nvmem_cell_put(cell);
|
||||
if (IS_ERR(efuse_buf))
|
||||
return PTR_ERR(efuse_buf);
|
||||
if (len == 2)
|
||||
rockchip_set_cpu((efuse_buf[0] << 8 | efuse_buf[1]));
|
||||
kfree(efuse_buf);
|
||||
}
|
||||
}
|
||||
|
||||
cell = nvmem_cell_get(dev, "cpu-version");
|
||||
if (!IS_ERR(cell)) {
|
||||
|
||||
Reference in New Issue
Block a user