Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/samsung Only process a tx or rx interrupt if th...
details: https://anonhg.NetBSD.org/src/rev/81b4b9c8e026
branches: trunk
changeset: 320398:81b4b9c8e026
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed Jul 04 13:14:51 2018 +0000
description:
Only process a tx or rx interrupt if the pending bit is set.
diffstat:
sys/arch/arm/samsung/exynos_sscom.c | 38 +++++++++++++++++++++++-------------
sys/arch/arm/samsung/sscom.c | 23 ++++++++++++---------
sys/arch/arm/samsung/sscom_var.h | 3 +-
3 files changed, 39 insertions(+), 25 deletions(-)
diffs (160 lines):
diff -r 98b5a4f2ec61 -r 81b4b9c8e026 sys/arch/arm/samsung/exynos_sscom.c
--- a/sys/arch/arm/samsung/exynos_sscom.c Wed Jul 04 12:25:48 2018 +0000
+++ b/sys/arch/arm/samsung/exynos_sscom.c Wed Jul 04 13:14:51 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_sscom.c,v 1.10 2017/06/19 21:58:13 jmcneill Exp $ */
+/* $NetBSD: exynos_sscom.c,v 1.11 2018/07/04 13:14:51 jmcneill Exp $ */
/*
* Copyright (c) 2014 Reinoud Zandijk
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.10 2017/06/19 21:58:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.11 2018/07/04 13:14:51 jmcneill Exp $");
#include "opt_sscom.h"
#include "opt_ddb.h"
@@ -95,27 +95,17 @@
static void
exynos_unmask_interrupts(struct sscom_softc *sc, int intbits)
{
- int psw = disable_interrupts(IF32_bits);
- uint32_t val;
-
- val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM);
+ uint32_t val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM);
val &= ~intbits;
bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM, val);
-
- restore_interrupts(psw);
}
static void
exynos_mask_interrupts(struct sscom_softc *sc, int intbits)
{
- int psw = disable_interrupts(IF32_bits);
- uint32_t val;
-
- val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM);
+ uint32_t val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM);
val |= intbits;
bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM, val);
-
- restore_interrupts(psw);
}
static void
@@ -134,6 +124,20 @@
}
}
+static int
+exynos_pending_interrupts(struct sscom_softc *sc)
+{
+ uint32_t val, ret = 0;
+
+ val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTP);
+ if (val & UINT_RXD)
+ ret |= SSCOM_HW_RXINT;
+ if (val & UINT_TXD)
+ ret |= SSCOM_HW_TXINT;
+
+ return ret;
+}
+
static void
exynos_clear_interrupts(struct sscom_softc *sc, u_int flags)
{
@@ -193,6 +197,7 @@
sc->sc_frequency = clk_get_rate(clk_uart_baud0);
sc->sc_change_txrx_interrupts = exynos_change_txrx_interrupts;
+ sc->sc_pending_interrupts = exynos_pending_interrupts;
sc->sc_clear_interrupts = exynos_clear_interrupts;
/* not used here, but do initialise */
@@ -204,6 +209,11 @@
aprint_normal("\n");
+ /* Disable interrupts */
+ bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM, 0);
+ bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTP,
+ bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTP));
+
if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
aprint_error_dev(self, "failed to decode interrupt\n");
return;
diff -r 98b5a4f2ec61 -r 81b4b9c8e026 sys/arch/arm/samsung/sscom.c
--- a/sys/arch/arm/samsung/sscom.c Wed Jul 04 12:25:48 2018 +0000
+++ b/sys/arch/arm/samsung/sscom.c Wed Jul 04 13:14:51 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sscom.c,v 1.9 2017/06/10 15:13:18 jmcneill Exp $ */
+/* $NetBSD: sscom.c,v 1.10 2018/07/04 13:14:51 jmcneill Exp $ */
/*
* Copyright (c) 2002, 2003 Fujitsu Component Limited
@@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.9 2017/06/10 15:13:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.10 2018/07/04 13:14:51 jmcneill Exp $");
#include "opt_sscom.h"
#include "opt_ddb.h"
@@ -422,6 +422,7 @@
/* Disable interrupts before configuring the device. */
KASSERT(sc->sc_change_txrx_interrupts != NULL);
+ KASSERT(sc->sc_pending_interrupts != NULL);
KASSERT(sc->sc_clear_interrupts != NULL);
sscom_disable_txrxint(sc);
@@ -1818,17 +1819,19 @@
sscomintr(void *v)
{
struct sscom_softc *sc = v;
- int clear = 0;
+ int pend, rv = 0;
+
+ pend = sc->sc_pending_interrupts(sc);
- if (sscomrxintr(v))
- clear |= SSCOM_HW_RXINT;
- if (sscomtxintr(v))
- clear |= SSCOM_HW_TXINT;
+ if (pend & SSCOM_HW_RXINT)
+ rv += sscomrxintr(v);
+ if (pend & SSCOM_HW_TXINT)
+ rv += sscomtxintr(v);
- if (clear)
- sc->sc_clear_interrupts(sc, clear);
+ if (pend)
+ sc->sc_clear_interrupts(sc, pend);
- return clear? 1: 0;
+ return rv;
}
diff -r 98b5a4f2ec61 -r 81b4b9c8e026 sys/arch/arm/samsung/sscom_var.h
--- a/sys/arch/arm/samsung/sscom_var.h Wed Jul 04 12:25:48 2018 +0000
+++ b/sys/arch/arm/samsung/sscom_var.h Wed Jul 04 13:14:51 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sscom_var.h,v 1.4 2015/04/14 20:32:35 riastradh Exp $ */
+/* $NetBSD: sscom_var.h,v 1.5 2018/07/04 13:14:51 jmcneill Exp $ */
/*
* Copyright (c) 2002, 2003 Fujitsu Component Limited
@@ -187,6 +187,7 @@
int (*sc_read_modem_status)( struct sscom_softc * );
void (*sc_set_modem_control)( struct sscom_softc * );
void (*sc_change_txrx_interrupts)(struct sscom_softc *, bool, u_int);
+ int (*sc_pending_interrupts)(struct sscom_softc *);
void (*sc_clear_interrupts)(struct sscom_softc *, u_int);
};
Home |
Main Index |
Thread Index |
Old Index