From ae88ccfd69677f5f05582d8000a09e9311996eb2 Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 27 May 2015 00:06:14 +0000 Subject: [PATCH] make the exynos code compile without fdt ok bmercer@ --- sys/arch/armv7/conf/Makefile.armv7 | 5 ++-- sys/arch/armv7/conf/files.armv7 | 6 ++++- sys/arch/armv7/exynos/exclock.c | 21 +++++++++++++---- sys/arch/armv7/exynos/exdisplay.c | 32 ++++++++++++++++++-------- sys/arch/armv7/exynos/exdog.c | 20 ++++++++++++---- sys/arch/armv7/exynos/exehci.c | 25 ++++++++++++++++---- sys/arch/armv7/exynos/exesdhc.c | 20 ++++++++++++---- sys/arch/armv7/exynos/exgpio.c | 20 ++++++++++++---- sys/arch/armv7/exynos/exiic.c | 18 ++++++++++++--- sys/arch/armv7/exynos/exmct.c | 20 ++++++++++++---- sys/arch/armv7/exynos/expower.c | 20 ++++++++++++---- sys/arch/armv7/exynos/exsysreg.c | 20 ++++++++++++---- sys/arch/armv7/exynos/exuart.c | 21 +++++++++++++---- sys/arch/armv7/exynos/exynos.c | 8 ++++++- sys/arch/armv7/exynos/exynos_machdep.c | 14 +++++++++-- 15 files changed, 214 insertions(+), 56 deletions(-) diff --git a/sys/arch/armv7/conf/Makefile.armv7 b/sys/arch/armv7/conf/Makefile.armv7 index 6322655a6b7..cb17b7d19e1 100644 --- a/sys/arch/armv7/conf/Makefile.armv7 +++ b/sys/arch/armv7/conf/Makefile.armv7 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.armv7,v 1.9 2015/05/20 01:44:20 jsg Exp $ +# $OpenBSD: Makefile.armv7,v 1.10 2015/05/27 00:06:14 jsg Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -179,8 +179,9 @@ install-kernel-${MACHINE_NAME}: KERNADDR_OMAP=0x80300000 KERNADDR_IMX=0x10300000 KERNADDR_SUNXI=0x40300000 +KERNADDR_EXYNOS=0x40300000 -.for SOC in IMX OMAP SUNXI +.for SOC in IMX OMAP SUNXI EXYNOS bsd.${SOC}.umg: bsd mkuboot -a arm -o linux -e ${KERNADDR_${SOC}} -l ${KERNADDR_${SOC}} \ bsd bsd.${SOC}.umg diff --git a/sys/arch/armv7/conf/files.armv7 b/sys/arch/armv7/conf/files.armv7 index eaa97fb74d0..514ebd187f1 100644 --- a/sys/arch/armv7/conf/files.armv7 +++ b/sys/arch/armv7/conf/files.armv7 @@ -1,4 +1,4 @@ -# $OpenBSD: files.armv7,v 1.11 2015/05/19 03:30:54 jsg Exp $ +# $OpenBSD: files.armv7,v 1.12 2015/05/27 00:06:14 jsg Exp $ maxpartitions 16 maxusers 2 8 64 @@ -8,6 +8,9 @@ major {sd = 24} major {cd = 26} major {rd = 18} +define fdt {} +file arch/armv7/fdt/fdt_machdep.c fdt needs-flag + file arch/arm/arm/conf.c #interrupt API layer @@ -60,3 +63,4 @@ include "dev/onewire/files.onewire" include "arch/armv7/imx/files.imx" include "arch/armv7/omap/files.omap" include "arch/armv7/sunxi/files.sunxi" +include "arch/armv7/exynos/files.exynos" diff --git a/sys/arch/armv7/exynos/exclock.c b/sys/arch/armv7/exynos/exclock.c index 85f595a9a2e..fdc3cbd8f16 100644 --- a/sys/arch/armv7/exynos/exclock.c +++ b/sys/arch/armv7/exynos/exclock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exclock.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */ +/* $OpenBSD: exclock.c,v 1.2 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include @@ -26,7 +28,9 @@ #include #include #include +#if NFDT > 0 #include +#endif #include /* registers */ @@ -109,10 +113,12 @@ struct cfdriver exclock_cd = { int exclock_match(struct device *parent, void *v, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,exynos5250-clock", aa->aa_node)) return 1; +#endif return 0; } @@ -122,15 +128,22 @@ exclock_attach(struct device *parent, struct device *self, void *args) { struct armv7_attach_args *aa = args; struct exclock_softc *sc = (struct exclock_softc *) self; - struct fdt_memory mem; + struct armv7mem mem; exclock_sc = sc; sc->sc_iot = aa->aa_iot; +#if NFDT > 0 if (aa->aa_node) { - if (fdt_get_memory_address(aa->aa_node, 0, &mem)) + struct fdt_memory fdtmem; + if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) panic("%s: could not extract memory data from FDT", __func__); - } else { + mem.addr = fdtmem.addr; + mem.size = fdtmem.size; + } else +#endif + { + mem.addr = aa->aa_dev->mem[0].addr; mem.size = aa->aa_dev->mem[0].size; } diff --git a/sys/arch/armv7/exynos/exdisplay.c b/sys/arch/armv7/exynos/exdisplay.c index 6c7663faa2d..bb7c1a84f09 100644 --- a/sys/arch/armv7/exynos/exdisplay.c +++ b/sys/arch/armv7/exynos/exdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exdisplay.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */ +/* $OpenBSD: exdisplay.c,v 1.2 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2013 Patrick Wildt * @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include @@ -33,7 +35,9 @@ #include #include +#if NFDT > 0 #include +#endif #include /* registers */ @@ -102,10 +106,12 @@ struct wsdisplay_accessops exdisplay_accessops = { int exdisplay_match(struct device *parent, void *v, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,exynos5250-fimd", aa->aa_node)) return 1; +#endif return 0; } @@ -117,17 +123,23 @@ exdisplay_attach(struct device *parent, struct device *self, void *args) struct exdisplay_softc *sc = (struct exdisplay_softc *) self; struct wsemuldisplaydev_attach_args waa; struct rasops_info *ri = &exdisplay_ri; - struct fdt_memory mem; - - if (aa->aa_node == NULL) { - printf(": not configured without FDT\n"); - return; - } + struct armv7mem mem; sc->sc_iot = aa->aa_iot; - if (fdt_get_memory_address(aa->aa_node, 0, &mem)) - panic("%s: could not extract memory data from FDT", - __func__); +#if NFDT > 0 + if (aa->aa_node) { + struct fdt_memory fdtmem; + if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + panic("%s: could not extract memory data from FDT", + __func__); + mem.addr = fdtmem.addr; + mem.size = fdtmem.size; + } else +#endif + { + mem.addr = aa->aa_dev->mem[0].addr; + mem.size = aa->aa_dev->mem[0].size; + } if (bus_space_map(sc->sc_iot, mem.addr, mem.size, 0, &sc->sc_ioh)) panic("%s: bus_space_map failed!", __func__); diff --git a/sys/arch/armv7/exynos/exdog.c b/sys/arch/armv7/exynos/exdog.c index d5e285a49a8..6240cc183d9 100644 --- a/sys/arch/armv7/exynos/exdog.c +++ b/sys/arch/armv7/exynos/exdog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exdog.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */ +/* $OpenBSD: exdog.c,v 1.2 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include @@ -24,7 +26,9 @@ #include #include #include +#if NFDT > 0 #include +#endif #include #include @@ -71,10 +75,12 @@ struct cfdriver exdog_cd = { int exdog_match(struct device *parent, void *v, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,exynos5250-wdt", aa->aa_node)) return 1; +#endif return 0; } @@ -84,14 +90,20 @@ exdog_attach(struct device *parent, struct device *self, void *args) { struct armv7_attach_args *aa = args; struct exdog_softc *sc = (struct exdog_softc *) self; - struct fdt_memory mem; + struct armv7mem mem; sc->sc_iot = aa->aa_iot; +#if NFDT > 0 if (aa->aa_node) { - if (fdt_get_memory_address(aa->aa_node, 0, &mem)) + struct fdt_memory fdtmem; + if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) panic("%s: could not extract memory data from FDT", __func__); - } else { + mem.addr = fdtmem.addr; + mem.size = fdtmem.size; + } else +#endif + { mem.addr = aa->aa_dev->mem[0].addr; mem.size = aa->aa_dev->mem[0].size; } diff --git a/sys/arch/armv7/exynos/exehci.c b/sys/arch/armv7/exynos/exehci.c index a73f6284fb3..8d7d537ff03 100644 --- a/sys/arch/armv7/exynos/exehci.c +++ b/sys/arch/armv7/exynos/exehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exehci.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */ +/* $OpenBSD: exehci.c,v 1.2 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include @@ -24,7 +26,9 @@ #include #include +#if NFDT > 0 #include +#endif #include #include @@ -104,10 +108,12 @@ void exehci_setup(struct exehci_softc *); int exehci_match(struct device *parent, void *v, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,exynos4210-ehci", aa->aa_node)) return 1; +#endif return 0; } @@ -118,23 +124,25 @@ exehci_attach(struct device *parent, struct device *self, void *aux) struct exehci_softc *sc = (struct exehci_softc *)self; struct ehci_softc *esc; struct armv7_attach_args *aa = aux; - struct fdt_memory hmem, pmem; + struct armv7mem hmem, pmem; int irq; usbd_status r; sc->sc_iot = aa->aa_iot; sc->sc_dmat = aa->aa_dmat; +#if NFDT > 0 if (aa->aa_node) { + struct fdt_memory fhmem, fpmem; uint32_t ints[3]; - if (fdt_get_memory_address(aa->aa_node, 0, &hmem)) + if (fdt_get_memory_address(aa->aa_node, 0, &fhmem)) panic("%s: could not extract memory data from FDT", __func__); /* XXX: In a different way, please. */ void *node = fdt_find_compatible("samsung,exynos5250-usb2-phy"); - if (node == NULL || fdt_get_memory_address(node, 0, &pmem)) + if (node == NULL || fdt_get_memory_address(node, 0, &fpmem)) panic("%s: could not extract phy data from FDT", __func__); @@ -144,8 +152,15 @@ exehci_attach(struct device *parent, struct device *self, void *aux) panic("%s: could not extract interrupt data from FDT", __func__); + hmem.addr = fhmem.addr; + hmem.size = fhmem.size; + pmem.addr = fpmem.addr; + pmem.size = fpmem.size; + irq = ints[1]; - } else { + } else +#endif + { hmem.addr = aa->aa_dev->mem[0].addr; hmem.size = aa->aa_dev->mem[0].size; pmem.addr = aa->aa_dev->mem[1].addr; diff --git a/sys/arch/armv7/exynos/exesdhc.c b/sys/arch/armv7/exynos/exesdhc.c index 2a48896cfab..f2756792496 100644 --- a/sys/arch/armv7/exynos/exesdhc.c +++ b/sys/arch/armv7/exynos/exesdhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exesdhc.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */ +/* $OpenBSD: exesdhc.c,v 1.2 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2009 Dale Rahn * Copyright (c) 2006 Uwe Stuehler @@ -19,6 +19,7 @@ /* i.MX SD/MMC support derived from /sys/dev/sdmmc/sdhc.c */ +#include "fdt.h" #include #include @@ -27,7 +28,9 @@ #include #include #include +#if NFDT > 0 #include +#endif #include #include @@ -248,10 +251,12 @@ struct cfattach exesdhc_fdt_ca = { int exesdhc_match(struct device *parent, void *v, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,exynos5250-dw-mshc", aa->aa_node)) return 1; +#endif return 0; } @@ -261,19 +266,21 @@ exesdhc_attach(struct device *parent, struct device *self, void *args) { struct exesdhc_softc *sc = (struct exesdhc_softc *) self; struct armv7_attach_args *aa = args; - struct fdt_memory mem; struct sdmmcbus_attach_args saa; + struct armv7mem mem; int error = 1, irq; uint32_t caps; sc->sc_iot = aa->aa_iot; +#if NFDT > 0 if (aa->aa_node) { + struct fdt_memory fdtmem; static int unit = 0; uint32_t ints[3]; sc->unit = unit++; - if (fdt_get_memory_address(aa->aa_node, 0, &mem)) + if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) panic("%s: could not extract memory data from FDT", __func__); @@ -283,8 +290,13 @@ exesdhc_attach(struct device *parent, struct device *self, void *args) panic("%s: could not extract interrupt data from FDT", __func__); + mem.addr = fdtmem.addr; + mem.size = fdtmem.size; + irq = ints[1]; - } else { + } else +#endif + { irq = aa->aa_dev->irq[0]; mem.addr = aa->aa_dev->mem[0].addr; mem.size = aa->aa_dev->mem[0].size; diff --git a/sys/arch/armv7/exynos/exgpio.c b/sys/arch/armv7/exynos/exgpio.c index fa8bbf377b3..f7677708c70 100644 --- a/sys/arch/armv7/exynos/exgpio.c +++ b/sys/arch/armv7/exynos/exgpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exgpio.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */ +/* $OpenBSD: exgpio.c,v 1.2 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * Copyright (c) 2012-2013 Patrick Wildt @@ -16,6 +16,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include @@ -26,7 +28,9 @@ #include #include +#if NFDT > 0 #include +#endif #include #include @@ -103,10 +107,12 @@ struct cfdriver exgpio_cd = { int exgpio_match(struct device *parent, void *v, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,exynos5250-pinctrl", aa->aa_node)) return 1; +#endif return 0; } @@ -116,14 +122,20 @@ exgpio_attach(struct device *parent, struct device *self, void *args) { struct armv7_attach_args *aa = args; struct exgpio_softc *sc = (struct exgpio_softc *) self; - struct fdt_memory mem; + struct armv7mem mem; sc->sc_iot = aa->aa_iot; +#if NFDT > 0 if (aa->aa_node) { - if (fdt_get_memory_address(aa->aa_node, 0, &mem)) + struct fdt_memory fdtmem; + if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) panic("%s: could not extract memory data from FDT", __func__); - } else { + mem.addr = fdtmem.addr; + mem.size = fdtmem.size; + } else +#endif + { mem.addr = aa->aa_dev->mem[0].addr; mem.size = aa->aa_dev->mem[0].size; } diff --git a/sys/arch/armv7/exynos/exiic.c b/sys/arch/armv7/exynos/exiic.c index e47f156725e..0d4e284cb9d 100644 --- a/sys/arch/armv7/exynos/exiic.c +++ b/sys/arch/armv7/exynos/exiic.c @@ -14,6 +14,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include @@ -21,7 +23,9 @@ #include #include #include +#if NFDT > 0 #include +#endif #include #include @@ -115,10 +119,12 @@ struct cfdriver exiic_cd = { int exiic_match(struct device *parent, void *v, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,s3c2440-i2c", aa->aa_node)) return 1; +#endif return 0; } @@ -128,17 +134,23 @@ exiic_attach(struct device *parent, struct device *self, void *args) { struct exiic_softc *sc = (struct exiic_softc *)self; struct armv7_attach_args *aa = args; - struct fdt_memory mem; + struct armv7mem mem; sc->sc_iot = aa->aa_iot; +#if NFDT > 0 if (aa->aa_node) { + struct fdt_memory fdtmem; static int unit = 0; sc->unit = unit++; - if (fdt_get_memory_address(aa->aa_node, 0, &mem)) + if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) panic("%s: could not extract memory data from FDT", __func__); - } else { + mem.addr = fdtmem.addr; + mem.size = fdtmem.size; + } else +#endif + { mem.addr = aa->aa_dev->mem[0].addr; mem.size = aa->aa_dev->mem[0].size; sc->unit = aa->aa_dev->unit; diff --git a/sys/arch/armv7/exynos/exmct.c b/sys/arch/armv7/exynos/exmct.c index 37c71806fdc..6d9f9ad2da7 100644 --- a/sys/arch/armv7/exynos/exmct.c +++ b/sys/arch/armv7/exynos/exmct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exmct.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */ +/* $OpenBSD: exmct.c,v 1.2 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include @@ -26,7 +28,9 @@ #include #include #include +#if NFDT > 0 #include +#endif #include /* registers */ @@ -63,10 +67,12 @@ struct cfdriver exmct_cd = { int exmct_match(struct device *parent, void *v, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,exynos4210-mct", aa->aa_node)) return 1; +#endif return 0; } @@ -76,15 +82,21 @@ exmct_attach(struct device *parent, struct device *self, void *args) { struct armv7_attach_args *aa = args; struct exmct_softc *sc = (struct exmct_softc *) self; - struct fdt_memory mem; + struct armv7mem mem; uint32_t i, mask, reg; sc->sc_iot = aa->aa_iot; +#if NFDT > 0 if (aa->aa_node) { - if (fdt_get_memory_address(aa->aa_node, 0, &mem)) + struct fdt_memory fdtmem; + if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) panic("%s: could not extract memory data from FDT", __func__); - } else { + mem.addr = fdtmem.addr; + mem.size = fdtmem.size; + } else +#endif + { mem.addr = aa->aa_dev->mem[0].addr; mem.size = aa->aa_dev->mem[0].size; } diff --git a/sys/arch/armv7/exynos/expower.c b/sys/arch/armv7/exynos/expower.c index 4bb4a2b7fd8..aa3652294b7 100644 --- a/sys/arch/armv7/exynos/expower.c +++ b/sys/arch/armv7/exynos/expower.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expower.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */ +/* $OpenBSD: expower.c,v 1.2 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include @@ -26,7 +28,9 @@ #include #include #include +#if NFDT > 0 #include +#endif #include #include @@ -70,10 +74,12 @@ struct cfdriver expower_cd = { int expower_match(struct device *parent, void *v, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,exynos5250-pmu", aa->aa_node)) return 1; +#endif return 0; } @@ -83,14 +89,20 @@ expower_attach(struct device *parent, struct device *self, void *args) { struct armv7_attach_args *aa = args; struct expower_softc *sc = (struct expower_softc *) self; - struct fdt_memory mem; + struct armv7mem mem; sc->sc_iot = aa->aa_iot; +#if NFDT > 0 if (aa->aa_node) { - if (fdt_get_memory_address(aa->aa_node, 0, &mem)) + struct fdt_memory fdtmem; + if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) panic("%s: could not extract memory data from FDT", __func__); - } else { + mem.addr = fdtmem.addr; + mem.size = fdtmem.size; + } else +#endif + { mem.addr = aa->aa_dev->mem[0].addr; mem.size = aa->aa_dev->mem[0].size; } diff --git a/sys/arch/armv7/exynos/exsysreg.c b/sys/arch/armv7/exynos/exsysreg.c index 169ecc0d69f..bc6682d651a 100644 --- a/sys/arch/armv7/exynos/exsysreg.c +++ b/sys/arch/armv7/exynos/exsysreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exsysreg.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */ +/* $OpenBSD: exsysreg.c,v 1.2 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include @@ -26,7 +28,9 @@ #include #include #include +#if NFDT > 0 #include +#endif #include #include @@ -70,10 +74,12 @@ struct cfdriver exsysreg_cd = { int exsysreg_match(struct device *parent, void *v, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,exynos5-sysreg", aa->aa_node)) return 1; +#endif return 0; } @@ -83,14 +89,20 @@ exsysreg_attach(struct device *parent, struct device *self, void *args) { struct armv7_attach_args *aa = args; struct exsysreg_softc *sc = (struct exsysreg_softc *) self; - struct fdt_memory mem; + struct armv7mem mem; sc->sc_iot = aa->aa_iot; +#if NFDT > 0 if (aa->aa_node) { - if (fdt_get_memory_address(aa->aa_node, 0, &mem)) + struct fdt_memory fdtmem; + if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) panic("%s: could not extract memory data from FDT", __func__); - } else { + mem.addr = fdtmem.addr; + mem.size = fdtmem.size; + } else +#endif + { mem.addr = aa->aa_dev->mem[0].addr; mem.size = aa->aa_dev->mem[0].size; } diff --git a/sys/arch/armv7/exynos/exuart.c b/sys/arch/armv7/exynos/exuart.c index 9e2c1149337..8e51735ac9f 100644 --- a/sys/arch/armv7/exynos/exuart.c +++ b/sys/arch/armv7/exynos/exuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exuart.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */ +/* $OpenBSD: exuart.c,v 1.2 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include @@ -37,7 +39,9 @@ #endif #include +#if NFDT > 0 #include +#endif #include #include #include @@ -139,10 +143,12 @@ exuartprobe(struct device *parent, void *self, void *aux) int exuartprobe_fdt(struct device *parent, void *self, void *aux) { +#if NFDT > 0 struct armv7_attach_args *aa = aux; if (fdt_node_compatible("samsung,exynos4210-uart", aa->aa_node)) return 1; +#endif return 0; } @@ -155,14 +161,16 @@ exuartattach(struct device *parent, struct device *self, void *args) { struct armv7_attach_args *aa = args; struct exuart_softc *sc = (struct exuart_softc *) self; - struct fdt_memory mem; + struct armv7mem mem; int irq; sc->sc_iot = aa->aa_iot; +#if NFDT > 0 if (aa->aa_node) { + struct fdt_memory fdtmem; uint32_t ints[3]; - if (fdt_get_memory_address(aa->aa_node, 0, &mem)) + if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) panic("%s: could not extract memory data from FDT", __func__); @@ -172,8 +180,13 @@ exuartattach(struct device *parent, struct device *self, void *args) panic("%s: could not extract interrupt data from FDT", __func__); + mem.addr = fdtmem.addr; + mem.size = fdtmem.size; + irq = ints[1]; - } else { + } else +#endif + { irq = aa->aa_dev->irq[0]; mem.addr = aa->aa_dev->mem[0].addr; mem.size = aa->aa_dev->mem[0].size; diff --git a/sys/arch/armv7/exynos/exynos.c b/sys/arch/armv7/exynos/exynos.c index 239634a9abe..06369bb1125 100644 --- a/sys/arch/armv7/exynos/exynos.c +++ b/sys/arch/armv7/exynos/exynos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exynos.c,v 1.5 2015/05/24 11:01:48 jsg Exp $ */ +/* $OpenBSD: exynos.c,v 1.6 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn * Copyright (c) 2012-2013 Patrick Wildt @@ -16,11 +16,15 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include +#if NFDT > 0 #include +#endif #include @@ -108,10 +112,12 @@ exynos_board_name(void) int exynos_match(struct device *parent, void *cfdata, void *aux) { +#if NFDT > 0 /* If we're running with fdt, do not attach. */ /* XXX: Find a better way. */ if (fdt_next_node(0)) return (0); +#endif return (exynos_board_devs() != NULL); } diff --git a/sys/arch/armv7/exynos/exynos_machdep.c b/sys/arch/armv7/exynos/exynos_machdep.c index e82e7ca9827..76665a8b6c4 100644 --- a/sys/arch/armv7/exynos/exynos_machdep.c +++ b/sys/arch/armv7/exynos/exynos_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exynos_machdep.c,v 1.3 2015/05/19 03:30:54 jsg Exp $ */ +/* $OpenBSD: exynos_machdep.c,v 1.4 2015/05/27 00:06:14 jsg Exp $ */ /* * Copyright (c) 2013 Patrick Wildt * @@ -15,13 +15,18 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fdt.h" + #include #include #include #include #include + +#if NFDT > 0 #include +#endif #include #include @@ -48,10 +53,11 @@ exynos_platform_init_cons(void) { paddr_t paddr; size_t size; - void *node; switch (board_id) { case BOARD_ID_EXYNOS5_CHROMEBOOK: +#if NFDT > 0 + void *node; node = fdt_find_node("/framebuffer"); if (node != NULL) { uint32_t *mem; @@ -60,6 +66,10 @@ exynos_platform_init_cons(void) size = betoh32(*mem); } } +#else + paddr = 0xbfc00000; + size = 0x202000; +#endif exdisplay_cnattach(&armv7_bs_tag, paddr, size); break; default: -- 2.20.1