git: 40a0633862cd - stable/13 - mvebu_gpio: Fix settings of gpio pin direction.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 20 Jan 2022 10:24:09 UTC
The branch stable/13 has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=40a0633862cd2eae3272f10be96e36f48e3af030 commit 40a0633862cd2eae3272f10be96e36f48e3af030 Author: Michal Meloun <mmel@FreeBSD.org> AuthorDate: 2021-03-07 08:50:57 +0000 Commit: Michal Meloun <mmel@FreeBSD.org> CommitDate: 2022-01-20 10:22:30 +0000 mvebu_gpio: Fix settings of gpio pin direction. Data Output Enable Control register is inverted – 0 means output direction. Reflect this fact in code. MFC after: 3 weeks (cherry picked from commit 01c6d7918985c6e8610d6245af0f745ced86ffd5) --- sys/arm/mv/mvebu_gpio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm/mv/mvebu_gpio.c b/sys/arm/mv/mvebu_gpio.c index c38fbceebf24..21766f57c9b6 100644 --- a/sys/arm/mv/mvebu_gpio.c +++ b/sys/arm/mv/mvebu_gpio.c @@ -167,10 +167,10 @@ mvebu_gpio_pin_configure(struct mvebu_gpio_softc *sc, struct gpio_pin *pin, pin->gp_flags &= ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); if (flags & GPIO_PIN_OUTPUT) { pin->gp_flags |= GPIO_PIN_OUTPUT; - gpio_write(sc, GPIO_CONTROL_SET, pin, 1); + gpio_write(sc, GPIO_CONTROL_CLR, pin, 1); } else { pin->gp_flags |= GPIO_PIN_INPUT; - gpio_write(sc, GPIO_CONTROL_CLR, pin, 1); + gpio_write(sc, GPIO_CONTROL_SET, pin, 1); } } @@ -785,7 +785,7 @@ mvebu_gpio_attach(device_t dev) else pin->gp_caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; pin->gp_flags = - gpio_read(sc, GPIO_CONTROL, &sc->gpio_pins[i]) != 0 ? + gpio_read(sc, GPIO_CONTROL, &sc->gpio_pins[i]) == 0 ? GPIO_PIN_OUTPUT : GPIO_PIN_INPUT; snprintf(pin->gp_name, GPIOMAXNAME, "gpio%d", i);