Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Allow for specifying (optional) pass number locator for ...
details: https://anonhg.NetBSD.org/src/rev/8dd2c75e1135
branches: trunk
changeset: 823497:8dd2c75e1135
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed Apr 26 01:51:52 2017 +0000
description:
Allow for specifying (optional) pass number locator for devices at fdt.
diffstat:
sys/arch/evbarm/conf/TEGRA | 20 ++++++++--------
sys/dev/fdt/fdtbus.c | 53 ++++++++++++++++++++++++++++++++++++++-------
sys/dev/fdt/fdtvar.h | 3 +-
sys/dev/fdt/files.fdt | 4 +-
4 files changed, 58 insertions(+), 22 deletions(-)
diffs (215 lines):
diff -r cdbf6f48cf7d -r 8dd2c75e1135 sys/arch/evbarm/conf/TEGRA
--- a/sys/arch/evbarm/conf/TEGRA Wed Apr 26 01:43:00 2017 +0000
+++ b/sys/arch/evbarm/conf/TEGRA Wed Apr 26 01:51:52 2017 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: TEGRA,v 1.17 2017/04/22 23:53:24 jmcneill Exp $
+# $NetBSD: TEGRA,v 1.18 2017/04/26 01:51:52 jmcneill Exp $
#
# NVIDIA Tegra K1 (T124)
#
@@ -42,28 +42,28 @@
# CPU frequency scaling
tegra124cpu* at fdt?
-fclock* at fdt?
-fregulator* at fdt?
+fclock* at fdt? pass 4
+fregulator* at fdt? pass 4
gpiokeys* at fdt?
# Interrupt controller
-tegralic* at fdt? # LIC
-gic* at fdt? # GIC
+tegralic* at fdt? pass 1 # LIC
+gic* at fdt? pass 1 # GIC
# Memory controller
-tegramc* at fdt? # MC
+tegramc* at fdt? pass 4 # MC
# FUSE controller
-tegrafuse* at fdt? # FUSE
+tegrafuse* at fdt? pass 4 # FUSE
# Power management controller
-tegrapmc* at fdt? # PMC
+tegrapmc* at fdt? pass 4 # PMC
# Clock and Reset controller
-tegra124car* at fdt? # CAR
+tegra124car* at fdt? pass 3 # CAR
# GPIO controller
-tegragpio* at fdt? # GPIO
+tegragpio* at fdt? pass 2 # GPIO
gpio* at gpiobus?
# Timers
diff -r cdbf6f48cf7d -r 8dd2c75e1135 sys/dev/fdt/fdtbus.c
--- a/sys/dev/fdt/fdtbus.c Wed Apr 26 01:43:00 2017 +0000
+++ b/sys/dev/fdt/fdtbus.c Wed Apr 26 01:51:52 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.8 2017/04/16 12:24:57 jmcneill Exp $ */
+/* $NetBSD: fdtbus.c,v 1.9 2017/04/26 01:51: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.8 2017/04/16 12:24:57 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.9 2017/04/26 01:51:52 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -40,6 +40,8 @@
#include <dev/fdt/fdtvar.h>
+#include "locators.h"
+
#define FDT_MAX_PATH 256
struct fdt_node {
@@ -64,8 +66,9 @@
static int fdt_match(device_t, cfdata_t, void *);
static void fdt_attach(device_t, device_t, void *);
+static int fdt_scan_submatch(device_t, cfdata_t, const int *, void *);
static void fdt_scan_bus(struct fdt_softc *);
-static void fdt_scan(struct fdt_softc *);
+static void fdt_scan(struct fdt_softc *, int);
static void fdt_add_node(struct fdt_node *);
static u_int fdt_get_order(int);
@@ -159,17 +162,31 @@
if (OF_finddevice("/") != faa->faa_phandle)
return;
+ aprint_debug_dev(sc->sc_dev, " order phandle bus path\n");
+ aprint_debug_dev(sc->sc_dev, " ===== ======= === ====\n");
+ TAILQ_FOREACH(node, &fdt_nodes, n_nodes) {
+ char buf[FDT_MAX_PATH];
+ const char *path = buf;
+ if (!fdtbus_get_path(node->n_phandle, buf, sizeof(buf)))
+ path = node->n_name;
+ aprint_debug_dev(sc->sc_dev, " %04x 0x%04x %s %s\n",
+ node->n_order & 0xffff, node->n_phandle,
+ device_xname(node->n_bus), path);
+ }
+
/* Scan devices */
- fdt_scan(sc);
+ for (int pass = 1; pass <= FDTCF_PASS_DEFAULT; pass++)
+ fdt_scan(sc, pass);
}
static void
fdt_init_attach_args(struct fdt_softc *sc, struct fdt_node *node,
- struct fdt_attach_args *faa)
+ bool quiet, struct fdt_attach_args *faa)
{
*faa = sc->sc_faa;
faa->faa_phandle = node->n_phandle;
faa->faa_name = node->n_name;
+ faa->faa_quiet = quiet;
}
static void
@@ -185,7 +202,7 @@
if (node->n_dev != NULL)
continue;
- fdt_init_attach_args(sc, node, &faa);
+ fdt_init_attach_args(sc, node, true, &faa);
/*
* Only attach busses to nodes where this driver is the best
@@ -202,22 +219,37 @@
}
}
+static int
+fdt_scan_submatch(device_t parent, cfdata_t cf, const int *locs, void *aux)
+{
+ if (locs[FDTCF_PASS] != FDTCF_PASS_DEFAULT &&
+ locs[FDTCF_PASS] != cf->cf_loc[FDTCF_PASS])
+ return 0;
+
+ return config_stdsubmatch(parent, cf, locs, aux);
+}
+
static void
-fdt_scan(struct fdt_softc *sc)
+fdt_scan(struct fdt_softc *sc, int pass)
{
struct fdt_node *node;
struct fdt_attach_args faa;
+ const int locs[FDTCF_NLOCS] = {
+ [FDTCF_PASS] = pass
+ };
+ bool quiet = pass != FDTCF_PASS_DEFAULT;
TAILQ_FOREACH(node, &fdt_nodes, n_nodes) {
if (node->n_dev != NULL)
continue;
- fdt_init_attach_args(sc, node, &faa);
+ fdt_init_attach_args(sc, node, quiet, &faa);
/*
* Attach the device.
*/
- node->n_dev = config_found(node->n_bus, &faa, fdt_print);
+ node->n_dev = config_found_sm_loc(node->n_bus, "fdt", locs,
+ &faa, fdt_print, fdt_scan_submatch);
}
}
@@ -258,6 +290,9 @@
char buf[FDT_MAX_PATH];
const char *name = buf;
+ if (faa->faa_quiet)
+ return QUIET;
+
/* Skip "not configured" for nodes w/o compatible property */
if (OF_getproplen(faa->faa_phandle, "compatible") <= 0)
return QUIET;
diff -r cdbf6f48cf7d -r 8dd2c75e1135 sys/dev/fdt/fdtvar.h
--- a/sys/dev/fdt/fdtvar.h Wed Apr 26 01:43:00 2017 +0000
+++ b/sys/dev/fdt/fdtvar.h Wed Apr 26 01:51:52 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.12 2017/04/22 21:47:41 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.13 2017/04/26 01:51:52 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -45,6 +45,7 @@
bus_space_tag_t faa_a4x_bst;
bus_dma_tag_t faa_dmat;
int faa_phandle;
+ int faa_quiet;
};
/* flags for fdtbus_intr_establish */
diff -r cdbf6f48cf7d -r 8dd2c75e1135 sys/dev/fdt/files.fdt
--- a/sys/dev/fdt/files.fdt Wed Apr 26 01:43:00 2017 +0000
+++ b/sys/dev/fdt/files.fdt Wed Apr 26 01:51:52 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.10 2017/04/22 13:24:20 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.11 2017/04/26 01:51:52 jmcneill Exp $
include "external/bsd/libfdt/conf/files.libfdt"
@@ -6,7 +6,7 @@
define fdtbus { } : clk
-device fdt { } : fdtbus
+device fdt { [pass = 10] } : fdtbus
attach fdt at fdtbus
file dev/fdt/fdtbus.c fdt
Home |
Main Index |
Thread Index |
Old Index