Source-Changes-HG archive

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

[src/netbsd-9]: src/sys Pull up following revision(s) (requested by jmcneill ...



details:   https://anonhg.NetBSD.org/src/rev/7400e0e33d0f
branches:  netbsd-9
changeset: 454968:7400e0e33d0f
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Oct 03 17:23:11 2019 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #276):

        sys/arch/arm/samsung/exynos_pinctrl.c: revision 1.14
        sys/arch/arm/rockchip/rk3399_iomux.c: revision 1.6
        sys/dev/fdt/fdtvar.h: revision 1.54
        sys/arch/arm/broadcom/bcm2835_gpio.c: revision 1.14
        sys/dev/i2c/axppmic.c: revision 1.26
        sys/arch/arm/nvidia/tegra_pinmux.c: revision 1.4
        sys/arch/arm/rockchip/rk3328_iomux.c: revision 1.3
        sys/dev/fdt/fdt_pinctrl.c: revision 1.10
        sys/arch/arm/amlogic/meson_pinctrl.c: revision 1.6
        sys/dev/fdt/fdtbus.c: revision 1.30
        sys/arch/arm/sunxi/sunxi_gpio.c: revision 1.27

Add support for devices with separate "init" and "default" pinctrl states.

diffstat:

 sys/arch/arm/amlogic/meson_pinctrl.c  |   6 +--
 sys/arch/arm/broadcom/bcm2835_gpio.c  |   6 +--
 sys/arch/arm/nvidia/tegra_pinmux.c    |   6 +--
 sys/arch/arm/rockchip/rk3328_iomux.c  |   6 +--
 sys/arch/arm/rockchip/rk3399_iomux.c  |   6 +--
 sys/arch/arm/samsung/exynos_pinctrl.c |   6 +--
 sys/arch/arm/sunxi/sunxi_gpio.c       |   6 +--
 sys/dev/fdt/fdt_pinctrl.c             |  39 +++++-----------------------
 sys/dev/fdt/fdtbus.c                  |  48 +++++++++++++++++++++++++++++++++-
 sys/dev/fdt/fdtvar.h                  |   4 +-
 sys/dev/i2c/axppmic.c                 |   7 +---
 11 files changed, 71 insertions(+), 69 deletions(-)

diffs (truncated from 401 to 300 lines):

diff -r adea396ba80b -r 7400e0e33d0f sys/arch/arm/amlogic/meson_pinctrl.c
--- a/sys/arch/arm/amlogic/meson_pinctrl.c      Thu Oct 03 17:20:33 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_pinctrl.c      Thu Oct 03 17:23:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_pinctrl.c,v 1.5 2019/04/19 19:07:56 jmcneill Exp $ */
+/* $NetBSD: meson_pinctrl.c,v 1.5.6.1 2019/10/03 17:23:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.5 2019/04/19 19:07:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.5.6.1 2019/10/03 17:23:11 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -575,8 +575,6 @@
        aprint_naive("\n");
        aprint_normal(": %s\n", sc->sc_conf->name);
 
-       fdtbus_pinctrl_configure();
-
        meson_pinctrl_initgpio(sc);
 }
 
diff -r adea396ba80b -r 7400e0e33d0f sys/arch/arm/broadcom/bcm2835_gpio.c
--- a/sys/arch/arm/broadcom/bcm2835_gpio.c      Thu Oct 03 17:20:33 2019 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_gpio.c      Thu Oct 03 17:23:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_gpio.c,v 1.12 2019/05/10 08:28:50 skrll Exp $  */
+/*     $NetBSD: bcm2835_gpio.c,v 1.12.2.1 2019/10/03 17:23:11 martin Exp $     */
 
 /*-
  * Copyright (c) 2013, 2014, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.12 2019/05/10 08:28:50 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.12.2.1 2019/10/03 17:23:11 martin Exp $");
 
 /*
  * Driver for BCM2835 GPIO
@@ -348,8 +348,6 @@
                    &bcm283x_pinctrl_funcs);
        }
 
-       fdtbus_pinctrl_configure();
-
        fdtbus_register_interrupt_controller(self, phandle,
            &bcmgpio_fdt_intrfuncs);
 
diff -r adea396ba80b -r 7400e0e33d0f sys/arch/arm/nvidia/tegra_pinmux.c
--- a/sys/arch/arm/nvidia/tegra_pinmux.c        Thu Oct 03 17:20:33 2019 +0000
+++ b/sys/arch/arm/nvidia/tegra_pinmux.c        Thu Oct 03 17:23:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_pinmux.c,v 1.2.4.1 2019/09/28 12:21:29 martin Exp $ */
+/* $NetBSD: tegra_pinmux.c,v 1.2.4.2 2019/10/03 17:23:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_tegra.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_pinmux.c,v 1.2.4.1 2019/09/28 12:21:29 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_pinmux.c,v 1.2.4.2 2019/10/03 17:23:11 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -285,8 +285,6 @@
 
        for (child = OF_child(phandle); child; child = OF_peer(child))
                fdtbus_register_pinctrl_config(self, child, &tegra_pinmux_funcs);
-
-       fdtbus_pinctrl_configure();
 }
 
 CFATTACH_DECL_NEW(tegra_pinmux, sizeof(struct tegra_pinmux_softc),
diff -r adea396ba80b -r 7400e0e33d0f sys/arch/arm/rockchip/rk3328_iomux.c
--- a/sys/arch/arm/rockchip/rk3328_iomux.c      Thu Oct 03 17:20:33 2019 +0000
+++ b/sys/arch/arm/rockchip/rk3328_iomux.c      Thu Oct 03 17:23:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3328_iomux.c,v 1.2 2019/01/23 04:21:54 thorpej Exp $ */
+/* $NetBSD: rk3328_iomux.c,v 1.2.6.1 2019/10/03 17:23:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rk3328_iomux.c,v 1.2 2019/01/23 04:21:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk3328_iomux.c,v 1.2.6.1 2019/10/03 17:23:11 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -308,8 +308,6 @@
                }
        }
 
-       fdtbus_pinctrl_configure();
-
        for (child = OF_child(phandle); child; child = OF_peer(child)) {
                struct fdt_attach_args cfaa = *faa;
                cfaa.faa_phandle = child;
diff -r adea396ba80b -r 7400e0e33d0f sys/arch/arm/rockchip/rk3399_iomux.c
--- a/sys/arch/arm/rockchip/rk3399_iomux.c      Thu Oct 03 17:20:33 2019 +0000
+++ b/sys/arch/arm/rockchip/rk3399_iomux.c      Thu Oct 03 17:23:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_iomux.c,v 1.4 2019/04/30 22:42:32 jmcneill Exp $ */
+/* $NetBSD: rk3399_iomux.c,v 1.4.4.1 2019/10/03 17:23:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 //#define RK3399_IOMUX_DEBUG
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rk3399_iomux.c,v 1.4 2019/04/30 22:42:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk3399_iomux.c,v 1.4.4.1 2019/10/03 17:23:11 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -482,8 +482,6 @@
                }
        }
 
-       fdtbus_pinctrl_configure();
-
        for (child = OF_child(phandle); child; child = OF_peer(child)) {
                struct fdt_attach_args cfaa = *faa;
                cfaa.faa_phandle = child;
diff -r adea396ba80b -r 7400e0e33d0f sys/arch/arm/samsung/exynos_pinctrl.c
--- a/sys/arch/arm/samsung/exynos_pinctrl.c     Thu Oct 03 17:20:33 2019 +0000
+++ b/sys/arch/arm/samsung/exynos_pinctrl.c     Thu Oct 03 17:23:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exynos_pinctrl.c,v 1.13 2018/07/02 23:54:52 jmcneill Exp $ */
+/*     $NetBSD: exynos_pinctrl.c,v 1.13.4.1 2019/10/03 17:23:11 martin Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.13 2018/07/02 23:54:52 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.13.4.1 2019/10/03 17:23:11 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -124,8 +124,6 @@
                                                       &exynos_pinctrl_controller_func);
                }
        }
-
-       fdtbus_pinctrl_configure();
 }
 
 static void
diff -r adea396ba80b -r 7400e0e33d0f sys/arch/arm/sunxi/sunxi_gpio.c
--- a/sys/arch/arm/sunxi/sunxi_gpio.c   Thu Oct 03 17:20:33 2019 +0000
+++ b/sys/arch/arm/sunxi/sunxi_gpio.c   Thu Oct 03 17:23:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gpio.c,v 1.26 2019/06/04 19:49:43 tnn Exp $ */
+/* $NetBSD: sunxi_gpio.c,v 1.26.2.1 2019/10/03 17:23:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.26 2019/06/04 19:49:43 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.26.2.1 2019/10/03 17:23:11 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1019,8 +1019,6 @@
                fdtbus_register_pinctrl_config(self, child, &sunxi_pinctrl_funcs);
        }
 
-       fdtbus_pinctrl_configure();
-
        sunxi_gpio_attach_ports(sc);
 
        /* Disable all external interrupts */
diff -r adea396ba80b -r 7400e0e33d0f sys/dev/fdt/fdt_pinctrl.c
--- a/sys/dev/fdt/fdt_pinctrl.c Thu Oct 03 17:20:33 2019 +0000
+++ b/sys/dev/fdt/fdt_pinctrl.c Thu Oct 03 17:23:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_pinctrl.c,v 1.8.4.1 2019/09/28 07:22:16 martin Exp $ */
+/* $NetBSD: fdt_pinctrl.c,v 1.8.4.2 2019/10/03 17:23:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2019 Jason R. Thorpe
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.8.4.1 2019/09/28 07:22:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.8.4.2 2019/10/03 17:23:11 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -123,42 +123,17 @@
 
        err = fdtbus_get_index(phandle, "pinctrl-names", cfgname, &index);
        if (err != 0)
-               return -1;
+               return ENOENT;
 
        return fdtbus_pinctrl_set_config_index(phandle, index);
 }
 
-static void
-fdtbus_pinctrl_configure_node(int phandle)
+bool
+fdtbus_pinctrl_has_config(int phandle, const char *cfgname)
 {
-       char buf[256];
-       int child, error;
-
-       for (child = OF_child(phandle); child; child = OF_peer(child)) {
-               if (!fdtbus_status_okay(child))
-                       continue;
-
-               /* Configure child nodes */
-               fdtbus_pinctrl_configure_node(child);
+       u_int index;
 
-               /*
-                * Set default configuration for this node. This may fail if the
-                * pinctrl provider is missing; that's OK, we will re-configure
-                * when that provider attaches.
-                */
-               fdtbus_get_path(child, buf, sizeof(buf));
-               error = fdtbus_pinctrl_set_config(child, "default");
-               if (error == 0)
-                       aprint_debug("pinctrl: set default config for %s\n", buf);
-               else if (error != ENOENT)
-                       aprint_debug("pinctrl: failed to set default config for %s: %d\n", buf, error);
-       }
-}
-
-void
-fdtbus_pinctrl_configure(void)
-{
-       fdtbus_pinctrl_configure_node(OF_finddevice("/"));
+       return fdtbus_get_index(phandle, "pinctrl-names", cfgname, &index) == 0;
 }
 
 /*
diff -r adea396ba80b -r 7400e0e33d0f sys/dev/fdt/fdtbus.c
--- a/sys/dev/fdt/fdtbus.c      Thu Oct 03 17:20:33 2019 +0000
+++ b/sys/dev/fdt/fdtbus.c      Thu Oct 03 17:23:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.29 2019/05/25 19:21:34 jmcneill Exp $ */
+/* $NetBSD: fdtbus.c,v 1.29.2.1 2019/10/03 17:23:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.29 2019/05/25 19:21:34 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.29.2.1 2019/10/03 17:23:11 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -56,6 +56,8 @@
 
        u_int           n_order;
 
+       bool            n_pinctrl_init;
+
        TAILQ_ENTRY(fdt_node) n_nodes;
 };
 
@@ -79,6 +81,8 @@
 static void    fdt_scan(struct fdt_softc *, int);
 static void    fdt_add_node(struct fdt_node *);
 static u_int   fdt_get_order(int);
+static void    fdt_pre_attach(struct fdt_node *);
+static void    fdt_post_attach(struct fdt_node *);
 
 static const char * const fdtbus_compatible[] =
     { "simple-bus", NULL };
@@ -313,14 +317,20 @@
                        /*
                         * Attach the device.
                         */
+                       fdt_pre_attach(node);
                        node->n_dev = config_attach_loc(node->n_bus, cf_pass, locs,
                            &faa, fdtbus_print);
+                       if (node->n_dev != NULL)
+                               fdt_post_attach(node);



Home | Main Index | Thread Index | Old Index