Page MenuHomeFreeBSD

D29044.id85065.diff
No OneTemporary

D29044.id85065.diff

diff --git a/sys/arm/mv/mvebu_gpio.c b/sys/arm/mv/mvebu_gpio.c
--- a/sys/arm/mv/mvebu_gpio.c
+++ b/sys/arm/mv/mvebu_gpio.c
@@ -124,17 +124,17 @@
*
*/
static inline void
-gpio_write(struct mvebu_gpio_softc *sc, bus_size_t reg,
+gpio_modify(struct mvebu_gpio_softc *sc, bus_size_t reg,
struct gpio_pin *pin, uint32_t val)
{
- uint32_t tmp;
+ uint32_t mask, data;
int bit;
bit = GPIO_BIT(pin->gp_pin);
- tmp = 0x100 << bit; /* mask */
- tmp |= (val & 1) << bit; /* value */
- SYSCON_WRITE_4(sc->syscon, sc->offset + GPIO_REGNUM(pin->gp_pin) + reg,
- tmp);
+ mask = 0x1 << bit; /* mask */
+ data = (val & 1) << bit; /* value */
+ SYSCON_MODIFY_4(sc->syscon, sc->offset + GPIO_REGNUM(pin->gp_pin) + reg,
+ mask, data);
}
static inline uint32_t
@@ -161,10 +161,10 @@
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_modify(sc, GPIO_CONTROL_SET, pin, 1);
} else {
pin->gp_flags |= GPIO_PIN_INPUT;
- gpio_write(sc, GPIO_CONTROL_CLR, pin, 1);
+ gpio_modify(sc, GPIO_CONTROL_CLR, pin, 1);
}
}
@@ -253,9 +253,9 @@
return (EINVAL);
if (value != 0)
- gpio_write(sc, GPIO_DATA_SET, &sc->gpio_pins[pin], 1);
+ gpio_modify(sc, GPIO_DATA_SET, &sc->gpio_pins[pin], 1);
else
- gpio_write(sc, GPIO_DATA_CLR, &sc->gpio_pins[pin], 1);
+ gpio_modify(sc, GPIO_DATA_CLR, &sc->gpio_pins[pin], 1);
return (0);
}
@@ -290,9 +290,9 @@
GPIO_LOCK(sc);
mvebu_gpio_pin_get(sc->dev, pin, &val);
if (val != 0)
- gpio_write(sc, GPIO_DATA_CLR, &sc->gpio_pins[pin], 1);
+ gpio_modify(sc, GPIO_DATA_CLR, &sc->gpio_pins[pin], 1);
else
- gpio_write(sc, GPIO_DATA_SET, &sc->gpio_pins[pin], 1);
+ gpio_modify(sc, GPIO_DATA_SET, &sc->gpio_pins[pin], 1);
GPIO_UNLOCK(sc);
return (0);
@@ -776,11 +776,11 @@
snprintf(pin->gp_name, GPIOMAXNAME, "gpio%d", i);
/* Init HW */
- gpio_write(sc, GPIO_INT_MASK, pin, 0);
- gpio_write(sc, GPIO_INT_LEVEL_MASK, pin, 0);
- gpio_write(sc, GPIO_INT_CAUSE, pin, 0);
- gpio_write(sc, GPIO_DATA_IN_POL, pin, 1);
- gpio_write(sc, GPIO_BLINK_ENA, pin, 0);
+ gpio_modify(sc, GPIO_INT_MASK, pin, 0);
+ gpio_modify(sc, GPIO_INT_LEVEL_MASK, pin, 0);
+ gpio_modify(sc, GPIO_INT_CAUSE, pin, 0);
+ gpio_modify(sc, GPIO_DATA_IN_POL, pin, 1);
+ gpio_modify(sc, GPIO_BLINK_ENA, pin, 0);
}
if (sc->irq_res[0] != NULL) {

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 2, 3:11 PM (16 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13359780
Default Alt Text
D29044.id85065.diff (2 KB)

Event Timeline