mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
soc: rockchip: cpuinfo: Add rockchip_set_spec_sn
Parse 'spec-sn' as rockchip_soc_id bit[7:0].
e.g.
cpuinfo {
compatible = "rockchip,cpuinfo";
nvmem-cells = <&otp_id>, <&cpu_version>, <&cpu_code>, <&specification_serial_number>;
nvmem-cell-names = "id", "cpu-version", "cpu-code", "spec-sn";
};
* bit[7~0]: 0x1 ~ 0x1a --- A ~ Z
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: Ic1d3d384343f4bde0e65c7826260d5dcc5149e80
This commit is contained in:
@@ -65,6 +65,45 @@ static int rk3566_soc_init(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rockchip_set_spec_sn(struct device *dev)
|
||||
{
|
||||
struct nvmem_cell *cell;
|
||||
u8 *val;
|
||||
|
||||
cell = nvmem_cell_get(dev, "spec-sn1");
|
||||
if (!IS_ERR(cell)) {
|
||||
val = nvmem_cell_read(cell, NULL);
|
||||
nvmem_cell_put(cell);
|
||||
if (IS_ERR(val))
|
||||
return PTR_ERR(val);
|
||||
|
||||
if (*val) {
|
||||
rockchip_soc_id &= ~ROCKCHIP_SOC_SSN_MASK;
|
||||
rockchip_soc_id |= *val;
|
||||
kfree(val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
kfree(val);
|
||||
}
|
||||
|
||||
cell = nvmem_cell_get(dev, "spec-sn");
|
||||
if (!IS_ERR(cell)) {
|
||||
val = nvmem_cell_read(cell, NULL);
|
||||
nvmem_cell_put(cell);
|
||||
if (IS_ERR(val))
|
||||
return PTR_ERR(val);
|
||||
|
||||
rockchip_soc_id &= ~ROCKCHIP_SOC_SSN_MASK;
|
||||
rockchip_soc_id |= *val;
|
||||
|
||||
kfree(val);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rockchip_cpuinfo_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -80,6 +119,8 @@ static int rockchip_cpuinfo_probe(struct platform_device *pdev)
|
||||
goto skip_cpu_code;
|
||||
}
|
||||
|
||||
rockchip_set_spec_sn(dev);
|
||||
|
||||
cell = nvmem_cell_get(dev, "cpu-code1");
|
||||
if (!IS_ERR(cell)) {
|
||||
efuse_buf = nvmem_cell_read(cell, &len);
|
||||
|
||||
@@ -248,6 +248,7 @@ static inline bool cpu_is_rk3567(void) { return false; }
|
||||
static inline bool cpu_is_rk3568(void) { return false; }
|
||||
#endif
|
||||
|
||||
#define ROCKCHIP_SOC_SSN_MASK 0xff
|
||||
#define ROCKCHIP_SOC_MASK (ROCKCHIP_CPU_MASK | 0xff)
|
||||
#define ROCKCHIP_SOC_PX30 (ROCKCHIP_CPU_PX30 | 0x00)
|
||||
#define ROCKCHIP_SOC_PX30S (ROCKCHIP_CPU_PX30 | 0x01)
|
||||
|
||||
Reference in New Issue
Block a user