88
99#include "clk-alpha-pll.h"
1010
11- static const u8 ipq_pll_offsets [] = {
12- [PLL_OFF_L_VAL ] = 0x08 ,
13- [PLL_OFF_ALPHA_VAL ] = 0x10 ,
14- [PLL_OFF_USER_CTL ] = 0x18 ,
15- [PLL_OFF_CONFIG_CTL ] = 0x20 ,
16- [PLL_OFF_CONFIG_CTL_U ] = 0x24 ,
17- [PLL_OFF_STATUS ] = 0x28 ,
18- [PLL_OFF_TEST_CTL ] = 0x30 ,
19- [PLL_OFF_TEST_CTL_U ] = 0x34 ,
11+ /*
12+ * Even though APSS PLL type is of existing one (like Huayra), its offsets
13+ * are different from the one mentioned in the clk-alpha-pll.c, since the
14+ * PLL is specific to APSS, so lets the define the same.
15+ */
16+ static const u8 ipq_pll_offsets [][PLL_OFF_MAX_REGS ] = {
17+ [CLK_ALPHA_PLL_TYPE_HUAYRA ] = {
18+ [PLL_OFF_L_VAL ] = 0x08 ,
19+ [PLL_OFF_ALPHA_VAL ] = 0x10 ,
20+ [PLL_OFF_USER_CTL ] = 0x18 ,
21+ [PLL_OFF_CONFIG_CTL ] = 0x20 ,
22+ [PLL_OFF_CONFIG_CTL_U ] = 0x24 ,
23+ [PLL_OFF_STATUS ] = 0x28 ,
24+ [PLL_OFF_TEST_CTL ] = 0x30 ,
25+ [PLL_OFF_TEST_CTL_U ] = 0x34 ,
26+ },
2027};
2128
22- static struct clk_alpha_pll ipq_pll = {
29+ static struct clk_alpha_pll ipq_pll_huayra = {
2330 .offset = 0x0 ,
24- .regs = ipq_pll_offsets ,
31+ .regs = ipq_pll_offsets [ CLK_ALPHA_PLL_TYPE_HUAYRA ] ,
2532 .flags = SUPPORTS_DYNAMIC_UPDATE ,
2633 .clkr = {
2734 .enable_reg = 0x0 ,
@@ -61,6 +68,21 @@ static const struct alpha_pll_config ipq8074_pll_config = {
6168 .test_ctl_hi_val = 0x4000 ,
6269};
6370
71+ struct apss_pll_data {
72+ struct clk_alpha_pll * pll ;
73+ const struct alpha_pll_config * pll_config ;
74+ };
75+
76+ static struct apss_pll_data ipq8074_pll_data = {
77+ .pll = & ipq_pll_huayra ,
78+ .pll_config = & ipq8074_pll_config ,
79+ };
80+
81+ static struct apss_pll_data ipq6018_pll_data = {
82+ .pll = & ipq_pll_huayra ,
83+ .pll_config = & ipq6018_pll_config ,
84+ };
85+
6486static const struct regmap_config ipq_pll_regmap_config = {
6587 .reg_bits = 32 ,
6688 .reg_stride = 4 ,
@@ -71,7 +93,7 @@ static const struct regmap_config ipq_pll_regmap_config = {
7193
7294static int apss_ipq_pll_probe (struct platform_device * pdev )
7395{
74- const struct alpha_pll_config * ipq_pll_config ;
96+ const struct apss_pll_data * data ;
7597 struct device * dev = & pdev -> dev ;
7698 struct regmap * regmap ;
7799 void __iomem * base ;
@@ -85,23 +107,23 @@ static int apss_ipq_pll_probe(struct platform_device *pdev)
85107 if (IS_ERR (regmap ))
86108 return PTR_ERR (regmap );
87109
88- ipq_pll_config = of_device_get_match_data (& pdev -> dev );
89- if (!ipq_pll_config )
110+ data = of_device_get_match_data (& pdev -> dev );
111+ if (!data )
90112 return - ENODEV ;
91113
92- clk_alpha_pll_configure (& ipq_pll , regmap , ipq_pll_config );
114+ clk_alpha_pll_configure (data -> pll , regmap , data -> pll_config );
93115
94- ret = devm_clk_register_regmap (dev , & ipq_pll . clkr );
116+ ret = devm_clk_register_regmap (dev , & data -> pll -> clkr );
95117 if (ret )
96118 return ret ;
97119
98120 return devm_of_clk_add_hw_provider (dev , of_clk_hw_simple_get ,
99- & ipq_pll . clkr .hw );
121+ & data -> pll -> clkr .hw );
100122}
101123
102124static const struct of_device_id apss_ipq_pll_match_table [] = {
103- { .compatible = "qcom,ipq6018-a53pll" , .data = & ipq6018_pll_config },
104- { .compatible = "qcom,ipq8074-a53pll" , .data = & ipq8074_pll_config },
125+ { .compatible = "qcom,ipq6018-a53pll" , .data = & ipq6018_pll_data },
126+ { .compatible = "qcom,ipq8074-a53pll" , .data = & ipq8074_pll_data },
105127 { }
106128};
107129MODULE_DEVICE_TABLE (of , apss_ipq_pll_match_table );
0 commit comments