xref: /openbmc/linux/drivers/clk/sprd/common.h (revision b830f94f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 //
3 // Spreadtrum clock infrastructure
4 //
5 // Copyright (C) 2017 Spreadtrum, Inc.
6 // Author: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
7 
8 #ifndef _SPRD_CLK_COMMON_H_
9 #define _SPRD_CLK_COMMON_H_
10 
11 #include <linux/clk-provider.h>
12 #include <linux/of_platform.h>
13 #include <linux/regmap.h>
14 
15 struct device_node;
16 
17 struct sprd_clk_common {
18 	struct regmap	*regmap;
19 	u32		reg;
20 	struct clk_hw	hw;
21 };
22 
23 struct sprd_clk_desc {
24 	struct sprd_clk_common		**clk_clks;
25 	unsigned long			num_clk_clks;
26 	struct clk_hw_onecell_data      *hw_clks;
27 };
28 
29 static inline struct sprd_clk_common *
30 	hw_to_sprd_clk_common(const struct clk_hw *hw)
31 {
32 	return container_of(hw, struct sprd_clk_common, hw);
33 }
34 int sprd_clk_regmap_init(struct platform_device *pdev,
35 			 const struct sprd_clk_desc *desc);
36 int sprd_clk_probe(struct device *dev, struct clk_hw_onecell_data *clkhw);
37 
38 #endif /* _SPRD_CLK_COMMON_H_ */
39