Add vendor callback for post-bus clock ops and add SDHC_FLAG_STOP_WITH_TC flag

This commit is contained in:
jmcneill 2019-03-13 12:16:49 +00:00
parent f0d6546978
commit 16219c4edc
2 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sdhc.c,v 1.101 2017/06/23 08:43:59 ryo Exp $ */
/* $NetBSD: sdhc.c,v 1.102 2019/03/13 12:16:49 jmcneill Exp $ */
/* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */
/*
@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.101 2017/06/23 08:43:59 ryo Exp $");
__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.102 2019/03/13 12:16:49 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@ -1236,6 +1236,12 @@ sdhc_bus_clock_ddr(sdmmc_chipset_handle_t sch, int freq, bool ddr)
HCLR1(hp, SDHC_HOST_CTL, SDHC_HIGH_SPEED);
}
if (hp->sc->sc_vendor_bus_clock_post) {
error = (*hp->sc->sc_vendor_bus_clock_post)(hp->sc, freq);
if (error != 0)
goto out;
}
out:
mutex_exit(&hp->intr_lock);
@ -1556,6 +1562,11 @@ sdhc_exec_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd)
}
}
if (ISSET(hp->sc->sc_flags, SDHC_FLAG_STOP_WITH_TC)) {
if (cmd->c_opcode == MMC_STOP_TRANSMISSION)
SET(cmd->c_flags, SCF_RSP_BSY);
}
/*
* Start the MMC command, or mark `cmd' as failed and return.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: sdhcvar.h,v 1.29 2017/04/22 21:49:41 jmcneill Exp $ */
/* $NetBSD: sdhcvar.h,v 1.30 2019/03/13 12:16:49 jmcneill Exp $ */
/* $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */
/*
@ -61,6 +61,7 @@ struct sdhc_softc {
#define SDHC_FLAG_USDHC 0x00800000 /* Freescale uSDHC */
#define SDHC_FLAG_NO_AUTO_STOP 0x01000000 /* No auto CMD12 */
#define SDHC_FLAG_NO_BUSY_INTR 0x02000000 /* No intr when RESP_BUSY */
#define SDHC_FLAG_STOP_WITH_TC 0x04000000 /* CMD12 can set xfer complete w/o SCF_RSP_BSY */
uint32_t sc_clkbase;
int sc_clkmsk; /* Mask for SDCLK */
@ -72,6 +73,7 @@ struct sdhc_softc {
int (*sc_vendor_card_detect)(struct sdhc_softc *);
int (*sc_vendor_bus_width)(struct sdhc_softc *, int);
int (*sc_vendor_bus_clock)(struct sdhc_softc *, int);
int (*sc_vendor_bus_clock_post)(struct sdhc_softc *, int);
int (*sc_vendor_transfer_data_dma)(struct sdhc_softc *, struct sdmmc_command *);
void (*sc_vendor_hw_reset)(struct sdhc_softc *, struct sdhc_host *);
int (*sc_vendor_signal_voltage)(struct sdhc_softc *, int);