Date: Sat, 1 Aug 2015 23:10:37 +0000 (UTC) From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286165 - head/sys/arm/ti Message-ID: <201508012310.t71NAbFx089235@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508012310.t71NAbFx089235>