- Correct bus space resource type for register access.

- Add configuration of interrupt type and polarity via FDT.

Sponsored by:	DARPA, AFRL
This commit is contained in:
hselasky 2014-05-27 10:12:16 +00:00
parent 6712d8d387
commit 0a93966003
3 changed files with 17 additions and 3 deletions

View File

@ -2052,7 +2052,8 @@ saf1761_otg_init(struct saf1761_otg_softc *sc)
SAF1761_WRITE_LE_4(sc, SOTG_INTERRUPT_CFG,
SOTG_INTERRUPT_CFG_CDBGMOD |
SOTG_INTERRUPT_CFG_DDBGMODIN |
SOTG_INTERRUPT_CFG_DDBGMODOUT);
SOTG_INTERRUPT_CFG_DDBGMODOUT |
sc->sc_interrupt_cfg);
/* enable VBUS and ID interrupt */
SAF1761_WRITE_LE_4(sc, SOTG_IRQ_ENABLE_SET_CLR,

View File

@ -144,6 +144,7 @@ struct saf1761_otg_softc {
uint32_t sc_host_isoc_map;
uint32_t sc_intr_enable; /* enabled interrupts */
uint32_t sc_hw_mode; /* hardware mode */
uint32_t sc_interrupt_cfg; /* interrupt configuration */
uint32_t sc_bounce_buffer[1024 / 4];

View File

@ -156,6 +156,18 @@ saf1761_otg_fdt_attach(device_t dev)
sc->sc_hw_mode |= SOTG_HW_MODE_CTRL_DREQ_POL;
}
/* get IRQ polarity */
if (OF_getprop(ofw_bus_get_node(dev), "int-polarity",
&param, sizeof(param)) > 0) {
sc->sc_interrupt_cfg |= SOTG_INTERRUPT_CFG_INTPOL;
}
/* get IRQ level triggering */
if (OF_getprop(ofw_bus_get_node(dev), "int-level",
&param, sizeof(param)) > 0) {
sc->sc_interrupt_cfg |= SOTG_INTERRUPT_CFG_INTLVL;
}
/* initialise some bus fields */
sc->sc_bus.parent = dev;
sc->sc_bus.devices = sc->sc_devices;
@ -168,7 +180,7 @@ saf1761_otg_fdt_attach(device_t dev)
}
rid = 0;
sc->sc_io_res =
bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
if (!sc->sc_io_res) {
goto error;
@ -243,7 +255,7 @@ saf1761_otg_fdt_detach(device_t dev)
sc->sc_irq_res = NULL;
}
if (sc->sc_io_res) {
bus_release_resource(dev, SYS_RES_IOPORT, 0,
bus_release_resource(dev, SYS_RES_MEMORY, 0,
sc->sc_io_res);
sc->sc_io_res = NULL;
}