summaryrefslogtreecommitdiff
path: root/bsp/rockchip/dm/clk/clk-rk-mux.h
blob: 0ed8bd1002607ce6870086c4d25afead6a1a756e (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
53
54
55
56
57
/*
 * 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_MUX_H__
#define __CLK_RK_MUX_H__

#include "clk-rk.h"

#define MUX_RAW(_id, cname, pnames, f, o, s, w, mf) \
{                                               \
    .cell.name = cname,                         \
    .cell.parent_names = pnames,                \
    .cell.parents_nr = RT_ARRAY_SIZE(pnames),   \
    .cell.flags = f,                            \
    .id = _id,                                  \
    .muxdiv_offset = o,                         \
    .mux_shift = s,                             \
    .mux_width = w,                             \
    .mux_flags = mf,                            \
    .gate_offset = -1,                          \
    .init = rockchip_mux_clk_cell_init,         \
}

#define MUX(_id, cname, pnames, f, o, s, w, mf) \
    (void *)&(struct rockchip_clk_cell)MUX_RAW(_id, cname, pnames, f, o, s, w, mf)

#define MUXTBL_RAW(_id, cname, pnames, f, o, s, w, mf, mt) \
{                                               \
    .cell.name = cname,                         \
    .cell.parent_names = pname,                 \
    .cell.parents_nr = RT_ARRAY_SIZE(pnames),   \
    .cell.flags = f,                            \
    .id = _id,                                  \
    .muxdiv_offset = o,                         \
    .mux_shift = s,                             \
    .mux_width = w,                             \
    .mux_flags = mf,                            \
    .gate_offset = -1,                          \
    .mux_table = mt,                            \
    .init = rockchip_mux_clk_cell_init,         \
}

#define MUXTBL(_id, cname, pnames, f, o, s, w, mf, mt) \
    (void *)&(struct rockchip_clk_cell)MUXTBL_RAW(_id, cname, pnames, f, o, s, w, mf, mt)

extern const struct rt_clk_ops rockchip_mux_clk_ops, rockchip_mux_ro_clk_ops;

void rockchip_mux_clk_cell_init(struct rockchip_clk_cell *rk_cell);

#endif /* __CLK_RK_MUX_H__ */