Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / clk / baikal-t1 / ccu-pll.h
blob76cd9132a2196adb4da163ee70a850e20762a6d7
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
5 * Baikal-T1 CCU PLL interface driver
6 */
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>
14 #include <linux/of.h>
17 * struct ccu_pll_init_data - CCU PLL initialization data
18 * @id: Clock private identifier.
19 * @name: Clocks name.
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 {
27 unsigned int id;
28 const char *name;
29 const char *parent_name;
30 unsigned int base;
31 struct regmap *sys_regs;
32 struct device_node *np;
33 unsigned long flags;
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.
45 struct ccu_pll {
46 struct clk_hw hw;
47 unsigned int id;
48 unsigned int reg_ctl;
49 unsigned int reg_ctl1;
50 struct regmap *sys_regs;
51 spinlock_t lock;
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__ */