xref: /linux/drivers/reset/spacemit/reset-spacemit-common.h (revision bdbddf72a2ab1cfea699959795d70df3931eefe7)
1*aba86f7bSGuodong Xu /* SPDX-License-Identifier: GPL-2.0-only */
2*aba86f7bSGuodong Xu /*
3*aba86f7bSGuodong Xu  * SpacemiT reset controller driver - common definitions
4*aba86f7bSGuodong Xu  */
5*aba86f7bSGuodong Xu 
6*aba86f7bSGuodong Xu #ifndef _RESET_SPACEMIT_COMMON_H_
7*aba86f7bSGuodong Xu #define _RESET_SPACEMIT_COMMON_H_
8*aba86f7bSGuodong Xu 
9*aba86f7bSGuodong Xu #include <linux/auxiliary_bus.h>
10*aba86f7bSGuodong Xu #include <linux/regmap.h>
11*aba86f7bSGuodong Xu #include <linux/reset-controller.h>
12*aba86f7bSGuodong Xu #include <linux/types.h>
13*aba86f7bSGuodong Xu 
14*aba86f7bSGuodong Xu struct ccu_reset_data {
15*aba86f7bSGuodong Xu 	u32 offset;
16*aba86f7bSGuodong Xu 	u32 assert_mask;
17*aba86f7bSGuodong Xu 	u32 deassert_mask;
18*aba86f7bSGuodong Xu };
19*aba86f7bSGuodong Xu 
20*aba86f7bSGuodong Xu struct ccu_reset_controller_data {
21*aba86f7bSGuodong Xu 	const struct ccu_reset_data *reset_data;	/* array */
22*aba86f7bSGuodong Xu 	size_t count;
23*aba86f7bSGuodong Xu };
24*aba86f7bSGuodong Xu 
25*aba86f7bSGuodong Xu struct ccu_reset_controller {
26*aba86f7bSGuodong Xu 	struct reset_controller_dev rcdev;
27*aba86f7bSGuodong Xu 	const struct ccu_reset_controller_data *data;
28*aba86f7bSGuodong Xu 	struct regmap *regmap;
29*aba86f7bSGuodong Xu };
30*aba86f7bSGuodong Xu 
31*aba86f7bSGuodong Xu #define RESET_DATA(_offset, _assert_mask, _deassert_mask)	\
32*aba86f7bSGuodong Xu 	{							\
33*aba86f7bSGuodong Xu 		.offset		= (_offset),			\
34*aba86f7bSGuodong Xu 		.assert_mask	= (_assert_mask),		\
35*aba86f7bSGuodong Xu 		.deassert_mask	= (_deassert_mask),		\
36*aba86f7bSGuodong Xu 	}
37*aba86f7bSGuodong Xu 
38*aba86f7bSGuodong Xu /* Common probe function */
39*aba86f7bSGuodong Xu int spacemit_reset_probe(struct auxiliary_device *adev,
40*aba86f7bSGuodong Xu 			 const struct auxiliary_device_id *id);
41*aba86f7bSGuodong Xu 
42*aba86f7bSGuodong Xu #endif /* _RESET_SPACEMIT_COMMON_H_ */
43