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/omap | |
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/omap')
-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 |
5 files changed, 30 insertions, 26 deletions
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"); |