diff options
Diffstat (limited to 'sys/arch/armv7/sunxi')
-rw-r--r-- | sys/arch/armv7/sunxi/a1xintc.c | 12 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/files.sunxi | 8 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sun4i.c | 9 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sun7i.c | 9 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sunxi.c | 210 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sunxi_machdep.c | 2 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sunxireg.h | 24 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sunxivar.h | 74 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxiahci.c | 20 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxiccmu.c | 13 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxidog.c | 17 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxie.c | 14 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxiehci.c | 18 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxipio.c | 15 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxirtc.c | 11 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxitimer.c | 12 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxiuart.c | 20 |
17 files changed, 118 insertions, 370 deletions
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"); |