Give a hint to controllers in the command flags if we are performing a

transfer with an SDHC capable card. If the controller needs to adjust
command args, it can use this hint to understand how it is encoded.
This commit is contained in:
jmcneill 2017-06-04 15:00:02 +00:00
parent 2409a1e57b
commit c255568acb
2 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sdmmc_mem.c,v 1.56 2017/04/11 23:26:33 jmcneill Exp $ */
/* $NetBSD: sdmmc_mem.c,v 1.57 2017/06/04 15:00:02 jmcneill Exp $ */
/* $OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $ */
/*
@ -45,7 +45,7 @@
/* Routines for SD/MMC memory cards. */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.56 2017/04/11 23:26:33 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.57 2017/06/04 15:00:02 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@ -1641,6 +1641,8 @@ sdmmc_mem_read_block_subr(struct sdmmc_function *sf, bus_dmamap_t dmap,
if (!ISSET(sf->flags, SFF_SDHC))
cmd.c_arg <<= SDMMC_SECTOR_SIZE_SB;
cmd.c_flags = SCF_CMD_ADTC | SCF_CMD_READ | SCF_RSP_R1 | SCF_RSP_SPI_R1;
if (ISSET(sf->flags, SFF_SDHC))
cmd.c_flags |= SCF_XFER_SDHC;
if (ISSET(sc->sc_caps, SMC_CAPS_DMA))
cmd.c_dmamap = dmap;
@ -1866,6 +1868,8 @@ sdmmc_mem_write_block_subr(struct sdmmc_function *sf, bus_dmamap_t dmap,
if (!ISSET(sf->flags, SFF_SDHC))
cmd.c_arg <<= SDMMC_SECTOR_SIZE_SB;
cmd.c_flags = SCF_CMD_ADTC | SCF_RSP_R1;
if (ISSET(sf->flags, SFF_SDHC))
cmd.c_flags |= SCF_XFER_SDHC;
if (ISSET(sc->sc_caps, SMC_CAPS_DMA))
cmd.c_dmamap = dmap;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sdmmcvar.h,v 1.23 2017/02/17 10:51:48 nonaka Exp $ */
/* $NetBSD: sdmmcvar.h,v 1.24 2017/06/04 15:00:02 jmcneill Exp $ */
/* $OpenBSD: sdmmcvar.h,v 1.13 2009/01/09 10:55:22 jsg Exp $ */
/*
@ -122,6 +122,8 @@ struct sdmmc_command {
#define SCF_RSP_SPI_BSY (1U << 13)
/* Probing */
#define SCF_TOUT_OK (1U << 14) /* command timeout expected */
/* Transfer hints */
#define SCF_XFER_SDHC (1U << 15) /* card is SDHC */
/* response types */
#define SCF_RSP_R0 0 /* none */
#define SCF_RSP_R1 (SCF_RSP_PRESENT|SCF_RSP_CRC|SCF_RSP_IDX)