1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
5 * Baikal-T1 CCU PLL interface driver
7 #ifndef __CLK_BT1_CCU_PLL_H__
8 #define __CLK_BT1_CCU_PLL_H__
10 #include <linux/clk-provider.h>
11 #include <linux/spinlock.h>
12 #include <linux/regmap.h>
13 #include <linux/bits.h>
17 * struct ccu_pll_init_data - CCU PLL initialization data
18 * @id: Clock private identifier.
20 * @parent_name: Clocks parent name in a fw node.
21 * @base: PLL registers base address with respect to the sys_regs base.
22 * @sys_regs: Baikal-T1 System Controller registers map.
23 * @np: Pointer to the node describing the CCU PLLs.
24 * @flags: PLL clock flags.
26 struct ccu_pll_init_data
{
29 const char *parent_name
;
31 struct regmap
*sys_regs
;
32 struct device_node
*np
;
37 * struct ccu_pll - CCU PLL descriptor
38 * @hw: clk_hw of the PLL.
39 * @id: Clock private identifier.
40 * @reg_ctl: PLL control register base.
41 * @reg_ctl1: PLL control1 register base.
42 * @sys_regs: Baikal-T1 System Controller registers map.
43 * @lock: PLL state change spin-lock.
49 unsigned int reg_ctl1
;
50 struct regmap
*sys_regs
;
53 #define to_ccu_pll(_hw) container_of(_hw, struct ccu_pll, hw)
55 static inline struct clk_hw
*ccu_pll_get_clk_hw(struct ccu_pll
*pll
)
57 return pll
? &pll
->hw
: NULL
;
60 struct ccu_pll
*ccu_pll_hw_register(const struct ccu_pll_init_data
*init
);
62 void ccu_pll_hw_unregister(struct ccu_pll
*pll
);
64 #endif /* __CLK_BT1_CCU_PLL_H__ */