summaryrefslogtreecommitdiff
path: root/drivers/clk/baikal-t1/ccu-rst.h
blob: 68214d7774652df0af5721e2b7a0d82101981fb6 (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
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2021 BAIKAL ELECTRONICS, JSC
 *
 * Baikal-T1 CCU Resets interface driver
 */
#ifndef __CLK_BT1_CCU_RST_H__
#define __CLK_BT1_CCU_RST_H__

#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/reset-controller.h>

struct ccu_rst_info;

/*
 * struct ccu_rst_init_data - CCU Resets initialization data
 * @sys_regs: Baikal-T1 System Controller registers map.
 * @np: Pointer to the node with the System CCU block.
 */
struct ccu_rst_init_data {
	struct regmap *sys_regs;
	struct device_node *np;
};

/*
 * struct ccu_rst - CCU Reset descriptor
 * @rcdev: Reset controller descriptor.
 * @sys_regs: Baikal-T1 System Controller registers map.
 * @rsts_info: Reset flag info (base address and mask).
 */
struct ccu_rst {
	struct reset_controller_dev rcdev;
	struct regmap *sys_regs;
	const struct ccu_rst_info *rsts_info;
};
#define to_ccu_rst(_rcdev) container_of(_rcdev, struct ccu_rst, rcdev)

#ifdef CONFIG_CLK_BT1_CCU_RST

struct ccu_rst *ccu_rst_hw_register(const struct ccu_rst_init_data *init);

void ccu_rst_hw_unregister(struct ccu_rst *rst);

#else

static inline
struct ccu_rst *ccu_rst_hw_register(const struct ccu_rst_init_data *init)
{
	return NULL;
}

static inline void ccu_rst_hw_unregister(struct ccu_rst *rst) {}

#endif

#endif /* __CLK_BT1_CCU_RST_H__ */