1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/*
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-5-1 GuEe-GUI first version
*/
#ifndef __CCU_DPLL_H__
#define __CCU_DPLL_H__
#include "ccu.h"
struct ccu_dpll_rate_tbl
{
rt_uint64_t rate;
rt_uint32_t reg0;
rt_uint32_t reg1;
rt_uint32_t reg2;
rt_uint32_t reg3;
rt_uint32_t reg4;
rt_uint32_t reg5;
rt_uint32_t reg6;
rt_uint32_t reg7;
};
struct ccu_dpll_config
{
rt_uint32_t tbl_size;
struct ccu_dpll_rate_tbl *rate_tbl;
};
struct ccu_dpll
{
struct ccu_common common;
struct ccu_dpll_config dpll;
};
#define DPLL_RATE(_rate, _reg0, _reg1, _reg2, _reg3, _reg4, _reg5, _reg6, _reg7) \
{ \
.rate = (_rate), \
.reg0 = (_reg0), \
.reg1 = (_reg1), \
.reg2 = (_reg2), \
.reg3 = (_reg3), \
.reg4 = (_reg4), \
.reg5 = (_reg5), \
.reg6 = (_reg6), \
.reg7 = (_reg7), \
}
#define _SPACEMIT_CCU_DPLL_CONFIG(_table, _size) \
{ \
.rate_tbl = (struct ccu_dpll_rate_tbl *)_table, \
.tbl_size = _size, \
}
#define SPACEMIT_CCU_DPLL(_struct, _name, _table, _size, \
_base_type, _reg_ctrl, _reg_sel, _is_pll, _flags) \
struct ccu_dpll _struct = \
{ \
.dpll = _SPACEMIT_CCU_DPLL_CONFIG(_table, _size), \
.common = \
{ \
.reg_ctrl = _reg_ctrl, \
.reg_sel = _reg_sel, \
.base_type = _base_type, \
.is_pll = RT_FALSE, \
.cell.name = _name, \
.cell.ops = &ccu_dpll_ops, \
.cell.flags = _flags, \
}, \
}
extern const struct rt_clk_ops ccu_dpll_ops;
rt_inline struct ccu_dpll *cell_to_ccu_dpll(struct rt_clk_cell *cell)
{
struct ccu_common *common = cell_to_ccu_common(cell);
return rt_container_of(common, struct ccu_dpll, common);
}
#endif /* __CCU_DPLL_H__ */
|