git: 01c6d7918985 - main - mvebu_gpio: Fix settings of gpio pin direction.
Michal Meloun
mmel at FreeBSD.org
Sun Mar 7 11:31:28 UTC 2021
The branch main has been updated by mmel:
URL: https://cgit.FreeBSD.org/src/commit/?id=01c6d7918985c6e8610d6245af0f745ced86ffd5
commit 01c6d7918985c6e8610d6245af0f745ced86ffd5
Author: Michal Meloun <mmel at FreeBSD.org>
AuthorDate: 2021-03-07 08:50:57 +0000
Commit: Michal Meloun <mmel at FreeBSD.org>
CommitDate: 2021-03-07 10:41: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
---
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);
More information about the dev-commits-src-all
mailing list