1271546Sian/*-
2271546Sian * Copyright (c) 2014 Ian Lepore <ian@freebsd.org>
3271546Sian * All rights reserved.
4271546Sian *
5271546Sian * Redistribution and use in source and binary forms, with or without
6271546Sian * modification, are permitted provided that the following conditions
7271546Sian * are met:
8271546Sian * 1. Redistributions of source code must retain the above copyright
9271546Sian *    notice, this list of conditions and the following disclaimer.
10271546Sian * 2. Redistributions in binary form must reproduce the above copyright
11271546Sian *    notice, this list of conditions and the following disclaimer in the
12271546Sian *    documentation and/or other materials provided with the distribution.
13271546Sian *
14271546Sian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15271546Sian * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16271546Sian * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17271546Sian * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18271546Sian * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19271546Sian * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20271546Sian * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21271546Sian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22271546Sian * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23271546Sian * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24271546Sian *
25271546Sian * $FreeBSD$
26271546Sian */
27271546Sian
28271546Sian#ifndef DEV_FDT_PINCTRL_H
29271546Sian#define DEV_FDT_PINCTRL_H
30271546Sian
31271546Sian#include "fdt_pinctrl_if.h"
32271546Sian
33271546Sian/*
34271546Sian * Configure pins by name or index.  This looks up the pinctrl-N property in
35271546Sian * client's fdt data by index or name, and passes each handle in it to the
36271546Sian * pinctrl driver for configuration.
37271546Sian */
38271546Sianint fdt_pinctrl_configure(device_t client, u_int index);
39271546Sianint fdt_pinctrl_configure_by_name(device_t client, const char * name);
40271546Sian
41271546Sian/*
42271546Sian * Register a pinctrl driver so that it can be used by other devices which call
43271546Sian * fdt_pinctrl_configure().  The pinprop argument is the name of a property that
44271546Sian * identifies each descendent of the pinctrl node which is a pin configuration
45271546Sian * node whose xref phandle can be passed to FDT_PINCTRL_CONFIGURE().  If this is
46271546Sian * NULL, every descendant node is registered.
47271546Sian */
48271546Sianint fdt_pinctrl_register(device_t pinctrl, const char *pinprop);
49271546Sian
50271546Sian/*
51271546Sian * Walk the device tree and configure pins for each enabled device whose
52271546Sian * pinctrl-0 property contains references to nodes which are children of the
53271546Sian * given pinctrl device.  This helper routine is for use by pinctrl drivers.
54271546Sian */
55271546Sianint fdt_pinctrl_configure_tree(device_t pinctrl);
56271546Sian
57271546Sian#endif /* DEV_FDT_PINCTRL_H */
58271546Sian
59