33#include <linux/delay.h>
44#include <linux/clk-provider.h>
55#include <linux/io.h>
6- #include <linux/of.h>
76#include <linux/platform_device.h>
7+ #include <linux/property.h>
88#include <dt-bindings/clock/en7523-clk.h>
99
1010#define REG_PCI_CONTROL 0x88
@@ -47,6 +47,10 @@ struct en_clk_gate {
4747 struct clk_hw hw ;
4848};
4949
50+ struct en_clk_soc_data {
51+ const struct clk_ops pcie_ops ;
52+ };
53+
5054static const u32 gsw_base [] = { 400000000 , 500000000 };
5155static const u32 emi_base [] = { 333000000 , 400000000 };
5256static const u32 bus_base [] = { 500000000 , 540000000 };
@@ -145,11 +149,6 @@ static const struct en_clk_desc en7523_base_clks[] = {
145149 }
146150};
147151
148- static const struct of_device_id of_match_clk_en7523 [] = {
149- { .compatible = "airoha,en7523-scu" , },
150- { /* sentinel */ }
151- };
152-
153152static unsigned int en7523_get_base_rate (void __iomem * base , unsigned int i )
154153{
155154 const struct en_clk_desc * desc = & en7523_base_clks [i ];
@@ -247,14 +246,10 @@ static void en7523_pci_unprepare(struct clk_hw *hw)
247246static struct clk_hw * en7523_register_pcie_clk (struct device * dev ,
248247 void __iomem * np_base )
249248{
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 );
255250 struct clk_init_data init = {
256251 .name = "pcie" ,
257- .ops = & pcie_gate_ops ,
252+ .ops = & soc_data -> pcie_ops ,
258253 };
259254 struct en_clk_gate * cg ;
260255
@@ -264,7 +259,7 @@ static struct clk_hw *en7523_register_pcie_clk(struct device *dev,
264259
265260 cg -> base = np_base ;
266261 cg -> hw .init = & init ;
267- en7523_pci_unprepare (& cg -> hw );
262+ init . ops -> unprepare (& cg -> hw );
268263
269264 if (clk_hw_register (dev , & cg -> hw ))
270265 return NULL ;
@@ -333,6 +328,19 @@ static int en7523_clk_probe(struct platform_device *pdev)
333328 return r ;
334329}
335330
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+
336344static struct platform_driver clk_en7523_drv = {
337345 .probe = en7523_clk_probe ,
338346 .driver = {
0 commit comments