8
8
9
9
#include "clk-alpha-pll.h"
10
10
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
+ },
20
27
};
21
28
22
- static struct clk_alpha_pll ipq_pll = {
29
+ static struct clk_alpha_pll ipq_pll_huayra = {
23
30
.offset = 0x0 ,
24
- .regs = ipq_pll_offsets ,
31
+ .regs = ipq_pll_offsets [ CLK_ALPHA_PLL_TYPE_HUAYRA ] ,
25
32
.flags = SUPPORTS_DYNAMIC_UPDATE ,
26
33
.clkr = {
27
34
.enable_reg = 0x0 ,
@@ -61,6 +68,21 @@ static const struct alpha_pll_config ipq8074_pll_config = {
61
68
.test_ctl_hi_val = 0x4000 ,
62
69
};
63
70
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
+
64
86
static const struct regmap_config ipq_pll_regmap_config = {
65
87
.reg_bits = 32 ,
66
88
.reg_stride = 4 ,
@@ -71,7 +93,7 @@ static const struct regmap_config ipq_pll_regmap_config = {
71
93
72
94
static int apss_ipq_pll_probe (struct platform_device * pdev )
73
95
{
74
- const struct alpha_pll_config * ipq_pll_config ;
96
+ const struct apss_pll_data * data ;
75
97
struct device * dev = & pdev -> dev ;
76
98
struct regmap * regmap ;
77
99
void __iomem * base ;
@@ -85,23 +107,23 @@ static int apss_ipq_pll_probe(struct platform_device *pdev)
85
107
if (IS_ERR (regmap ))
86
108
return PTR_ERR (regmap );
87
109
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 )
90
112
return - ENODEV ;
91
113
92
- clk_alpha_pll_configure (& ipq_pll , regmap , ipq_pll_config );
114
+ clk_alpha_pll_configure (data -> pll , regmap , data -> pll_config );
93
115
94
- ret = devm_clk_register_regmap (dev , & ipq_pll . clkr );
116
+ ret = devm_clk_register_regmap (dev , & data -> pll -> clkr );
95
117
if (ret )
96
118
return ret ;
97
119
98
120
return devm_of_clk_add_hw_provider (dev , of_clk_hw_simple_get ,
99
- & ipq_pll . clkr .hw );
121
+ & data -> pll -> clkr .hw );
100
122
}
101
123
102
124
static 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 },
105
127
{ }
106
128
};
107
129
MODULE_DEVICE_TABLE (of , apss_ipq_pll_match_table );
0 commit comments