diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2014-03-27 05:22:08 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-03-27 05:21:54 -0700 |
commit | 78fa1c7b674e4e5a8ebc6a8f3845c508c75ff532 (patch) | |
tree | 0438144a4d36f840f42d7f4df1068f3531036f73 /drivers/clk | |
parent | 00c5a70fa78078a8b44491d69c52177e4a4366a2 (diff) | |
parent | 74c94a905473affadb03218f56ce40a5592addb5 (diff) |
Merge "clk: qcom: clock-a7: Add support to read efuse for MSM8916"
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/qcom/clock-a7.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/drivers/clk/qcom/clock-a7.c b/drivers/clk/qcom/clock-a7.c index 1f29a6e0bf5f..d65e556beb00 100644 --- a/drivers/clk/qcom/clock-a7.c +++ b/drivers/clk/qcom/clock-a7.c @@ -153,6 +153,39 @@ static void get_speed_bin(struct platform_device *pdev, int *bin, int *version) return; } +static void get_speed_bin_b(struct platform_device *pdev, int *bin, + int *version) +{ + struct resource *res; + void __iomem *base; + u32 pte_efuse; + + *bin = 0; + *version = 0; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "efuse"); + if (!res) { + dev_info(&pdev->dev, + "No speed/PVS binning available. Defaulting to 0!\n"); + return; + } + + base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (!base) { + dev_warn(&pdev->dev, + "Unable to read efuse data. Defaulting to 0!\n"); + return; + } + + pte_efuse = readl_relaxed(base); + devm_iounmap(&pdev->dev, base); + + *bin = (pte_efuse >> 2) & 0x7; + + dev_info(&pdev->dev, "Speed bin: %d PVS Version: %d\n", *bin, + *version); +} + static int of_get_clk_src(struct platform_device *pdev, struct clk_src *parents) { struct device_node *of = pdev->dev.of_node; @@ -195,6 +228,10 @@ static int clock_a7_probe(struct platform_device *pdev) struct clk *aux_clk, *main_pll; char prop_name[] = "qcom,speedX-bin-vX"; const void *prop; + bool compat_bin = false; + + compat_bin = of_device_is_compatible(pdev->dev.of_node, + "qcom,clock-a53-8916"); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rcg-base"); if (!res) { @@ -225,7 +262,10 @@ static int clock_a7_probe(struct platform_device *pdev) if (prop) a7ssmux.safe_freq = of_read_ulong(prop, 1); - get_speed_bin(pdev, &speed_bin, &version); + if (compat_bin) + get_speed_bin_b(pdev, &speed_bin, &version); + else + get_speed_bin(pdev, &speed_bin, &version); snprintf(prop_name, ARRAY_SIZE(prop_name), "qcom,speed%d-bin-v%d", speed_bin, version); |