From owner-svn-src-all@FreeBSD.ORG Mon Feb 2 19:22:36 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 275C7347; Mon, 2 Feb 2015 19:22:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E944476F; Mon, 2 Feb 2015 19:22:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t12JMZDG040718; Mon, 2 Feb 2015 19:22:35 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t12JMZDE040713; Mon, 2 Feb 2015 19:22:35 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201502021922.t12JMZDE040713@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 2 Feb 2015 19:22:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278108 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Feb 2015 19:22:36 -0000 Author: loos Date: Mon Feb 2 19:22:34 2015 New Revision: 278108 URL: https://svnweb.freebsd.org/changeset/base/278108 Log: Register the GPIO controller device reference on xref table for FDT systems. Modified: head/sys/dev/gpio/gpiobus.c head/sys/dev/gpio/gpiobusvar.h head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Mon Feb 2 19:00:18 2015 (r278107) +++ head/sys/dev/gpio/gpiobus.c Mon Feb 2 19:22:34 2015 (r278108) @@ -143,6 +143,9 @@ gpiobus_attach_bus(device_t dev) device_delete_child(dev, busdev); return (NULL); } +#ifdef FDT + ofw_gpiobus_register_provider(dev); +#endif bus_generic_attach(dev); return (busdev); @@ -152,6 +155,10 @@ int gpiobus_detach_bus(device_t dev) { +#ifdef FDT + ofw_gpiobus_unregister_provider(dev); +#endif + return (bus_generic_detach(dev)); } Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Mon Feb 2 19:00:18 2015 (r278107) +++ head/sys/dev/gpio/gpiobusvar.h Mon Feb 2 19:22:34 2015 (r278108) @@ -93,6 +93,8 @@ gpio_map_gpios(device_t bus, phandle_t d } device_t ofw_gpiobus_add_fdt_child(device_t, phandle_t); +void ofw_gpiobus_register_provider(device_t); +void ofw_gpiobus_unregister_provider(device_t); #endif int gpio_check_flags(uint32_t, uint32_t); device_t gpiobus_attach_bus(device_t); Modified: head/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- head/sys/dev/gpio/ofw_gpiobus.c Mon Feb 2 19:00:18 2015 (r278107) +++ head/sys/dev/gpio/ofw_gpiobus.c Mon Feb 2 19:22:34 2015 (r278108) @@ -217,6 +217,24 @@ ofw_gpiobus_parse_gpios(struct gpiobus_s return (0); } +void +ofw_gpiobus_register_provider(device_t provider) +{ + phandle_t node; + + node = ofw_bus_get_node(provider); + OF_device_register_xref(OF_xref_from_node(node), provider); +} + +void +ofw_gpiobus_unregister_provider(device_t provider) +{ + phandle_t node; + + node = ofw_bus_get_node(provider); + OF_device_register_xref(OF_xref_from_node(node), NULL); +} + static struct ofw_gpiobus_devinfo * ofw_gpiobus_setup_devinfo(device_t dev, phandle_t node) {