3
3
#include <linux/delay.h>
4
4
#include <linux/clk-provider.h>
5
5
#include <linux/io.h>
6
- #include <linux/of.h>
7
6
#include <linux/platform_device.h>
7
+ #include <linux/property.h>
8
8
#include <dt-bindings/clock/en7523-clk.h>
9
9
10
10
#define REG_PCI_CONTROL 0x88
@@ -47,6 +47,10 @@ struct en_clk_gate {
47
47
struct clk_hw hw ;
48
48
};
49
49
50
+ struct en_clk_soc_data {
51
+ const struct clk_ops pcie_ops ;
52
+ };
53
+
50
54
static const u32 gsw_base [] = { 400000000 , 500000000 };
51
55
static const u32 emi_base [] = { 333000000 , 400000000 };
52
56
static const u32 bus_base [] = { 500000000 , 540000000 };
@@ -145,11 +149,6 @@ static const struct en_clk_desc en7523_base_clks[] = {
145
149
}
146
150
};
147
151
148
- static const struct of_device_id of_match_clk_en7523 [] = {
149
- { .compatible = "airoha,en7523-scu" , },
150
- { /* sentinel */ }
151
- };
152
-
153
152
static unsigned int en7523_get_base_rate (void __iomem * base , unsigned int i )
154
153
{
155
154
const struct en_clk_desc * desc = & en7523_base_clks [i ];
@@ -247,14 +246,10 @@ static void en7523_pci_unprepare(struct clk_hw *hw)
247
246
static struct clk_hw * en7523_register_pcie_clk (struct device * dev ,
248
247
void __iomem * np_base )
249
248
{
250
- static const struct clk_ops pcie_gate_ops = {
251
- .is_enabled = en7523_pci_is_enabled ,
252
- .prepare = en7523_pci_prepare ,
253
- .unprepare = en7523_pci_unprepare ,
254
- };
249
+ const struct en_clk_soc_data * soc_data = device_get_match_data (dev );
255
250
struct clk_init_data init = {
256
251
.name = "pcie" ,
257
- .ops = & pcie_gate_ops ,
252
+ .ops = & soc_data -> pcie_ops ,
258
253
};
259
254
struct en_clk_gate * cg ;
260
255
@@ -264,7 +259,7 @@ static struct clk_hw *en7523_register_pcie_clk(struct device *dev,
264
259
265
260
cg -> base = np_base ;
266
261
cg -> hw .init = & init ;
267
- en7523_pci_unprepare (& cg -> hw );
262
+ init . ops -> unprepare (& cg -> hw );
268
263
269
264
if (clk_hw_register (dev , & cg -> hw ))
270
265
return NULL ;
@@ -333,6 +328,19 @@ static int en7523_clk_probe(struct platform_device *pdev)
333
328
return r ;
334
329
}
335
330
331
+ static const struct en_clk_soc_data en7523_data = {
332
+ .pcie_ops = {
333
+ .is_enabled = en7523_pci_is_enabled ,
334
+ .prepare = en7523_pci_prepare ,
335
+ .unprepare = en7523_pci_unprepare ,
336
+ },
337
+ };
338
+
339
+ static const struct of_device_id of_match_clk_en7523 [] = {
340
+ { .compatible = "airoha,en7523-scu" , .data = & en7523_data },
341
+ { /* sentinel */ }
342
+ };
343
+
336
344
static struct platform_driver clk_en7523_drv = {
337
345
.probe = en7523_clk_probe ,
338
346
.driver = {
0 commit comments