From owner-svn-src-all@freebsd.org Sat Aug 1 23:10:38 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 184419B0BC8; Sat, 1 Aug 2015 23:10:38 +0000 (UTC) (envelope-from gonzo@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 F34FE13B4; Sat, 1 Aug 2015 23:10:37 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71NAbuM089236; Sat, 1 Aug 2015 23:10:37 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71NAbFx089235; Sat, 1 Aug 2015 23:10:37 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201508012310.t71NAbFx089235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 1 Aug 2015 23:10:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286165 - head/sys/arm/ti 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: Sat, 01 Aug 2015 23:10:38 -0000 Author: gonzo Date: Sat Aug 1 23:10:36 2015 New Revision: 286165 URL: https://svnweb.freebsd.org/changeset/base/286165 Log: Set output pin initial value based on pin's pinmux pullup/pulldown setup Some of FDT blobs for AM335x-based devices use pinmux pullup/pulldown flag to setup initial GPIO ouputp value, e.g. 4DCAPE-43 sets LCD DATAEN signal this way. It works for Linux because Linux driver does not enforce pin direction until after it's requested by consumer. So input with pullup flag set acts as output with GPIO_HIGH value Reviewed by: loos Modified: head/sys/arm/ti/ti_gpio.c Modified: head/sys/arm/ti/ti_gpio.c ============================================================================== --- head/sys/arm/ti/ti_gpio.c Sat Aug 1 22:56:42 2015 (r286164) +++ head/sys/arm/ti/ti_gpio.c Sat Aug 1 23:10:36 2015 (r286165) @@ -573,7 +573,7 @@ ti_gpio_bank_init(device_t dev) { int pin; struct ti_gpio_softc *sc; - uint32_t flags, reg_oe, rev; + uint32_t flags, reg_oe, reg_set, rev; clk_ident_t clk; sc = device_get_softc(dev); @@ -607,12 +607,18 @@ ti_gpio_bank_init(device_t dev) /* Init OE register based on pads configuration. */ reg_oe = 0xffffffff; + reg_set = 0; for (pin = 0; pin < PINS_PER_BANK; pin++) { TI_GPIO_GET_FLAGS(dev, pin, &flags); - if (flags & GPIO_PIN_OUTPUT) + if (flags & GPIO_PIN_OUTPUT) { reg_oe &= ~(1UL << pin); + if (flags & GPIO_PIN_PULLUP) + reg_set |= (1UL << pin); + } } ti_gpio_write_4(sc, TI_GPIO_OE, reg_oe); + if (reg_set) + ti_gpio_write_4(sc, TI_GPIO_SETDATAOUT, reg_set); return (0); }