2faf82baebbd37734341f37380f7a84a2b0ac255
[openwrt/staging/neocturne.git] /
1 From 7bd608426c407a79debea54b2b243950f330c5b8 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Fri, 19 Aug 2022 00:06:24 +0200
4 Subject: [PATCH] clk: qcom: apss-ipq-pll: use OF match data for Alpha PLL
5 config
6
7 Convert the driver to use OF match data for providing the Alpha PLL config
8 per compatible.
9 This is required for IPQ8074 support since it uses a different Alpha PLL
10 config.
11
12 While we are here rename "ipq_pll_config" to "ipq6018_pll_config" to make
13 it clear that it is for IPQ6018 only.
14
15 Signed-off-by: Robert Marko <robimarko@gmail.com>
16 Signed-off-by: Bjorn Andersson <andersson@kernel.org>
17 Link: https://lore.kernel.org/r/20220818220628.339366-5-robimarko@gmail.com
18 ---
19 drivers/clk/qcom/apss-ipq-pll.c | 12 +++++++++---
20 1 file changed, 9 insertions(+), 3 deletions(-)
21
22 --- a/drivers/clk/qcom/apss-ipq-pll.c
23 +++ b/drivers/clk/qcom/apss-ipq-pll.c
24 @@ -2,6 +2,7 @@
25 // Copyright (c) 2018, The Linux Foundation. All rights reserved.
26 #include <linux/clk-provider.h>
27 #include <linux/module.h>
28 +#include <linux/of_device.h>
29 #include <linux/platform_device.h>
30 #include <linux/regmap.h>
31
32 @@ -36,7 +37,7 @@ static struct clk_alpha_pll ipq_pll = {
33 },
34 };
35
36 -static const struct alpha_pll_config ipq_pll_config = {
37 +static const struct alpha_pll_config ipq6018_pll_config = {
38 .l = 0x37,
39 .config_ctl_val = 0x04141200,
40 .config_ctl_hi_val = 0x0,
41 @@ -54,6 +55,7 @@ static const struct regmap_config ipq_pl
42
43 static int apss_ipq_pll_probe(struct platform_device *pdev)
44 {
45 + const struct alpha_pll_config *ipq_pll_config;
46 struct device *dev = &pdev->dev;
47 struct regmap *regmap;
48 void __iomem *base;
49 @@ -67,7 +69,11 @@ static int apss_ipq_pll_probe(struct pla
50 if (IS_ERR(regmap))
51 return PTR_ERR(regmap);
52
53 - clk_alpha_pll_configure(&ipq_pll, regmap, &ipq_pll_config);
54 + ipq_pll_config = of_device_get_match_data(&pdev->dev);
55 + if (!ipq_pll_config)
56 + return -ENODEV;
57 +
58 + clk_alpha_pll_configure(&ipq_pll, regmap, ipq_pll_config);
59
60 ret = devm_clk_register_regmap(dev, &ipq_pll.clkr);
61 if (ret)
62 @@ -78,7 +84,7 @@ static int apss_ipq_pll_probe(struct pla
63 }
64
65 static const struct of_device_id apss_ipq_pll_match_table[] = {
66 - { .compatible = "qcom,ipq6018-a53pll" },
67 + { .compatible = "qcom,ipq6018-a53pll", .data = &ipq6018_pll_config },
68 { }
69 };
70 MODULE_DEVICE_TABLE(of, apss_ipq_pll_match_table);