xref: /linux/drivers/clk/sunxi-ng/ccu_reset.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*9c92ab61SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
21d80c142SMaxime Ripard /*
31d80c142SMaxime Ripard  * Copyright (c) 2016 Maxime Ripard. All rights reserved.
41d80c142SMaxime Ripard  */
51d80c142SMaxime Ripard 
61d80c142SMaxime Ripard #ifndef _CCU_RESET_H_
71d80c142SMaxime Ripard #define _CCU_RESET_H_
81d80c142SMaxime Ripard 
91d80c142SMaxime Ripard #include <linux/reset-controller.h>
10b042e42fSTobias Klauser #include <linux/spinlock.h>
111d80c142SMaxime Ripard 
121d80c142SMaxime Ripard struct ccu_reset_map {
131d80c142SMaxime Ripard 	u16	reg;
141d80c142SMaxime Ripard 	u32	bit;
151d80c142SMaxime Ripard };
161d80c142SMaxime Ripard 
171d80c142SMaxime Ripard 
181d80c142SMaxime Ripard struct ccu_reset {
191d80c142SMaxime Ripard 	void __iomem			*base;
201d80c142SMaxime Ripard 	struct ccu_reset_map		*reset_map;
211d80c142SMaxime Ripard 	spinlock_t			*lock;
221d80c142SMaxime Ripard 
231d80c142SMaxime Ripard 	struct reset_controller_dev	rcdev;
241d80c142SMaxime Ripard };
251d80c142SMaxime Ripard 
rcdev_to_ccu_reset(struct reset_controller_dev * rcdev)261d80c142SMaxime Ripard static inline struct ccu_reset *rcdev_to_ccu_reset(struct reset_controller_dev *rcdev)
271d80c142SMaxime Ripard {
281d80c142SMaxime Ripard 	return container_of(rcdev, struct ccu_reset, rcdev);
291d80c142SMaxime Ripard }
301d80c142SMaxime Ripard 
311d80c142SMaxime Ripard extern const struct reset_control_ops ccu_reset_ops;
321d80c142SMaxime Ripard 
331d80c142SMaxime Ripard #endif /* _CCU_RESET_H_ */
34