svn commit: r287315 - head/sys/arm/allwinner

Luiz Otavio O Souza loos at FreeBSD.org
Sun Aug 30 22:38:07 UTC 2015


Author: loos
Date: Sun Aug 30 22:38:06 2015
New Revision: 287315
URL: https://svnweb.freebsd.org/changeset/base/287315

Log:
  The vendor's DTS for Allwinner A20 uses a different way to map the gpio
  pins, they specify the bank and the pin in two separated cells.
  
  This allow the use of vendor's DTS definitions by adding a gpio map
  routine that copes with that.

Modified:
  head/sys/arm/allwinner/a10_gpio.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==============================================================================
--- head/sys/arm/allwinner/a10_gpio.c	Sun Aug 30 21:55:01 2015	(r287314)
+++ head/sys/arm/allwinner/a10_gpio.c	Sun Aug 30 22:38:06 2015	(r287315)
@@ -449,6 +449,18 @@ a10_gpio_get_node(device_t dev, device_t
 	return (ofw_bus_get_node(dev));
 }
 
+static int
+a10_gpio_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, int gcells,
+    pcell_t *gpios, uint32_t *pin, uint32_t *flags)
+{
+
+	/* The GPIO pins are mapped as: <gpio-phandle bank pin flags>. */
+	*pin = gpios[0] * 32 + gpios[1];
+	*flags = gpios[gcells - 1];
+
+	return (0);
+}
+
 static device_method_t a10_gpio_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		a10_gpio_probe),
@@ -465,6 +477,7 @@ static device_method_t a10_gpio_methods[
 	DEVMETHOD(gpio_pin_get,		a10_gpio_pin_get),
 	DEVMETHOD(gpio_pin_set,		a10_gpio_pin_set),
 	DEVMETHOD(gpio_pin_toggle,	a10_gpio_pin_toggle),
+	DEVMETHOD(gpio_map_gpios,	a10_gpio_map_gpios),
 
 	/* ofw_bus interface */
 	DEVMETHOD(ofw_bus_get_node,	a10_gpio_get_node),


More information about the svn-src-all mailing list