Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add support for devices with separate "init" and "defaul...
details: https://anonhg.NetBSD.org/src/rev/62641d8d3dc6
branches: trunk
changeset: 459933:62641d8d3dc6
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Oct 01 23:32:52 2019 +0000
description:
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 d77015d92a42 -r 62641d8d3dc6 sys/arch/arm/amlogic/meson_pinctrl.c
--- a/sys/arch/arm/amlogic/meson_pinctrl.c Tue Oct 01 22:44:18 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_pinctrl.c Tue Oct 01 23:32:52 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.6 2019/10/01 23:32:52 jmcneill 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.6 2019/10/01 23:32:52 jmcneill 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 d77015d92a42 -r 62641d8d3dc6 sys/arch/arm/broadcom/bcm2835_gpio.c
--- a/sys/arch/arm/broadcom/bcm2835_gpio.c Tue Oct 01 22:44:18 2019 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_gpio.c Tue Oct 01 23:32:52 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_gpio.c,v 1.13 2019/09/28 07:24:52 mlelstv Exp $ */
+/* $NetBSD: bcm2835_gpio.c,v 1.14 2019/10/01 23:32:52 jmcneill 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.13 2019/09/28 07:24:52 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.14 2019/10/01 23:32:52 jmcneill Exp $");
/*
* Driver for BCM2835 GPIO
@@ -360,8 +360,6 @@
&bcm283x_pinctrl_funcs);
}
- fdtbus_pinctrl_configure();
-
fdtbus_register_interrupt_controller(self, phandle,
&bcmgpio_fdt_intrfuncs);
diff -r d77015d92a42 -r 62641d8d3dc6 sys/arch/arm/nvidia/tegra_pinmux.c
--- a/sys/arch/arm/nvidia/tegra_pinmux.c Tue Oct 01 22:44:18 2019 +0000
+++ b/sys/arch/arm/nvidia/tegra_pinmux.c Tue Oct 01 23:32:52 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_pinmux.c,v 1.3 2019/09/28 07:42:47 skrll Exp $ */
+/* $NetBSD: tegra_pinmux.c,v 1.4 2019/10/01 23:32:52 jmcneill 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.3 2019/09/28 07:42:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_pinmux.c,v 1.4 2019/10/01 23:32:52 jmcneill 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 d77015d92a42 -r 62641d8d3dc6 sys/arch/arm/rockchip/rk3328_iomux.c
--- a/sys/arch/arm/rockchip/rk3328_iomux.c Tue Oct 01 22:44:18 2019 +0000
+++ b/sys/arch/arm/rockchip/rk3328_iomux.c Tue Oct 01 23:32:52 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.3 2019/10/01 23:32:52 jmcneill 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.3 2019/10/01 23:32:52 jmcneill 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 d77015d92a42 -r 62641d8d3dc6 sys/arch/arm/rockchip/rk3399_iomux.c
--- a/sys/arch/arm/rockchip/rk3399_iomux.c Tue Oct 01 22:44:18 2019 +0000
+++ b/sys/arch/arm/rockchip/rk3399_iomux.c Tue Oct 01 23:32:52 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_iomux.c,v 1.5 2019/08/20 23:32:33 tnn Exp $ */
+/* $NetBSD: rk3399_iomux.c,v 1.6 2019/10/01 23:32:52 jmcneill 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.5 2019/08/20 23:32:33 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk3399_iomux.c,v 1.6 2019/10/01 23:32:52 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -512,8 +512,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 d77015d92a42 -r 62641d8d3dc6 sys/arch/arm/samsung/exynos_pinctrl.c
--- a/sys/arch/arm/samsung/exynos_pinctrl.c Tue Oct 01 22:44:18 2019 +0000
+++ b/sys/arch/arm/samsung/exynos_pinctrl.c Tue Oct 01 23:32:52 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.14 2019/10/01 23:32:52 jmcneill 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.14 2019/10/01 23:32:52 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -124,8 +124,6 @@
&exynos_pinctrl_controller_func);
}
}
-
- fdtbus_pinctrl_configure();
}
static void
diff -r d77015d92a42 -r 62641d8d3dc6 sys/arch/arm/sunxi/sunxi_gpio.c
--- a/sys/arch/arm/sunxi/sunxi_gpio.c Tue Oct 01 22:44:18 2019 +0000
+++ b/sys/arch/arm/sunxi/sunxi_gpio.c Tue Oct 01 23:32:52 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.27 2019/10/01 23:32:52 jmcneill 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.27 2019/10/01 23:32:52 jmcneill 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 d77015d92a42 -r 62641d8d3dc6 sys/dev/fdt/fdt_pinctrl.c
--- a/sys/dev/fdt/fdt_pinctrl.c Tue Oct 01 22:44:18 2019 +0000
+++ b/sys/dev/fdt/fdt_pinctrl.c Tue Oct 01 23:32:52 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_pinctrl.c,v 1.9 2019/09/27 20:05:53 jmcneill Exp $ */
+/* $NetBSD: fdt_pinctrl.c,v 1.10 2019/10/01 23:32:52 jmcneill Exp $ */
/*-
* Copyright (c) 2019 Jason R. Thorpe
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.9 2019/09/27 20:05:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.10 2019/10/01 23:32:52 jmcneill 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 d77015d92a42 -r 62641d8d3dc6 sys/dev/fdt/fdtbus.c
--- a/sys/dev/fdt/fdtbus.c Tue Oct 01 22:44:18 2019 +0000
+++ b/sys/dev/fdt/fdtbus.c Tue Oct 01 23:32:52 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.30 2019/10/01 23:32:52 jmcneill 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.30 2019/10/01 23:32:52 jmcneill 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