git: 3c04909b9cb0 - stable/13 - aw_mmc: add crash dumping support in MMCCAM mode

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Mon, 04 Jul 2022 10:20:10 UTC
The branch stable/13 has been updated by avg:

URL: https://cgit.FreeBSD.org/src/commit/?id=3c04909b9cb04f00479327cd3a4079ae2b806e68

commit 3c04909b9cb04f00479327cd3a4079ae2b806e68
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2022-02-16 07:56:06 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2022-07-04 10:19:51 +0000

    aw_mmc: add crash dumping support in MMCCAM mode
    
    (cherry picked from commit af8b51b0bac932fd0bb80cc1fe672b725bd5f0e8)
---
 sys/arm/allwinner/aw_mmc.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/sys/arm/allwinner/aw_mmc.c b/sys/arm/allwinner/aw_mmc.c
index 3271090f19e3..81dd34ce8c54 100644
--- a/sys/arm/allwinner/aw_mmc.c
+++ b/sys/arm/allwinner/aw_mmc.c
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bus.h>
+#include <sys/conf.h>
 #include <sys/kernel.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
@@ -304,6 +305,15 @@ aw_mmc_cam_request(device_t dev, union ccb *ccb)
 
 	return (0);
 }
+
+static void
+aw_mmc_cam_poll(device_t dev)
+{
+	struct aw_mmc_softc *sc;
+
+	sc = device_get_softc(dev);
+	aw_mmc_intr(sc);
+}
 #endif /* MMCCAM */
 
 static void
@@ -788,7 +798,8 @@ aw_mmc_req_done(struct aw_mmc_softc *sc)
 		aw_mmc_update_clock(sc, 1);
 	}
 
-	callout_stop(&sc->aw_timeoutc);
+	if (!dumping)
+		callout_stop(&sc->aw_timeoutc);
 	sc->aw_intr = 0;
 	sc->aw_resid = 0;
 	sc->aw_dma_map_err = 0;
@@ -1078,8 +1089,10 @@ aw_mmc_request(device_t bus, device_t child, struct mmc_request *req)
 		AW_MMC_WRITE_4(sc, AW_MMC_CMDR, cmdreg | cmd->opcode);
 	}
 
-	callout_reset(&sc->aw_timeoutc, sc->aw_timeout * hz,
-	    aw_mmc_timeout, sc);
+	if (!dumping) {
+		callout_reset(&sc->aw_timeoutc, sc->aw_timeout * hz,
+		    aw_mmc_timeout, sc);
+	}
 	AW_MMC_UNLOCK(sc);
 
 	return (0);
@@ -1491,6 +1504,7 @@ static device_method_t aw_mmc_methods[] = {
 	DEVMETHOD(mmc_sim_get_tran_settings,	aw_mmc_get_tran_settings),
 	DEVMETHOD(mmc_sim_set_tran_settings,	aw_mmc_set_tran_settings),
 	DEVMETHOD(mmc_sim_cam_request,		aw_mmc_cam_request),
+	DEVMETHOD(mmc_sim_cam_poll,		aw_mmc_cam_poll),
 #endif
 
 	DEVMETHOD_END