add ixp425_set_gpio to program the gpio interrupt type
This commit is contained in:
parent
ad0be1f829
commit
a8c053089c
@ -218,16 +218,7 @@ ata_avila_attach(device_t dev)
|
||||
rman_set_bustag(&sc->sc_alt_ata, &sc->sc_expbus_tag);
|
||||
rman_set_bushandle(&sc->sc_alt_ata, sc->sc_alt_ioh);
|
||||
|
||||
GPIO_CONF_WRITE_4(sa, IXP425_GPIO_GPOER,
|
||||
GPIO_CONF_READ_4(sa, IXP425_GPIO_GPOER) | (1<<config->gpin));
|
||||
/* set interrupt type */
|
||||
GPIO_CONF_WRITE_4(sa, GPIO_TYPE_REG(config->gpin),
|
||||
(GPIO_CONF_READ_4(sa, GPIO_TYPE_REG(config->gpin)) &~
|
||||
GPIO_TYPE(config->gpin, GPIO_TYPE_MASK)) |
|
||||
GPIO_TYPE(config->gpin, GPIO_TYPE_EDG_RISING));
|
||||
|
||||
/* clear ISR */
|
||||
GPIO_CONF_WRITE_4(sa, IXP425_GPIO_GPISR, (1<<config->gpin));
|
||||
ixp425_set_gpio(sa, config->gpin, GPIO_TYPE_EDG_RISING);
|
||||
|
||||
/* configure CS1/3 window, leaving timing unchanged */
|
||||
EXP_BUS_WRITE_4(sc, sc->sc_16bit_off,
|
||||
|
@ -159,6 +159,25 @@ DB_SHOW_COMMAND(gpio, db_show_gpio)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
ixp425_set_gpio(struct ixp425_softc *sc, int pin, int type)
|
||||
{
|
||||
uint32_t gpiotr = GPIO_CONF_READ_4(sc, GPIO_TYPE_REG(pin));
|
||||
|
||||
/* clear interrupt type */
|
||||
GPIO_CONF_WRITE_4(sc, GPIO_TYPE_REG(pin),
|
||||
gpiotr &~ GPIO_TYPE(pin, GPIO_TYPE_MASK));
|
||||
/* clear any pending interrupt */
|
||||
GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPISR, (1<<pin));
|
||||
/* set new interrupt type */
|
||||
GPIO_CONF_WRITE_4(sc, GPIO_TYPE_REG(pin),
|
||||
gpiotr | GPIO_TYPE(pin, type));
|
||||
|
||||
/* configure gpio line as an input */
|
||||
GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPOER,
|
||||
GPIO_CONF_READ_4(sc, IXP425_GPIO_GPOER) | (1<<pin));
|
||||
}
|
||||
|
||||
static __inline void
|
||||
ixp425_gpio_ack(int irq)
|
||||
{
|
||||
|
@ -65,6 +65,8 @@ struct ixp425_softc {
|
||||
bus_dma_tag_t sc_dmat;
|
||||
};
|
||||
|
||||
void ixp425_set_gpio(struct ixp425_softc *sc, int pin, int type);
|
||||
|
||||
struct ixppcib_softc {
|
||||
device_t sc_dev;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user