]> git.baikalelectronics.ru Git - kernel.git/commitdiff
clk: qcom: apss-ipq-pll: use OF match data for Alpha PLL config
authorRobert Marko <robimarko@gmail.com>
Thu, 18 Aug 2022 22:06:24 +0000 (00:06 +0200)
committerBjorn Andersson <andersson@kernel.org>
Tue, 27 Sep 2022 02:40:10 +0000 (21:40 -0500)
Convert the driver to use OF match data for providing the Alpha PLL config
per compatible.
This is required for IPQ8074 support since it uses a different Alpha PLL
config.

While we are here rename "ipq_pll_config" to "ipq6018_pll_config" to make
it clear that it is for IPQ6018 only.

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20220818220628.339366-5-robimarko@gmail.com
drivers/clk/qcom/apss-ipq-pll.c

index bef7899ad0d660de94d6cd1cfd2639fd2e943ad7..ba77749b16c46d9881f828afc8635d0d4447ab31 100644 (file)
@@ -2,6 +2,7 @@
 // Copyright (c) 2018, The Linux Foundation. All rights reserved.
 #include <linux/clk-provider.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 
@@ -36,7 +37,7 @@ static struct clk_alpha_pll ipq_pll = {
        },
 };
 
-static const struct alpha_pll_config ipq_pll_config = {
+static const struct alpha_pll_config ipq6018_pll_config = {
        .l = 0x37,
        .config_ctl_val = 0x04141200,
        .config_ctl_hi_val = 0x0,
@@ -54,6 +55,7 @@ static const struct regmap_config ipq_pll_regmap_config = {
 
 static int apss_ipq_pll_probe(struct platform_device *pdev)
 {
+       const struct alpha_pll_config *ipq_pll_config;
        struct device *dev = &pdev->dev;
        struct regmap *regmap;
        void __iomem *base;
@@ -67,7 +69,11 @@ static int apss_ipq_pll_probe(struct platform_device *pdev)
        if (IS_ERR(regmap))
                return PTR_ERR(regmap);
 
-       clk_alpha_pll_configure(&ipq_pll, regmap, &ipq_pll_config);
+       ipq_pll_config = of_device_get_match_data(&pdev->dev);
+       if (!ipq_pll_config)
+               return -ENODEV;
+
+       clk_alpha_pll_configure(&ipq_pll, regmap, ipq_pll_config);
 
        ret = devm_clk_register_regmap(dev, &ipq_pll.clkr);
        if (ret)
@@ -78,7 +84,7 @@ static int apss_ipq_pll_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id apss_ipq_pll_match_table[] = {
-       { .compatible = "qcom,ipq6018-a53pll" },
+       { .compatible = "qcom,ipq6018-a53pll", .data = &ipq6018_pll_config },
        { }
 };
 MODULE_DEVICE_TABLE(of, apss_ipq_pll_match_table);