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
7 Convert the driver to use OF match data for providing the Alpha PLL config
9 This is required for IPQ8074 support since it uses a different Alpha PLL
12 While we are here rename "ipq_pll_config" to "ipq6018_pll_config" to make
13 it clear that it is for IPQ6018 only.
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
19 drivers/clk/qcom/apss-ipq-pll.c | 12 +++++++++---
20 1 file changed, 9 insertions(+), 3 deletions(-)
22 --- a/drivers/clk/qcom/apss-ipq-pll.c
23 +++ b/drivers/clk/qcom/apss-ipq-pll.c
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>
32 @@ -36,7 +37,7 @@ static struct clk_alpha_pll ipq_pll = {
36 -static const struct alpha_pll_config ipq_pll_config = {
37 +static const struct alpha_pll_config ipq6018_pll_config = {
39 .config_ctl_val = 0x04141200,
40 .config_ctl_hi_val = 0x0,
41 @@ -54,6 +55,7 @@ static const struct regmap_config ipq_pl
43 static int apss_ipq_pll_probe(struct platform_device *pdev)
45 + const struct alpha_pll_config *ipq_pll_config;
46 struct device *dev = &pdev->dev;
47 struct regmap *regmap;
49 @@ -67,7 +69,11 @@ static int apss_ipq_pll_probe(struct pla
51 return PTR_ERR(regmap);
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)
58 + clk_alpha_pll_configure(&ipq_pll, regmap, ipq_pll_config);
60 ret = devm_clk_register_regmap(dev, &ipq_pll.clkr);
62 @@ -78,7 +84,7 @@ static int apss_ipq_pll_probe(struct pla
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 },
70 MODULE_DEVICE_TABLE(of, apss_ipq_pll_match_table);