summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorSylvestre Gallon <syl@cvs.openbsd.org>2013-11-06 19:03:08 +0000
committerSylvestre Gallon <syl@cvs.openbsd.org>2013-11-06 19:03:08 +0000
commitc0e01660c1ab7ce84cb73edad823b55dabf0a0f1 (patch)
tree22e141c488668d5c329b50134b94692b132bfddd /sys/arch
parent4366a2f228de1179ea58f3a67c1c72629d14d23d (diff)
After factorizing armv7_machdep code here is an effort to factorize all
the code present in omap/omap.c imx/imx.c and sunxi/sunxi.c All this code looks quite the same, so we move it in a generic armv7/armv7.c This is a step closer to only one kernel for all armv7 boards. ok patrick@, rapha@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/armv7/conf/files.armv73
-rw-r--r--sys/arch/armv7/imx/files.imx4
-rw-r--r--sys/arch/armv7/imx/imx.c201
-rw-r--r--sys/arch/armv7/imx/imx6.c8
-rw-r--r--sys/arch/armv7/imx/imx_machdep.c2
-rw-r--r--sys/arch/armv7/imx/imxahci.c18
-rw-r--r--sys/arch/armv7/imx/imxccm.c12
-rw-r--r--sys/arch/armv7/imx/imxdog.c12
-rw-r--r--sys/arch/armv7/imx/imxehci.c36
-rw-r--r--sys/arch/armv7/imx/imxenet.c18
-rw-r--r--sys/arch/armv7/imx/imxesdhc.c18
-rw-r--r--sys/arch/armv7/imx/imxgpio.c12
-rw-r--r--sys/arch/armv7/imx/imxiic.c18
-rw-r--r--sys/arch/armv7/imx/imxiomuxc.c12
-rw-r--r--sys/arch/armv7/imx/imxocotp.c12
-rw-r--r--sys/arch/armv7/imx/imxuart.c16
-rw-r--r--sys/arch/armv7/imx/imxvar.h56
-rw-r--r--sys/arch/armv7/omap/am335x.c8
-rw-r--r--sys/arch/armv7/omap/dmtimer.c24
-rw-r--r--sys/arch/armv7/omap/edma.c14
-rw-r--r--sys/arch/armv7/omap/files.omap8
-rw-r--r--sys/arch/armv7/omap/gptimer.c16
-rw-r--r--sys/arch/armv7/omap/if_cpsw.c26
-rw-r--r--sys/arch/armv7/omap/intc.c12
-rw-r--r--sys/arch/armv7/omap/omap.c210
-rw-r--r--sys/arch/armv7/omap/omap3.c8
-rw-r--r--sys/arch/armv7/omap/omap4.c10
-rw-r--r--sys/arch/armv7/omap/omap_com.c14
-rw-r--r--sys/arch/armv7/omap/omap_machdep.c3
-rw-r--r--sys/arch/armv7/omap/omapid.c12
-rw-r--r--sys/arch/armv7/omap/omapvar.h60
-rw-r--r--sys/arch/armv7/omap/omdog.c12
-rw-r--r--sys/arch/armv7/omap/omehci.c30
-rw-r--r--sys/arch/armv7/omap/omgpio.c14
-rw-r--r--sys/arch/armv7/omap/ommmc.c18
-rw-r--r--sys/arch/armv7/omap/omusbtll.c12
-rw-r--r--sys/arch/armv7/omap/prcm.c22
-rw-r--r--sys/arch/armv7/omap/sitara_cm.c12
-rw-r--r--sys/arch/armv7/sunxi/a1xintc.c12
-rw-r--r--sys/arch/armv7/sunxi/files.sunxi8
-rw-r--r--sys/arch/armv7/sunxi/sun4i.c9
-rw-r--r--sys/arch/armv7/sunxi/sun7i.c9
-rw-r--r--sys/arch/armv7/sunxi/sunxi.c210
-rw-r--r--sys/arch/armv7/sunxi/sunxi_machdep.c2
-rw-r--r--sys/arch/armv7/sunxi/sunxireg.h24
-rw-r--r--sys/arch/armv7/sunxi/sunxivar.h74
-rw-r--r--sys/arch/armv7/sunxi/sxiahci.c20
-rw-r--r--sys/arch/armv7/sunxi/sxiccmu.c13
-rw-r--r--sys/arch/armv7/sunxi/sxidog.c17
-rw-r--r--sys/arch/armv7/sunxi/sxie.c14
-rw-r--r--sys/arch/armv7/sunxi/sxiehci.c18
-rw-r--r--sys/arch/armv7/sunxi/sxipio.c15
-rw-r--r--sys/arch/armv7/sunxi/sxirtc.c11
-rw-r--r--sys/arch/armv7/sunxi/sxitimer.c12
-rw-r--r--sys/arch/armv7/sunxi/sxiuart.c20
55 files changed, 365 insertions, 1126 deletions
diff --git a/sys/arch/armv7/conf/files.armv7 b/sys/arch/armv7/conf/files.armv7
index 7e3b969849d..b379a4bebe7 100644
--- a/sys/arch/armv7/conf/files.armv7
+++ b/sys/arch/armv7/conf/files.armv7
@@ -1,4 +1,4 @@
-# $OpenBSD: files.armv7,v 1.8 2013/11/04 14:07:16 deraadt Exp $
+# $OpenBSD: files.armv7,v 1.9 2013/11/06 19:03:07 syl Exp $
maxpartitions 16
maxusers 2 8 64
@@ -21,6 +21,7 @@ file arch/arm/arm/irq_dispatch.S
file arch/arm/arm/softintr.c
# Generic MD files
+file arch/armv7/armv7/armv7.c
file arch/armv7/armv7/armv7_machdep.c
file arch/armv7/armv7/autoconf.c
file arch/arm/arm/disksubr.c disk
diff --git a/sys/arch/armv7/imx/files.imx b/sys/arch/armv7/imx/files.imx
index a75f7414958..a408d71a880 100644
--- a/sys/arch/armv7/imx/files.imx
+++ b/sys/arch/armv7/imx/files.imx
@@ -1,11 +1,11 @@
-# $OpenBSD: files.imx,v 1.1 2013/09/06 20:45:53 patrick Exp $
+# $OpenBSD: files.imx,v 1.2 2013/11/06 19:03:07 syl Exp $
define imx {}
device imx: imx
attach imx at mainbus
file arch/armv7/imx/imx_machdep.c imx
file arch/armv7/imx/imx.c imx
-file arch/armv7/imx/imx6.c imx
+file arch/armv7/imx/imx6.c
# serial ports
device imxuart
diff --git a/sys/arch/armv7/imx/imx.c b/sys/arch/armv7/imx/imx.c
index 0d4d9be0969..d08a5438c91 100644
--- a/sys/arch/armv7/imx/imx.c
+++ b/sys/arch/armv7/imx/imx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imx.c,v 1.2 2013/10/05 23:05:11 patrick Exp $ */
+/* $OpenBSD: imx.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
@@ -18,115 +18,13 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/reboot.h>
-#define _ARM32_BUS_DMA_PRIVATE
-#include <machine/bus.h>
-#include <arch/arm/armv7/armv7var.h>
-#include <armv7/imx/imxvar.h>
-
-struct arm32_bus_dma_tag imx_bus_dma_tag = {
- 0,
- 0,
- NULL,
- _bus_dmamap_create,
- _bus_dmamap_destroy,
- _bus_dmamap_load,
- _bus_dmamap_load_mbuf,
- _bus_dmamap_load_uio,
- _bus_dmamap_load_raw,
- _bus_dmamap_unload,
- _bus_dmamap_sync,
- _bus_dmamem_alloc,
- _bus_dmamem_free,
- _bus_dmamem_map,
- _bus_dmamem_unmap,
- _bus_dmamem_mmap,
-};
-
-struct board_dev {
- char *name;
- int unit;
-};
-
-struct board_dev phyflex_imx6_devs[] = {
- { "imxccm", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxocotp", 0 },
- { "imxuart", 3 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxesdhc", 1 },
- { "imxesdhc", 2 },
- { "ehci", 0 },
- { "imxenet", 0 },
- { "ahci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev sabrelite_devs[] = {
- { "imxccm", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxocotp", 0 },
- { "imxuart", 1 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxesdhc", 2 },
- { "imxesdhc", 3 },
- { "ehci", 0 },
- { "imxenet", 0 },
- { "ahci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev wandboard_devs[] = {
- { "imxccm", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxocotp", 0 },
- { "imxuart", 0 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxenet", 0 },
- { "imxesdhc", 2 },
- { "imxesdhc", 0 },
- { "ehci", 0 },
- { "ahci", 0 }, /* only on quad, afaik. */
- { NULL, 0 }
-};
-
-struct board_dev *board_devs;
-struct imx_dev *imx_devs = NULL;
-
-struct imx_softc {
- struct device sc_dv;
-};
+#include <machine/bus.h>
-int imx_match(struct device *, void *, void *);
-void imx_attach(struct device *, struct device *, void *);
-int imx_submatch(struct device *, void *, void *);
+#include <armv7/armv7/armv7var.h>
struct cfattach imx_ca = {
- sizeof(struct imx_softc), imx_match, imx_attach, NULL,
+ sizeof(struct armv7_softc), armv7_match, armv7_attach, NULL,
config_activate_children
};
@@ -134,94 +32,3 @@ struct cfdriver imx_cd = {
NULL, "imx", DV_DULL
};
-int
-imx_match(struct device *parent, void *cfdata, void *aux)
-{
- return (1);
-}
-
-void
-imx_attach(struct device *parent, struct device *self, void *aux)
-{
- struct board_dev *bd;
-
- switch (board_id) {
- case BOARD_ID_IMX6_PHYFLEX:
- printf(": PhyFLEX-i.MX6\n");
- imx6_init();
- board_devs = phyflex_imx6_devs;
- break;
- case BOARD_ID_IMX6_SABRELITE:
- printf(": i.MX6 SABRE Lite\n");
- imx6_init();
- board_devs = sabrelite_devs;
- break;
- case BOARD_ID_IMX6_WANDBOARD:
- printf(": i.MX6 Wandboard\n");
- imx6_init();
- board_devs = wandboard_devs;
- break;
- default:
- printf("\n");
- panic("%s: board type 0x%x unknown", __func__, board_id);
- }
-
- /* Directly configure on-board devices (dev* in config file). */
- for (bd = board_devs; bd->name != NULL; bd++) {
- struct imx_dev *id = imx_find_dev(bd->name, bd->unit);
- struct imx_attach_args ia;
-
- if (id == NULL)
- printf("%s: device %s unit %d not found\n",
- self->dv_xname, bd->name, bd->unit);
-
- memset(&ia, 0, sizeof(ia));
- ia.ia_dev = id;
- ia.ia_iot = &armv7_bs_tag;
- ia.ia_dmat = &imx_bus_dma_tag;
-
- if (config_found_sm(self, &ia, NULL, imx_submatch) == NULL)
- printf("%s: device %s unit %d not configured\n",
- self->dv_xname, bd->name, bd->unit);
- }
-}
-
-/*
- * We do direct configuration of devices on this SoC "bus", so we
- * never call the child device's match function at all (it can be
- * NULL in the struct cfattach).
- */
-int
-imx_submatch(struct device *parent, void *child, void *aux)
-{
- struct cfdata *cf = child;
- struct imx_attach_args *ia = aux;
-
- if (strcmp(cf->cf_driver->cd_name, ia->ia_dev->name) == 0)
- return (1);
-
- /* "These are not the droids you are looking for." */
- return (0);
-}
-
-void
-imx_set_devs(struct imx_dev *devs)
-{
- imx_devs = devs;
-}
-
-struct imx_dev *
-imx_find_dev(const char *name, int unit)
-{
- struct imx_dev *id;
-
- if (imx_devs == NULL)
- panic("%s: imx_devs == NULL", __func__);
-
- for (id = imx_devs; id->name != NULL; id++) {
- if (id->unit == unit && strcmp(id->name, name) == 0)
- return (id);
- }
-
- return (NULL);
-}
diff --git a/sys/arch/armv7/imx/imx6.c b/sys/arch/armv7/imx/imx6.c
index 75e69a3aebd..5fa3ca01da2 100644
--- a/sys/arch/armv7/imx/imx6.c
+++ b/sys/arch/armv7/imx/imx6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imx6.c,v 1.1 2013/09/06 20:45:53 patrick Exp $ */
+/* $OpenBSD: imx6.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org>
* Copyright (c) 2012 Patrick Wildt <patrick@blueri.se>
@@ -22,7 +22,7 @@
#include <machine/bus.h>
#include <arch/arm/armv7/armv7var.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
/* IRQs are defined without the 32 cpu IRQs */
@@ -153,7 +153,7 @@
#define PCIE_IRQ2 122
#define PCIE_IRQ3 123
-struct imx_dev imx6_devs[] = {
+struct armv7_dev imx6_devs[] = {
/*
* Clock Control Module
@@ -341,5 +341,5 @@ struct imx_dev imx6_devs[] = {
void
imx6_init(void)
{
- imx_set_devs(imx6_devs);
+ armv7_set_devs(imx6_devs);
}
diff --git a/sys/arch/armv7/imx/imx_machdep.c b/sys/arch/armv7/imx/imx_machdep.c
index 081cc1e9cb6..2c25439e40c 100644
--- a/sys/arch/armv7/imx/imx_machdep.c
+++ b/sys/arch/armv7/imx/imx_machdep.c
@@ -28,7 +28,7 @@
#include <arm/cortex/smc.h>
#include <arm/armv7/armv7var.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/imx/imxuartvar.h>
#include <armv7/armv7/armv7_machdep.h>
diff --git a/sys/arch/armv7/imx/imxahci.c b/sys/arch/armv7/imx/imxahci.c
index ffe6f88845e..90e1042ae9d 100644
--- a/sys/arch/armv7/imx/imxahci.c
+++ b/sys/arch/armv7/imx/imxahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxahci.c,v 1.1 2013/09/06 20:45:53 patrick Exp $ */
+/* $OpenBSD: imxahci.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
*
@@ -27,7 +27,7 @@
#include <dev/ic/ahcivar.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/imx/imxccmvar.h>
#include <armv7/imx/imxiomuxcvar.h>
@@ -96,20 +96,20 @@ struct cfdriver imxahci_cd = {
void
imxahci_attach(struct device *parent, struct device *self, void *args)
{
- struct imx_attach_args *ia = args;
+ struct armv7_attach_args *aa = args;
struct imxahci_softc *imxsc = (struct imxahci_softc *) self;
struct ahci_softc *sc = &imxsc->sc;
uint32_t timeout = 0x100000;
- sc->sc_iot = ia->ia_iot;
- sc->sc_ios = ia->ia_dev->mem[0].size;
- sc->sc_dmat = ia->ia_dmat;
+ sc->sc_iot = aa->aa_iot;
+ sc->sc_ios = aa->aa_dev->mem[0].size;
+ sc->sc_dmat = aa->aa_dmat;
- if (bus_space_map(sc->sc_iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc_ioh))
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("imxahci_attach: bus_space_map failed!");
- sc->sc_ih = arm_intr_establish(ia->ia_dev->irq[0], IPL_BIO,
+ sc->sc_ih = arm_intr_establish(aa->aa_dev->irq[0], IPL_BIO,
ahci_intr, sc, sc->sc_dev.dv_xname);
if (sc->sc_ih == NULL) {
printf(": unable to establish interrupt\n");
diff --git a/sys/arch/armv7/imx/imxccm.c b/sys/arch/armv7/imx/imxccm.c
index dc2daee6e58..26dcc478a69 100644
--- a/sys/arch/armv7/imx/imxccm.c
+++ b/sys/arch/armv7/imx/imxccm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxccm.c,v 1.1 2013/09/06 20:45:53 patrick Exp $ */
+/* $OpenBSD: imxccm.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -26,7 +26,7 @@
#include <sys/timeout.h>
#include <machine/intr.h>
#include <machine/bus.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
/* registers */
#define CCM_CCR 0x00
@@ -222,13 +222,13 @@ struct cfdriver imxccm_cd = {
void
imxccm_attach(struct device *parent, struct device *self, void *args)
{
- struct imx_attach_args *ia = args;
+ struct armv7_attach_args *aa = args;
struct imxccm_softc *sc = (struct imxccm_softc *) self;
imxccm_sc = sc;
- sc->sc_iot = ia->ia_iot;
- if (bus_space_map(sc->sc_iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("imxccm_attach: bus_space_map failed!");
printf(": imx6 rev 1.%d CPU freq: %d MHz",
diff --git a/sys/arch/armv7/imx/imxdog.c b/sys/arch/armv7/imx/imxdog.c
index a6b32478d70..9498cbb9350 100644
--- a/sys/arch/armv7/imx/imxdog.c
+++ b/sys/arch/armv7/imx/imxdog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxdog.c,v 1.1 2013/09/06 20:45:53 patrick Exp $ */
+/* $OpenBSD: imxdog.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -25,7 +25,7 @@
#include <sys/timeout.h>
#include <machine/intr.h>
#include <machine/bus.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
/* registers */
#define WCR 0x00
@@ -56,12 +56,12 @@ struct cfdriver imxdog_cd = {
void
imxdog_attach(struct device *parent, struct device *self, void *args)
{
- struct imx_attach_args *ia = args;
+ struct armv7_attach_args *aa = args;
struct imxdog_softc *sc = (struct imxdog_softc *) self;
- sc->sc_iot = ia->ia_iot;
- if (bus_space_map(sc->sc_iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("imxdog_attach: bus_space_map failed!");
printf("\n");
diff --git a/sys/arch/armv7/imx/imxehci.c b/sys/arch/armv7/imx/imxehci.c
index 065316d4684..a6cd11c699c 100644
--- a/sys/arch/armv7/imx/imxehci.c
+++ b/sys/arch/armv7/imx/imxehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxehci.c,v 1.1 2013/09/06 20:45:53 patrick Exp $ */
+/* $OpenBSD: imxehci.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -30,7 +30,7 @@
#include <dev/usb/usbdivar.h>
#include <dev/usb/usb_mem.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/imx/imxccmvar.h>
#include <armv7/imx/imxgpiovar.h>
@@ -85,35 +85,35 @@ void
imxehci_attach(struct device *parent, struct device *self, void *aux)
{
struct imxehci_softc *sc = (struct imxehci_softc *)self;
- struct imx_attach_args *ia = aux;
+ struct armv7_attach_args *aa = aux;
usbd_status r;
char *devname = sc->sc.sc_bus.bdev.dv_xname;
- sc->sc.iot = ia->ia_iot;
- sc->sc.sc_bus.dmatag = ia->ia_dmat;
- sc->sc.sc_size = ia->ia_dev->mem[0].size;
+ sc->sc.iot = aa->aa_iot;
+ sc->sc.sc_bus.dmatag = aa->aa_dmat;
+ sc->sc.sc_size = aa->aa_dev->mem[0].size;
/* Map I/O space */
- if (bus_space_map(sc->sc.iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc.ioh)) {
+ if (bus_space_map(sc->sc.iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc.ioh)) {
printf(": cannot map mem space\n");
goto out;
}
- if (bus_space_map(sc->sc.iot, ia->ia_dev->mem[1].addr,
- ia->ia_dev->mem[1].size, 0, &sc->uh_ioh)) {
+ if (bus_space_map(sc->sc.iot, aa->aa_dev->mem[1].addr,
+ aa->aa_dev->mem[1].size, 0, &sc->uh_ioh)) {
printf(": cannot map mem space\n");
goto mem0;
}
- if (bus_space_map(sc->sc.iot, ia->ia_dev->mem[2].addr,
- ia->ia_dev->mem[2].size, 0, &sc->ph_ioh)) {
+ if (bus_space_map(sc->sc.iot, aa->aa_dev->mem[2].addr,
+ aa->aa_dev->mem[2].size, 0, &sc->ph_ioh)) {
printf(": cannot map mem space\n");
goto mem1;
}
- if (bus_space_map(sc->sc.iot, ia->ia_dev->mem[3].addr,
- ia->ia_dev->mem[3].size, 0, &sc->nc_ioh)) {
+ if (bus_space_map(sc->sc.iot, aa->aa_dev->mem[3].addr,
+ aa->aa_dev->mem[3].size, 0, &sc->nc_ioh)) {
printf(": cannot map mem space\n");
goto mem2;
}
@@ -191,7 +191,7 @@ imxehci_attach(struct device *parent, struct device *self, void *aux)
EOWRITE4(&sc->sc, EHCI_PORTSC(1),
EOREAD4(&sc->sc, EHCI_PORTSC(1)) & ~EHCI_PS_PTS_UTMI_MASK);
- sc->sc_ih = arm_intr_establish(ia->ia_dev->irq[0], IPL_USB,
+ sc->sc_ih = arm_intr_establish(aa->aa_dev->irq[0], IPL_USB,
ehci_intr, &sc->sc, devname);
if (sc->sc_ih == NULL) {
printf(": unable to establish interrupt\n");
@@ -214,11 +214,11 @@ intr:
arm_intr_disestablish(sc->sc_ih);
sc->sc_ih = NULL;
mem3:
- bus_space_unmap(sc->sc.iot, sc->nc_ioh, ia->ia_dev->mem[3].addr);
+ bus_space_unmap(sc->sc.iot, sc->nc_ioh, aa->aa_dev->mem[3].addr);
mem2:
- bus_space_unmap(sc->sc.iot, sc->ph_ioh, ia->ia_dev->mem[2].addr);
+ bus_space_unmap(sc->sc.iot, sc->ph_ioh, aa->aa_dev->mem[2].addr);
mem1:
- bus_space_unmap(sc->sc.iot, sc->uh_ioh, ia->ia_dev->mem[1].addr);
+ bus_space_unmap(sc->sc.iot, sc->uh_ioh, aa->aa_dev->mem[1].addr);
mem0:
bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
sc->sc.sc_size = 0;
diff --git a/sys/arch/armv7/imx/imxenet.c b/sys/arch/armv7/imx/imxenet.c
index c9745ca2669..49f70f579cf 100644
--- a/sys/arch/armv7/imx/imxenet.c
+++ b/sys/arch/armv7/imx/imxenet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxenet.c,v 1.3 2013/10/24 08:28:11 mpi Exp $ */
+/* $OpenBSD: imxenet.c,v 1.4 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -47,7 +47,7 @@
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/imx/imxenet.h>
#include <armv7/imx/imxccmvar.h>
#include <armv7/imx/imxgpiovar.h>
@@ -207,18 +207,18 @@ struct cfdriver imxenet_cd = {
void
imxenet_attach(struct device *parent, struct device *self, void *args)
{
- struct imx_attach_args *ia = args;
+ struct armv7_attach_args *aa = args;
struct imxenet_softc *sc = (struct imxenet_softc *) self;
struct mii_data *mii;
struct ifnet *ifp;
int tsize, rsize, tbsize, rbsize, s;
- sc->sc_iot = ia->ia_iot;
- if (bus_space_map(sc->sc_iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("imxenet_attach: bus_space_map failed!");
- sc->sc_dma_tag = ia->ia_dmat;
+ sc->sc_dma_tag = aa->aa_dmat;
/* power it up */
imxccm_enable_enet();
@@ -242,7 +242,7 @@ imxenet_attach(struct device *parent, struct device *self, void *args)
HWRITE4(sc, ENET_EIMR, 0);
HWRITE4(sc, ENET_EIR, 0xffffffff);
- sc->sc_ih = arm_intr_establish(ia->ia_dev->irq[0], IPL_NET,
+ sc->sc_ih = arm_intr_establish(aa->aa_dev->irq[0], IPL_NET,
imxenet_intr, sc, sc->sc_dev.dv_xname);
tsize = ENET_MAX_TXD * sizeof(struct imxenet_buf_desc);
@@ -342,7 +342,7 @@ rxdma:
txdma:
imxenet_dma_free(sc, &sc->txdma);
bad:
- bus_space_unmap(sc->sc_iot, sc->sc_ioh, ia->ia_dev->mem[0].size);
+ bus_space_unmap(sc->sc_iot, sc->sc_ioh, aa->aa_dev->mem[0].size);
}
void
diff --git a/sys/arch/armv7/imx/imxesdhc.c b/sys/arch/armv7/imx/imxesdhc.c
index cafeadd69e0..24e51eef646 100644
--- a/sys/arch/armv7/imx/imxesdhc.c
+++ b/sys/arch/armv7/imx/imxesdhc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxesdhc.c,v 1.3 2013/10/27 20:27:09 aalm Exp $ */
+/* $OpenBSD: imxesdhc.c,v 1.4 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -31,7 +31,7 @@
#include <dev/sdmmc/sdmmcchip.h>
#include <dev/sdmmc/sdmmcvar.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/imx/imxccmvar.h>
#include <armv7/imx/imxgpiovar.h>
@@ -244,22 +244,22 @@ void
imxesdhc_attach(struct device *parent, struct device *self, void *args)
{
struct imxesdhc_softc *sc = (struct imxesdhc_softc *) self;
- struct imx_attach_args *ia = args;
+ struct armv7_attach_args *aa = args;
struct sdmmcbus_attach_args saa;
int error = 1;
uint32_t caps;
- sc->unit = ia->ia_dev->unit;
- sc->sc_iot = ia->ia_iot;
- if (bus_space_map(sc->sc_iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->unit = aa->aa_dev->unit;
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("imxesdhc_attach: bus_space_map failed!");
printf("\n");
/* XXX DMA channels? */
- sc->sc_ih = arm_intr_establish(ia->ia_dev->irq[0], IPL_SDMMC,
+ sc->sc_ih = arm_intr_establish(aa->aa_dev->irq[0], IPL_SDMMC,
imxesdhc_intr, sc, sc->sc_dev.dv_xname);
/*
@@ -274,7 +274,7 @@ imxesdhc_attach(struct device *parent, struct device *self, void *args)
/*
* Determine the base clock frequency. (2.2.24)
*/
- sc->clkbase = imxccm_get_usdhx(ia->ia_dev->unit + 1);
+ sc->clkbase = imxccm_get_usdhx(aa->aa_dev->unit + 1);
/*
* Determine SD bus voltage levels supported by the controller.
diff --git a/sys/arch/armv7/imx/imxgpio.c b/sys/arch/armv7/imx/imxgpio.c
index a1a447fd3bf..9b23e89b237 100644
--- a/sys/arch/armv7/imx/imxgpio.c
+++ b/sys/arch/armv7/imx/imxgpio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxgpio.c,v 1.2 2013/10/19 19:45:17 patrick Exp $ */
+/* $OpenBSD: imxgpio.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
@@ -28,7 +28,7 @@
#include <machine/bus.h>
#include <machine/intr.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/imx/imxgpiovar.h>
/* iMX6 registers */
@@ -114,12 +114,12 @@ imxgpio_match(struct device *parent, void *v, void *aux)
void
imxgpio_attach(struct device *parent, struct device *self, void *args)
{
- struct imx_attach_args *ia = args;
+ struct armv7_attach_args *aa = args;
struct imxgpio_softc *sc = (struct imxgpio_softc *) self;
- sc->sc_iot = ia->ia_iot;
- if (bus_space_map(sc->sc_iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("imxgpio_attach: bus_space_map failed!");
diff --git a/sys/arch/armv7/imx/imxiic.c b/sys/arch/armv7/imx/imxiic.c
index 5997967bc0d..ab5fd06f3ce 100644
--- a/sys/arch/armv7/imx/imxiic.c
+++ b/sys/arch/armv7/imx/imxiic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxiic.c,v 1.1 2013/09/06 20:45:53 patrick Exp $ */
+/* $OpenBSD: imxiic.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
*
@@ -23,7 +23,7 @@
#include <sys/systm.h>
#include <machine/bus.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/imx/imxiomuxcvar.h>
#include <armv7/imx/imxccmvar.h>
#include <armv7/imx/imxiicvar.h>
@@ -98,17 +98,17 @@ void
imxiic_attach(struct device *parent, struct device *self, void *args)
{
struct imxiic_softc *sc = (struct imxiic_softc *)self;
- struct imx_attach_args *ia = args;
+ struct armv7_attach_args *aa = args;
- sc->sc_iot = ia->ia_iot;
- sc->sc_ios = ia->ia_dev->mem[0].size;
- sc->unit = ia->ia_dev->unit;
- if (bus_space_map(sc->sc_iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ sc->sc_ios = aa->aa_dev->mem[0].size;
+ sc->unit = aa->aa_dev->unit;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("imxiic_attach: bus_space_map failed!");
#if 0
- sc->sc_ih = arm_intr_establish(ia->ia_dev->irq[0], IPL_BIO,
+ sc->sc_ih = arm_intr_establish(aa->aa_dev->irq[0], IPL_BIO,
imxiic_intr, sc, sc->sc_dev.dv_xname);
#endif
diff --git a/sys/arch/armv7/imx/imxiomuxc.c b/sys/arch/armv7/imx/imxiomuxc.c
index f1ec2a1b8a9..d58e8b80f48 100644
--- a/sys/arch/armv7/imx/imxiomuxc.c
+++ b/sys/arch/armv7/imx/imxiomuxc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxiomuxc.c,v 1.1 2013/09/06 20:45:54 patrick Exp $ */
+/* $OpenBSD: imxiomuxc.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
*
@@ -25,7 +25,7 @@
#include <sys/timeout.h>
#include <machine/intr.h>
#include <machine/bus.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
/* registers */
#define IOMUXC_GPR1 0x004
@@ -145,12 +145,12 @@ struct cfdriver imxiomuxc_cd = {
void
imxiomuxc_attach(struct device *parent, struct device *self, void *args)
{
- struct imx_attach_args *ia = args;
+ struct armv7_attach_args *aa = args;
struct imxiomuxc_softc *sc = (struct imxiomuxc_softc *) self;
- sc->sc_iot = ia->ia_iot;
- if (bus_space_map(sc->sc_iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("imxiomuxc_attach: bus_space_map failed!");
printf("\n");
diff --git a/sys/arch/armv7/imx/imxocotp.c b/sys/arch/armv7/imx/imxocotp.c
index 0e4ce9d7305..f9d78811c68 100644
--- a/sys/arch/armv7/imx/imxocotp.c
+++ b/sys/arch/armv7/imx/imxocotp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxocotp.c,v 1.1 2013/09/06 20:45:54 patrick Exp $ */
+/* $OpenBSD: imxocotp.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -26,7 +26,7 @@
#include <machine/intr.h>
#include <machine/bus.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/imx/imxocotpvar.h>
/* registers */
@@ -54,12 +54,12 @@ struct cfdriver imxocotp_cd = {
void
imxocotp_attach(struct device *parent, struct device *self, void *args)
{
- struct imx_attach_args *ia = args;
+ struct armv7_attach_args *aa = args;
struct imxocotp_softc *sc = (struct imxocotp_softc *) self;
- sc->sc_iot = ia->ia_iot;
- if (bus_space_map(sc->sc_iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("imxocotp_attach: bus_space_map failed!");
printf("\n");
diff --git a/sys/arch/armv7/imx/imxuart.c b/sys/arch/armv7/imx/imxuart.c
index 4e895b465fe..2aa2e394967 100644
--- a/sys/arch/armv7/imx/imxuart.c
+++ b/sys/arch/armv7/imx/imxuart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxuart.c,v 1.1 2013/09/06 20:45:54 patrick Exp $ */
+/* $OpenBSD: imxuart.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2005 Dale Rahn <drahn@motorola.com>
*
@@ -39,7 +39,7 @@
#include <machine/bus.h>
#include <armv7/imx/imxuartreg.h>
#include <armv7/imx/imxuartvar.h>
-#include <armv7/imx/imxvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/imx/imxccmvar.h>
#define DEVUNIT(x) (minor(x) & 0x7f)
@@ -136,18 +136,18 @@ struct cdevsw imxuartdev =
void
imxuartattach(struct device *parent, struct device *self, void *args)
{
- struct imx_attach_args *ia = args;
+ struct armv7_attach_args *aa = args;
struct imxuart_softc *sc = (struct imxuart_softc *) self;
- sc->sc_irq = arm_intr_establish(ia->ia_dev->irq[0], IPL_TTY,
+ sc->sc_irq = arm_intr_establish(aa->aa_dev->irq[0], IPL_TTY,
imxuart_intr, sc, sc->sc_dev.dv_xname);
- sc->sc_iot = ia->ia_iot;
- if (bus_space_map(sc->sc_iot, ia->ia_dev->mem[0].addr,
- ia->ia_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("imxuartattach: bus_space_map failed!");
- if (ia->ia_dev->mem[0].addr == imxuartconsaddr)
+ if (aa->aa_dev->mem[0].addr == imxuartconsaddr)
printf(" console");
timeout_set(&sc->sc_diag_tmo, imxuart_diag, sc);
diff --git a/sys/arch/armv7/imx/imxvar.h b/sys/arch/armv7/imx/imxvar.h
index df1ec551060..e69de29bb2d 100644
--- a/sys/arch/armv7/imx/imxvar.h
+++ b/sys/arch/armv7/imx/imxvar.h
@@ -1,56 +0,0 @@
-/* $OpenBSD: imxvar.h,v 1.2 2013/10/05 23:05:12 patrick Exp $ */
-/*
- * Copyright (c) 2005,2008 Dale Rahn <drahn@drahn.com>
- * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* Physical memory range for on-chip devices. */
-struct imx_mem {
- u_int32_t addr; /* physical start address */
- u_int32_t size; /* size of range in bytes */
-};
-
-#define IMX_DEV_NMEM 6 /* number of memory ranges */
-#define IMX_DEV_NIRQ 4 /* number of IRQs per device */
-
-/* Descriptor for all on-chip devices. */
-struct imx_dev {
- char *name; /* driver name or made up name */
- int unit; /* driver instance number or -1 */
- struct imx_mem mem[IMX_DEV_NMEM]; /* memory ranges */
- int irq[IMX_DEV_NIRQ]; /* IRQ number(s) */
-};
-
-/* Passed as third arg to attach functions. */
-struct imx_attach_args {
- struct imx_dev *ia_dev;
- bus_space_tag_t ia_iot;
- bus_dma_tag_t ia_dmat;
-};
-
-void imx_set_devs(struct imx_dev *);
-struct imx_dev *imx_find_dev(const char *, int);
-
-void imx6_init(void);
-
-/* XXX */
-void *avic_intr_establish(int irqno, int level, int (*func)(void *),
- void *arg, char *name);
-
-/* board identification - from uboot */
-#define BOARD_ID_IMX6_PHYFLEX 3529
-#define BOARD_ID_IMX6_SABRELITE 3769
-#define BOARD_ID_IMX6_WANDBOARD 4412
-extern uint32_t board_id;
diff --git a/sys/arch/armv7/omap/am335x.c b/sys/arch/armv7/omap/am335x.c
index 6cb7e286a9e..24302ba11af 100644
--- a/sys/arch/armv7/omap/am335x.c
+++ b/sys/arch/armv7/omap/am335x.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: am335x.c,v 1.4 2013/10/18 15:23:58 syl Exp $ */
+/* $OpenBSD: am335x.c,v 1.5 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org>
@@ -21,7 +21,7 @@
#include <sys/param.h>
#include <machine/bus.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#define PRCM_SIZE 0x2000
#define PRCM_ADDR 0x44E00000
@@ -97,7 +97,7 @@
#define CPSW_ADDR 0x4A100000
#define CPSW_IRQ 40
-struct omap_dev am335x_devs[] = {
+struct armv7_dev am335x_devs[] = {
/*
* Power, Reset and Clock Manager
@@ -202,5 +202,5 @@ struct omap_dev am335x_devs[] = {
void
am335x_init(void)
{
- omap_set_devs(am335x_devs);
+ armv7_set_devs(am335x_devs);
}
diff --git a/sys/arch/armv7/omap/dmtimer.c b/sys/arch/armv7/omap/dmtimer.c
index 7eb7b2a70f8..e7dd984e335 100644
--- a/sys/arch/armv7/omap/dmtimer.c
+++ b/sys/arch/armv7/omap/dmtimer.c
@@ -32,7 +32,7 @@
#include <sys/timetc.h>
#include <dev/clock_subr.h>
#include <machine/bus.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/omap/prcmvar.h>
#include <machine/intr.h>
@@ -145,23 +145,23 @@ void
dmtimer_attach(struct device *parent, struct device *self, void *args)
{
struct dmtimer_softc *sc = (struct dmtimer_softc *)self;
- struct omap_attach_args *oa = args;
+ struct armv7_attach_args *aa = args;
bus_space_handle_t ioh;
u_int32_t rev, cfg;
- sc->sc_iot = oa->oa_iot;
+ sc->sc_iot = aa->aa_iot;
- if (bus_space_map(sc->sc_iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &ioh))
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &ioh))
panic("%s: bus_space_map failed!\n", __func__);
-
+
prcm_setclock(1, PRCM_CLK_SPEED_32);
prcm_setclock(2, PRCM_CLK_SPEED_32);
prcm_enablemodule(PRCM_TIMER2);
prcm_enablemodule(PRCM_TIMER3);
-
- /* reset */
+
+ /* reset */
bus_space_write_4(sc->sc_iot, ioh, DM_TIOCP_CFG,
DM_TIOCP_CFG_SOFTRESET);
while (bus_space_read_4(sc->sc_iot, ioh, DM_TIOCP_CFG)
@@ -170,7 +170,7 @@ dmtimer_attach(struct device *parent, struct device *self, void *args)
if (self->dv_unit == 0) {
dmtimer_ioh0 = ioh;
- dmtimer_irq = oa->oa_dev->irq[0];
+ dmtimer_irq = aa->aa_dev->irq[0];
/* enable write posted mode */
bus_space_write_4(sc->sc_iot, ioh, DM_TSICR, DM_TSICR_POSTED);
/* stop timer */
@@ -186,7 +186,7 @@ dmtimer_attach(struct device *parent, struct device *self, void *args)
bus_space_write_4(sc->sc_iot, ioh, DM_TLDR, 0);
bus_space_write_4(sc->sc_iot, ioh, DM_TCLR,
DM_TCLR_AR | DM_TCLR_ST);
-
+
dmtimer_timecounter.tc_frequency = TIMER_FREQUENCY;
dmtimer_timecounter.tc_priv = sc;
tc_init(&dmtimer_timecounter);
@@ -195,7 +195,7 @@ dmtimer_attach(struct device *parent, struct device *self, void *args)
}
else
panic("attaching too many dmtimers at 0x%x",
- oa->oa_dev->mem[0].addr);
+ aa->aa_dev->mem[0].addr);
/* set IDLEMODE to smart-idle */
cfg = bus_space_read_4(sc->sc_iot, ioh, DM_TIOCP_CFG);
@@ -206,7 +206,7 @@ dmtimer_attach(struct device *parent, struct device *self, void *args)
printf(" rev %d.%d\n", (rev & DM_TIDR_MAJOR) >> 8, rev & DM_TIDR_MINOR);
}
-/*
+/*
* See comment in arm/xscale/i80321_clock.c
*
* Counter is count up, but with autoreload timers it is not possible
diff --git a/sys/arch/armv7/omap/edma.c b/sys/arch/armv7/omap/edma.c
index 3a86160013e..bf860ae066c 100644
--- a/sys/arch/armv7/omap/edma.c
+++ b/sys/arch/armv7/omap/edma.c
@@ -21,7 +21,7 @@
#include <machine/bus.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/omap/prcmvar.h>
#include <armv7/omap/edmavar.h>
@@ -92,16 +92,16 @@ struct cfdriver edma_cd = {
void
edma_attach(struct device *parent, struct device *self, void *aux)
{
- struct omap_attach_args *oaa = aux;
+ struct armv7_attach_args *aa = aux;
struct edma_softc *sc = (struct edma_softc *)self;
uint32_t rev;
int i;
- sc->sc_iot = oaa->oa_iot;
+ sc->sc_iot = aa->aa_iot;
/* Map Base address for TPCC and TPCTX */
- if (bus_space_map(sc->sc_iot, oaa->oa_dev->mem[0].addr,
- oaa->oa_dev->mem[0].size, 0, &sc->sc_tpcc)) {
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_tpcc)) {
printf("%s: bus_space_map failed for TPCC\n", DEVNAME(sc));
return ;
}
@@ -115,12 +115,12 @@ edma_attach(struct device *parent, struct device *self, void *aux)
/* XXX IPL_VM ? */
/* Enable interrupts line */
- sc->sc_ih_comp = arm_intr_establish(oaa->oa_dev->irq[0], IPL_VM,
+ sc->sc_ih_comp = arm_intr_establish(aa->aa_dev->irq[0], IPL_VM,
edma_comp_intr, sc, DEVNAME(sc));
if (sc->sc_ih_comp == NULL) {
printf("%s: unable to establish interrupt comp\n", DEVNAME(sc));
bus_space_unmap(sc->sc_iot, sc->sc_tpcc,
- oaa->oa_dev->mem[0].size);
+ aa->aa_dev->mem[0].size);
return ;
}
diff --git a/sys/arch/armv7/omap/files.omap b/sys/arch/armv7/omap/files.omap
index 63f73f2e35b..337c558c65d 100644
--- a/sys/arch/armv7/omap/files.omap
+++ b/sys/arch/armv7/omap/files.omap
@@ -1,13 +1,13 @@
-# $OpenBSD: files.omap,v 1.3 2013/11/04 20:14:16 syl Exp $
+# $OpenBSD: files.omap,v 1.4 2013/11/06 19:03:07 syl Exp $
define omap {}
device omap: omap
attach omap at mainbus
file arch/armv7/omap/omap_machdep.c omap
file arch/armv7/omap/omap.c omap
-file arch/armv7/omap/omap3.c omap
-file arch/armv7/omap/omap4.c omap
-file arch/armv7/omap/am335x.c omap
+file arch/armv7/omap/omap3.c
+file arch/armv7/omap/omap4.c
+file arch/armv7/omap/am335x.c
device ommmc: sdmmcbus
attach ommmc at omap
diff --git a/sys/arch/armv7/omap/gptimer.c b/sys/arch/armv7/omap/gptimer.c
index 6741766e4f8..59874c0ffc7 100644
--- a/sys/arch/armv7/omap/gptimer.c
+++ b/sys/arch/armv7/omap/gptimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gptimer.c,v 1.1 2013/09/04 14:38:30 patrick Exp $ */
+/* $OpenBSD: gptimer.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -31,7 +31,7 @@
#include <sys/timetc.h>
#include <dev/clock_subr.h>
#include <machine/bus.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/omap/prcmvar.h>
#include <machine/intr.h>
@@ -140,13 +140,13 @@ struct cfdriver gptimer_cd = {
void
gptimer_attach(struct device *parent, struct device *self, void *args)
{
- struct omap_attach_args *oa = args;
+ struct armv7_attach_args *aa = args;
bus_space_handle_t ioh;
u_int32_t rev;
- gptimer_iot = oa->oa_iot;
- if (bus_space_map(gptimer_iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &ioh))
+ gptimer_iot = aa->aa_iot;
+ if (bus_space_map(gptimer_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &ioh))
panic("gptimer_attach: bus_space_map failed!");
rev = bus_space_read_4(gptimer_iot, ioh, GP_TIDR);
@@ -154,7 +154,7 @@ gptimer_attach(struct device *parent, struct device *self, void *args)
printf(" rev %d.%d\n", rev >> 4 & 0xf, rev & 0xf);
if (self->dv_unit == 0) {
gptimer_ioh0 = ioh;
- gptimer_irq = oa->oa_dev->irq[0];
+ gptimer_irq = aa->aa_dev->irq[0];
bus_space_write_4(gptimer_iot, gptimer_ioh0, GP_TCLR, 0);
} else if (self->dv_unit == 1) {
/* start timer because it is used in delay */
@@ -172,7 +172,7 @@ gptimer_attach(struct device *parent, struct device *self, void *args)
}
else
panic("attaching too many gptimers at 0x%x",
- oa->oa_dev->mem[0].addr);
+ aa->aa_dev->mem[0].addr);
arm_clock_register(gptimer_cpu_initclocks, gptimer_delay,
gptimer_setstatclockrate, NULL);
diff --git a/sys/arch/armv7/omap/if_cpsw.c b/sys/arch/armv7/omap/if_cpsw.c
index e6f5b9f27b5..a8c361ecc33 100644
--- a/sys/arch/armv7/omap/if_cpsw.c
+++ b/sys/arch/armv7/omap/if_cpsw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cpsw.c,v 1.18 2013/09/12 10:28:03 dlg Exp $ */
+/* $OpenBSD: if_cpsw.c,v 1.19 2013/11/06 19:03:07 syl Exp $ */
/* $NetBSD: if_cpsw.c,v 1.3 2013/04/17 14:36:34 bouyer Exp $ */
/*
@@ -80,7 +80,7 @@
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <arch/armv7/omap/omapvar.h>
+#include <arch/armv7/armv7/armv7var.h>
#include <arch/armv7/omap/sitara_cm.h>
#include <arch/armv7/omap/if_cpswreg.h>
@@ -323,7 +323,7 @@ void
cpsw_attach(struct device *parent, struct device *self, void *aux)
{
struct cpsw_softc *sc = (struct cpsw_softc *)self;
- struct omap_attach_args *oa = aux;
+ struct armv7_attach_args *aa = aux;
struct arpcom * const ac = &sc->sc_ac;
struct ifnet * const ifp = &ac->ac_if;
u_int32_t idver;
@@ -334,26 +334,26 @@ cpsw_attach(struct device *parent, struct device *self, void *aux)
cpsw_get_mac_addr(sc);
- sc->sc_rxthih = arm_intr_establish(oa->oa_dev->irq[0] +
+ sc->sc_rxthih = arm_intr_establish(aa->aa_dev->irq[0] +
CPSW_INTROFF_RXTH, IPL_NET, cpsw_rxthintr, sc, DEVNAME(sc));
- sc->sc_rxih = arm_intr_establish(oa->oa_dev->irq[0] +
+ sc->sc_rxih = arm_intr_establish(aa->aa_dev->irq[0] +
CPSW_INTROFF_RX, IPL_NET, cpsw_rxintr, sc, DEVNAME(sc));
- sc->sc_txih = arm_intr_establish(oa->oa_dev->irq[0] +
+ sc->sc_txih = arm_intr_establish(aa->aa_dev->irq[0] +
CPSW_INTROFF_TX, IPL_NET, cpsw_txintr, sc, DEVNAME(sc));
- sc->sc_miscih = arm_intr_establish(oa->oa_dev->irq[0] +
+ sc->sc_miscih = arm_intr_establish(aa->aa_dev->irq[0] +
CPSW_INTROFF_MISC, IPL_NET, cpsw_miscintr, sc, DEVNAME(sc));
- sc->sc_bst = oa->oa_iot;
- sc->sc_bdt = oa->oa_dmat;
+ sc->sc_bst = aa->aa_iot;
+ sc->sc_bdt = aa->aa_dmat;
- error = bus_space_map(sc->sc_bst, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &sc->sc_bsh);
+ error = bus_space_map(sc->sc_bst, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_bsh);
if (error) {
printf("can't map registers: %d\n", error);
return;
}
- sc->sc_txdescs_pa = oa->oa_dev->mem[0].addr +
+ sc->sc_txdescs_pa = aa->aa_dev->mem[0].addr +
CPSW_CPPI_RAM_TXDESCS_BASE;
error = bus_space_subregion(sc->sc_bst, sc->sc_bsh,
CPSW_CPPI_RAM_TXDESCS_BASE, CPSW_CPPI_RAM_TXDESCS_SIZE,
@@ -363,7 +363,7 @@ cpsw_attach(struct device *parent, struct device *self, void *aux)
return;
}
- sc->sc_rxdescs_pa = oa->oa_dev->mem[0].addr +
+ sc->sc_rxdescs_pa = aa->aa_dev->mem[0].addr +
CPSW_CPPI_RAM_RXDESCS_BASE;
error = bus_space_subregion(sc->sc_bst, sc->sc_bsh,
CPSW_CPPI_RAM_RXDESCS_BASE, CPSW_CPPI_RAM_RXDESCS_SIZE,
diff --git a/sys/arch/armv7/omap/intc.c b/sys/arch/armv7/omap/intc.c
index 2e515a54b16..82971096c82 100644
--- a/sys/arch/armv7/omap/intc.c
+++ b/sys/arch/armv7/omap/intc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intc.c,v 1.1 2013/09/04 14:38:30 patrick Exp $ */
+/* $OpenBSD: intc.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -22,7 +22,7 @@
#include <sys/device.h>
#include <sys/evcount.h>
#include <machine/bus.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include "intc.h"
#define INTC_NUM_IRQ intc_nirq
@@ -113,13 +113,13 @@ int intc_attached = 0;
void
intc_attach(struct device *parent, struct device *self, void *args)
{
- struct omap_attach_args *oa = args;
+ struct armv7_attach_args *aa = args;
int i;
u_int32_t rev;
- intc_iot = oa->oa_iot;
- if (bus_space_map(intc_iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &intc_ioh))
+ 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))
panic("intc_attach: bus_space_map failed!");
rev = bus_space_read_4(intc_iot, intc_ioh, INTC_REVISION);
diff --git a/sys/arch/armv7/omap/omap.c b/sys/arch/armv7/omap/omap.c
index d92b0ada21d..56e0cc2efe2 100644
--- a/sys/arch/armv7/omap/omap.c
+++ b/sys/arch/armv7/omap/omap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omap.c,v 1.3 2013/10/10 19:40:02 syl Exp $ */
+/* $OpenBSD: omap.c,v 1.4 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
*
@@ -17,218 +17,16 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/reboot.h>
-#define _ARM32_BUS_DMA_PRIVATE
-#include <machine/bus.h>
-#include <arch/arm/armv7/armv7var.h>
-#include <armv7/omap/omapvar.h>
-
-struct arm32_bus_dma_tag omap_bus_dma_tag = {
- 0,
- 0,
- NULL,
- _bus_dmamap_create,
- _bus_dmamap_destroy,
- _bus_dmamap_load,
- _bus_dmamap_load_mbuf,
- _bus_dmamap_load_uio,
- _bus_dmamap_load_raw,
- _bus_dmamap_unload,
- _bus_dmamap_sync,
- _bus_dmamem_alloc,
- _bus_dmamem_free,
- _bus_dmamem_map,
- _bus_dmamem_unmap,
- _bus_dmamem_mmap,
-};
-
-struct board_dev {
- char *name;
- int unit;
-};
-
-struct board_dev beagleboard_devs[] = {
- { "prcm", 0 },
- { "intc", 0 },
- { "gptimer", 0 },
- { "gptimer", 1 },
- { "omdog", 0 },
- { "omgpio", 0 },
- { "omgpio", 1 },
- { "omgpio", 2 },
- { "omgpio", 3 },
- { "omgpio", 4 },
- { "omgpio", 5 },
- { "ommmc", 0 }, /* HSMMC1 */
- { "com", 2 }, /* UART3 */
- { NULL, 0 }
-};
-
-struct board_dev beaglebone_devs[] = {
- { "prcm", 0 },
- { "sitaracm", 0 },
- { "intc", 0 },
- { "edma", 0 },
- { "dmtimer", 0 },
- { "dmtimer", 1 },
- { "omdog", 0 },
- { "ommmc", 0 }, /* HSMMC0 */
- { "ommmc", 1 }, /* HSMMC1 */
- { "com", 0 }, /* UART0 */
- { "cpsw", 0 },
- { NULL, 0 }
-};
-struct board_dev overo_devs[] = {
- { "prcm", 0 },
- { "intc", 0 },
- { "gptimer", 0 },
- { "gptimer", 1 },
- { "omdog", 0 },
- { "omgpio", 0 },
- { "omgpio", 1 },
- { "omgpio", 2 },
- { "omgpio", 3 },
- { "omgpio", 4 },
- { "omgpio", 5 },
- { "ommmc", 0 }, /* HSMMC1 */
- { "com", 2 }, /* UART3 */
- { NULL, 0 }
-};
-
-struct board_dev pandaboard_devs[] = {
- { "omapid", 0 },
- { "prcm", 0 },
- { "omdog", 0 },
- { "omgpio", 0 },
- { "omgpio", 1 },
- { "omgpio", 2 },
- { "omgpio", 3 },
- { "omgpio", 4 },
- { "omgpio", 5 },
- { "ommmc", 0 }, /* HSMMC1 */
- { "com", 2 }, /* UART3 */
- { "ehci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev *board_devs;
-
-struct omap_dev *omap_devs = NULL;
-
-struct omap_softc {
- struct device sc_dv;
-};
+#include <machine/bus.h>
-int omap_match(struct device *, void *, void *);
-void omap_attach(struct device *, struct device *, void *);
-int omap_submatch(struct device *, void *, void *);
+#include <armv7/armv7/armv7var.h>
struct cfattach omap_ca = {
- sizeof(struct omap_softc), omap_match, omap_attach
+ sizeof(struct armv7_softc), armv7_match, armv7_attach
};
struct cfdriver omap_cd = {
NULL, "omap", DV_DULL
};
-int
-omap_match(struct device *parent, void *cfdata, void *aux)
-{
- return (1);
-}
-
-void
-omap_attach(struct device *parent, struct device *self, void *aux)
-{
- struct board_dev *bd;
-
- switch (board_id) {
- case BOARD_ID_OMAP3_BEAGLE:
- printf(": BeagleBoard\n");
- omap3_init();
- board_devs = beagleboard_devs;
- break;
- case BOARD_ID_AM335X_BEAGLEBONE:
- printf(": BeagleBone\n");
- am335x_init();
- board_devs = beaglebone_devs;
- break;
- case BOARD_ID_OMAP3_OVERO:
- printf(": Gumstix Overo\n");
- omap3_init();
- board_devs = overo_devs;
- break;
- case BOARD_ID_OMAP4_PANDA:
- printf(": PandaBoard\n");
- omap4_init();
- board_devs = pandaboard_devs;
- break;
- default:
- printf("\n");
- panic("%s: board type 0x%x unknown", __func__, board_id);
- }
-
- /* Directly configure on-board devices (dev* in config file). */
- for (bd = board_devs; bd->name != NULL; bd++) {
- struct omap_dev *od = omap_find_dev(bd->name, bd->unit);
- struct omap_attach_args oa;
-
- if (od == NULL) {
- printf("%s: device %s unit %d not found\n",
- self->dv_xname, bd->name, bd->unit);
- continue;
- }
-
- memset(&oa, 0, sizeof(oa));
- oa.oa_dev = od;
- oa.oa_iot = &armv7_bs_tag;
- oa.oa_dmat = &omap_bus_dma_tag;
-
- if (config_found_sm(self, &oa, NULL, omap_submatch) == NULL)
- printf("%s: device %s unit %d not configured\n",
- self->dv_xname, bd->name, bd->unit);
- }
-}
-
-/*
- * We do direct configuration of devices on this SoC "bus", so we
- * never call the child device's match function at all (it can be
- * NULL in the struct cfattach).
- */
-int
-omap_submatch(struct device *parent, void *child, void *aux)
-{
- struct cfdata *cf = child;
- struct omap_attach_args *oa = aux;
-
- if (strcmp(cf->cf_driver->cd_name, oa->oa_dev->name) == 0)
- return (1);
-
- /* "These are not the droids you are looking for." */
- return (0);
-}
-
-void
-omap_set_devs(struct omap_dev *devs)
-{
- omap_devs = devs;
-}
-
-struct omap_dev *
-omap_find_dev(const char *name, int unit)
-{
- struct omap_dev *od;
-
- if (omap_devs == NULL)
- panic("%s: omap_devs == NULL", __func__);
-
- for (od = omap_devs; od->name != NULL; od++) {
- if (od->unit == unit && strcmp(od->name, name) == 0)
- return (od);
- }
-
- return (NULL);
-}
diff --git a/sys/arch/armv7/omap/omap3.c b/sys/arch/armv7/omap/omap3.c
index 913770fff24..bf2feb5fa85 100644
--- a/sys/arch/armv7/omap/omap3.c
+++ b/sys/arch/armv7/omap/omap3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omap3.c,v 1.1 2013/09/04 14:38:30 patrick Exp $ */
+/* $OpenBSD: omap3.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org>
@@ -21,7 +21,7 @@
#include <machine/bus.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#define PRCM_ADDR 0x48004000
#define PRCM_SIZE 0x2000
@@ -69,7 +69,7 @@
#define USBTLL_ADDR 0x48062000
#define USBTLL_SIZE 0x1000
-struct omap_dev omap3_devs[] = {
+struct armv7_dev omap3_devs[] = {
/*
* Power, Reset and Clock Manager
@@ -192,5 +192,5 @@ struct omap_dev omap3_devs[] = {
void
omap3_init(void)
{
- omap_set_devs(omap3_devs);
+ armv7_set_devs(omap3_devs);
}
diff --git a/sys/arch/armv7/omap/omap4.c b/sys/arch/armv7/omap/omap4.c
index 0fa2790b302..5cd1b81dc33 100644
--- a/sys/arch/armv7/omap/omap4.c
+++ b/sys/arch/armv7/omap/omap4.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omap4.c,v 1.2 2013/10/18 15:23:58 syl Exp $ */
+/* $OpenBSD: omap4.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org>
@@ -19,10 +19,10 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
+
#include <machine/bus.h>
-#include <arch/arm/armv7/armv7var.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#define OMAPID_ADDR 0x4a002000
#define OMAPID_SIZE 0x1000
@@ -81,7 +81,7 @@
#define USBOHCI_SIZE 0x400
#define USBEHCI_IRQ 77
-struct omap_dev omap4_devs[] = {
+struct armv7_dev omap4_devs[] = {
/*
* Power, Reset and Clock Manager
@@ -196,5 +196,5 @@ struct omap_dev omap4_devs[] = {
void
omap4_init(void)
{
- omap_set_devs(omap4_devs);
+ armv7_set_devs(omap4_devs);
}
diff --git a/sys/arch/armv7/omap/omap_com.c b/sys/arch/armv7/omap/omap_com.c
index 8700000d6a5..9a3a94c4f20 100644
--- a/sys/arch/armv7/omap/omap_com.c
+++ b/sys/arch/armv7/omap/omap_com.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omap_com.c,v 1.1 2013/09/04 14:38:31 patrick Exp $ */
+/* $OpenBSD: omap_com.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
* All rights reserved.
@@ -48,7 +48,7 @@
/* pick up armv7_a4x_bs_tag */
#include <arch/arm/armv7/armv7var.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#define com_isr 8
#define ISR_RECV (ISR_RXPL | ISR_XMODE | ISR_RCVEIR)
@@ -57,7 +57,7 @@ void omapuart_attach(struct device *, struct device *, void *);
int omapuart_activate(struct device *, int);
struct cfattach com_omap_ca = {
- sizeof (struct com_softc), NULL, omapuart_attach, NULL,
+ sizeof (struct com_softc), NULL, omapuart_attach, NULL,
omapuart_activate
};
@@ -65,22 +65,22 @@ void
omapuart_attach(struct device *parent, struct device *self, void *aux)
{
struct com_softc *sc = (struct com_softc *)self;
- struct omap_attach_args *oa = aux;
+ struct armv7_attach_args *aa = aux;
sc->sc_iot = &armv7_a4x_bs_tag; /* XXX: This sucks */
- sc->sc_iobase = oa->oa_dev->mem[0].addr;
+ sc->sc_iobase = aa->aa_dev->mem[0].addr;
sc->sc_frequency = 48000000;
sc->sc_uarttype = COM_UART_TI16750;
if (bus_space_map(sc->sc_iot, sc->sc_iobase,
- oa->oa_dev->mem[0].size, 0, &sc->sc_ioh)) {
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh)) {
printf("%s: bus_space_map failed\n", __func__);
return;
}
com_attach_subr(sc);
- (void)arm_intr_establish(oa->oa_dev->irq[0], IPL_TTY, comintr,
+ (void)arm_intr_establish(aa->aa_dev->irq[0], IPL_TTY, comintr,
sc, sc->sc_dev.dv_xname);
}
diff --git a/sys/arch/armv7/omap/omap_machdep.c b/sys/arch/armv7/omap/omap_machdep.c
index ebd475df3b8..50c15a49ba9 100644
--- a/sys/arch/armv7/omap/omap_machdep.c
+++ b/sys/arch/armv7/omap/omap_machdep.c
@@ -17,6 +17,7 @@
#include <sys/param.h>
#include <sys/types.h>
+#include <sys/device.h>
#include <sys/systm.h>
#include <sys/termios.h>
@@ -28,7 +29,7 @@
#include <arm/cortex/smc.h>
#include <arm/armv7/armv7var.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/armv7/armv7_machdep.h>
extern void omap4_smc_call(uint32_t, uint32_t);
diff --git a/sys/arch/armv7/omap/omapid.c b/sys/arch/armv7/omap/omapid.c
index 23c5245d5b9..406c9d6739f 100644
--- a/sys/arch/armv7/omap/omapid.c
+++ b/sys/arch/armv7/omap/omapid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omapid.c,v 1.1 2013/09/04 14:38:31 patrick Exp $ */
+/* $OpenBSD: omapid.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2013 Dale Rahn <drahn@dalerahn.com>
*
@@ -25,7 +25,7 @@
#include <sys/timeout.h>
#include <machine/intr.h>
#include <machine/bus.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
/* registers */
#define O4_ID_SIZE 0x1000
@@ -63,15 +63,15 @@ void amptimer_set_clockrate(int32_t new_frequency); /* XXX */
void
omapid_attach(struct device *parent, struct device *self, void *args)
{
- struct omap_attach_args *oa = args;
+ struct armv7_attach_args *aa = args;
struct omapid_softc *sc = (struct omapid_softc *) self;
uint32_t rev;
uint32_t newclockrate = 0;
char *board;
- sc->sc_iot = oa->oa_iot;
- if (bus_space_map(sc->sc_iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("omapid: bus_space_map failed!");
omapid_sc = sc;
diff --git a/sys/arch/armv7/omap/omapvar.h b/sys/arch/armv7/omap/omapvar.h
index 5c891ac23a7..e69de29bb2d 100644
--- a/sys/arch/armv7/omap/omapvar.h
+++ b/sys/arch/armv7/omap/omapvar.h
@@ -1,60 +0,0 @@
-/* $OpenBSD: omapvar.h,v 1.2 2013/10/10 19:40:02 syl Exp $ */
-/*
- * Copyright (c) 2005,2008 Dale Rahn <drahn@drahn.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* Physical memory range for on-chip devices. */
-struct omap_mem {
- u_int32_t addr; /* physical start address */
- u_int32_t size; /* size of range in bytes */
-};
-
-#define OMAP_DEV_NMEM 4 /* number of memory ranges */
-#define OMAP_DEV_NIRQ 4 /* number of IRQs per device */
-#define OMAP_DEV_NDMA 4 /* number of DMA channels per device */
-
-/* Descriptor for all on-chip devices. */
-struct omap_dev {
- char *name; /* driver name or made up name */
- int unit; /* driver instance number or -1 */
- struct omap_mem mem[OMAP_DEV_NMEM]; /* memory ranges */
- int irq[OMAP_DEV_NIRQ]; /* IRQ number(s) */
- int dma[OMAP_DEV_NDMA]; /* DMA chan number(s) */
-};
-
-/* Passed as third arg to attach functions. */
-struct omap_attach_args {
- struct omap_dev *oa_dev;
- bus_space_tag_t oa_iot;
- bus_dma_tag_t oa_dmat;
-};
-
-void omap_set_devs(struct omap_dev *);
-struct omap_dev *omap_find_dev(const char *, int);
-
-void omap3_init(void);
-void omap4_init(void);
-void am335x_init(void);
-
-/* XXX */
-void *avic_intr_establish(int irqno, int level, int (*func)(void *),
- void *arg, char *name);
-
-/* board identification - from uboot */
-#define BOARD_ID_AM335X_BEAGLEBONE 3589
-#define BOARD_ID_OMAP3_BEAGLE 1546
-#define BOARD_ID_OMAP3_OVERO 1798
-#define BOARD_ID_OMAP4_PANDA 2791
-extern uint32_t board_id;
diff --git a/sys/arch/armv7/omap/omdog.c b/sys/arch/armv7/omap/omdog.c
index f84be92a334..69595ee8ce7 100644
--- a/sys/arch/armv7/omap/omdog.c
+++ b/sys/arch/armv7/omap/omdog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omdog.c,v 1.2 2013/11/01 12:15:15 fgsch Exp $ */
+/* $OpenBSD: omdog.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2013 Federico G. Schwindt <fgsch@openbsd.org>
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
@@ -26,7 +26,7 @@
#include <sys/timeout.h>
#include <machine/intr.h>
#include <machine/bus.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#define WIDR 0x00 /* Identification Register */
#define WCLR 0x24 /* Control Register */
@@ -74,13 +74,13 @@ struct cfdriver omdog_cd = {
void
omdog_attach(struct device *parent, struct device *self, void *args)
{
- struct omap_attach_args *oa = args;
+ struct armv7_attach_args *aa = args;
struct omdog_softc *sc = (struct omdog_softc *) self;
u_int32_t rev;
- sc->sc_iot = oa->oa_iot;
- if (bus_space_map(sc->sc_iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("%s: bus_space_map failed!", __func__);
rev = bus_space_read_4(sc->sc_iot, sc->sc_ioh, WIDR);
diff --git a/sys/arch/armv7/omap/omehci.c b/sys/arch/armv7/omap/omehci.c
index 1fc17f84abc..f258a982662 100644
--- a/sys/arch/armv7/omap/omehci.c
+++ b/sys/arch/armv7/omap/omehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omehci.c,v 1.1 2013/09/04 14:38:31 patrick Exp $ */
+/* $OpenBSD: omehci.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -58,7 +58,7 @@
#include <dev/usb/usbdivar.h>
#include <dev/usb/usb_mem.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/omap/prcmvar.h>
#include <armv7/omap/omgpiovar.h>
#include <armv7/omap/omehcivar.h>
@@ -105,14 +105,14 @@ void
omehci_attach(struct device *parent, struct device *self, void *aux)
{
struct omehci_softc *sc = (struct omehci_softc *)self;
- struct omap_attach_args *oa = aux;
+ struct armv7_attach_args *aa = aux;
usbd_status r;
char *devname = sc->sc.sc_bus.bdev.dv_xname;
uint32_t i;
- sc->sc.iot = oa->oa_iot;
- sc->sc.sc_bus.dmatag = oa->oa_dmat;
- sc->sc.sc_size = oa->oa_dev->mem[0].size;
+ sc->sc.iot = aa->aa_iot;
+ sc->sc.sc_bus.dmatag = aa->aa_dmat;
+ sc->sc.sc_size = aa->aa_dev->mem[0].size;
/* set defaults */
for (i = 0; i < 3; i++) {
@@ -133,21 +133,21 @@ omehci_attach(struct device *parent, struct device *self, void *aux)
}
/* Map I/O space */
- if (bus_space_map(sc->sc.iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &sc->sc.ioh)) {
+ if (bus_space_map(sc->sc.iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc.ioh)) {
printf(": cannot map mem space\n");
goto out;
}
- if (bus_space_map(sc->sc.iot, oa->oa_dev->mem[1].addr,
- oa->oa_dev->mem[1].size, 0, &sc->uhh_ioh)) {
+ if (bus_space_map(sc->sc.iot, aa->aa_dev->mem[1].addr,
+ aa->aa_dev->mem[1].size, 0, &sc->uhh_ioh)) {
printf(": cannot map mem space\n");
goto mem0;
}
if (sc->tll_avail &&
- bus_space_map(sc->sc.iot, oa->oa_dev->mem[2].addr,
- oa->oa_dev->mem[2].size, 0, &sc->tll_ioh)) {
+ bus_space_map(sc->sc.iot, aa->aa_dev->mem[2].addr,
+ aa->aa_dev->mem[2].size, 0, &sc->tll_ioh)) {
printf(": cannot map mem space\n");
goto mem1;
}
@@ -164,7 +164,7 @@ omehci_attach(struct device *parent, struct device *self, void *aux)
sc->sc.sc_offs = EREAD1(&sc->sc, EHCI_CAPLENGTH);
EOWRITE2(&sc->sc, EHCI_USBINTR, 0);
- sc->sc_ih = arm_intr_establish(oa->oa_dev->irq[0], IPL_USB,
+ sc->sc_ih = arm_intr_establish(aa->aa_dev->irq[0], IPL_USB,
ehci_intr, &sc->sc, devname);
if (sc->sc_ih == NULL) {
printf(": unable to establish interrupt\n");
@@ -189,9 +189,9 @@ intr:
arm_intr_disestablish(sc->sc_ih);
sc->sc_ih = NULL;
mem2:
- bus_space_unmap(sc->sc.iot, sc->tll_ioh, oa->oa_dev->mem[2].size);
+ bus_space_unmap(sc->sc.iot, sc->tll_ioh, aa->aa_dev->mem[2].size);
mem1:
- bus_space_unmap(sc->sc.iot, sc->uhh_ioh, oa->oa_dev->mem[1].size);
+ bus_space_unmap(sc->sc.iot, sc->uhh_ioh, aa->aa_dev->mem[1].size);
mem0:
bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
sc->sc.sc_size = 0;
diff --git a/sys/arch/armv7/omap/omgpio.c b/sys/arch/armv7/omap/omgpio.c
index 1f7ca3232ee..78ad8c50dae 100644
--- a/sys/arch/armv7/omap/omgpio.c
+++ b/sys/arch/armv7/omap/omgpio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omgpio.c,v 1.1 2013/09/04 14:38:31 patrick Exp $ */
+/* $OpenBSD: omgpio.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -27,7 +27,7 @@
#include <machine/bus.h>
#include <machine/intr.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/omap/omgpiovar.h>
/* OMAP3 registers */
@@ -176,13 +176,13 @@ omgpio_match(struct device *parent, void *v, void *aux)
void
omgpio_attach(struct device *parent, struct device *self, void *args)
{
- struct omap_attach_args *oa = args;
+ struct armv7_attach_args *aa = args;
struct omgpio_softc *sc = (struct omgpio_softc *) self;
u_int32_t rev;
- sc->sc_iot = oa->oa_iot;
- if (bus_space_map(sc->sc_iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("omgpio_attach: bus_space_map failed!");
@@ -209,7 +209,7 @@ omgpio_attach(struct device *parent, struct device *self, void *args)
printf(" omap%d rev %d.%d\n", sc->sc_omap_ver, rev >> 4 & 0xf,
rev & 0xf);
- sc->sc_irq = oa->oa_dev->irq[0];
+ sc->sc_irq = aa->aa_dev->irq[0];
if (sc->sc_omap_ver == 3) {
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
diff --git a/sys/arch/armv7/omap/ommmc.c b/sys/arch/armv7/omap/ommmc.c
index 770e3541839..ad836827ccc 100644
--- a/sys/arch/armv7/omap/ommmc.c
+++ b/sys/arch/armv7/omap/ommmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ommmc.c,v 1.9 2013/10/28 20:45:20 syl Exp $ */
+/* $OpenBSD: ommmc.c,v 1.10 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2009 Dale Rahn <drahn@openbsd.org>
@@ -31,7 +31,7 @@
#include <dev/sdmmc/sdmmcchip.h>
#include <dev/sdmmc/sdmmcvar.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/omap/prcmvar.h>
/*
@@ -278,21 +278,21 @@ void
ommmc_attach(struct device *parent, struct device *self, void *args)
{
struct ommmc_softc *sc = (struct ommmc_softc *) self;
- struct omap_attach_args *oa = args;
+ struct armv7_attach_args *aa = args;
struct sdmmcbus_attach_args saa;
uint32_t caps;
- sc->sc_iot = oa->oa_iot;
- if (bus_space_map(sc->sc_iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("%s: bus_space_map failed!", __func__);
printf("\n");
/* Enable ICLKEN, FCLKEN? */
- prcm_enablemodule(PRCM_MMC0 + oa->oa_dev->unit);
+ prcm_enablemodule(PRCM_MMC0 + aa->aa_dev->unit);
- sc->sc_ih = arm_intr_establish(oa->oa_dev->irq[0], IPL_SDMMC,
+ sc->sc_ih = arm_intr_establish(aa->aa_dev->irq[0], IPL_SDMMC,
ommmc_intr, sc, DEVNAME(sc));
if (sc->sc_ih == NULL) {
printf("%s: cannot map interrupt\n", DEVNAME(sc));
@@ -402,7 +402,7 @@ ommmc_attach(struct device *parent, struct device *self, void *args)
err:
if (sc->sc_ih != NULL)
arm_intr_disestablish(sc->sc_ih);
- bus_space_unmap(sc->sc_iot, sc->sc_ioh, oa->oa_dev->mem[0].size);
+ bus_space_unmap(sc->sc_iot, sc->sc_ioh, aa->aa_dev->mem[0].size);
}
diff --git a/sys/arch/armv7/omap/omusbtll.c b/sys/arch/armv7/omap/omusbtll.c
index ba2daa7a75c..3ab75532b93 100644
--- a/sys/arch/armv7/omap/omusbtll.c
+++ b/sys/arch/armv7/omap/omusbtll.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omusbtll.c,v 1.1 2013/09/04 14:38:31 patrick Exp $ */
+/* $OpenBSD: omusbtll.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2010 Dale Rahn <drahn@openbsd.org>
*
@@ -23,7 +23,7 @@
#include <sys/evcount.h>
#include <machine/bus.h>
#include <machine/intr.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/omap/prcmvar.h>
/* registers */
@@ -106,12 +106,12 @@ void
omusbtll_attach(struct device *parent, struct device *self, void *args)
{
struct omusbtll_softc *sc = (struct omusbtll_softc *) self;
- struct omap_attach_args *oa = args;
+ struct armv7_attach_args *aa = args;
u_int32_t rev;
- sc->sc_iot = oa->oa_iot;
- if (bus_space_map(sc->sc_iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &sc->sc_ioh)) {
+ sc->sc_iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh)) {
printf("%s: bus_space_map failed!\n", __func__);
return;
}
diff --git a/sys/arch/armv7/omap/prcm.c b/sys/arch/armv7/omap/prcm.c
index 8dfa6ab2988..77eb6312bb4 100644
--- a/sys/arch/armv7/omap/prcm.c
+++ b/sys/arch/armv7/omap/prcm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: prcm.c,v 1.6 2013/10/28 11:11:50 rapha Exp $ */
+/* $OpenBSD: prcm.c,v 1.7 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -58,7 +58,7 @@
#include <machine/bus.h>
#include <machine/intr.h>
#include <arm/cpufunc.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/omap/prcmvar.h>
#include <armv7/omap/am335x_prcmreg.h>
@@ -117,11 +117,11 @@ struct cfdriver prcm_cd = {
void
prcm_attach(struct device *parent, struct device *self, void *args)
{
- struct omap_attach_args *oa = args;
+ struct armv7_attach_args *aa = args;
struct prcm_softc *sc = (struct prcm_softc *) self;
u_int32_t reg;
- sc->sc_iot = oa->oa_iot;
+ sc->sc_iot = aa->aa_iot;
switch (board_id) {
case BOARD_ID_AM335X_BEAGLEBONE:
@@ -144,18 +144,18 @@ prcm_attach(struct device *parent, struct device *self, void *args)
break;
}
- if (bus_space_map(sc->sc_iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &sc->sc_prcm))
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_prcm))
panic("prcm_attach: bus_space_map failed!");
if (sc->cm1_avail &&
- bus_space_map(sc->sc_iot, oa->oa_dev->mem[1].addr,
- oa->oa_dev->mem[1].size, 0, &sc->sc_cm1))
+ bus_space_map(sc->sc_iot, aa->aa_dev->mem[1].addr,
+ aa->aa_dev->mem[1].size, 0, &sc->sc_cm1))
panic("prcm_attach: bus_space_map failed!");
if (sc->cm2_avail &&
- bus_space_map(sc->sc_iot, oa->oa_dev->mem[2].addr,
- oa->oa_dev->mem[2].size, 0, &sc->sc_cm2))
+ bus_space_map(sc->sc_iot, aa->aa_dev->mem[2].addr,
+ aa->aa_dev->mem[2].size, 0, &sc->sc_cm2))
panic("prcm_attach: bus_space_map failed!");
reg = bus_space_read_4(sc->sc_iot, sc->sc_prcm, PRCM_REVISION);
@@ -190,7 +190,7 @@ prcm_v3_setup(struct prcm_softc *sc)
prcm_imask_mask[PRCM_REG_WKUP] = PRCM_REG_WKUP_IMASK;
prcm_fmask_addr[PRCM_REG_WKUP] = PRCM_REG_WKUP_FADDR;
prcm_imask_addr[PRCM_REG_WKUP] = PRCM_REG_WKUP_IADDR;
-
+
prcm_fmask_mask[PRCM_REG_PER] = PRCM_REG_PER_FMASK;
prcm_imask_mask[PRCM_REG_PER] = PRCM_REG_PER_IMASK;
prcm_fmask_addr[PRCM_REG_PER] = PRCM_REG_PER_FADDR;
diff --git a/sys/arch/armv7/omap/sitara_cm.c b/sys/arch/armv7/omap/sitara_cm.c
index 4b493fb78d7..4958a4fabcf 100644
--- a/sys/arch/armv7/omap/sitara_cm.c
+++ b/sys/arch/armv7/omap/sitara_cm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sitara_cm.c,v 1.1 2013/09/04 14:38:32 patrick Exp $ */
+/* $OpenBSD: sitara_cm.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
/* $NetBSD: sitara_cm.c,v 1.1 2013/04/17 14:31:02 bouyer Exp $ */
/*
* Copyright (c) 2010
@@ -57,7 +57,7 @@
#include <sys/proc.h>
#include <machine/bus.h>
-#include <armv7/omap/omapvar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/omap/sitara_cm.h>
#include <armv7/omap/sitara_cmreg.h>
@@ -373,16 +373,16 @@ void
sitara_cm_attach(struct device *parent, struct device *self, void *aux)
{
struct sitara_cm_softc *sc = (struct sitara_cm_softc *)self;
- struct omap_attach_args *oa = aux;
+ struct armv7_attach_args *aa = aux;
uint32_t rev;
if (sitara_cm_sc)
panic("sitara_cm_attach: already attached");
- sc->sc_iot = oa->oa_iot;
+ sc->sc_iot = aa->aa_iot;
- if (bus_space_map(oa->oa_iot, oa->oa_dev->mem[0].addr,
- oa->oa_dev->mem[0].size, 0, &sc->sc_ioh) != 0)
+ if (bus_space_map(aa->aa_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh) != 0)
panic("%s: bus_space_map failed!\n", __func__);
sitara_cm_sc = sc;
diff --git a/sys/arch/armv7/sunxi/a1xintc.c b/sys/arch/armv7/sunxi/a1xintc.c
index c080a0a8dd6..68176bd0e48 100644
--- a/sys/arch/armv7/sunxi/a1xintc.c
+++ b/sys/arch/armv7/sunxi/a1xintc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: a1xintc.c,v 1.2 2013/10/23 18:01:52 jasper Exp $ */
+/* $OpenBSD: a1xintc.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Artturi Alm
@@ -25,7 +25,7 @@
#include <machine/bus.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/sunxi/sunxireg.h>
#include <armv7/sunxi/sxipiovar.h>
#include <armv7/sunxi/a1xintc.h>
@@ -159,12 +159,12 @@ int intc_attached = 0;
void
a1xintc_attach(struct device *parent, struct device *self, void *args)
{
- struct sxi_attach_args *sxi = args;
+ struct armv7_attach_args *aa = args;
int i, j;
- intc_iot = sxi->sxi_iot;
- if (bus_space_map(intc_iot, sxi->sxi_dev->mem[0].addr,
- sxi->sxi_dev->mem[0].size, 0, &intc_ioh))
+ 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))
panic("a1xintc_attach: bus_space_map failed!");
/* disable/mask/clear all interrupts */
diff --git a/sys/arch/armv7/sunxi/files.sunxi b/sys/arch/armv7/sunxi/files.sunxi
index f7484e387a5..8a21e510bb3 100644
--- a/sys/arch/armv7/sunxi/files.sunxi
+++ b/sys/arch/armv7/sunxi/files.sunxi
@@ -1,12 +1,12 @@
-# $OpenBSD: files.sunxi,v 1.1 2013/10/23 17:08:47 jasper Exp $
+# $OpenBSD: files.sunxi,v 1.2 2013/11/06 19:03:07 syl Exp $
define sunxi {}
device sunxi: sunxi
attach sunxi at mainbus
file arch/armv7/sunxi/sunxi_machdep.c sunxi
-file arch/armv7/sunxi/sunxi.c sunxi
-file arch/armv7/sunxi/sun4i.c sunxi
-file arch/armv7/sunxi/sun7i.c sunxi
+file arch/armv7/sunxi/sunxi.c sunxi
+file arch/armv7/sunxi/sun4i.c
+file arch/armv7/sunxi/sun7i.c
device sxiccmu
attach sxiccmu at sunxi
diff --git a/sys/arch/armv7/sunxi/sun4i.c b/sys/arch/armv7/sunxi/sun4i.c
index 207bd1ffbec..6c3197a2bfc 100644
--- a/sys/arch/armv7/sunxi/sun4i.c
+++ b/sys/arch/armv7/sunxi/sun4i.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sun4i.c,v 1.2 2013/10/23 18:01:52 jasper Exp $ */
+/* $OpenBSD: sun4i.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org>
*
@@ -20,10 +20,10 @@
#include <machine/bus.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/sunxi/sunxireg.h>
-struct sxi_dev sxia1x_devs[] = {
+struct armv7_dev sxia1x_devs[] = {
/* 'Port IO' */
{ .name = "sxipio",
@@ -161,9 +161,8 @@ struct sxi_dev sxia1x_devs[] = {
}
};
-void sxia1x_init(void);
void
sxia1x_init(void)
{
- sxi_set_devs(sxia1x_devs);
+ armv7_set_devs(sxia1x_devs);
}
diff --git a/sys/arch/armv7/sunxi/sun7i.c b/sys/arch/armv7/sunxi/sun7i.c
index ed099690ebc..0d06b31fa52 100644
--- a/sys/arch/armv7/sunxi/sun7i.c
+++ b/sys/arch/armv7/sunxi/sun7i.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sun7i.c,v 1.2 2013/10/23 18:01:52 jasper Exp $ */
+/* $OpenBSD: sun7i.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org>
@@ -21,10 +21,10 @@
#include <machine/bus.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/sunxi/sunxireg.h>
-struct sxi_dev sxia20_devs[] = {
+struct armv7_dev sxia20_devs[] = {
/* 'Port IO' */
{ .name = "sxipio",
@@ -156,9 +156,8 @@ struct sxi_dev sxia20_devs[] = {
}
};
-void sxia20_init(void);
void
sxia20_init(void)
{
- sxi_set_devs(sxia20_devs);
+ armv7_set_devs(sxia20_devs);
}
diff --git a/sys/arch/armv7/sunxi/sunxi.c b/sys/arch/armv7/sunxi/sunxi.c
index 2d157fe02f9..41936919b41 100644
--- a/sys/arch/armv7/sunxi/sunxi.c
+++ b/sys/arch/armv7/sunxi/sunxi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sunxi.c,v 1.2 2013/10/23 18:01:52 jasper Exp $ */
+/* $OpenBSD: sunxi.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
*
@@ -17,217 +17,15 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/reboot.h>
-#define _ARM32_BUS_DMA_PRIVATE
-/* #include <machine/bus.h> */
-#include <arch/arm/armv7/armv7var.h>
-#include <armv7/sunxi/sunxivar.h>
-#include <armv7/sunxi/sunxireg.h>
-struct arm32_bus_dma_tag sunxi_bus_dma_tag = {
- 0,
- 0,
- NULL,
- _bus_dmamap_create,
- _bus_dmamap_destroy,
- _bus_dmamap_load,
- _bus_dmamap_load_mbuf,
- _bus_dmamap_load_uio,
- _bus_dmamap_load_raw,
- _bus_dmamap_unload,
- _bus_dmamap_sync,
- _bus_dmamem_alloc,
- _bus_dmamem_free,
- _bus_dmamem_map,
- _bus_dmamem_unmap,
- _bus_dmamem_mmap,
-};
-
-struct board_dev {
- char *name;
- int unit;
-};
-
-struct board_dev sun4i_devs[] = {
- { "sxipio", 0 },
- { "sxiccmu", 0 },
- { "a1xintc", 0 },
- { "sxitimer", 0 },
- { "sxitimer", 1 },
- { "sxitimer", 2 },
- { "sxidog", 0 },
- { "sxirtc", 0 },
- { "sxiuart", 0 },
- { "sxiuart", 1 },
- { "sxiuart", 2 },
- { "sxiuart", 3 },
- { "sxiuart", 4 },
- { "sxiuart", 5 },
- { "sxiuart", 6 },
- { "sxiuart", 7 },
- { "sxie", 0 },
- { "ahci", 0 },
- { "ehci", 0 },
- { "ehci", 1 },
-#if 0
- { "ohci", 0 },
- { "ohci", 1 },
-#endif
- { NULL, 0 }
-};
-
-struct board_dev sun7i_devs[] = {
- { "sxipio", 0 },
- { "sxiccmu", 0 },
- { "sxitimer", 0 },
- { "sxitimer", 1 },
- { "sxitimer", 2 },
- { "sxidog", 0 },
- { "sxirtc", 0 },
- { "sxiuart", 0 },
- { "sxiuart", 1 },
- { "sxiuart", 2 },
- { "sxiuart", 3 },
- { "sxiuart", 4 },
- { "sxiuart", 5 },
- { "sxiuart", 6 },
- { "sxiuart", 7 },
- { "sxie", 0 },
- { "ahci", 0 },
- { "ehci", 0 },
- { "ehci", 1 },
-#if 0
- { "ohci", 0 },
- { "ohci", 1 },
-#endif
- { NULL, 0 }
-};
-
-struct board_dev *board_devs;
-struct sxi_dev *sunxi_devs = NULL;
+#include <machine/bus.h>
-extern void sxia1x_init(void);
-extern void sxia20_init(void);
-
-struct sunxi_softc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- bus_dma_tag_t sc_dmat;
-};
-
-int sunxi_match(struct device *, void *, void *);
-void sunxi_attach(struct device *, struct device *, void *);
-int sxi_submatch(struct device *, void *, void *);
+#include <armv7/armv7/armv7var.h>
struct cfattach sunxi_ca = {
- sizeof(struct sunxi_softc), sunxi_match, sunxi_attach
+ sizeof(struct armv7_softc), armv7_match, armv7_attach
};
struct cfdriver sunxi_cd = {
NULL, "sunxi", DV_DULL
};
-
-int
-sunxi_match(struct device *parent, void *cfdata, void *aux)
-{
- return 1;
-}
-
-void
-sunxi_attach(struct device *parent, struct device *self, void *aux)
-{
- struct sunxi_softc *sc = (struct sunxi_softc *)self;
- struct board_dev *bd;
- sc->sc_iot = &armv7_bs_tag;
- sc->sc_dmat = &sunxi_bus_dma_tag;
-
- switch (board_id) {
- case BOARD_ID_SUN4I_A10:
- printf(": A1X\n");
- sxia1x_init();
- board_devs = sun4i_devs;
- break;
- case BOARD_ID_SUN7I_A20:
- printf(": A20\n");
- sxia20_init();
- board_devs = sun7i_devs;
- break;
- default:
- printf("\n");
- panic("sunxi_attach: board type 0x%x unknown", board_id);
- }
-
-#if 1
- /*
- * XXX think of a better place to do this, as there might
- * be need for access by other drivers later.
- */
- if (bus_space_map(sc->sc_iot, SYSCTRL_ADDR, SYSCTRL_SIZE, 0,
- &sc->sc_ioh))
- panic("sunxi_attach: bus_space_map failed!");
- /* map the part of SRAM dedicated to EMAC to EMAC */
- SXISET4(sc, 4, 5 << 2);
-#endif
-
- /* Directly configure on-board devices (dev* in config file). */
- for (bd = board_devs; bd->name != NULL; bd++) {
- struct sxi_dev *sxid = sxi_find_dev(bd->name, bd->unit);
- struct sxi_attach_args sxi;
-
- if (sxid == NULL) {
- printf("%s: device %s unit %d not found\n",
- self->dv_xname, bd->name, bd->unit);
- continue;
- }
-
- memset(&sxi, 0, sizeof(sxi));
- sxi.sxi_dev = sxid;
- sxi.sxi_iot = sc->sc_iot;
- sxi.sxi_dmat = sc->sc_dmat;
-
- if (config_found_sm(self, &sxi, NULL, sxi_submatch) == NULL)
- printf("%s: device %s unit %d not configured\n",
- self->dv_xname, bd->name, bd->unit);
- }
-}
-
-/*
- * We do direct configuration of devices on this SoC "bus", so we
- * never call the child device's match function at all (it can be
- * NULL in the struct cfattach).
- */
-int
-sxi_submatch(struct device *parent, void *child, void *aux)
-{
- struct cfdata *cf = child;
- struct sxi_attach_args *sxi = aux;
-
- if (strcmp(cf->cf_driver->cd_name, sxi->sxi_dev->name) == 0)
- return 1;
-
- return 0;
-}
-
-void
-sxi_set_devs(struct sxi_dev *devs)
-{
- sunxi_devs = devs;
-}
-
-struct sxi_dev *
-sxi_find_dev(const char *name, int unit)
-{
- struct sxi_dev *sxid;
-
- if (sunxi_devs == NULL)
- panic("sunxi_find_dev: sunxi_devs == NULL");
-
- for (sxid = sunxi_devs; sxid->name != NULL; sxid++)
- if (sxid->unit == unit && strcmp(sxid->name, name) == 0)
- return sxid;
-
- return NULL;
-}
diff --git a/sys/arch/armv7/sunxi/sunxi_machdep.c b/sys/arch/armv7/sunxi/sunxi_machdep.c
index 29334322ba2..b0164adec44 100644
--- a/sys/arch/armv7/sunxi/sunxi_machdep.c
+++ b/sys/arch/armv7/sunxi/sunxi_machdep.c
@@ -28,7 +28,7 @@
#include <arm/cortex/smc.h>
#include <arm/armv7/armv7var.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/armv7/armv7_machdep.h>
extern int sxiuartcnattach(bus_space_tag_t, bus_addr_t, int, long, tcflag_t);
diff --git a/sys/arch/armv7/sunxi/sunxireg.h b/sys/arch/armv7/sunxi/sunxireg.h
index 68a63bb275e..e1d4f558fd5 100644
--- a/sys/arch/armv7/sunxi/sunxireg.h
+++ b/sys/arch/armv7/sunxi/sunxireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sunxireg.h,v 1.5 2013/10/27 12:58:53 jasper Exp $ */
+/* $OpenBSD: sunxireg.h,v 1.6 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2013 Artturi Alm
*
@@ -15,6 +15,28 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#define SXIREAD1(sc, reg) \
+ (bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, (reg)))
+#define SXIWRITE1(sc, reg, val) \
+ bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
+#define SXISET1(sc, reg, bits) \
+ SXIWRITE1((sc), (reg), SXIREAD1((sc), (reg)) | (bits))
+#define SXICLR1(sc, reg, bits) \
+ SXIWRITE1((sc), (reg), SXIREAD1((sc), (reg)) & ~(bits))
+#define SXICMS1(sc, reg, mask, bits) \
+ SXIWRITE1((sc), (reg), (SXIREAD1((sc), (reg)) & ~(mask)) | (bits))
+
+#define SXIREAD4(sc, reg) \
+ (bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg)))
+#define SXIWRITE4(sc, reg, val) \
+ bus_space_write_4((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
+#define SXISET4(sc, reg, bits) \
+ SXIWRITE4((sc), (reg), SXIREAD4((sc), (reg)) | (bits))
+#define SXICLR4(sc, reg, bits) \
+ SXIWRITE4((sc), (reg), SXIREAD4((sc), (reg)) & ~(bits))
+#define SXICMS4(sc, reg, mask, bits) \
+ SXIWRITE4((sc), (reg), (SXIREAD4((sc), (reg)) & ~(mask)) | (bits))
+
#define TIMER0_FREQUENCY (32768)
#define TIMER1_FREQUENCY (32768)
#define TIMER2_FREQUENCY (32768)
diff --git a/sys/arch/armv7/sunxi/sunxivar.h b/sys/arch/armv7/sunxi/sunxivar.h
index 1e3fe09cff1..e69de29bb2d 100644
--- a/sys/arch/armv7/sunxi/sunxivar.h
+++ b/sys/arch/armv7/sunxi/sunxivar.h
@@ -1,74 +0,0 @@
-/* $OpenBSD: sunxivar.h,v 1.2 2013/10/23 18:01:52 jasper Exp $ */
-/*
- * Copyright (c) 2005,2008 Dale Rahn <drahn@drahn.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <machine/bus.h>
-
-
-#define SXIREAD1(sc, reg) \
- (bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, (reg)))
-#define SXIWRITE1(sc, reg, val) \
- bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
-#define SXISET1(sc, reg, bits) \
- SXIWRITE1((sc), (reg), SXIREAD1((sc), (reg)) | (bits))
-#define SXICLR1(sc, reg, bits) \
- SXIWRITE1((sc), (reg), SXIREAD1((sc), (reg)) & ~(bits))
-#define SXICMS1(sc, reg, mask, bits) \
- SXIWRITE1((sc), (reg), (SXIREAD1((sc), (reg)) & ~(mask)) | (bits))
-
-#define SXIREAD4(sc, reg) \
- (bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg)))
-#define SXIWRITE4(sc, reg, val) \
- bus_space_write_4((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
-#define SXISET4(sc, reg, bits) \
- SXIWRITE4((sc), (reg), SXIREAD4((sc), (reg)) | (bits))
-#define SXICLR4(sc, reg, bits) \
- SXIWRITE4((sc), (reg), SXIREAD4((sc), (reg)) & ~(bits))
-#define SXICMS4(sc, reg, mask, bits) \
- SXIWRITE4((sc), (reg), (SXIREAD4((sc), (reg)) & ~(mask)) | (bits))
-
-
-/* Physical memory range for on-chip devices. */
-struct sxi_mem {
- bus_addr_t addr; /* physical start address */
- bus_size_t size; /* size of range in bytes */
-};
-
-#define SXI_DEV_NMEM 4 /* max number of memory ranges */
-#define SXI_DEV_NIRQ 4 /* max number of IRQs per device */
-
-/* Descriptor for all on-chip devices. */
-struct sxi_dev {
- char *name; /* driver name or made up name */
- int unit; /* driver instance number or -1 */
- struct sxi_mem mem[SXI_DEV_NMEM]; /* memory ranges */
- int irq[SXI_DEV_NIRQ]; /* IRQ number(s) */
-};
-
-/* Passed as third arg to attach functions. */
-struct sxi_attach_args {
- struct sxi_dev *sxi_dev;
- bus_space_tag_t sxi_iot;
- bus_dma_tag_t sxi_dmat;
-};
-
-void sxi_set_devs(struct sxi_dev *);
-struct sxi_dev *sxi_find_dev(const char *, int);
-
-/* board identification - from uboot */
-#define BOARD_ID_SUN4I_A10 4104
-#define BOARD_ID_SUN7I_A20 4283
-extern uint32_t board_id;
diff --git a/sys/arch/armv7/sunxi/sxiahci.c b/sys/arch/armv7/sunxi/sxiahci.c
index 3f96f80d69e..cd7813e3321 100644
--- a/sys/arch/armv7/sunxi/sxiahci.c
+++ b/sys/arch/armv7/sunxi/sxiahci.c
@@ -28,7 +28,7 @@
#include <dev/ic/ahcivar.h>
#include <dev/ic/ahcireg.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/sunxi/sunxireg.h>
#include <armv7/sunxi/sxiccmuvar.h>
#include <armv7/sunxi/sxipiovar.h>
@@ -72,19 +72,19 @@ struct cfdriver sxiahci_cd = {
void
sxiahci_attach(struct device *parent, struct device *self, void *args)
{
- struct sxi_attach_args *sxi = args;
+ struct armv7_attach_args *aa = args;
struct sxiahci_softc *sxisc = (struct sxiahci_softc *)self;
struct ahci_softc *sc = &sxisc->sc;
bus_space_tag_t iot;
bus_space_handle_t ioh;
uint32_t timo;
- sc->sc_iot = iot = sxi->sxi_iot;
- sc->sc_ios = sxi->sxi_dev->mem[0].size;
- sc->sc_dmat = sxi->sxi_dmat;
+ sc->sc_iot = iot = aa->aa_iot;
+ sc->sc_ios = aa->aa_dev->mem[0].size;
+ sc->sc_dmat = aa->aa_dmat;
- if (bus_space_map(sc->sc_iot, sxi->sxi_dev->mem[0].addr,
- sxi->sxi_dev->mem[0].size, 0, &sc->sc_ioh))
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("sxiahci_attach: bus_space_map failed!");
ioh = sc->sc_ioh;
@@ -108,10 +108,10 @@ sxiahci_attach(struct device *parent, struct device *self, void *args)
1 << 17 | 1 << 10 | 1 << 9 | 1 << 7);
delay(10);
- SXISET4(sc, SXIAHCI_PHYCS1, 1 << 28 | 1 << 15);
+ SXISET4(sc, SXIAHCI_PHYCS1, 1 << 28 | 1 << 15);
delay(10);
- SXICLR4(sc, SXIAHCI_PHYCS1, 1 << 19);
+ SXICLR4(sc, SXIAHCI_PHYCS1, 1 << 19);
delay(10);
SXICMS4(sc, SXIAHCI_PHYCS0, 1 << 21 | 1 << 20, 1 << 22);
@@ -149,7 +149,7 @@ sxiahci_attach(struct device *parent, struct device *self, void *args)
sxipio_setcfg(SXIAHCI_PWRPIN, SXIPIO_OUTPUT);
sxipio_setpin(SXIAHCI_PWRPIN);
- sc->sc_ih = arm_intr_establish(sxi->sxi_dev->irq[0], IPL_BIO,
+ sc->sc_ih = arm_intr_establish(aa->aa_dev->irq[0], IPL_BIO,
ahci_intr, sc, sc->sc_dev.dv_xname);
if (sc->sc_ih == NULL) {
printf(": unable to establish interrupt\n");
diff --git a/sys/arch/armv7/sunxi/sxiccmu.c b/sys/arch/armv7/sunxi/sxiccmu.c
index 96fa3c84e39..27a471d6ed7 100644
--- a/sys/arch/armv7/sunxi/sxiccmu.c
+++ b/sys/arch/armv7/sunxi/sxiccmu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxiccmu.c,v 1.3 2013/11/01 21:15:05 aalm Exp $ */
+/* $OpenBSD: sxiccmu.c,v 1.4 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Artturi Alm
@@ -28,7 +28,8 @@
#include <machine/bus.h>
#include <machine/intr.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/armv7/armv7var.h>
+#include <armv7/sunxi/sunxireg.h>
#include <armv7/sunxi/sxiccmuvar.h>
#ifdef DEBUG_CCMU
@@ -109,12 +110,12 @@ void
sxiccmu_attach(struct device *parent, struct device *self, void *args)
{
struct sxiccmu_softc *sc = (struct sxiccmu_softc *)self;
- struct sxi_attach_args *sxi = args;
+ struct armv7_attach_args *aa = args;
- sc->sc_iot = sxi->sxi_iot;
+ sc->sc_iot = aa->aa_iot;
- if (bus_space_map(sc->sc_iot, sxi->sxi_dev->mem[0].addr,
- sxi->sxi_dev->mem[0].size, 0, &sc->sc_ioh))
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("sxiccmu_attach: bus_space_map failed!");
printf("\n");
diff --git a/sys/arch/armv7/sunxi/sxidog.c b/sys/arch/armv7/sunxi/sxidog.c
index f791c875caa..9dfef879603 100644
--- a/sys/arch/armv7/sunxi/sxidog.c
+++ b/sys/arch/armv7/sunxi/sxidog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxidog.c,v 1.2 2013/10/23 18:01:52 jasper Exp $ */
+/* $OpenBSD: sxidog.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -27,7 +27,8 @@
#include <machine/intr.h>
#include <machine/bus.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/sunxi/sunxireg.h>
+#include <armv7/armv7/armv7var.h>
/* XXX other way around than bus_space_subregion? */
extern bus_space_handle_t sxitimer_ioh;
@@ -82,12 +83,12 @@ struct cfdriver sxidog_cd = {
void
sxidog_attach(struct device *parent, struct device *self, void *args)
{
- struct sxi_attach_args *sxi = args;
+ struct armv7_attach_args *aa = args;
struct sxidog_softc *sc = (struct sxidog_softc *)self;
- sc->sc_iot = sxi->sxi_iot;
+ sc->sc_iot = aa->aa_iot;
if (bus_space_subregion(sc->sc_iot, sxitimer_ioh,
- sxi->sxi_dev->mem[0].addr, sxi->sxi_dev->mem[0].size, &sc->sc_ioh))
+ aa->aa_dev->mem[0].addr, aa->aa_dev->mem[0].size, &sc->sc_ioh))
panic("sxidog_attach: bus_space_subregion failed!");
#ifdef DEBUG
@@ -95,7 +96,7 @@ sxidog_attach(struct device *parent, struct device *self, void *args)
SXIREAD4(sc, WDOG_MR));
#endif
#if 0
- (void)intc_intr_establish(sxi->sxi_dev->irq[0], IPL_HIGH, /* XXX */
+ (void)intc_intr_establish(aa->aa_dev->irq[0], IPL_HIGH, /* XXX */
sxidog_intr, sc, sc->sc_dev.dv_xname);
#endif
sxidog_sc = sc;
@@ -117,13 +118,13 @@ sxidog_callback(void *arg, int period)
/*
* clearing bits in mode reg has no effect according
* to the user manual, so just set new timeout and enable it.
- * XXX
+ * XXX
*/
SXIWRITE4(sc, WDOG_MR, WDOG_EN | WDOG_RST_EN |
WDOG_INTV_VALUE(period));
/* reset */
SXIWRITE4(sc, WDOG_CR, WDOG_CTRL_KEY | WDOG_RESTART);
-
+
return period;
}
diff --git a/sys/arch/armv7/sunxi/sxie.c b/sys/arch/armv7/sunxi/sxie.c
index 659def85614..ac714ec8dac 100644
--- a/sys/arch/armv7/sunxi/sxie.c
+++ b/sys/arch/armv7/sunxi/sxie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxie.c,v 1.4 2013/10/26 20:20:22 jasper Exp $ */
+/* $OpenBSD: sxie.c,v 1.5 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
* Copyright (c) 2013 Artturi Alm
@@ -50,8 +50,8 @@
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/sunxi/sunxireg.h>
-#include <armv7/sunxi/sunxivar.h>
#include <armv7/sunxi/sxiccmuvar.h>
#include <armv7/sunxi/sxipiovar.h>
@@ -199,16 +199,16 @@ struct cfdriver sxie_cd = {
void
sxie_attach(struct device *parent, struct device *self, void *args)
{
- struct sxi_attach_args *sxi = args;
+ struct armv7_attach_args *aa = args;
struct sxie_softc *sc = (struct sxie_softc *) self;
struct mii_data *mii;
struct ifnet *ifp;
int s;
- sc->sc_iot = sxi->sxi_iot;
+ sc->sc_iot = aa->aa_iot;
- if (bus_space_map(sc->sc_iot, sxi->sxi_dev->mem[0].addr,
- sxi->sxi_dev->mem[0].size, 0, &sc->sc_ioh))
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("sxie_attach: bus_space_map ioh failed!");
if (bus_space_map(sc->sc_iot, SID_ADDR, SID_SIZE, 0, &sc->sc_sid_ioh))
@@ -217,7 +217,7 @@ sxie_attach(struct device *parent, struct device *self, void *args)
sxie_socware_init(sc);
sc->txf_inuse = 0;
- sc->sc_ih = arm_intr_establish(sxi->sxi_dev->irq[0], IPL_NET,
+ sc->sc_ih = arm_intr_establish(aa->aa_dev->irq[0], IPL_NET,
sxie_intr, sc, sc->sc_dev.dv_xname);
s = splnet();
diff --git a/sys/arch/armv7/sunxi/sxiehci.c b/sys/arch/armv7/sunxi/sxiehci.c
index 80052407581..37e2da46d1c 100644
--- a/sys/arch/armv7/sunxi/sxiehci.c
+++ b/sys/arch/armv7/sunxi/sxiehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxiehci.c,v 1.2 2013/10/23 18:01:52 jasper Exp $ */
+/* $OpenBSD: sxiehci.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -58,7 +58,7 @@
#include <dev/usb/usbdivar.h>
#include <dev/usb/usb_mem.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/sunxi/sxiccmuvar.h>
#include <armv7/sunxi/sxipiovar.h>
@@ -102,16 +102,16 @@ void
sxiehci_attach(struct device *parent, struct device *self, void *aux)
{
struct sxiehci_softc *sc = (struct sxiehci_softc *)self;
- struct sxi_attach_args *sxi = aux;
+ struct armv7_attach_args *aa = aux;
usbd_status r;
char *devname = sc->sc.sc_bus.bdev.dv_xname;
- sc->sc.iot = sxi->sxi_iot;
- sc->sc.sc_bus.dmatag = sxi->sxi_dmat;
- sc->sc.sc_size = sxi->sxi_dev->mem[0].size;
+ sc->sc.iot = aa->aa_iot;
+ sc->sc.sc_bus.dmatag = aa->aa_dmat;
+ sc->sc.sc_size = aa->aa_dev->mem[0].size;
- if (bus_space_map(sc->sc.iot, sxi->sxi_dev->mem[0].addr,
- sxi->sxi_dev->mem[0].size, 0, &sc->sc.ioh)) {
+ if (bus_space_map(sc->sc.iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc.ioh)) {
printf(": cannot map mem space\n");
goto out;
}
@@ -125,7 +125,7 @@ sxiehci_attach(struct device *parent, struct device *self, void *aux)
sc->sc.sc_offs = EREAD1(&sc->sc, EHCI_CAPLENGTH);
EOWRITE2(&sc->sc, EHCI_USBINTR, 0);
- sc->sc_ih = arm_intr_establish(sxi->sxi_dev->irq[0], IPL_USB,
+ sc->sc_ih = arm_intr_establish(aa->aa_dev->irq[0], IPL_USB,
ehci_intr, &sc->sc, devname);
if (sc->sc_ih == NULL) {
printf(": unable to establish interrupt\n");
diff --git a/sys/arch/armv7/sunxi/sxipio.c b/sys/arch/armv7/sunxi/sxipio.c
index 65817fb1c38..b62d58f3700 100644
--- a/sys/arch/armv7/sunxi/sxipio.c
+++ b/sys/arch/armv7/sunxi/sxipio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxipio.c,v 1.4 2013/11/03 14:08:56 rapha Exp $ */
+/* $OpenBSD: sxipio.c,v 1.5 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
* Copyright (c) 2013 Artturi Alm
@@ -27,7 +27,8 @@
#include <dev/gpio/gpiovar.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/armv7/armv7var.h>
+#include <armv7/sunxi/sunxireg.h>
#include <armv7/sunxi/sxipiovar.h>
#include "gpio.h"
@@ -103,19 +104,19 @@ void
sxipio_attach(struct device *parent, struct device *self, void *args)
{
struct sxipio_softc *sc = (struct sxipio_softc *)self;
- struct sxi_attach_args *sxi = args;
+ struct armv7_attach_args *aa = args;
/* XXX check unit, bail if != 0 */
- sc->sc_iot = sxipio_iot = sxi->sxi_iot;
- if (bus_space_map(sxipio_iot, sxi->sxi_dev->mem[0].addr,
- sxi->sxi_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = sxipio_iot = aa->aa_iot;
+ if (bus_space_map(sxipio_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("sxipio_attach: bus_space_map failed!");
sxipio_ioh = sc->sc_ioh;
sxipio_sc = sc;
- sc->sc_irq = sxi->sxi_dev->irq[0];
+ sc->sc_irq = aa->aa_dev->irq[0];
sxipio_setcfg(SXIPIO_LED_GREEN, SXIPIO_OUTPUT);
sxipio_setcfg(SXIPIO_LED_BLUE, SXIPIO_OUTPUT);
sxipio_setpin(SXIPIO_LED_GREEN);
diff --git a/sys/arch/armv7/sunxi/sxirtc.c b/sys/arch/armv7/sunxi/sxirtc.c
index 33ddcc403aa..d757c54db62 100644
--- a/sys/arch/armv7/sunxi/sxirtc.c
+++ b/sys/arch/armv7/sunxi/sxirtc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxirtc.c,v 1.2 2013/10/23 18:01:52 jasper Exp $ */
+/* $OpenBSD: sxirtc.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
* Copyright (c) 2013 Artturi Alm
@@ -28,7 +28,8 @@
#include <machine/bus.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/armv7/armv7var.h>
+#include <armv7/sunxi/sunxireg.h>
#define SXIRTC_YYMMDD 0x00
#define SXIRTC_HHMMSS 0x04
@@ -67,16 +68,16 @@ void
sxirtc_attach(struct device *parent, struct device *self, void *args)
{
struct sxirtc_softc *sc = (struct sxirtc_softc *)self;
- struct sxi_attach_args *sxi = args;
+ struct armv7_attach_args *aa = args;
todr_chip_handle_t handle;
handle = malloc(sizeof(struct todr_chip_handle), M_DEVBUF, M_NOWAIT);
if (handle == NULL)
panic("sxirtc_attach: couldn't allocate todr_handle");
- sc->sc_iot = sxi->sxi_iot;
+ sc->sc_iot = aa->aa_iot;
if (bus_space_subregion(sc->sc_iot, sxitimer_ioh,
- sxi->sxi_dev->mem[0].addr, sxi->sxi_dev->mem[0].size, &sc->sc_ioh))
+ aa->aa_dev->mem[0].addr, aa->aa_dev->mem[0].size, &sc->sc_ioh))
panic("sxirtc_attach: bus_space_subregion failed!");
handle->cookie = self;
diff --git a/sys/arch/armv7/sunxi/sxitimer.c b/sys/arch/armv7/sunxi/sxitimer.c
index bc744199a56..3f42bc5ef36 100644
--- a/sys/arch/armv7/sunxi/sxitimer.c
+++ b/sys/arch/armv7/sunxi/sxitimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxitimer.c,v 1.2 2013/10/27 12:58:53 jasper Exp $ */
+/* $OpenBSD: sxitimer.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
@@ -32,7 +32,7 @@
#include <machine/bus.h>
#include <machine/intr.h>
-#include <armv7/sunxi/sunxivar.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/sunxi/sunxireg.h>
/* #include <armv7/sunxi/sxipiovar.h> */
@@ -139,17 +139,17 @@ struct cfdriver sxitimer_cd = {
void
sxitimer_attach(struct device *parent, struct device *self, void *args)
{
- struct sxi_attach_args *sxi = args;
+ struct armv7_attach_args *aa = args;
uint32_t freq, ival, now, cr, v;
int unit = self->dv_unit;
if (unit != 0)
goto skip_init;
- sxitimer_iot = sxi->sxi_iot;
+ sxitimer_iot = aa->aa_iot;
- if (bus_space_map(sxitimer_iot, sxi->sxi_dev->mem[0].addr,
- sxi->sxi_dev->mem[0].size, 0, &sxitimer_ioh))
+ if (bus_space_map(sxitimer_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sxitimer_ioh))
panic("sxitimer_attach: bus_space_map failed!");
diff --git a/sys/arch/armv7/sunxi/sxiuart.c b/sys/arch/armv7/sunxi/sxiuart.c
index 567be24def8..b2cddfde042 100644
--- a/sys/arch/armv7/sunxi/sxiuart.c
+++ b/sys/arch/armv7/sunxi/sxiuart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxiuart.c,v 1.2 2013/10/23 18:01:52 jasper Exp $ */
+/* $OpenBSD: sxiuart.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
/*
* Copyright (c) 2005 Dale Rahn <drahn@motorola.com>
* Copyright (c) 2013 Artturi Alm
@@ -38,9 +38,9 @@
#include <machine/bus.h>
+#include <armv7/armv7/armv7var.h>
#include <armv7/sunxi/sxiuartreg.h>
#include <armv7/sunxi/sunxireg.h>
-#include <armv7/sunxi/sunxivar.h>
#define DEVUNIT(x) (minor(x) & 0x7f)
#define DEVCUA(x) (minor(x) & 0x80)
@@ -50,7 +50,7 @@ struct sxiuart_softc {
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
struct soft_intrhand *sc_si;
- void *sc_irq;
+ void *sc_irq;
struct tty *sc_tty;
struct timeout sc_diag_tmo;
struct timeout sc_dtr_tmo;
@@ -79,7 +79,7 @@ struct sxiuart_softc {
uint8_t sc_initialize;
uint8_t sc_cua;
- uint8_t *sc_ibuf, *sc_ibufp, *sc_ibufhigh, *sc_ibufend;
+ uint8_t *sc_ibuf, *sc_ibufp, *sc_ibufhigh, *sc_ibufend;
#define SXIUART_IBUFSIZE 128
#define SXIUART_IHIGHWATER 100
uint8_t sc_ibufs[2][SXIUART_IBUFSIZE];
@@ -137,19 +137,19 @@ struct cdevsw sxiuartdev =
void
sxiuartattach(struct device *parent, struct device *self, void *args)
{
- struct sxi_attach_args *sxi = args;
+ struct armv7_attach_args *aa = args;
struct sxiuart_softc *sc = (struct sxiuart_softc *) self;
bus_space_tag_t iot;
bus_space_handle_t ioh;
int s;
- sc->sc_iot = iot = sxi->sxi_iot;
- if (bus_space_map(sc->sc_iot, sxi->sxi_dev->mem[0].addr,
- sxi->sxi_dev->mem[0].size, 0, &sc->sc_ioh))
+ sc->sc_iot = iot = aa->aa_iot;
+ if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+ aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
panic("sxiuartattach: bus_space_map failed!");
ioh = sc->sc_ioh;
- if (sxi->sxi_dev->mem[0].addr == sxiuartconsaddr) {
+ if (aa->aa_dev->mem[0].addr == sxiuartconsaddr) {
cn_tab->cn_dev = makedev(12 /* XXX */, 0);
cdevsw[12] = sxiuartdev; /* KLUDGE */
@@ -185,7 +185,7 @@ sxiuartattach(struct device *parent, struct device *self, void *args)
bus_space_write_1(sc->sc_iot, sc->sc_ioh, SXIUART_MCR, sc->sc_mcr);
splx(s);
- arm_intr_establish(sxi->sxi_dev->irq[0], IPL_TTY,
+ arm_intr_establish(aa->aa_dev->irq[0], IPL_TTY,
sxiuart_intr, sc, sc->sc_dev.dv_xname);
printf("\n");