From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 15:50:20 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F37C71FD; Sat, 31 Jan 2015 15:50:19 +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 DF555B0D; Sat, 31 Jan 2015 15:50:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0VFoJ5V041178; Sat, 31 Jan 2015 15:50:19 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0VFoJMb041177; Sat, 31 Jan 2015 15:50:19 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201501311550.t0VFoJMb041177@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sat, 31 Jan 2015 15:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277980 - 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-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2015 15:50:20 -0000 Author: loos Date: Sat Jan 31 15:50:19 2015 New Revision: 277980 URL: https://svnweb.freebsd.org/changeset/base/277980 Log: Implement a new method to retrieve the gpiobus reference from a GPIO controller. The gpiobus is responsible to keep track of the used pins and serialize the access to pins. Some of these features are important to devices that do not descend directly from gpiobus and as such cannot make use of its features (one classic example is gpioc that is attached to the GPIO controller and could not, until now, make use of the gpiobus locking). Modified: head/sys/dev/gpio/gpio_if.m Modified: head/sys/dev/gpio/gpio_if.m ============================================================================== --- head/sys/dev/gpio/gpio_if.m Sat Jan 31 15:41:01 2015 (r277979) +++ head/sys/dev/gpio/gpio_if.m Sat Jan 31 15:50:19 2015 (r277980) @@ -32,6 +32,13 @@ INTERFACE gpio; CODE { + static device_t + gpio_default_get_bus(void) + { + + return (NULL); + } + static int gpio_default_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, int gcells, pcell_t *gpios, uint32_t *pin, @@ -56,6 +63,13 @@ HEADER { }; # +# Return the gpiobus device reference +# +METHOD device_t get_bus { + device_t dev; +} DEFAULT gpio_default_get_bus; + +# # Get maximum pin number # METHOD int pin_max {