Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Feb 2014 18:42:23 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r261845 - in head/sys/arm: broadcom/bcm2835 ti
Message-ID:  <201402131842.s1DIgNjn003441@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Thu Feb 13 18:42:23 2014
New Revision: 261845
URL: http://svnweb.freebsd.org/changeset/base/261845

Log:
  Allow the use of the OFW GPIO bus for ti_gpio and bcm2835_gpio.  With this
  change the gpio children can be described as directly connected to the GPIO
  controller without the need of describing the OFW GPIO bus itself on the
  DTS file.
  
  With this commit the OFW GPIO bus is fully functional on BBB and RPi.
  
  GPIO controllers which want to use the OFW GPIO bus will need similar
  changes.
  
  Approved by:	adrian (mentor, implicit)

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
  head/sys/arm/ti/ti_gpio.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c	Thu Feb 13 18:22:49 2014	(r261844)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c	Thu Feb 13 18:42:23 2014	(r261845)
@@ -766,6 +766,14 @@ bcm_gpio_detach(device_t dev)
 	return (EBUSY);
 }
 
+static phandle_t
+bcm_gpio_get_node(device_t bus, device_t dev)
+{
+
+	/* We only have one child, the GPIO bus, which needs our own node. */
+	return (ofw_bus_get_node(bus));
+}
+
 static device_method_t bcm_gpio_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		bcm_gpio_probe),
@@ -782,6 +790,9 @@ static device_method_t bcm_gpio_methods[
 	DEVMETHOD(gpio_pin_set,		bcm_gpio_pin_set),
 	DEVMETHOD(gpio_pin_toggle,	bcm_gpio_pin_toggle),
 
+	/* ofw_bus interface */
+	DEVMETHOD(ofw_bus_get_node,	bcm_gpio_get_node),
+
 	DEVMETHOD_END
 };
 

Modified: head/sys/arm/ti/ti_gpio.c
==============================================================================
--- head/sys/arm/ti/ti_gpio.c	Thu Feb 13 18:22:49 2014	(r261844)
+++ head/sys/arm/ti/ti_gpio.c	Thu Feb 13 18:42:23 2014	(r261845)
@@ -792,6 +792,14 @@ ti_gpio_detach(device_t dev)
 	return(0);
 }
 
+static phandle_t
+ti_gpio_get_node(device_t bus, device_t dev)
+{
+
+	/* We only have one child, the GPIO bus, which needs our own node. */
+	return (ofw_bus_get_node(bus));
+}
+
 static device_method_t ti_gpio_methods[] = {
 	DEVMETHOD(device_probe, ti_gpio_probe),
 	DEVMETHOD(device_attach, ti_gpio_attach),
@@ -806,6 +814,10 @@ static device_method_t ti_gpio_methods[]
 	DEVMETHOD(gpio_pin_get, ti_gpio_pin_get),
 	DEVMETHOD(gpio_pin_set, ti_gpio_pin_set),
 	DEVMETHOD(gpio_pin_toggle, ti_gpio_pin_toggle),
+
+	/* ofw_bus interface */
+	DEVMETHOD(ofw_bus_get_node, ti_gpio_get_node),
+
 	{0, 0},
 };
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402131842.s1DIgNjn003441>