summaryrefslogtreecommitdiff
path: root/sys/arch/armv7
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-03-31 11:54:08 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-03-31 11:54:08 +0000
commitfa38a79e0e37dba9f6fa1641b1694a614984c8d0 (patch)
treeddb829b46995a38329c5904e130851eb52bfe7e7 /sys/arch/armv7
parent2c4c8b1883be9ac4deb0656393256bc901aebdc9 (diff)
Newer device trees no longer put the full physical address in the "reg"
property; it contains on offset in the parent's address space instead. Since the driver needs the address of the CPPI RAM to program the descriptors, use bus_space_vaddr(9) and pmap_extract(9) to get it. ok jsg@
Diffstat (limited to 'sys/arch/armv7')
-rw-r--r--sys/arch/armv7/omap/if_cpsw.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/arch/armv7/omap/if_cpsw.c b/sys/arch/armv7/omap/if_cpsw.c
index b3868754419..ea361cbb91b 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.44 2018/12/24 08:45:57 jsg Exp $ */
+/* $OpenBSD: if_cpsw.c,v 1.45 2020/03/31 11:54:07 kettenis Exp $ */
/* $NetBSD: if_cpsw.c,v 1.3 2013/04/17 14:36:34 bouyer Exp $ */
/*
@@ -89,6 +89,8 @@
#include <dev/ofw/ofw_pinctrl.h>
#include <dev/ofw/fdt.h>
+#include <uvm/uvm_extern.h>
+
#define CPSW_TXFRAGS 16
#define OMAP2SCM_MAC_ID0_LO 0x630
@@ -334,6 +336,7 @@ cpsw_attach(struct device *parent, struct device *self, void *aux)
struct fdt_attach_args *faa = aux;
struct arpcom * const ac = &sc->sc_ac;
struct ifnet * const ifp = &ac->ac_if;
+ void *descs;
u_int32_t idver;
int error;
int node;
@@ -383,14 +386,12 @@ cpsw_attach(struct device *parent, struct device *self, void *aux)
sc->sc_bdt = faa->fa_dmat;
error = bus_space_map(sc->sc_bst, faa->fa_reg[0].addr,
- memsize, 0, &sc->sc_bsh);
+ memsize, BUS_SPACE_MAP_LINEAR, &sc->sc_bsh);
if (error) {
printf("can't map registers: %d\n", error);
return;
}
- 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,
&sc->sc_bsh_txdescs);
@@ -398,6 +399,8 @@ cpsw_attach(struct device *parent, struct device *self, void *aux)
printf("can't subregion tx ring SRAM: %d\n", error);
return;
}
+ descs = bus_space_vaddr(sc->sc_bst, sc->sc_bsh_txdescs);
+ pmap_extract(pmap_kernel(), (vaddr_t)descs, &sc->sc_txdescs_pa);
sc->sc_rxdescs_pa = faa->fa_reg[0].addr +
CPSW_CPPI_RAM_RXDESCS_BASE;
@@ -408,6 +411,8 @@ cpsw_attach(struct device *parent, struct device *self, void *aux)
printf("can't subregion rx ring SRAM: %d\n", error);
return;
}
+ descs = bus_space_vaddr(sc->sc_bst, sc->sc_bsh_rxdescs);
+ pmap_extract(pmap_kernel(), (vaddr_t)descs, &sc->sc_rxdescs_pa);
sc->sc_rdp = malloc(sizeof(*sc->sc_rdp), M_TEMP, M_WAITOK);
KASSERT(sc->sc_rdp != NULL);