Restrict dwcmmc to 32bit DMA (<4GB) regardless of attachment
This commit is contained in:
parent
ab013bb301
commit
62b14db6f4
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dwcmmc_fdt.c,v 1.22 2024/02/09 08:50:52 skrll Exp $ */
|
||||
/* $NetBSD: dwcmmc_fdt.c,v 1.23 2024/02/09 17:16:42 skrll Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2015-2018 Jared McNeill <jmcneill@invisible.ca>
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.22 2024/02/09 08:50:52 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.23 2024/02/09 17:16:42 skrll Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
|
@ -149,16 +149,7 @@ dwcmmc_fdt_attach(device_t parent, device_t self, void *aux)
|
|||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_bst = faa->faa_bst;
|
||||
if (sizeof(bus_addr_t) > 4) {
|
||||
error = bus_dmatag_subregion(faa->faa_dmat, 0, __MASK(32),
|
||||
&sc->sc_dmat, BUS_DMA_WAITOK);
|
||||
if (error != 0) {
|
||||
aprint_error(": couldn't create DMA tag: %d\n", error);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sc->sc_dmat = faa->faa_dmat;
|
||||
}
|
||||
sc->sc_dmat = faa->faa_dmat;
|
||||
error = bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh);
|
||||
if (error) {
|
||||
aprint_error(": couldn't map %#" PRIx64 ": %d\n",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dwc_mmc.c,v 1.30 2024/02/09 16:57:11 skrll Exp $ */
|
||||
/* $NetBSD: dwc_mmc.c,v 1.31 2024/02/09 17:16:42 skrll Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.30 2024/02/09 16:57:11 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.31 2024/02/09 17:16:42 skrll Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
|
@ -837,6 +837,16 @@ dwc_mmc_init(struct dwc_mmc_softc *sc)
|
|||
val = MMC_READ(sc, DWC_MMC_VERID);
|
||||
sc->sc_verid = __SHIFTOUT(val, DWC_MMC_VERID_ID);
|
||||
|
||||
if (sizeof(bus_addr_t) > 4) {
|
||||
int error = bus_dmatag_subregion(sc->sc_dmat, 0, __MASK(32),
|
||||
&sc->sc_dmat, BUS_DMA_WAITOK);
|
||||
if (error != 0) {
|
||||
aprint_error_dev(sc->sc_dev,
|
||||
"failed to create DMA subregion\n");
|
||||
return ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
if (sc->sc_fifo_reg == 0) {
|
||||
if (sc->sc_verid < DWC_MMC_VERID_240A)
|
||||
sc->sc_fifo_reg = 0x100;
|
||||
|
|
Loading…
Reference in New Issue