drivers that use the FDT over to the FDT interrupt establish API.
ok kettenis@
-.\" $OpenBSD: intc.4,v 1.2 2014/09/19 17:17:04 jmc Exp $
+.\" $OpenBSD: intc.4,v 1.3 2016/08/06 10:07:45 jsg Exp $
.\" Copyright (c) 2014 Raphael Graf <rapha@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: September 19 2014 $
+.Dd $Mdocdate: August 6 2016 $
.Dt INTC 4 armv7
.Os
.Sh NAME
.Nm intc
.Nd Texas Instruments interrupt controller device
.Sh SYNOPSIS
-.Cd "intc* at omap?"
+.Cd "intc* at fdt?"
.Sh DESCRIPTION
The
.Nm
-.\" $OpenBSD: omap.4,v 1.4 2016/06/26 10:04:18 jsg Exp $
+.\" $OpenBSD: omap.4,v 1.5 2016/08/06 10:07:45 jsg Exp $
.\" Copyright (c) 2014 Sylvestre Gallon <syl@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 26 2016 $
+.Dd $Mdocdate: August 6 2016 $
.Dt OMAP 4 armv7
.Os
.Sh NAME
Texas Instruments enhanced DMA device
.It Xr gptimer 4
Texas Instruments general purpose timer device
-.It Xr intc 4
-Texas Instruments interrupt controller device
.It Xr omgpio 4
omap3, omap4 and am335x GPIO controller
.It Xr prcm 4
-# $OpenBSD: GENERIC,v 1.40 2016/08/06 09:50:55 jsg Exp $
+# $OpenBSD: GENERIC,v 1.41 2016/08/06 10:07:45 jsg Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
omapid* at omap?
# OMAP on-chip devices
-intc* at omap? # OMAP3 interrupt controller
+intc* at fdt? # OMAP3 interrupt controller
#edma* at omap? # OMAP3 dma controller
prcm* at omap? # power/clock controller
sitaracm* at omap? # sitara control module
-# $OpenBSD: RAMDISK,v 1.37 2016/08/06 09:50:55 jsg Exp $
+# $OpenBSD: RAMDISK,v 1.38 2016/08/06 10:07:45 jsg Exp $
machine armv7 arm
omapid* at omap?
# OMAP on-chip devices
-intc* at omap? # OMAP3 interrupt controller
+intc* at fdt? # OMAP3 interrupt controller
#edma* at omap? # OMAP3 dma controller
prcm* at omap? # power/clock controller
sitaracm* at omap? # sitara control module
-# $OpenBSD: files.omap,v 1.13 2016/06/26 09:06:35 jsg Exp $
+# $OpenBSD: files.omap,v 1.14 2016/08/06 10:07:45 jsg Exp $
define omap {}
device omap: omap
file arch/armv7/omap/edma.c edma
device intc
-attach intc at omap
+attach intc at fdt
file arch/armv7/omap/intc.c intc
device gptimer
-/* $OpenBSD: if_cpsw.c,v 1.38 2016/07/27 11:45:02 patrick Exp $ */
+/* $OpenBSD: if_cpsw.c,v 1.39 2016/08/06 10:07:45 jsg Exp $ */
/* $NetBSD: if_cpsw.c,v 1.3 2013/04/17 14:36:34 bouyer Exp $ */
/*
int error;
int node;
u_int i;
- uint32_t intr[4];
uint32_t memsize;
char name[32];
- if (faa->fa_nreg < 1 || (faa->fa_nintr != 4 && faa->fa_nintr != 12))
+ if (faa->fa_nreg < 1)
return;
- for (i = 0; i < 4; i++) {
- if (faa->fa_nintr == 4)
- intr[i] = faa->fa_intr[i];
- else
- intr[i] = faa->fa_intr[(3 * i) + 1];
- }
-
/*
* fa_reg[0].size is size of CPSW_SS and CPSW_PORT
* fa_reg[1].size is size of CPSW_WR
memcpy(sc->sc_ac.ac_enaddr, sc->sc_port_config[0].enaddr,
ETHER_ADDR_LEN);
- sc->sc_rxthih = arm_intr_establish(intr[0], IPL_NET, cpsw_rxthintr, sc,
- DEVNAME(sc));
- sc->sc_rxih = arm_intr_establish(intr[1], IPL_NET, cpsw_rxintr, sc,
- DEVNAME(sc));
- sc->sc_txih = arm_intr_establish(intr[2], IPL_NET, cpsw_txintr, sc,
- DEVNAME(sc));
- sc->sc_miscih = arm_intr_establish(intr[3], IPL_NET, cpsw_miscintr, sc,
- DEVNAME(sc));
+ sc->sc_rxthih = arm_intr_establish_fdt_idx(faa->fa_node, 0, IPL_NET,
+ cpsw_rxthintr, sc, DEVNAME(sc));
+ sc->sc_rxih = arm_intr_establish_fdt_idx(faa->fa_node, 1, IPL_NET,
+ cpsw_rxintr, sc, DEVNAME(sc));
+ sc->sc_txih = arm_intr_establish_fdt_idx(faa->fa_node, 2, IPL_NET,
+ cpsw_txintr, sc, DEVNAME(sc));
+ sc->sc_miscih = arm_intr_establish_fdt_idx(faa->fa_node, 3, IPL_NET,
+ cpsw_miscintr, sc, DEVNAME(sc));
sc->sc_bst = faa->fa_iot;
sc->sc_bdt = faa->fa_dmat;
-/* $OpenBSD: intc.c,v 1.5 2016/07/17 00:28:46 jsg Exp $ */
+/* $OpenBSD: intc.c,v 1.6 2016/08/06 10:07:45 jsg Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/evcount.h>
+
#include <machine/bus.h>
+#include <machine/fdt.h>
+
#include <armv7/armv7/armv7var.h>
+#include <dev/ofw/openfirm.h>
#include <dev/ofw/fdt.h>
#include "intc.h"
struct intrq intc_handler[INTC_MAX_IRQ];
u_int32_t intc_smask[NIPL];
u_int32_t intc_imask[INTC_MAX_BANKS][NIPL];
+struct interrupt_controller intc_ic;
bus_space_tag_t intc_iot;
bus_space_handle_t intc_ioh;
int intc_nirq;
+int intc_match(struct device *, void *, void *);
void intc_attach(struct device *, struct device *, void *);
int intc_spllower(int new);
int intc_splraise(int new);
void intc_setipl(int new);
void intc_calc_mask(void);
+void *intc_intr_establish_fdt(void *, int *, int, int (*)(void *),
+ void *, char *);
struct cfattach intc_ca = {
- sizeof (struct device), NULL, intc_attach
+ sizeof (struct device), intc_match, intc_attach
};
struct cfdriver intc_cd = {
int intc_attached = 0;
+int
+intc_match(struct device *parent, void *match, void *aux)
+{
+ struct fdt_attach_args *faa = aux;
+
+ return (OF_is_compatible(faa->fa_node, "ti,omap3-intc") ||
+ OF_is_compatible(faa->fa_node, "ti,am33xx-intc"));
+}
+
void
-intc_attach(struct device *parent, struct device *self, void *args)
+intc_attach(struct device *parent, struct device *self, void *aux)
{
- struct armv7_attach_args *aa = args;
+ struct fdt_attach_args *faa = aux;
int i;
u_int32_t rev;
- void *node;
- node = fdt_find_node("/");
- if (node == NULL)
- panic("%s: could not get fdt root node", __func__);
-
- intc_iot = aa->aa_iot;
- if (bus_space_map(intc_iot, aa->aa_dev->mem[0].addr,
- aa->aa_dev->mem[0].size, 0, &intc_ioh))
+ intc_iot = faa->fa_iot;
+ if (bus_space_map(intc_iot, faa->fa_reg[0].addr,
+ faa->fa_reg[0].size, 0, &intc_ioh))
panic("intc_attach: bus_space_map failed!");
rev = bus_space_read_4(intc_iot, intc_ioh, INTC_REVISION);
bus_space_write_4(intc_iot, intc_ioh, INTC_SYSCONFIG,
INTC_SYSCONFIG_AUTOIDLE);
- if (fdt_is_compatible(node, "ti,am33xx"))
+ if (OF_is_compatible(faa->fa_node, "ti,am33xx-intc"))
intc_nirq = 128;
else
intc_nirq = 96;
intc_setipl(IPL_HIGH); /* XXX ??? */
enable_interrupts(PSR_I);
+
+ intc_ic.ic_node = faa->fa_node;
+ intc_ic.ic_establish = intc_intr_establish_fdt;
+ arm_intr_register_fdt(&intc_ic);
}
void
return (ih);
}
+void *
+intc_intr_establish_fdt(void *cookie, int *cell, int level,
+ int (*func)(void *), void *arg, char *name)
+{
+ return intc_intr_establish(cell[0], level, func, arg, name);
+}
+
void
intc_intr_disestablish(void *cookie)
{
-/* $OpenBSD: omap.c,v 1.16 2016/07/10 03:04:00 jsg Exp $ */
+/* $OpenBSD: omap.c,v 1.17 2016/08/06 10:07:45 jsg Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
*
struct board_dev omap3_dev[] = {
{ "prcm", 0 },
- { "intc", 0 },
{ "gptimer", 0 },
{ "gptimer", 1 },
{ "omgpio", 0 },
struct board_dev am33xx_dev[] = {
{ "prcm", 0 },
{ "sitaracm", 0 },
- { "intc", 0 },
{ "edma", 0 },
{ "dmtimer", 0 },
{ "dmtimer", 1 },
-/* $OpenBSD: omap_com.c,v 1.8 2016/07/27 11:45:02 patrick Exp $ */
+/* $OpenBSD: omap_com.c,v 1.9 2016/08/06 10:07:45 jsg Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
* All rights reserved.
{
struct com_softc *sc = (struct com_softc *)self;
struct fdt_attach_args *faa = aux;
- int irq;
- if (faa->fa_nreg != 1 || (faa->fa_nintr != 1 && faa->fa_nintr != 3))
+ if (faa->fa_nreg < 1)
return;
sc->sc_iot = &armv7_a4x_bs_tag; /* XXX: This sucks */
sc->sc_frequency = 48000000;
sc->sc_uarttype = COM_UART_TI16750;
- if (faa->fa_nintr == 1)
- irq = faa->fa_intr[0];
- else
- irq = faa->fa_intr[1];
-
if (bus_space_map(sc->sc_iot, sc->sc_iobase,
faa->fa_reg[0].size, 0, &sc->sc_ioh)) {
printf("%s: bus_space_map failed\n", __func__);
com_attach_subr(sc);
- (void)arm_intr_establish(irq, IPL_TTY, comintr,
+ (void)arm_intr_establish_fdt(faa->fa_node, IPL_TTY, comintr,
sc, sc->sc_dev.dv_xname);
}
-/* $OpenBSD: ommmc.c,v 1.27 2016/07/27 11:45:02 patrick Exp $ */
+/* $OpenBSD: ommmc.c,v 1.28 2016/08/06 10:07:45 jsg Exp $ */
/*
* Copyright (c) 2009 Dale Rahn <drahn@openbsd.org>
struct fdt_attach_args *faa = aux;
struct sdmmcbus_attach_args saa;
uint32_t caps;
- uint32_t addr, size, irq;
+ uint32_t addr, size;
int len, unit;
char hwmods[128];
- if (faa->fa_nreg != 1 || (faa->fa_nintr != 1 && faa->fa_nintr != 3))
+ if (faa->fa_nreg < 1)
return;
if (faa->fa_reg[0].size <= 0x100)
size = faa->fa_reg[0].size;
}
- if (faa->fa_nintr == 1)
- irq = faa->fa_intr[0];
- else
- irq = faa->fa_intr[1];
-
unit = 0;
if ((len = OF_getprop(faa->fa_node, "ti,hwmods", hwmods,
sizeof(hwmods))) == 5) {
/* Enable ICLKEN, FCLKEN? */
prcm_enablemodule(PRCM_MMC0 + unit);
- sc->sc_ih = arm_intr_establish(irq, IPL_SDMMC,
+ sc->sc_ih = arm_intr_establish_fdt(faa->fa_node, IPL_SDMMC,
ommmc_intr, sc, DEVNAME(sc));
if (sc->sc_ih == NULL) {
printf("%s: cannot map interrupt\n", DEVNAME(sc));
-/* $OpenBSD: ti_iic.c,v 1.7 2016/07/27 11:45:02 patrick Exp $ */
+/* $OpenBSD: ti_iic.c,v 1.8 2016/08/06 10:07:45 jsg Exp $ */
/* $NetBSD: ti_iic.c,v 1.4 2013/04/25 13:04:27 rkujawa Exp $ */
/*
struct fdt_attach_args *faa = aux;
struct i2cbus_attach_args iba;
uint16_t rev;
- int irq, unit, len;
+ int unit, len;
char hwmods[128];
- if (faa->fa_nreg != 1 || (faa->fa_nintr != 1 && faa->fa_nintr != 3))
+ if (faa->fa_nreg < 1)
return;
sc->sc_iot = faa->fa_iot;
sc->sc_node = faa->fa_node;
-
- if (faa->fa_nintr == 1)
- irq = faa->fa_intr[0];
- else
- irq = faa->fa_intr[1];
unit = 0;
if ((len = OF_getprop(faa->fa_node, "ti,hwmods", hwmods,
sitara_cm_pinctrlbyname(faa->fa_node, "default");
- sc->sc_ih = arm_intr_establish(irq, IPL_NET,
+ sc->sc_ih = arm_intr_establish_fdt(faa->fa_node, IPL_NET,
ti_iic_intr, sc, DEVNAME(sc));
prcm_enablemodule(PRCM_I2C0 + unit);