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/armv7/imx | |
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/armv7/imx')
-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 |
8 files changed, 47 insertions, 40 deletions
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) |