diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2016-07-27 11:45:03 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2016-07-27 11:45:03 +0000 |
commit | 1fd68993a9a5fbb0307078e17eb6ede551aedddf (patch) | |
tree | 4d88596a74b88d513c2557c21203fcfc1bac3dbe /sys/arch | |
parent | 786148d7afd0301a999f964879ef4bb28778e6d9 (diff) |
Instead of passing the raw reg property to simplebus nodes,
pass a pre-processed array of fdt_reg structs. This means
that the drivers don't have to understand the cell properties
themselves but can rely on the 64-bit addr/size pairs.
ok kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/include/fdt.h | 4 | ||||
-rw-r--r-- | sys/arch/arm/simplebus/simplebus.c | 40 | ||||
-rw-r--r-- | sys/arch/armv7/imx/if_fec.c | 11 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxahci.c | 11 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxdog.c | 9 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxehci.c | 13 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxesdhc.c | 11 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxgpio.c | 9 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxiic.c | 13 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxuart.c | 10 | ||||
-rw-r--r-- | sys/arch/armv7/omap/if_cpsw.c | 15 | ||||
-rw-r--r-- | sys/arch/armv7/omap/omap_com.c | 8 | ||||
-rw-r--r-- | sys/arch/armv7/omap/omdog.c | 9 | ||||
-rw-r--r-- | sys/arch/armv7/omap/ommmc.c | 15 | ||||
-rw-r--r-- | sys/arch/armv7/omap/ti_iic.c | 9 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxie.c | 9 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxiuart.c | 10 |
17 files changed, 121 insertions, 85 deletions
diff --git a/sys/arch/arm/include/fdt.h b/sys/arch/arm/include/fdt.h index cc7c6041229..b506f5fb8ef 100644 --- a/sys/arch/arm/include/fdt.h +++ b/sys/arch/arm/include/fdt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fdt.h,v 1.3 2016/07/13 20:42:44 patrick Exp $ */ +/* $OpenBSD: fdt.h,v 1.4 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se> * @@ -26,7 +26,7 @@ struct fdt_attach_args { int fa_node; bus_space_tag_t fa_iot; bus_dma_tag_t fa_dmat; - uint32_t *fa_reg; + struct fdt_reg *fa_reg; int fa_nreg; uint32_t *fa_intr; int fa_nintr; diff --git a/sys/arch/arm/simplebus/simplebus.c b/sys/arch/arm/simplebus/simplebus.c index c818814b62a..557999ae9ba 100644 --- a/sys/arch/arm/simplebus/simplebus.c +++ b/sys/arch/arm/simplebus/simplebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: simplebus.c,v 1.7 2016/07/18 11:53:32 patrick Exp $ */ +/* $OpenBSD: simplebus.c,v 1.8 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se> * @@ -22,6 +22,7 @@ #include <sys/malloc.h> #include <dev/ofw/openfirm.h> +#include <dev/ofw/fdt.h> #include <arm/fdt.h> @@ -125,7 +126,8 @@ simplebus_attach_node(struct device *self, int node) struct simplebus_softc *sc = (struct simplebus_softc *)self; struct fdt_attach_args fa; char buffer[128]; - int len; + int i, len, line; + uint32_t *cell, *reg; if (!OF_getprop(node, "compatible", buffer, sizeof(buffer))) return; @@ -143,11 +145,33 @@ simplebus_attach_node(struct device *self, int node) fa.fa_scells = sc->sc_scells; len = OF_getproplen(node, "reg"); - if (len > 0 && (len % sizeof(uint32_t)) == 0) { - fa.fa_reg = malloc(len, M_DEVBUF, M_WAITOK); - fa.fa_nreg = len / sizeof(uint32_t); - - OF_getpropintarray(node, "reg", fa.fa_reg, len); + line = (sc->sc_acells + sc->sc_scells) * sizeof(uint32_t); + if (len > 0 && line > 0 && (len % line) == 0) { + reg = malloc(len, M_TEMP, M_WAITOK); + OF_getpropintarray(node, "reg", reg, len); + + fa.fa_reg = malloc((len / line) * sizeof(struct fdt_reg), + M_DEVBUF, M_WAITOK | M_ZERO); + fa.fa_nreg = (len / line); + + for (i = 0, cell = reg; i < len / line; i++) { + if (sc->sc_acells >= 1) + fa.fa_reg[i].addr = cell[0]; + if (sc->sc_acells == 2) { + fa.fa_reg[i].addr <<= 32; + fa.fa_reg[i].addr |= cell[1]; + } + cell += sc->sc_acells; + if (sc->sc_scells >= 1) + fa.fa_reg[i].size = cell[0]; + if (sc->sc_scells == 2) { + fa.fa_reg[i].size <<= 32; + fa.fa_reg[i].size |= cell[1]; + } + cell += sc->sc_scells; + } + + free(reg, M_TEMP, len); } len = OF_getproplen(node, "interrupts"); @@ -162,7 +186,7 @@ simplebus_attach_node(struct device *self, int node) config_found(self, &fa, NULL); - free(fa.fa_reg, M_DEVBUF, fa.fa_nreg * sizeof(uint32_t)); + free(fa.fa_reg, M_DEVBUF, fa.fa_nreg * sizeof(struct fdt_reg)); free(fa.fa_intr, M_DEVBUF, fa.fa_nintr * sizeof(uint32_t)); } diff --git a/sys/arch/armv7/imx/if_fec.c b/sys/arch/armv7/imx/if_fec.c index 0ba9c0cc6fd..32b8729bb39 100644 --- a/sys/arch/armv7/imx/if_fec.c +++ b/sys/arch/armv7/imx/if_fec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_fec.c,v 1.10 2016/07/23 14:39:10 kettenis Exp $ */ +/* $OpenBSD: if_fec.c,v 1.11 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> * @@ -51,6 +51,7 @@ #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_gpio.h> +#include <dev/ofw/fdt.h> /* configuration registers */ #define ENET_EIR 0x004 @@ -298,7 +299,7 @@ fec_attach(struct device *parent, struct device *self, void *aux) uint32_t phy_reset_gpio[3]; uint32_t phy_reset_duration; - if (faa->fa_nreg < 2) + if (faa->fa_nreg < 1) return; if (OF_getpropintarray(faa->fa_node, "interrupts-extended", @@ -307,8 +308,8 @@ fec_attach(struct device *parent, struct device *self, void *aux) sc->sc_node = faa->fa_node; sc->sc_iot = faa->fa_iot; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->sc_ioh)) panic("fec_attach: bus_space_map failed!"); sc->sc_dma_tag = faa->fa_dmat; @@ -453,7 +454,7 @@ rxdma: txdma: fec_dma_free(sc, &sc->txdma); bad: - bus_space_unmap(sc->sc_iot, sc->sc_ioh, faa->fa_reg[1]); + bus_space_unmap(sc->sc_iot, sc->sc_ioh, faa->fa_reg[0].size); } void diff --git a/sys/arch/armv7/imx/imxahci.c b/sys/arch/armv7/imx/imxahci.c index 6badbb31c1e..9efa0c8fafb 100644 --- a/sys/arch/armv7/imx/imxahci.c +++ b/sys/arch/armv7/imx/imxahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxahci.c,v 1.5 2016/07/12 19:17:49 kettenis Exp $ */ +/* $OpenBSD: imxahci.c,v 1.6 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2013 Patrick Wildt <patrick@blueri.se> * @@ -34,6 +34,7 @@ #include <armv7/imx/imxiomuxcvar.h> #include <dev/ofw/openfirm.h> +#include <dev/ofw/fdt.h> /* registers */ #define SATA_CAP 0x000 @@ -114,15 +115,15 @@ imxahci_attach(struct device *parent, struct device *self, void *aux) struct fdt_attach_args *faa = aux; uint32_t timeout = 0x100000; - if (faa->fa_nreg < 2 || faa->fa_nintr < 3) + if (faa->fa_nreg < 1 || faa->fa_nintr < 3) return; sc->sc_iot = faa->fa_iot; - sc->sc_ios = faa->fa_reg[1]; + sc->sc_ios = faa->fa_reg[0].size; sc->sc_dmat = faa->fa_dmat; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->sc_ioh)) panic("imxahci_attach: bus_space_map failed!"); sc->sc_ih = arm_intr_establish(faa->fa_intr[1], IPL_BIO, diff --git a/sys/arch/armv7/imx/imxdog.c b/sys/arch/armv7/imx/imxdog.c index f3040d8fc09..52e12fdbd1b 100644 --- a/sys/arch/armv7/imx/imxdog.c +++ b/sys/arch/armv7/imx/imxdog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxdog.c,v 1.3 2016/06/13 23:43:58 kettenis Exp $ */ +/* $OpenBSD: imxdog.c,v 1.4 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> * @@ -29,6 +29,7 @@ #include <machine/fdt.h> #include <dev/ofw/openfirm.h> +#include <dev/ofw/fdt.h> #include <armv7/armv7/armv7var.h> @@ -73,12 +74,12 @@ imxdog_attach(struct device *parent, struct device *self, void *aux) struct fdt_attach_args *faa = aux; struct imxdog_softc *sc = (struct imxdog_softc *) self; - if (faa->fa_nreg < 2) + if (faa->fa_nreg < 1) return; sc->sc_iot = faa->fa_iot; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[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 e80ac9d2502..eaa8bfc0ad9 100644 --- a/sys/arch/armv7/imx/imxehci.c +++ b/sys/arch/armv7/imx/imxehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxehci.c,v 1.13 2016/07/13 09:12:46 kettenis Exp $ */ +/* $OpenBSD: imxehci.c,v 1.14 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> * @@ -37,6 +37,7 @@ #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_gpio.h> +#include <dev/ofw/fdt.h> #include <dev/usb/ehcireg.h> #include <dev/usb/ehcivar.h> @@ -114,7 +115,7 @@ imxehci_attach(struct device *parent, struct device *self, void *aux) uint32_t vbus; int node; - if (faa->fa_nreg < 2 || faa->fa_nintr < 3) + if (faa->fa_nreg < 1 || faa->fa_nintr < 3) return; if (OF_getpropintarray(faa->fa_node, "fsl,usbphy", @@ -143,11 +144,11 @@ imxehci_attach(struct device *parent, struct device *self, void *aux) sc->sc.iot = faa->fa_iot; sc->sc.sc_bus.dmatag = faa->fa_dmat; - sc->sc.sc_size = faa->fa_reg[1] - USB_EHCI_OFFSET; + sc->sc.sc_size = faa->fa_reg[0].size - USB_EHCI_OFFSET; /* Map I/O space */ - if (bus_space_map(sc->sc.iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->uh_ioh)) { + if (bus_space_map(sc->sc.iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->uh_ioh)) { printf(": cannot map mem space\n"); goto out; } @@ -281,7 +282,7 @@ mem2: bus_space_unmap(sc->sc.iot, sc->ph_ioh, phy_reg[1]); mem1: mem0: - bus_space_unmap(sc->sc.iot, sc->sc.ioh, faa->fa_reg[1]); + bus_space_unmap(sc->sc.iot, sc->sc.ioh, faa->fa_reg[0].size); sc->sc.sc_size = 0; out: return; diff --git a/sys/arch/armv7/imx/imxesdhc.c b/sys/arch/armv7/imx/imxesdhc.c index ebb253e3afb..3a5e16d6693 100644 --- a/sys/arch/armv7/imx/imxesdhc.c +++ b/sys/arch/armv7/imx/imxesdhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxesdhc.c,v 1.25 2016/07/11 14:54:18 kettenis Exp $ */ +/* $OpenBSD: imxesdhc.c,v 1.26 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2009 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -39,6 +39,7 @@ #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_gpio.h> +#include <dev/ofw/fdt.h> /* registers */ #define SDHC_DS_ADDR 0x00 @@ -296,15 +297,15 @@ imxesdhc_attach(struct device *parent, struct device *self, void *aux) uint32_t caps; uint32_t width; - if (faa->fa_nreg < 2 || faa->fa_nintr < 3) + if (faa->fa_nreg < 1 || faa->fa_nintr < 3) return; - sc->unit = (faa->fa_reg[0] & 0xc000) >> 14; + sc->unit = (faa->fa_reg[0].addr & 0xc000) >> 14; sc->sc_node = faa->fa_node; sc->sc_dmat = faa->fa_dmat; sc->sc_iot = faa->fa_iot; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->sc_ioh)) panic("imxesdhc_attach: bus_space_map failed!"); printf("\n"); diff --git a/sys/arch/armv7/imx/imxgpio.c b/sys/arch/armv7/imx/imxgpio.c index 2187fde1162..7ace8f50680 100644 --- a/sys/arch/armv7/imx/imxgpio.c +++ b/sys/arch/armv7/imx/imxgpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxgpio.c,v 1.9 2016/07/11 14:51:31 kettenis Exp $ */ +/* $OpenBSD: imxgpio.c,v 1.10 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> @@ -34,6 +34,7 @@ #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_gpio.h> +#include <dev/ofw/fdt.h> /* iMX6 registers */ #define GPIO_DR 0x00 @@ -117,12 +118,12 @@ imxgpio_attach(struct device *parent, struct device *self, void *aux) struct imxgpio_softc *sc = (struct imxgpio_softc *)self; struct fdt_attach_args *faa = aux; - if (faa->fa_nreg < 2) + if (faa->fa_nreg < 1) return; sc->sc_iot = faa->fa_iot; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->sc_ioh)) panic("imxgpio_attach: bus_space_map failed!"); sc->sc_gc.gc_node = faa->fa_node; diff --git a/sys/arch/armv7/imx/imxiic.c b/sys/arch/armv7/imx/imxiic.c index b966e0d7c7a..ae6d01adcf0 100644 --- a/sys/arch/armv7/imx/imxiic.c +++ b/sys/arch/armv7/imx/imxiic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxiic.c,v 1.8 2016/07/10 11:46:28 kettenis Exp $ */ +/* $OpenBSD: imxiic.c,v 1.9 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2013 Patrick Wildt <patrick@blueri.se> * @@ -30,6 +30,7 @@ #include <armv7/imx/imxiicvar.h> #include <dev/ofw/openfirm.h> +#include <dev/ofw/fdt.h> /* registers */ #define I2C_IADR 0x00 @@ -115,15 +116,15 @@ imxiic_attach(struct device *parent, struct device *self, void *aux) struct imxiic_softc *sc = (struct imxiic_softc *)self; struct fdt_attach_args *faa = aux; - if (faa->fa_nreg < 2) + if (faa->fa_nreg < 1) return; sc->sc_iot = faa->fa_iot; - sc->sc_ios = faa->fa_reg[1]; + sc->sc_ios = faa->fa_reg[0].size; sc->sc_node = faa->fa_node; - sc->unit = (faa->fa_reg[0] & 0xc000) >> 14; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + sc->unit = (faa->fa_reg[0].addr & 0xc000) >> 14; + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->sc_ioh)) panic("imxiic_attach: bus_space_map failed!"); #if 0 diff --git a/sys/arch/armv7/imx/imxuart.c b/sys/arch/armv7/imx/imxuart.c index 4376be6570e..3fd81b016b9 100644 --- a/sys/arch/armv7/imx/imxuart.c +++ b/sys/arch/armv7/imx/imxuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxuart.c,v 1.9 2016/07/26 22:10:10 patrick Exp $ */ +/* $OpenBSD: imxuart.c,v 1.10 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@motorola.com> * @@ -164,7 +164,7 @@ imxuart_attach(struct device *parent, struct device *self, void *aux) struct fdt_attach_args *faa = aux; int maj; - if (faa->fa_nreg < 2 || faa->fa_nintr < 3) + if (faa->fa_nreg < 1 || faa->fa_nintr < 3) return; imxiomuxc_pinctrlbyname(faa->fa_node, "default"); @@ -173,11 +173,11 @@ imxuart_attach(struct device *parent, struct device *self, void *aux) imxuart_intr, sc, sc->sc_dev.dv_xname); sc->sc_iot = faa->fa_iot; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->sc_ioh)) panic("imxuartattach: bus_space_map failed!"); - if (faa->fa_reg[0] == imxuartconsaddr) { + if (faa->fa_reg[0].addr == imxuartconsaddr) { /* Locate the major number. */ for (maj = 0; maj < nchrdev; maj++) if (cdevsw[maj].d_open == imxuartopen) diff --git a/sys/arch/armv7/omap/if_cpsw.c b/sys/arch/armv7/omap/if_cpsw.c index 6ced8b04da5..5566e476103 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.37 2016/07/17 02:45:05 jsg Exp $ */ +/* $OpenBSD: if_cpsw.c,v 1.38 2016/07/27 11:45:02 patrick Exp $ */ /* $NetBSD: if_cpsw.c,v 1.3 2013/04/17 14:36:34 bouyer Exp $ */ /* @@ -87,6 +87,7 @@ #include <arch/armv7/omap/sitara_cm.h> #include <dev/ofw/openfirm.h> +#include <dev/ofw/fdt.h> #define CPSW_TXFRAGS 16 @@ -341,7 +342,7 @@ cpsw_attach(struct device *parent, struct device *self, void *aux) uint32_t memsize; char name[32]; - if (faa->fa_nreg < 2 || (faa->fa_nintr != 4 && faa->fa_nintr != 12)) + if (faa->fa_nreg < 1 || (faa->fa_nintr != 4 && faa->fa_nintr != 12)) return; for (i = 0; i < 4; i++) { @@ -352,8 +353,8 @@ cpsw_attach(struct device *parent, struct device *self, void *aux) } /* - * fa_reg[1] is size of CPSW_SS and CPSW_PORT - * fa_reg[3] is size of CPSW_WR + * fa_reg[0].size is size of CPSW_SS and CPSW_PORT + * fa_reg[1].size is size of CPSW_WR * we map a size that is a superset of both */ memsize = 0x4000; @@ -389,14 +390,14 @@ cpsw_attach(struct device *parent, struct device *self, void *aux) sc->sc_bst = faa->fa_iot; sc->sc_bdt = faa->fa_dmat; - error = bus_space_map(sc->sc_bst, faa->fa_reg[0], + error = bus_space_map(sc->sc_bst, faa->fa_reg[0].addr, memsize, 0, &sc->sc_bsh); if (error) { printf("can't map registers: %d\n", error); return; } - sc->sc_txdescs_pa = faa->fa_reg[0] + + sc->sc_txdescs_pa = faa->fa_reg[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, @@ -406,7 +407,7 @@ cpsw_attach(struct device *parent, struct device *self, void *aux) return; } - sc->sc_rxdescs_pa = faa->fa_reg[0] + + sc->sc_rxdescs_pa = faa->fa_reg[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/omap_com.c b/sys/arch/armv7/omap/omap_com.c index 72eea2731af..20a51b493fd 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.7 2016/07/26 22:10:10 patrick Exp $ */ +/* $OpenBSD: omap_com.c,v 1.8 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. * All rights reserved. @@ -104,11 +104,11 @@ omapuart_attach(struct device *parent, struct device *self, void *aux) struct fdt_attach_args *faa = aux; int irq; - if (faa->fa_nreg != 2 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) + if (faa->fa_nreg != 1 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) return; sc->sc_iot = &armv7_a4x_bs_tag; /* XXX: This sucks */ - sc->sc_iobase = faa->fa_reg[0]; + sc->sc_iobase = faa->fa_reg[0].addr; sc->sc_frequency = 48000000; sc->sc_uarttype = COM_UART_TI16750; @@ -118,7 +118,7 @@ omapuart_attach(struct device *parent, struct device *self, void *aux) irq = faa->fa_intr[1]; if (bus_space_map(sc->sc_iot, sc->sc_iobase, - faa->fa_reg[1], 0, &sc->sc_ioh)) { + faa->fa_reg[0].size, 0, &sc->sc_ioh)) { printf("%s: bus_space_map failed\n", __func__); return; } diff --git a/sys/arch/armv7/omap/omdog.c b/sys/arch/armv7/omap/omdog.c index f4df5c4452d..376154bd9d7 100644 --- a/sys/arch/armv7/omap/omdog.c +++ b/sys/arch/armv7/omap/omdog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omdog.c,v 1.6 2016/06/26 05:16:33 jsg Exp $ */ +/* $OpenBSD: omdog.c,v 1.7 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2013 Federico G. Schwindt <fgsch@openbsd.org> * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org> @@ -30,6 +30,7 @@ #include <machine/fdt.h> #include <dev/ofw/openfirm.h> +#include <dev/ofw/fdt.h> #include <armv7/armv7/armv7var.h> @@ -94,12 +95,12 @@ omdog_attach(struct device *parent, struct device *self, void *aux) struct omdog_softc *sc = (struct omdog_softc *) self; u_int32_t rev; - if (faa->fa_nreg < 2) + if (faa->fa_nreg < 1) return; sc->sc_iot = faa->fa_iot; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[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/ommmc.c b/sys/arch/armv7/omap/ommmc.c index c6f530d0127..bf0451cae88 100644 --- a/sys/arch/armv7/omap/ommmc.c +++ b/sys/arch/armv7/omap/ommmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ommmc.c,v 1.26 2016/07/17 02:45:05 jsg Exp $ */ +/* $OpenBSD: ommmc.c,v 1.27 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2009 Dale Rahn <drahn@openbsd.org> @@ -37,6 +37,7 @@ #include <armv7/omap/sitara_cm.h> #include <dev/ofw/openfirm.h> +#include <dev/ofw/fdt.h> /* * NOTE: on OMAP4430/AM335x these registers skew by 0x100 @@ -302,18 +303,18 @@ ommmc_attach(struct device *parent, struct device *self, void *aux) int len, unit; char hwmods[128]; - if (faa->fa_nreg != 2 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) + if (faa->fa_nreg != 1 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) return; - if (faa->fa_reg[1] <= 0x100) + if (faa->fa_reg[0].size <= 0x100) return; if (OF_is_compatible(faa->fa_node, "ti,omap4-hsmmc")) { - addr = faa->fa_reg[0] + 0x100; - size = faa->fa_reg[1] - 0x100; + addr = faa->fa_reg[0].addr + 0x100; + size = faa->fa_reg[0].size - 0x100; } else { - addr = faa->fa_reg[0]; - size = faa->fa_reg[1]; + addr = faa->fa_reg[0].addr; + size = faa->fa_reg[0].size; } if (faa->fa_nintr == 1) diff --git a/sys/arch/armv7/omap/ti_iic.c b/sys/arch/armv7/omap/ti_iic.c index 718e63c7f09..046a822aab3 100644 --- a/sys/arch/armv7/omap/ti_iic.c +++ b/sys/arch/armv7/omap/ti_iic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ti_iic.c,v 1.6 2016/07/17 02:45:05 jsg Exp $ */ +/* $OpenBSD: ti_iic.c,v 1.7 2016/07/27 11:45:02 patrick Exp $ */ /* $NetBSD: ti_iic.c,v 1.4 2013/04/25 13:04:27 rkujawa Exp $ */ /* @@ -69,6 +69,7 @@ #include <armv7/omap/sitara_cm.h> #include <dev/ofw/openfirm.h> +#include <dev/ofw/fdt.h> #ifndef AM335X_I2C_SLAVE_ADDR #define AM335X_I2C_SLAVE_ADDR 0x01 @@ -167,7 +168,7 @@ ti_iic_attach(struct device *parent, struct device *self, void *aux) int irq, unit, len; char hwmods[128]; - if (faa->fa_nreg != 2 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) + if (faa->fa_nreg != 1 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) return; sc->sc_iot = faa->fa_iot; @@ -190,8 +191,8 @@ ti_iic_attach(struct device *parent, struct device *self, void *aux) sc->sc_rxthres = sc->sc_txthres = 4; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->sc_ioh)) panic("%s: bus_space_map failed!", DEVNAME(sc)); sitara_cm_pinctrlbyname(faa->fa_node, "default"); diff --git a/sys/arch/armv7/sunxi/sxie.c b/sys/arch/armv7/sunxi/sxie.c index f72f5362877..c0d4fd8666b 100644 --- a/sys/arch/armv7/sunxi/sxie.c +++ b/sys/arch/armv7/sunxi/sxie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sxie.c,v 1.16 2016/06/12 06:58:39 jsg Exp $ */ +/* $OpenBSD: sxie.c,v 1.17 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> * Copyright (c) 2013 Artturi Alm @@ -52,6 +52,7 @@ #include <armv7/sunxi/sxipiovar.h> #include <dev/ofw/openfirm.h> +#include <dev/ofw/fdt.h> /* configuration registers */ #define SXIE_CR 0x0000 @@ -212,7 +213,7 @@ sxie_attach(struct device *parent, struct device *self, void *aux) struct ifnet *ifp; int s, irq; - if (faa->fa_nreg != 2 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) + if (faa->fa_nreg != 1 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) return; if (faa->fa_nintr == 1) @@ -222,8 +223,8 @@ sxie_attach(struct device *parent, struct device *self, void *aux) sc->sc_iot = faa->fa_iot; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[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)) diff --git a/sys/arch/armv7/sunxi/sxiuart.c b/sys/arch/armv7/sunxi/sxiuart.c index c7e6dda995d..c08de46b677 100644 --- a/sys/arch/armv7/sunxi/sxiuart.c +++ b/sys/arch/armv7/sunxi/sxiuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sxiuart.c,v 1.8 2016/07/26 22:10:10 patrick Exp $ */ +/* $OpenBSD: sxiuart.c,v 1.9 2016/07/27 11:45:02 patrick Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@motorola.com> * Copyright (c) 2013 Artturi Alm @@ -175,7 +175,7 @@ sxiuart_attach(struct device *parent, struct device *self, void *aux) bus_space_handle_t ioh; int s, irq; - if (faa->fa_nreg != 2 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) + if (faa->fa_nreg != 1 || (faa->fa_nintr != 1 && faa->fa_nintr != 3)) return; if (faa->fa_nintr == 1) @@ -184,12 +184,12 @@ sxiuart_attach(struct device *parent, struct device *self, void *aux) irq = faa->fa_intr[1]; sc->sc_iot = iot = faa->fa_iot; - if (bus_space_map(sc->sc_iot, faa->fa_reg[0], - faa->fa_reg[1], 0, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->sc_ioh)) panic("sxiuartattach: bus_space_map failed!"); ioh = sc->sc_ioh; - if (faa->fa_reg[0] == sxiuartconsaddr) { + if (faa->fa_reg[0].addr == sxiuartconsaddr) { cn_tab->cn_dev = makedev(12 /* XXX */, 0); cdevsw[12] = sxiuartdev; /* KLUDGE */ |