diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-06-12 06:58:40 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-06-12 06:58:40 +0000 |
commit | 35f094a40d2d7a67758b27cb7e47044c49bd9605 (patch) | |
tree | 192a3d7e626e1b00d8afbc01aab5404dbc75ab9a | |
parent | 2a92e9233ea6e4a706f7bed77a5f5ae9c741f307 (diff) |
Handle both the nintr 1 (allwinner a10/cortex a8) and
nintr 3 (allwinner a20/cortex a7) cases.
-rw-r--r-- | sys/arch/armv7/sunxi/sxie.c | 13 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxiuart.c | 13 |
2 files changed, 18 insertions, 8 deletions
diff --git a/sys/arch/armv7/sunxi/sxie.c b/sys/arch/armv7/sunxi/sxie.c index 27068277d50..f72f5362877 100644 --- a/sys/arch/armv7/sunxi/sxie.c +++ b/sys/arch/armv7/sunxi/sxie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sxie.c,v 1.15 2016/06/11 06:42:16 jsg Exp $ */ +/* $OpenBSD: sxie.c,v 1.16 2016/06/12 06:58:39 jsg Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> * Copyright (c) 2013 Artturi Alm @@ -210,11 +210,16 @@ sxie_attach(struct device *parent, struct device *self, void *aux) struct fdt_attach_args *faa = aux; struct mii_data *mii; struct ifnet *ifp; - int s; + int s, irq; - if (faa->fa_nreg < 2 || faa->fa_nintr != 1) + if (faa->fa_nreg != 2 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) return; + if (faa->fa_nintr == 1) + irq = faa->fa_intr[0]; + else + irq = faa->fa_intr[1]; + sc->sc_iot = faa->fa_iot; if (bus_space_map(sc->sc_iot, faa->fa_reg[0], @@ -227,7 +232,7 @@ sxie_attach(struct device *parent, struct device *self, void *aux) sxie_socware_init(sc); sc->txf_inuse = 0; - sc->sc_ih = arm_intr_establish(faa->fa_intr[0], IPL_NET, + sc->sc_ih = arm_intr_establish(irq, IPL_NET, sxie_intr, sc, sc->sc_dev.dv_xname); s = splnet(); diff --git a/sys/arch/armv7/sunxi/sxiuart.c b/sys/arch/armv7/sunxi/sxiuart.c index 2ff11db2259..91eaa0b160e 100644 --- a/sys/arch/armv7/sunxi/sxiuart.c +++ b/sys/arch/armv7/sunxi/sxiuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sxiuart.c,v 1.6 2016/06/11 07:07:59 jsg Exp $ */ +/* $OpenBSD: sxiuart.c,v 1.7 2016/06/12 06:58:39 jsg Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@motorola.com> * Copyright (c) 2013 Artturi Alm @@ -173,11 +173,16 @@ sxiuart_attach(struct device *parent, struct device *self, void *aux) struct fdt_attach_args *faa = aux; bus_space_tag_t iot; bus_space_handle_t ioh; - int s; + int s, irq; - if (faa->fa_nreg < 2 || faa->fa_nintr != 1) + if (faa->fa_nreg != 2 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) return; + if (faa->fa_nintr == 1) + irq = faa->fa_intr[0]; + else + irq = faa->fa_intr[1]; + sc->sc_iot = iot = faa->fa_iot; if (bus_space_map(sc->sc_iot, faa->fa_reg[0], faa->fa_reg[1], 0, &sc->sc_ioh)) @@ -220,7 +225,7 @@ sxiuart_attach(struct device *parent, struct device *self, void *aux) bus_space_write_1(sc->sc_iot, sc->sc_ioh, SXIUART_MCR, sc->sc_mcr); splx(s); - arm_intr_establish(faa->fa_intr[0], IPL_TTY, + arm_intr_establish(irq, IPL_TTY, sxiuart_intr, sc, sc->sc_dev.dv_xname); printf("\n"); |