summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2015-05-23 21:12:51 +0000
committerian <ian@FreeBSD.org>2015-05-23 21:12:51 +0000
commit0c377e52af241168e3d1425b1a8a4e0cbaf0af25 (patch)
tree1d48591e3a5cce8f28d1a654c8430ed96e69d73f /sys/arm
parentf3f411e10b20906a8640a6316ddcc3c1f24725e3 (diff)
downloadFreeBSD-src-0c377e52af241168e3d1425b1a8a4e0cbaf0af25.zip
FreeBSD-src-0c377e52af241168e3d1425b1a8a4e0cbaf0af25.tar.gz
MFC r276021, r279766:
Reduce the diff in the Ti aintc between head and arm_intrng Fix spurious interrupts on arm am335x (beaglebone), by doing the EOI in both the post-filter and post-thread callbacks.
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/ti/aintc.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/sys/arm/ti/aintc.c b/sys/arm/ti/aintc.c
index 213a1d3..d54594c 100644
--- a/sys/arm/ti/aintc.c
+++ b/sys/arm/ti/aintc.c
@@ -72,12 +72,20 @@ static struct resource_spec ti_aintc_spec[] = {
static struct ti_aintc_softc *ti_aintc_sc = NULL;
-#define aintc_read_4(reg) \
- bus_space_read_4(ti_aintc_sc->aintc_bst, ti_aintc_sc->aintc_bsh, reg)
-#define aintc_write_4(reg, val) \
- bus_space_write_4(ti_aintc_sc->aintc_bst, ti_aintc_sc->aintc_bsh, reg, val)
+#define aintc_read_4(_sc, reg) \
+ bus_space_read_4((_sc)->aintc_bst, (_sc)->aintc_bsh, (reg))
+#define aintc_write_4(_sc, reg, val) \
+ bus_space_write_4((_sc)->aintc_bst, (_sc)->aintc_bsh, (reg), (val))
+static void
+aintc_post_filter(void *arg)
+{
+
+ arm_irq_memory_barrier(0);
+ aintc_write_4(ti_aintc_sc, INTC_CONTROL, 1); /* EOI */
+}
+
static int
ti_aintc_probe(device_t dev)
{
@@ -112,17 +120,19 @@ ti_aintc_attach(device_t dev)
ti_aintc_sc = sc;
- x = aintc_read_4(INTC_REVISION);
+ x = aintc_read_4(sc, INTC_REVISION);
device_printf(dev, "Revision %u.%u\n",(x >> 4) & 0xF, x & 0xF);
/* SoftReset */
- aintc_write_4(INTC_SYSCONFIG, 2);
+ aintc_write_4(sc, INTC_SYSCONFIG, 2);
/* Wait for reset to complete */
- while(!(aintc_read_4(INTC_SYSSTATUS) & 1));
+ while(!(aintc_read_4(sc, INTC_SYSSTATUS) & 1));
/*Set Priority Threshold */
- aintc_write_4(INTC_THRESHOLD, 0xFF);
+ aintc_write_4(sc, INTC_THRESHOLD, 0xFF);
+
+ arm_post_filter = aintc_post_filter;
return (0);
}
@@ -146,22 +156,17 @@ DRIVER_MODULE(aintc, simplebus, ti_aintc_driver, ti_aintc_devclass, 0, 0);
int
arm_get_next_irq(int last_irq)
{
+ struct ti_aintc_softc *sc = ti_aintc_sc;
uint32_t active_irq;
- if (last_irq != -1) {
- aintc_write_4(INTC_ISR_CLEAR(last_irq >> 5),
- 1UL << (last_irq & 0x1F));
- aintc_write_4(INTC_CONTROL,1);
- }
-
/* Get the next active interrupt */
- active_irq = aintc_read_4(INTC_SIR_IRQ);
+ active_irq = aintc_read_4(sc, INTC_SIR_IRQ);
/* Check for spurious interrupt */
if ((active_irq & 0xffffff80)) {
- device_printf(ti_aintc_sc->sc_dev,
- "Spurious interrupt detected (0x%08x)\n", active_irq);
- aintc_write_4(INTC_SIR_IRQ, 0);
+ device_printf(sc->sc_dev,
+ "Spurious interrupt detected (0x%08x)\n", active_irq);
+ aintc_write_4(sc, INTC_SIR_IRQ, 0);
return -1;
}
@@ -174,13 +179,17 @@ arm_get_next_irq(int last_irq)
void
arm_mask_irq(uintptr_t nb)
{
- aintc_write_4(INTC_MIR_SET(nb >> 5), (1UL << (nb & 0x1F)));
+ struct ti_aintc_softc *sc = ti_aintc_sc;
+
+ aintc_write_4(sc, INTC_MIR_SET(nb >> 5), (1UL << (nb & 0x1F)));
+ aintc_write_4(sc, INTC_CONTROL, 1); /* EOI */
}
void
arm_unmask_irq(uintptr_t nb)
{
+ struct ti_aintc_softc *sc = ti_aintc_sc;
arm_irq_memory_barrier(nb);
- aintc_write_4(INTC_MIR_CLEAR(nb >> 5), (1UL << (nb & 0x1F)));
+ aintc_write_4(sc, INTC_MIR_CLEAR(nb >> 5), (1UL << (nb & 0x1F)));
}
OpenPOWER on IntegriCloud