summaryrefslogtreecommitdiff
path: root/sys/dev/fdt
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2018-03-19 13:49:07 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2018-03-19 13:49:07 +0000
commit38878fcab55a80291c796eb9f999f72ea48351dc (patch)
tree1446592c332c11e0d6c5394d48e895364bf91b3e /sys/dev/fdt
parentd34d3260b4c5e2034f7034cee6bf750c7e405067 (diff)
Switch mvpinctrl(4) from a last match to first match principle. This is
needed as the full configuration table for an SoC can specify a function (maybe erroneously) more than once, and the tables are designed so that the first match counts. This is in preparation for a followup diff that makes use of the full table. ok kettenis@
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r--sys/dev/fdt/mvpinctrl.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/dev/fdt/mvpinctrl.c b/sys/dev/fdt/mvpinctrl.c
index 4e2e818ec26..c1e1faac7f5 100644
--- a/sys/dev/fdt/mvpinctrl.c
+++ b/sys/dev/fdt/mvpinctrl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mvpinctrl.c,v 1.1 2017/08/25 20:00:35 patrick Exp $ */
+/* $OpenBSD: mvpinctrl.c,v 1.2 2018/03/19 13:49:06 patrick Exp $ */
/*
* Copyright (c) 2013,2016 Patrick Wildt <patrick@blueri.se>
* Copyright (c) 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -149,8 +149,6 @@ mvpinctrl_pinctrl(uint32_t phandle, void *cookie)
OF_getprop(node, "marvell,pins", pins, plen);
while (plen > 0) {
- int found = 0;
-
for (i = 0; i < sc->sc_npins; i++) {
uint32_t off, shift;
@@ -159,16 +157,15 @@ mvpinctrl_pinctrl(uint32_t phandle, void *cookie)
if (strcmp(sc->sc_pins[i].function, func))
continue;
- found++;
-
off = (sc->sc_pins[i].pid / 8) * sizeof(uint32_t);
shift = (sc->sc_pins[i].pid % 8) * 4;
HWRITE4(sc, off, (HREAD4(sc, off) & ~(0xf << shift)) |
(sc->sc_pins[i].value << shift));
+ break;
}
- if (found == 0)
+ if (i == sc->sc_npins)
printf("%s: unsupported pin %s function %s\n",
sc->sc_dev.dv_xname, pin, func);