summaryrefslogtreecommitdiff
path: root/bsp/rockchip/dm/clk/clk-rk-gate.h
blob: d05069b4e78d8f23e9fa8b2cb65039f443116c95 (plain)
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
/*
 * Copyright (c) 2006-2022, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-3-08      GuEe-GUI     the first version
 */

#ifndef __CLK_RK_GATE_H__
#define __CLK_RK_GATE_H__

#include "clk-rk.h"

#define GATE(_id, cname, pname, f, o, b, gf)    \
(void *)&(struct rockchip_clk_cell)             \
{                                               \
    .cell.name = cname,                         \
    .cell.ops = &rockchip_gate_clk_ops,         \
    .cell.parent_name = pname,                  \
    .cell.parents_nr = 1,                       \
    .cell.flags = f | RT_CLK_F_SET_RATE_PARENT, \
    .id = _id,                                  \
    .gate_offset = o,                           \
    .gate_shift = b,                            \
    .gate_flags = gf,                           \
}

#define GATE_NO_SET_RATE(_id, cname, pname, f, o, b, gf) \
(void *)&(struct rockchip_clk_cell)                 \
{                                                   \
    .cell.name = cname,                             \
    .cell.ops = &rockchip_gate_clk_ops,             \
    .cell.parent_name = pname,                      \
    .cell.parents_nr = 1,                           \
    .cell.flags = (f) & ~RT_CLK_F_SET_RATE_PARENT,  \
    .id = _id,                                      \
    .gate_offset = o,                               \
    .gate_shift = b,                                \
    .gate_flags = gf,                               \
}

extern const struct rt_clk_ops rockchip_gate_clk_ops;

#endif /* __CLK_RK_GATE_H__ */