summaryrefslogtreecommitdiff
path: root/bsp/rockchip/dm/clk/clk-rk-divider.h
blob: 5bf25094c86c6a7df6b5be64b2e92b099fb9d35a (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
47
48
49
50
51
52
/*
 * 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_DIVIDER_H__
#define __CLK_RK_DIVIDER_H__

#include "clk-rk.h"

#define DIV(_id, cname, pname, f, o, s, w, df)  \
(void *)&(struct rockchip_clk_cell)         \
{                                           \
    .cell.name = cname,                     \
    .cell.parent_name = pname,              \
    .cell.parents_nr = 1,                   \
    .cell.flags = f,                        \
    .id = _id,                              \
    .muxdiv_offset = o,                     \
    .div_shift = s,                         \
    .div_width = w,                         \
    .div_flags = df,                        \
    .gate_offset = -1,                      \
    .init = rockchip_divider_clk_cell_init, \
}

#define DIVTBL(_id, cname, pname, f, o, s, w, df, dt) \
(void *)&(struct rockchip_clk_cell)         \
{                                           \
    .cell.name = cname,                     \
    .cell.parent_name = pname,              \
    .cell.parents_nr = 1,                   \
    .cell.flags = f,                        \
    .id = _id,                              \
    .muxdiv_offset = o,                     \
    .div_shift = s,                         \
    .div_width = w,                         \
    .div_flags = df,                        \
    .div_table = dt,                        \
    .init = rockchip_divider_clk_cell_init, \
}

extern const struct rt_clk_ops clk_divider_ops, clk_divider_ro_ops;

void rockchip_divider_clk_cell_init(struct rockchip_clk_cell *rk_cell);

#endif /* __CLK_RK_DIVIDER_H__ */