From owner-svn-src-all@freebsd.org Sun Aug 30 22:38:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0870D9C6FAB; Sun, 30 Aug 2015 22:38:07 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.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 ED6FB6C9; Sun, 30 Aug 2015 22:38:06 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7UMc6nP086923; Sun, 30 Aug 2015 22:38:06 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7UMc6aj086922; Sun, 30 Aug 2015 22:38:06 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201508302238.t7UMc6aj086922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sun, 30 Aug 2015 22:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287315 - head/sys/arm/allwinner 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.20 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: Sun, 30 Aug 2015 22:38:07 -0000 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: . */ + *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),