162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Simple Reset Controller ops
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Based on Allwinner SoCs Reset Controller driver
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Copyright 2013 Maxime Ripard
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * Maxime Ripard <maxime.ripard@free-electrons.com>
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#ifndef __RESET_SIMPLE_H__
1362306a36Sopenharmony_ci#define __RESET_SIMPLE_H__
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#include <linux/io.h>
1662306a36Sopenharmony_ci#include <linux/reset-controller.h>
1762306a36Sopenharmony_ci#include <linux/spinlock.h>
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/**
2062306a36Sopenharmony_ci * struct reset_simple_data - driver data for simple reset controllers
2162306a36Sopenharmony_ci * @lock: spinlock to protect registers during read-modify-write cycles
2262306a36Sopenharmony_ci * @membase: memory mapped I/O register range
2362306a36Sopenharmony_ci * @rcdev: reset controller device base structure
2462306a36Sopenharmony_ci * @active_low: if true, bits are cleared to assert the reset. Otherwise, bits
2562306a36Sopenharmony_ci *              are set to assert the reset. Note that this says nothing about
2662306a36Sopenharmony_ci *              the voltage level of the actual reset line.
2762306a36Sopenharmony_ci * @status_active_low: if true, bits read back as cleared while the reset is
2862306a36Sopenharmony_ci *                     asserted. Otherwise, bits read back as set while the
2962306a36Sopenharmony_ci *                     reset is asserted.
3062306a36Sopenharmony_ci * @reset_us: Minimum delay in microseconds needed that needs to be
3162306a36Sopenharmony_ci *            waited for between an assert and a deassert to reset the
3262306a36Sopenharmony_ci *            device. If multiple consumers with different delay
3362306a36Sopenharmony_ci *            requirements are connected to this controller, it must
3462306a36Sopenharmony_ci *            be the largest minimum delay. 0 means that such a delay is
3562306a36Sopenharmony_ci *            unknown and the reset operation is unsupported.
3662306a36Sopenharmony_ci */
3762306a36Sopenharmony_cistruct reset_simple_data {
3862306a36Sopenharmony_ci	spinlock_t			lock;
3962306a36Sopenharmony_ci	void __iomem			*membase;
4062306a36Sopenharmony_ci	struct reset_controller_dev	rcdev;
4162306a36Sopenharmony_ci	bool				active_low;
4262306a36Sopenharmony_ci	bool				status_active_low;
4362306a36Sopenharmony_ci	unsigned int			reset_us;
4462306a36Sopenharmony_ci};
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciextern const struct reset_control_ops reset_simple_ops;
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#endif /* __RESET_SIMPLE_H__ */
49