From cd0ae453a57b08bd20ea01a9871bb8f8a2d538a1 Mon Sep 17 00:00:00 2001 From: Finley Xiao Date: Wed, 12 Dec 2018 16:24:21 +0800 Subject: [PATCH] cpufreq: rockchip: Implement get_soc_info() for rk3399 SoCs Change-Id: I73519f717e79a1cc4e713e31ba8ee6c78567353f Signed-off-by: Finley Xiao --- drivers/cpufreq/rockchip-cpufreq.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c index f77709ab3a86..c24100c0c749 100644 --- a/drivers/cpufreq/rockchip-cpufreq.c +++ b/drivers/cpufreq/rockchip-cpufreq.c @@ -136,6 +136,35 @@ out: return ret; } +static int rk3399_get_soc_info(struct device *dev, struct device_node *np, + int *bin, int *process) +{ + int ret = 0, value = -EINVAL; + + if (!bin) + goto out; + if (of_property_match_string(np, "nvmem-cell-names", + "specification_serial_number") >= 0) { + ret = rockchip_get_efuse_value(np, + "specification_serial_number", + &value); + if (ret) { + dev_err(dev, + "Failed to get specification_serial_number\n"); + goto out; + } + if (value == 0xb) + *bin = 0; + else + *bin = 1; + } + + if (*bin >= 0) + dev_info(dev, "bin=%d\n", *bin); + +out: + return ret; +} static const struct of_device_id rockchip_cpufreq_of_match[] = { { .compatible = "rockchip,px30", @@ -153,6 +182,10 @@ static const struct of_device_id rockchip_cpufreq_of_match[] = { .compatible = "rockchip,rk3326", .data = (void *)&px30_get_soc_info, }, + { + .compatible = "rockchip,rk3399", + .data = (void *)&rk3399_get_soc_info, + }, {}, };