2018-12-13 23:42:54 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
|
|
/*
|
|
|
|
* Copyright 2018 NXP
|
|
|
|
* Dong Aisheng <aisheng.dong@nxp.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __IMX_CLK_SCU_H
|
|
|
|
#define __IMX_CLK_SCU_H
|
|
|
|
|
|
|
|
#include <linux/firmware/imx/sci.h>
|
2020-07-29 16:00:10 +08:00
|
|
|
#include <linux/of.h>
|
2018-12-13 23:42:54 +08:00
|
|
|
|
2020-07-29 16:00:10 +08:00
|
|
|
extern struct list_head imx_scu_clks[];
|
2020-07-29 16:00:18 +08:00
|
|
|
extern const struct dev_pm_ops imx_clk_lpcg_scu_pm_ops;
|
2020-07-29 16:00:10 +08:00
|
|
|
|
|
|
|
int imx_clk_scu_init(struct device_node *np);
|
|
|
|
struct clk_hw *imx_scu_of_clk_src_get(struct of_phandle_args *clkspec,
|
|
|
|
void *data);
|
|
|
|
struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
|
|
|
|
const char * const *parents,
|
|
|
|
int num_parents, u32 rsrc_id, u8 clk_type);
|
2019-01-30 21:39:15 +08:00
|
|
|
|
2020-07-29 16:00:12 +08:00
|
|
|
struct clk_hw *__imx_clk_scu(struct device *dev, const char *name,
|
|
|
|
const char * const *parents, int num_parents,
|
|
|
|
u32 rsrc_id, u8 clk_type);
|
2019-01-30 21:39:15 +08:00
|
|
|
|
2020-07-29 16:00:10 +08:00
|
|
|
void imx_clk_scu_unregister(void);
|
|
|
|
|
2020-07-29 16:00:16 +08:00
|
|
|
struct clk_hw *__imx_clk_lpcg_scu(struct device *dev, const char *name,
|
|
|
|
const char *parent_name, unsigned long flags,
|
|
|
|
void __iomem *reg, u8 bit_idx, bool hw_gate);
|
|
|
|
void imx_clk_lpcg_scu_unregister(struct clk_hw *hw);
|
|
|
|
|
2019-01-30 21:39:15 +08:00
|
|
|
static inline struct clk_hw *imx_clk_scu(const char *name, u32 rsrc_id,
|
2020-07-29 16:00:10 +08:00
|
|
|
u8 clk_type, u8 clk_cells)
|
2019-01-30 21:39:15 +08:00
|
|
|
{
|
2020-07-29 16:00:10 +08:00
|
|
|
if (clk_cells == 2)
|
|
|
|
return imx_clk_scu_alloc_dev(name, NULL, 0, rsrc_id, clk_type);
|
|
|
|
else
|
2020-07-29 16:00:12 +08:00
|
|
|
return __imx_clk_scu(NULL, name, NULL, 0, rsrc_id, clk_type);
|
2019-01-30 21:39:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct clk_hw *imx_clk_scu2(const char *name, const char * const *parents,
|
2020-07-29 16:00:10 +08:00
|
|
|
int num_parents, u32 rsrc_id, u8 clk_type,
|
|
|
|
u8 clk_cells)
|
2019-01-30 21:39:15 +08:00
|
|
|
{
|
2020-07-29 16:00:10 +08:00
|
|
|
if (clk_cells == 2)
|
|
|
|
return imx_clk_scu_alloc_dev(name, parents, num_parents, rsrc_id, clk_type);
|
|
|
|
else
|
2020-07-29 16:00:12 +08:00
|
|
|
return __imx_clk_scu(NULL, name, parents, num_parents, rsrc_id, clk_type);
|
2019-01-30 21:39:15 +08:00
|
|
|
}
|
2018-12-13 23:42:54 +08:00
|
|
|
|
2020-07-29 16:00:16 +08:00
|
|
|
static inline struct clk_hw *imx_clk_lpcg_scu_dev(struct device *dev, const char *name,
|
|
|
|
const char *parent_name, unsigned long flags,
|
|
|
|
void __iomem *reg, u8 bit_idx, bool hw_gate)
|
|
|
|
{
|
|
|
|
return __imx_clk_lpcg_scu(dev, name, parent_name, flags, reg,
|
|
|
|
bit_idx, hw_gate);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct clk_hw *imx_clk_lpcg_scu(const char *name, const char *parent_name,
|
|
|
|
unsigned long flags, void __iomem *reg,
|
|
|
|
u8 bit_idx, bool hw_gate)
|
|
|
|
{
|
|
|
|
return __imx_clk_lpcg_scu(NULL, name, parent_name, flags, reg,
|
|
|
|
bit_idx, hw_gate);
|
|
|
|
}
|
2018-12-13 23:42:54 +08:00
|
|
|
#endif
|