1270025Simp/*-
2270025Simp * Copyright (c) 2014 Warner Losh.  All rights reserved.
3270025Simp *
4270025Simp * Redistribution and use in source and binary forms, with or without
5270025Simp * modification, are permitted provided that the following conditions
6270025Simp * are met:
7270025Simp * 1. Redistributions of source code must retain the above copyright
8270025Simp *    notice, this list of conditions and the following disclaimer.
9270025Simp * 2. Redistributions in binary form must reproduce the above copyright
10270025Simp *    notice, this list of conditions and the following disclaimer in the
11270025Simp *    documentation and/or other materials provided with the distribution.
12270025Simp *
13270025Simp * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14270025Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15270025Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16270025Simp * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17270025Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18270025Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19270025Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20270025Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21270025Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22270025Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23270025Simp * SUCH DAMAGE.
24270025Simp */
25270025Simp
26270025Simp#include <sys/cdefs.h>
27270025Simp__FBSDID("$FreeBSD: releng/10.3/sys/arm/at91/at91_pinctrl.c 273652 2014-10-26 01:30:46Z ian $");
28270025Simp
29270025Simp#include <sys/param.h>
30270025Simp#include <sys/bus.h>
31270025Simp#include <sys/kernel.h>
32270025Simp#include <sys/module.h>
33270025Simp#include <sys/resource.h>
34270025Simp#include <sys/systm.h>
35270025Simp#include <sys/rman.h>
36270025Simp
37270025Simp#include <machine/bus.h>
38270025Simp
39270025Simp#include <arm/at91/at91var.h>
40270025Simp#include <arm/at91/at91_piovar.h>
41270025Simp
42270025Simp#include <dev/fdt/fdt_common.h>
43270025Simp#include <dev/ofw/openfirm.h>
44270025Simp#include <dev/ofw/ofw_bus.h>
45270025Simp#include <dev/ofw/ofw_bus_subr.h>
46270025Simp
47270025Simp#define BUS_PASS_PINMUX (BUS_PASS_INTERRUPT + 1)
48270025Simp
49270025Simpstruct pinctrl_range {
50270025Simp	uint64_t bus;
51270025Simp	uint64_t host;
52270025Simp	uint64_t size;
53270025Simp};
54270025Simp
55270025Simpstruct pinctrl_softc {
56270025Simp	device_t dev;
57270025Simp	phandle_t node;
58270025Simp
59270025Simp	struct pinctrl_range *ranges;
60270025Simp	int nranges;
61270025Simp
62270025Simp	pcell_t acells, scells;
63270025Simp	int done_pinmux;
64270025Simp};
65270025Simp
66270025Simpstruct pinctrl_devinfo {
67270025Simp	struct ofw_bus_devinfo	obdinfo;
68270025Simp	struct resource_list	rl;
69270025Simp};
70270025Simp
71270025Simpstatic int
72270025Simpat91_pinctrl_probe(device_t dev)
73270025Simp{
74270025Simp
75270025Simp	if (!ofw_bus_is_compatible(dev, "atmel,at91rm9200-pinctrl"))
76270025Simp		return (ENXIO);
77270025Simp	device_set_desc(dev, "pincontrol bus");
78270025Simp        return (0);
79270025Simp}
80270025Simp
81270025Simp/* XXX Make this a subclass of simplebus */
82270025Simp
83270025Simpstatic struct pinctrl_devinfo *
84270025Simpat91_pinctrl_setup_dinfo(device_t dev, phandle_t node)
85270025Simp{
86270025Simp	struct pinctrl_softc *sc;
87270025Simp	struct pinctrl_devinfo *ndi;
88270025Simp	uint32_t *reg, *intr, icells;
89270025Simp	uint64_t phys, size;
90270025Simp	phandle_t iparent;
91270025Simp	int i, j, k;
92270025Simp	int nintr;
93270025Simp	int nreg;
94270025Simp
95270025Simp	sc = device_get_softc(dev);
96270025Simp
97270025Simp	ndi = malloc(sizeof(*ndi), M_DEVBUF, M_WAITOK | M_ZERO);
98270025Simp	if (ofw_bus_gen_setup_devinfo(&ndi->obdinfo, node) != 0) {
99270025Simp		free(ndi, M_DEVBUF);
100270025Simp		return (NULL);
101270025Simp	}
102270025Simp
103270025Simp	resource_list_init(&ndi->rl);
104270025Simp	nreg = OF_getencprop_alloc(node, "reg", sizeof(*reg), (void **)&reg);
105270025Simp	if (nreg == -1)
106270025Simp		nreg = 0;
107270025Simp	if (nreg % (sc->acells + sc->scells) != 0) {
108270025Simp//		if (bootverbose)
109270025Simp			device_printf(dev, "Malformed reg property on <%s>\n",
110270025Simp			    ndi->obdinfo.obd_name);
111270025Simp		nreg = 0;
112270025Simp	}
113270025Simp
114270025Simp	for (i = 0, k = 0; i < nreg; i += sc->acells + sc->scells, k++) {
115270025Simp		phys = size = 0;
116270025Simp		for (j = 0; j < sc->acells; j++) {
117270025Simp			phys <<= 32;
118270025Simp			phys |= reg[i + j];
119270025Simp		}
120270025Simp		for (j = 0; j < sc->scells; j++) {
121270025Simp			size <<= 32;
122270025Simp			size |= reg[i + sc->acells + j];
123270025Simp		}
124270025Simp
125270025Simp		resource_list_add(&ndi->rl, SYS_RES_MEMORY, k,
126270025Simp		    phys, phys + size - 1, size);
127270025Simp	}
128270025Simp	free(reg, M_OFWPROP);
129270025Simp
130270025Simp	nintr = OF_getencprop_alloc(node, "interrupts",  sizeof(*intr),
131270025Simp	    (void **)&intr);
132270025Simp	if (nintr > 0) {
133270025Simp		if (OF_searchencprop(node, "interrupt-parent", &iparent,
134270025Simp		    sizeof(iparent)) == -1) {
135270025Simp			device_printf(dev, "No interrupt-parent found, "
136270025Simp			    "assuming direct parent\n");
137270025Simp			iparent = OF_parent(node);
138270025Simp		}
139273652Sian		if (OF_searchencprop(OF_node_from_xref(iparent),
140270025Simp		    "#interrupt-cells", &icells, sizeof(icells)) == -1) {
141270025Simp			device_printf(dev, "Missing #interrupt-cells property, "
142270025Simp			    "assuming <1>\n");
143270025Simp			icells = 1;
144270025Simp		}
145270025Simp		if (icells < 1 || icells > nintr) {
146270025Simp			device_printf(dev, "Invalid #interrupt-cells property "
147270025Simp			    "value <%d>, assuming <1>\n", icells);
148270025Simp			icells = 1;
149270025Simp		}
150270025Simp		for (i = 0, k = 0; i < nintr; i += icells, k++) {
151270025Simp			intr[i] = ofw_bus_map_intr(dev, iparent, icells,
152270025Simp			    &intr[i]);
153270025Simp			resource_list_add(&ndi->rl, SYS_RES_IRQ, k, intr[i],
154270025Simp			    intr[i], 1);
155270025Simp		}
156270025Simp		free(intr, M_OFWPROP);
157270025Simp	}
158270025Simp
159270025Simp	return (ndi);
160270025Simp}
161270025Simp
162270025Simpstatic int
163270025Simpat91_pinctrl_fill_ranges(phandle_t node, struct pinctrl_softc *sc)
164270025Simp{
165270025Simp	int host_address_cells;
166270025Simp	cell_t *base_ranges;
167270025Simp	ssize_t nbase_ranges;
168270025Simp	int err;
169270025Simp	int i, j, k;
170270025Simp
171270025Simp	err = OF_searchencprop(OF_parent(node), "#address-cells",
172270025Simp	    &host_address_cells, sizeof(host_address_cells));
173270025Simp	if (err <= 0)
174270025Simp		return (-1);
175270025Simp
176270025Simp	nbase_ranges = OF_getproplen(node, "ranges");
177270025Simp	if (nbase_ranges < 0)
178270025Simp		return (-1);
179270025Simp	sc->nranges = nbase_ranges / sizeof(cell_t) /
180270025Simp	    (sc->acells + host_address_cells + sc->scells);
181270025Simp	if (sc->nranges == 0)
182270025Simp		return (0);
183270025Simp
184270025Simp	sc->ranges = malloc(sc->nranges * sizeof(sc->ranges[0]),
185270025Simp	    M_DEVBUF, M_WAITOK);
186270025Simp	base_ranges = malloc(nbase_ranges, M_DEVBUF, M_WAITOK);
187270025Simp	OF_getencprop(node, "ranges", base_ranges, nbase_ranges);
188270025Simp
189270025Simp	for (i = 0, j = 0; i < sc->nranges; i++) {
190270025Simp		sc->ranges[i].bus = 0;
191270025Simp		for (k = 0; k < sc->acells; k++) {
192270025Simp			sc->ranges[i].bus <<= 32;
193270025Simp			sc->ranges[i].bus |= base_ranges[j++];
194270025Simp		}
195270025Simp		sc->ranges[i].host = 0;
196270025Simp		for (k = 0; k < host_address_cells; k++) {
197270025Simp			sc->ranges[i].host <<= 32;
198270025Simp			sc->ranges[i].host |= base_ranges[j++];
199270025Simp		}
200270025Simp		sc->ranges[i].size = 0;
201270025Simp		for (k = 0; k < sc->scells; k++) {
202270025Simp			sc->ranges[i].size <<= 32;
203270025Simp			sc->ranges[i].size |= base_ranges[j++];
204270025Simp		}
205270025Simp	}
206270025Simp
207270025Simp	free(base_ranges, M_DEVBUF);
208270025Simp	return (sc->nranges);
209270025Simp}
210270025Simp
211270025Simpstatic int
212270025Simpat91_pinctrl_attach(device_t dev)
213270025Simp{
214270025Simp	struct pinctrl_softc *sc;
215270025Simp	struct pinctrl_devinfo *di;
216270025Simp	phandle_t	node;
217270025Simp	device_t	cdev;
218270025Simp
219270025Simp	sc = device_get_softc(dev);
220270025Simp	node = ofw_bus_get_node(dev);
221270025Simp
222270025Simp	sc->dev = dev;
223270025Simp	sc->node = node;
224270025Simp
225270025Simp	/*
226270025Simp	 * Some important numbers
227270025Simp	 */
228270025Simp	sc->acells = 2;
229270025Simp	OF_getencprop(node, "#address-cells", &sc->acells, sizeof(sc->acells));
230270025Simp	sc->scells = 1;
231270025Simp	OF_getencprop(node, "#size-cells", &sc->scells, sizeof(sc->scells));
232270025Simp
233270025Simp	if (at91_pinctrl_fill_ranges(node, sc) < 0) {
234270025Simp		device_printf(dev, "could not get ranges\n");
235270025Simp		return (ENXIO);
236270025Simp	}
237270025Simp
238270025Simp	for (node = OF_child(node); node > 0; node = OF_peer(node)) {
239270025Simp		if ((di = at91_pinctrl_setup_dinfo(dev, node)) == NULL)
240270025Simp			continue;
241270025Simp		cdev = device_add_child(dev, NULL, -1);
242270025Simp		if (cdev == NULL) {
243270025Simp			device_printf(dev, "<%s>: device_add_child failed\n",
244270025Simp			    di->obdinfo.obd_name);
245270025Simp			resource_list_free(&di->rl);
246270025Simp			ofw_bus_gen_destroy_devinfo(&di->obdinfo);
247270025Simp			free(di, M_DEVBUF);
248270025Simp			continue;
249270025Simp		}
250270025Simp		device_set_ivars(cdev, di);
251270025Simp	}
252270025Simp
253270025Simp	return (bus_generic_attach(dev));
254270025Simp}
255270025Simp
256270025Simpstatic const struct ofw_bus_devinfo *
257270025Simppinctrl_get_devinfo(device_t bus __unused, device_t child)
258270025Simp{
259270025Simp        struct pinctrl_devinfo *ndi;
260270025Simp
261270025Simp        ndi = device_get_ivars(child);
262270025Simp        return (&ndi->obdinfo);
263270025Simp}
264270025Simp
265270025Simpstatic struct resource *
266270025Simppinctrl_alloc_resource(device_t bus, device_t child, int type, int *rid,
267270025Simp    u_long start, u_long end, u_long count, u_int flags)
268270025Simp{
269270025Simp	struct pinctrl_softc *sc;
270270025Simp	struct pinctrl_devinfo *di;
271270025Simp	struct resource_list_entry *rle;
272270025Simp	int j;
273270025Simp
274270025Simp	sc = device_get_softc(bus);
275270025Simp
276270025Simp	/*
277270025Simp	 * Request for the default allocation with a given rid: use resource
278270025Simp	 * list stored in the local device info.
279270025Simp	 */
280270025Simp	if ((start == 0UL) && (end == ~0UL)) {
281270025Simp		if ((di = device_get_ivars(child)) == NULL)
282270025Simp			return (NULL);
283270025Simp
284270025Simp		if (type == SYS_RES_IOPORT)
285270025Simp			type = SYS_RES_MEMORY;
286270025Simp
287270025Simp		rle = resource_list_find(&di->rl, type, *rid);
288270025Simp		if (rle == NULL) {
289270025Simp//			if (bootverbose)
290270025Simp				device_printf(bus, "no default resources for "
291270025Simp				    "rid = %d, type = %d\n", *rid, type);
292270025Simp			return (NULL);
293270025Simp		}
294270025Simp		start = rle->start;
295270025Simp		end = rle->end;
296270025Simp		count = rle->count;
297270025Simp        }
298270025Simp
299270025Simp	if (type == SYS_RES_MEMORY) {
300270025Simp		/* Remap through ranges property */
301270025Simp		for (j = 0; j < sc->nranges; j++) {
302270025Simp			if (start >= sc->ranges[j].bus && end <
303270025Simp			    sc->ranges[j].bus + sc->ranges[j].size) {
304270025Simp				start -= sc->ranges[j].bus;
305270025Simp				start += sc->ranges[j].host;
306270025Simp				end -= sc->ranges[j].bus;
307270025Simp				end += sc->ranges[j].host;
308270025Simp				break;
309270025Simp			}
310270025Simp		}
311270025Simp		if (j == sc->nranges && sc->nranges != 0) {
312270025Simp//			if (bootverbose)
313270025Simp				device_printf(bus, "Could not map resource "
314270025Simp				    "%#lx-%#lx\n", start, end);
315270025Simp
316270025Simp			return (NULL);
317270025Simp		}
318270025Simp	}
319270025Simp
320270025Simp	return (bus_generic_alloc_resource(bus, child, type, rid, start, end,
321270025Simp	    count, flags));
322270025Simp}
323270025Simp
324270025Simpstatic int
325270025Simppinctrl_print_res(struct pinctrl_devinfo *di)
326270025Simp{
327270025Simp	int rv;
328270025Simp
329270025Simp	rv = 0;
330270025Simp	rv += resource_list_print_type(&di->rl, "mem", SYS_RES_MEMORY, "%#lx");
331270025Simp	rv += resource_list_print_type(&di->rl, "irq", SYS_RES_IRQ, "%ld");
332270025Simp	return (rv);
333270025Simp}
334270025Simp
335270025Simpstatic void
336270025Simppinctrl_probe_nomatch(device_t bus, device_t child)
337270025Simp{
338270025Simp	const char *name, *type, *compat;
339270025Simp
340270025Simp//	if (!bootverbose)
341270025Simp		return;
342270025Simp
343270025Simp	name = ofw_bus_get_name(child);
344270025Simp	type = ofw_bus_get_type(child);
345270025Simp	compat = ofw_bus_get_compat(child);
346270025Simp
347270025Simp	device_printf(bus, "<%s>", name != NULL ? name : "unknown");
348270025Simp	pinctrl_print_res(device_get_ivars(child));
349270025Simp	if (!ofw_bus_status_okay(child))
350270025Simp		printf(" disabled");
351270025Simp	if (type)
352270025Simp		printf(" type %s", type);
353270025Simp	if (compat)
354270025Simp		printf(" compat %s", compat);
355270025Simp	printf(" (no driver attached)\n");
356270025Simp}
357270025Simp
358270025Simpstatic int
359270025Simppinctrl_print_child(device_t bus, device_t child)
360270025Simp{
361270025Simp	int rv;
362270025Simp
363270025Simp	rv = bus_print_child_header(bus, child);
364270025Simp	rv += pinctrl_print_res(device_get_ivars(child));
365270025Simp	if (!ofw_bus_status_okay(child))
366270025Simp		rv += printf(" disabled");
367270025Simp	rv += bus_print_child_footer(bus, child);
368270025Simp	return (rv);
369270025Simp}
370270025Simp
371270025Simpconst char *periphs[] = {"gpio", "periph A", "periph B", "periph C", "periph D", "periph E" };
372270025Simp
373270025Simpstatic void
374270025Simppinctrl_walk_tree(device_t bus, phandle_t node)
375270025Simp{
376270025Simp	struct pinctrl_softc *sc;
377270025Simp	char status[10];
378270025Simp	char name[32];
379270025Simp	phandle_t pinctrl[32], pins[32 * 4], scratch;
380270025Simp	ssize_t len, npins;
381270025Simp	int i, j;
382270025Simp
383270025Simp	sc = device_get_softc(bus);
384270025Simp	for (node = OF_child(node); node > 0; node = OF_peer(node)) {
385270025Simp		pinctrl_walk_tree(bus, node);
386270025Simp		memset(status, 0, sizeof(status));
387270025Simp		memset(name, 0, sizeof(name));
388270025Simp		OF_getprop(node, "status", status, sizeof(status));
389270025Simp		OF_getprop(node, "name", name, sizeof(name));
390270025Simp		if (strcmp(status, "okay") != 0) {
391270025Simp//			printf("pinctrl: omitting node %s since it isn't active\n", name);
392270025Simp			continue;
393270025Simp		}
394270025Simp		len = OF_getencprop(node, "pinctrl-0", pinctrl, sizeof(pinctrl));
395270025Simp		if (len <= 0) {
396270025Simp//			printf("pinctrl: no pinctrl-0 property for node %s, omitting\n", name);
397270025Simp			continue;
398270025Simp		}
399270025Simp		len /= sizeof(phandle_t);
400270025Simp		printf("pinctrl: Found active node %s\n", name);
401270025Simp		for (i = 0; i < len; i++) {
402273652Sian			scratch = OF_node_from_xref(pinctrl[i]);
403270025Simp			npins = OF_getencprop(scratch, "atmel,pins", pins, sizeof(pins));
404270025Simp			if (npins <= 0) {
405270025Simp				printf("We're doing it wrong %s\n", name);
406270025Simp				continue;
407270025Simp			}
408270025Simp			memset(name, 0, sizeof(name));
409270025Simp			OF_getprop(scratch, "name", name, sizeof(name));
410270025Simp			npins /= (4 * 4);
411270025Simp			printf("----> need to cope with %d more pins for %s\n", npins, name);
412270025Simp			for (j = 0; j < npins; j++) {
413270025Simp				uint32_t unit = pins[j * 4];
414270025Simp				uint32_t pin = pins[j * 4 + 1];
415270025Simp				uint32_t periph = pins[j * 4 + 2];
416270025Simp				uint32_t flags = pins[j * 4 + 3];
417270025Simp				uint32_t pio = (0xfffffff & sc->ranges[0].bus) + 0x200 * unit;
418270025Simp				printf("P%c%d %s %#x\n", unit + 'A', pin, periphs[periph],
419270025Simp				       flags);
420270025Simp				switch (periph) {
421270025Simp				case 0:
422270025Simp					at91_pio_use_gpio(pio, 1u << pin);
423270025Simp					at91_pio_gpio_pullup(pio, 1u << pin, !!(flags & 1));
424270025Simp					at91_pio_gpio_high_z(pio, 1u << pin, !!(flags & 2));
425270025Simp					at91_pio_gpio_set_deglitch(pio, 1u << pin, !!(flags & 4));
426270025Simp					// at91_pio_gpio_pulldown(pio, 1u << pin, !!(flags & 8));
427270025Simp					// at91_pio_gpio_dis_schmidt(pio, 1u << pin, !!(flags & 16));
428270025Simp					break;
429270025Simp				case 1:
430270025Simp					at91_pio_use_periph_a(pio, 1u << pin, flags);
431270025Simp					break;
432270025Simp				case 2:
433270025Simp					at91_pio_use_periph_b(pio, 1u << pin, flags);
434270025Simp					break;
435270025Simp				}
436270025Simp			}
437270025Simp		}
438270025Simp	}
439270025Simp}
440270025Simp
441270025Simpstatic void
442270025Simppinctrl_new_pass(device_t bus)
443270025Simp{
444270025Simp	struct pinctrl_softc *sc;
445270025Simp	phandle_t node;
446270025Simp
447270025Simp	sc = device_get_softc(bus);
448270025Simp
449270025Simp	bus_generic_new_pass(bus);
450270025Simp
451270025Simp	if (sc->done_pinmux || bus_current_pass < BUS_PASS_PINMUX)
452270025Simp		return;
453270025Simp	sc->done_pinmux++;
454270025Simp
455270025Simp	node = OF_peer(0);
456270025Simp	if (node == -1)
457270025Simp		return;
458270025Simp	pinctrl_walk_tree(bus, node);
459270025Simp}
460270025Simp
461270025Simpstatic device_method_t at91_pinctrl_methods[] = {
462270025Simp	DEVMETHOD(device_probe, at91_pinctrl_probe),
463270025Simp	DEVMETHOD(device_attach, at91_pinctrl_attach),
464270025Simp
465270025Simp	DEVMETHOD(bus_print_child,	pinctrl_print_child),
466270025Simp	DEVMETHOD(bus_probe_nomatch,	pinctrl_probe_nomatch),
467270025Simp	DEVMETHOD(bus_setup_intr,	bus_generic_setup_intr),
468270025Simp	DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
469270025Simp	DEVMETHOD(bus_alloc_resource,	pinctrl_alloc_resource),
470270025Simp	DEVMETHOD(bus_release_resource,	bus_generic_release_resource),
471270025Simp	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
472270025Simp	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
473270025Simp	DEVMETHOD(bus_adjust_resource,	bus_generic_adjust_resource),
474270025Simp	DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
475270025Simp	DEVMETHOD(bus_new_pass,		pinctrl_new_pass),
476270025Simp
477270025Simp	/* ofw_bus interface */
478270025Simp	DEVMETHOD(ofw_bus_get_devinfo,	pinctrl_get_devinfo),
479270025Simp	DEVMETHOD(ofw_bus_get_compat,	ofw_bus_gen_get_compat),
480270025Simp	DEVMETHOD(ofw_bus_get_model,	ofw_bus_gen_get_model),
481270025Simp	DEVMETHOD(ofw_bus_get_name,	ofw_bus_gen_get_name),
482270025Simp	DEVMETHOD(ofw_bus_get_node,	ofw_bus_gen_get_node),
483270025Simp	DEVMETHOD(ofw_bus_get_type,	ofw_bus_gen_get_type),
484270025Simp
485270025Simp	DEVMETHOD_END
486270025Simp};
487270025Simp
488270025Simpstatic driver_t at91_pinctrl_driver = {
489270025Simp	"at91_pinctrl",
490270025Simp	at91_pinctrl_methods,
491270025Simp	sizeof(struct pinctrl_softc),
492270025Simp};
493270025Simp
494270025Simpstatic devclass_t at91_pinctrl_devclass;
495270025Simp
496270025SimpEARLY_DRIVER_MODULE(at91_pinctrl, simplebus, at91_pinctrl_driver, at91_pinctrl_devclass,
497270025Simp    NULL, NULL, BUS_PASS_BUS);
498270025Simp
499270025Simp/*
500270025Simp * dummy driver to force pass BUS_PASS_PINMUX to happen.
501270025Simp */
502270025Simpstatic int
503270025Simpat91_pingroup_probe(device_t dev)
504270025Simp{
505270025Simp	return ENXIO;
506270025Simp}
507270025Simp
508270025Simpstatic device_method_t at91_pingroup_methods[] = {
509270025Simp	DEVMETHOD(device_probe, at91_pingroup_probe),
510270025Simp
511270025Simp	DEVMETHOD_END
512270025Simp};
513270025Simp
514270025Simp
515270025Simpstatic driver_t at91_pingroup_driver = {
516270025Simp	"at91_pingroup",
517270025Simp	at91_pingroup_methods,
518270025Simp	0,
519270025Simp};
520270025Simp
521270025Simpstatic devclass_t at91_pingroup_devclass;
522270025Simp
523270025SimpEARLY_DRIVER_MODULE(at91_pingroup, at91_pinctrl, at91_pingroup_driver, at91_pingroup_devclass,
524270025Simp    NULL, NULL, BUS_PASS_PINMUX);
525