diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2014-05-27 10:12:16 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2014-05-27 10:12:16 +0000 |
commit | 6df8a79713cac3def690fb02ec3507dfdded592b (patch) | |
tree | c82941fa139f8438314776556e4c7b59dafe224a /sys/dev | |
parent | 21c85d9d3b050ad5ab343d0c2e4dcec9fa3579ff (diff) | |
download | src-6df8a79713cac3def690fb02ec3507dfdded592b.tar.gz src-6df8a79713cac3def690fb02ec3507dfdded592b.zip |
- Correct bus space resource type for register access.
- Add configuration of interrupt type and polarity via FDT.
Sponsored by: DARPA, AFRL
Notes
Notes:
svn path=/head/; revision=266742
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/controller/saf1761_otg.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/controller/saf1761_otg.h | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/saf1761_otg_fdt.c | 16 |
3 files changed, 17 insertions, 3 deletions
diff --git a/sys/dev/usb/controller/saf1761_otg.c b/sys/dev/usb/controller/saf1761_otg.c index 888face0f3a1..f57dbd039870 100644 --- a/sys/dev/usb/controller/saf1761_otg.c +++ b/sys/dev/usb/controller/saf1761_otg.c @@ -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, diff --git a/sys/dev/usb/controller/saf1761_otg.h b/sys/dev/usb/controller/saf1761_otg.h index 6b7697255ea6..de5e7c9743b9 100644 --- a/sys/dev/usb/controller/saf1761_otg.h +++ b/sys/dev/usb/controller/saf1761_otg.h @@ -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]; diff --git a/sys/dev/usb/controller/saf1761_otg_fdt.c b/sys/dev/usb/controller/saf1761_otg_fdt.c index b0119d934211..ab64341f6af8 100644 --- a/sys/dev/usb/controller/saf1761_otg_fdt.c +++ b/sys/dev/usb/controller/saf1761_otg_fdt.c @@ -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", + ¶m, 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", + ¶m, 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; } |