Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/fdt pinctrl-single: support #pinctrl-cells 2



details:   https://anonhg.NetBSD.org/src/rev/25728e8fea2c
branches:  trunk
changeset: 1024862:25728e8fea2c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Nov 07 17:12:25 2021 +0000

description:
pinctrl-single: support #pinctrl-cells 2

diffstat:

 sys/dev/fdt/pinctrl_single.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (46 lines):

diff -r 1eed61d5d617 -r 25728e8fea2c sys/dev/fdt/pinctrl_single.c
--- a/sys/dev/fdt/pinctrl_single.c      Sun Nov 07 17:12:15 2021 +0000
+++ b/sys/dev/fdt/pinctrl_single.c      Sun Nov 07 17:12:25 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pinctrl_single.c,v 1.5 2021/01/27 03:10:21 thorpej Exp $ */
+/* $NetBSD: pinctrl_single.c,v 1.6 2021/11/07 17:12:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.5 2021/01/27 03:10:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.6 2021/11/07 17:12:25 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -110,7 +110,7 @@
        const u_int *pins;
        int pinslen;
 
-       if (len != 4)
+       if (len != 4 && len != 8)
                return -1;
 
        const int phandle = fdtbus_get_phandle_from_native(be32dec(data));
@@ -119,13 +119,14 @@
        if (pins == NULL)
                return -1;
 
-       while (pinslen >= 8) {
+       while (pinslen >= 4 + len) {
                const int off = be32toh(pins[0]);
                const int val = be32toh(pins[1]);
+               const int mux = len == 4 ? 0 : be32toh(pins[2]);
 
-               pinctrl_single_pins_write(sc, off, val);
-               pins += 2;
-               pinslen -= 8;
+               pinctrl_single_pins_write(sc, off, val | mux);
+               pins += 1 + (len / 4);
+               pinslen -= (4 + len);
        }
 
        return 0;



Home | Main Index | Thread Index | Old Index