Merge tag 'trace-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[linux/fpc-iii.git] / drivers / clk / imx / clk-scu.h
blobe8352164923e0e76a8192c7d3ed560ebdbb88bd0
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * Copyright 2018 NXP
4 * Dong Aisheng <aisheng.dong@nxp.com>
5 */
7 #ifndef __IMX_CLK_SCU_H
8 #define __IMX_CLK_SCU_H
10 #include <linux/firmware/imx/sci.h>
11 #include <linux/of.h>
13 extern struct list_head imx_scu_clks[];
14 extern const struct dev_pm_ops imx_clk_lpcg_scu_pm_ops;
16 int imx_clk_scu_init(struct device_node *np);
17 struct clk_hw *imx_scu_of_clk_src_get(struct of_phandle_args *clkspec,
18 void *data);
19 struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
20 const char * const *parents,
21 int num_parents, u32 rsrc_id, u8 clk_type);
23 struct clk_hw *__imx_clk_scu(struct device *dev, const char *name,
24 const char * const *parents, int num_parents,
25 u32 rsrc_id, u8 clk_type);
27 void imx_clk_scu_unregister(void);
29 struct clk_hw *__imx_clk_lpcg_scu(struct device *dev, const char *name,
30 const char *parent_name, unsigned long flags,
31 void __iomem *reg, u8 bit_idx, bool hw_gate);
32 void imx_clk_lpcg_scu_unregister(struct clk_hw *hw);
34 static inline struct clk_hw *imx_clk_scu(const char *name, u32 rsrc_id,
35 u8 clk_type, u8 clk_cells)
37 if (clk_cells == 2)
38 return imx_clk_scu_alloc_dev(name, NULL, 0, rsrc_id, clk_type);
39 else
40 return __imx_clk_scu(NULL, name, NULL, 0, rsrc_id, clk_type);
43 static inline struct clk_hw *imx_clk_scu2(const char *name, const char * const *parents,
44 int num_parents, u32 rsrc_id, u8 clk_type,
45 u8 clk_cells)
47 if (clk_cells == 2)
48 return imx_clk_scu_alloc_dev(name, parents, num_parents, rsrc_id, clk_type);
49 else
50 return __imx_clk_scu(NULL, name, parents, num_parents, rsrc_id, clk_type);
53 static inline struct clk_hw *imx_clk_lpcg_scu_dev(struct device *dev, const char *name,
54 const char *parent_name, unsigned long flags,
55 void __iomem *reg, u8 bit_idx, bool hw_gate)
57 return __imx_clk_lpcg_scu(dev, name, parent_name, flags, reg,
58 bit_idx, hw_gate);
61 static inline struct clk_hw *imx_clk_lpcg_scu(const char *name, const char *parent_name,
62 unsigned long flags, void __iomem *reg,
63 u8 bit_idx, bool hw_gate)
65 return __imx_clk_lpcg_scu(NULL, name, parent_name, flags, reg,
66 bit_idx, hw_gate);
68 #endif