svn commit: r355214 - head/sys/dev/gpio

Ian Lepore ian at FreeBSD.org
Fri Nov 29 18:05:55 UTC 2019


Author: ian
Date: Fri Nov 29 18:05:54 2019
New Revision: 355214
URL: https://svnweb.freebsd.org/changeset/base/355214

Log:
  Ignore "gpio-hog" nodes when instantiating ofw_gpiobus children.  Also,
  in ofw_gpiobus_probe() return BUS_PROBE_DEFAULT rather than 0; we are not
  the only possible driver to handle this device, we're just slightly better
  than the base gpiobus (which probes at BUS_PROBE_GENERIC).
  
  In the time since this code was first written, the gpio controller bindings
  aquired the concept of a "hog" node which could be used to preset one or
  more gpio pins as input or output at a specified level.  This change doesn't
  fully implement the hogging concept, it just filters out hog nodes when
  instantiating child devices by scanning for child nodes in the fdt data.
  
  The whole concept of having child nodes under the controller node is not
  supported by the standard bindings, and appears to be a freebsd extension,
  probably left over from the days when we had no support for cross-tree
  phandle references in the fdt data.

Modified:
  head/sys/dev/gpio/ofw_gpiobus.c

Modified: head/sys/dev/gpio/ofw_gpiobus.c
==============================================================================
--- head/sys/dev/gpio/ofw_gpiobus.c	Fri Nov 29 16:14:32 2019	(r355213)
+++ head/sys/dev/gpio/ofw_gpiobus.c	Fri Nov 29 18:05:54 2019	(r355214)
@@ -492,7 +492,7 @@ ofw_gpiobus_probe(device_t dev)
 		return (ENXIO);
 	device_set_desc(dev, "OFW GPIO bus");
 
-	return (0);
+	return (BUS_PROBE_DEFAULT);
 }
 
 static int
@@ -511,6 +511,8 @@ ofw_gpiobus_attach(device_t dev)
 	 */
 	for (child = OF_child(ofw_bus_get_node(dev)); child != 0;
 	    child = OF_peer(child)) {
+		if (OF_hasprop(child, "gpio-hog"))
+			continue;
 		if (!OF_hasprop(child, "gpios"))
 			continue;
 		if (ofw_gpiobus_add_fdt_child(dev, NULL, child) == NULL)


More information about the svn-src-head mailing list