clk: Add Allwinner A64 CLK driver
[platform/kernel/u-boot.git] / arch / arm / include / asm / arch-sunxi / ccu.h
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2018 Amarula Solutions.
4  * Author: Jagan Teki <jagan@amarulasolutions.com>
5  */
6
7 #ifndef _ASM_ARCH_CCU_H
8 #define _ASM_ARCH_CCU_H
9
10 /**
11  * enum ccu_flags - ccu clock flags
12  *
13  * @CCU_CLK_F_IS_VALID:         is given clock gate is valid?
14  */
15 enum ccu_flags {
16         CCU_CLK_F_IS_VALID              = BIT(0),
17 };
18
19 /**
20  * struct ccu_clk_gate - ccu clock gate
21  * @off:        gate offset
22  * @bit:        gate bit
23  * @flags:      ccu clock gate flags
24  */
25 struct ccu_clk_gate {
26         u16 off;
27         u32 bit;
28         enum ccu_flags flags;
29 };
30
31 #define GATE(_off, _bit) {                      \
32         .off = _off,                            \
33         .bit = _bit,                            \
34         .flags = CCU_CLK_F_IS_VALID,            \
35 }
36
37 /**
38  * struct ccu_desc - clock control unit descriptor
39  *
40  * @gates:      clock gates
41  */
42 struct ccu_desc {
43         const struct ccu_clk_gate *gates;
44 };
45
46 /**
47  * struct ccu_priv - sunxi clock control unit
48  *
49  * @base:       base address
50  * @desc:       ccu descriptor
51  */
52 struct ccu_priv {
53         void *base;
54         const struct ccu_desc *desc;
55 };
56
57 /**
58  * sunxi_clk_probe - common sunxi clock probe
59  * @dev:        clock device
60  */
61 int sunxi_clk_probe(struct udevice *dev);
62
63 extern struct clk_ops sunxi_clk_ops;
64
65 #endif /* _ASM_ARCH_CCU_H */