Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/mv/mvebu_gpio.c
Show First 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static inline void | static inline void | ||||
mvebu_gpio_isrc_eoi(struct mvebu_gpio_softc *sc, | mvebu_gpio_isrc_eoi(struct mvebu_gpio_softc *sc, | ||||
struct mvebu_gpio_irqsrc *mgi) | struct mvebu_gpio_irqsrc *mgi) | ||||
{ | { | ||||
if (!mgi->is_level) | if (!mgi->is_level) | ||||
intr_modify(sc, GPIO_INT_CAUSE, mgi, 1, 1); | intr_modify(sc, GPIO_INT_CAUSE, mgi, 0, 1); | ||||
} | } | ||||
static int | static int | ||||
mvebu_gpio_pic_attach(struct mvebu_gpio_softc *sc) | mvebu_gpio_pic_attach(struct mvebu_gpio_softc *sc) | ||||
{ | { | ||||
int rv; | int rv; | ||||
uint32_t irq; | uint32_t irq; | ||||
const char *name; | const char *name; | ||||
▲ Show 20 Lines • Show All 428 Lines • ▼ Show 20 Lines | for (i = 0; i < sc->gpio_npins; i++) { | ||||
pin->gp_flags = | 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; | GPIO_PIN_OUTPUT : GPIO_PIN_INPUT; | ||||
snprintf(pin->gp_name, GPIOMAXNAME, "gpio%d", i); | snprintf(pin->gp_name, GPIOMAXNAME, "gpio%d", i); | ||||
/* Init HW */ | /* Init HW */ | ||||
gpio_write(sc, GPIO_INT_MASK, pin, 0); | gpio_write(sc, GPIO_INT_MASK, pin, 0); | ||||
gpio_write(sc, GPIO_INT_LEVEL_MASK, pin, 0); | gpio_write(sc, GPIO_INT_LEVEL_MASK, pin, 0); | ||||
gpio_write(sc, GPIO_INT_CAUSE, pin, 1); | gpio_write(sc, GPIO_INT_CAUSE, pin, 0); | ||||
gpio_write(sc, GPIO_DATA_IN_POL, pin, 1); | gpio_write(sc, GPIO_DATA_IN_POL, pin, 1); | ||||
gpio_write(sc, GPIO_BLINK_ENA, pin, 0); | gpio_write(sc, GPIO_BLINK_ENA, pin, 0); | ||||
} | } | ||||
if (sc->irq_res[0] != NULL) { | if (sc->irq_res[0] != NULL) { | ||||
rv = mvebu_gpio_pic_attach(sc); | rv = mvebu_gpio_pic_attach(sc); | ||||
if (rv != 0) { | if (rv != 0) { | ||||
device_printf(dev, "WARNING: unable to attach PIC\n"); | device_printf(dev, "WARNING: unable to attach PIC\n"); | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |