1294661Smmel#-
2294661Smmel# Copyright 2016 Michal Meloun <mmel@FreeBSD.org>
3294661Smmel# All rights reserved.
4294661Smmel#
5294661Smmel# Redistribution and use in source and binary forms, with or without
6294661Smmel# modification, are permitted provided that the following conditions
7294661Smmel# are met:
8294661Smmel# 1. Redistributions of source code must retain the above copyright
9294661Smmel#    notice, this list of conditions and the following disclaimer.
10294661Smmel# 2. Redistributions in binary form must reproduce the above copyright
11294661Smmel#    notice, this list of conditions and the following disclaimer in the
12294661Smmel#    documentation and/or other materials provided with the distribution.
13294661Smmel#
14294661Smmel# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15294661Smmel# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16294661Smmel# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17294661Smmel# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18294661Smmel# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19294661Smmel# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20294661Smmel# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21294661Smmel# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22294661Smmel# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23294661Smmel# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24294661Smmel# SUCH DAMAGE.
25294661Smmel#
26294661Smmel# $FreeBSD$
27294661Smmel#
28294661Smmel
29294661Smmel#ifdef FDT
30294661Smmel#include <sys/types.h>
31294661Smmel#include <dev/ofw/ofw_bus.h>
32294661Smmel#endif
33294661Smmel
34294661SmmelINTERFACE hwreset;
35294661Smmel
36294661Smmel#ifdef FDT
37294661SmmelHEADER {
38294661Smmelint hwreset_default_ofw_map(device_t , phandle_t, int, pcell_t *, intptr_t *);
39294661Smmel}
40294661Smmel
41294661Smmel#
42294661Smmel# map fdt property cells to reset id
43294661Smmel# Returns 0 on success or a standard errno value.
44294661Smmel#
45294661SmmelMETHOD int map {
46294661Smmel	device_t	provider_dev;
47294661Smmel	phandle_t	xref;
48294661Smmel	int		ncells;
49294661Smmel	pcell_t		*cells;
50294661Smmel	intptr_t	*id;
51294661Smmel} DEFAULT hwreset_default_ofw_map;
52294661Smmel#endif
53294661Smmel
54294661Smmel#
55294661Smmel# Assert/deassert given reset.
56294661Smmel# Returns 0 on success or a standard errno value.
57294661Smmel#
58294661SmmelMETHOD int assert {
59294661Smmel	device_t	provider_dev;
60294661Smmel	intptr_t	id;
61294661Smmel	bool		value;
62294661Smmel};
63294661Smmel
64294661Smmel#
65294661Smmel# Get actual status of given reset.
66294661Smmel# Returns 0 on success or a standard errno value.
67294661Smmel#
68294661SmmelMETHOD int is_asserted {
69294661Smmel	device_t	provider_dev;
70294661Smmel	intptr_t	id;
71294661Smmel	bool		*value;
72294661Smmel};
73