linux/include/linux/mmc/sdio.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 *  include/linux/mmc/sdio.h
 *
 *  Copyright 2006-2007 Pierre Ossman
 */

#ifndef LINUX_MMC_SDIO_H
#define LINUX_MMC_SDIO_H

/* SDIO commands                         type  argument     response */
#define SD_IO_SEND_OP_COND
#define SD_IO_RW_DIRECT
#define SD_IO_RW_EXTENDED

/*
 * SD_IO_RW_DIRECT argument format:
 *
 *      [31] R/W flag
 *      [30:28] Function number
 *      [27] RAW flag
 *      [25:9] Register address
 *      [7:0] Data
 */

/*
 * SD_IO_RW_EXTENDED argument format:
 *
 *      [31] R/W flag
 *      [30:28] Function number
 *      [27] Block mode
 *      [26] Increment address
 *      [25:9] Register address
 *      [8:0] Byte/block count
 */

#define R4_18V_PRESENT
#define R4_MEMORY_PRESENT

/*
  SDIO status in R5
  Type
	e : error bit
	s : status bit
	r : detected and set for the actual command response
	x : detected and set during command execution. the host must poll
            the card by sending status command in order to read these bits.
  Clear condition
	a : according to the card state
	b : always related to the previous command. Reception of
            a valid command will clear it (with a delay of one command)
	c : clear by read
 */

#define R5_COM_CRC_ERROR
#define R5_ILLEGAL_COMMAND
#define R5_ERROR
#define R5_FUNCTION_NUMBER
#define R5_OUT_OF_RANGE
#define R5_STATUS(x)
#define R5_IO_CURRENT_STATE(x)

/*
 * Card Common Control Registers (CCCR)
 */

#define SDIO_CCCR_CCCR

#define SDIO_CCCR_REV_1_00
#define SDIO_CCCR_REV_1_10
#define SDIO_CCCR_REV_1_20
#define SDIO_CCCR_REV_3_00

#define SDIO_SDIO_REV_1_00
#define SDIO_SDIO_REV_1_10
#define SDIO_SDIO_REV_1_20
#define SDIO_SDIO_REV_2_00
#define SDIO_SDIO_REV_3_00

#define SDIO_CCCR_SD

#define SDIO_SD_REV_1_01
#define SDIO_SD_REV_1_10
#define SDIO_SD_REV_2_00
#define SDIO_SD_REV_3_00

#define SDIO_CCCR_IOEx
#define SDIO_CCCR_IORx

#define SDIO_CCCR_IENx
#define SDIO_CCCR_INTx

#define SDIO_CCCR_ABORT

#define SDIO_CCCR_IF

#define SDIO_BUS_WIDTH_MASK
#define SDIO_BUS_WIDTH_1BIT
#define SDIO_BUS_WIDTH_RESERVED
#define SDIO_BUS_WIDTH_4BIT
#define SDIO_BUS_ECSI
#define SDIO_BUS_SCSI

#define SDIO_BUS_ASYNC_INT

#define SDIO_BUS_CD_DISABLE

#define SDIO_CCCR_CAPS

#define SDIO_CCCR_CAP_SDC
#define SDIO_CCCR_CAP_SMB
#define SDIO_CCCR_CAP_SRW
#define SDIO_CCCR_CAP_SBS
#define SDIO_CCCR_CAP_S4MI
#define SDIO_CCCR_CAP_E4MI
#define SDIO_CCCR_CAP_LSC
#define SDIO_CCCR_CAP_4BLS

#define SDIO_CCCR_CIS

/* Following 4 regs are valid only if SBS is set */
#define SDIO_CCCR_SUSPEND
#define SDIO_CCCR_SELx
#define SDIO_CCCR_EXECx
#define SDIO_CCCR_READYx

#define SDIO_CCCR_BLKSIZE

#define SDIO_CCCR_POWER

#define SDIO_POWER_SMPC
#define SDIO_POWER_EMPC

#define SDIO_CCCR_SPEED

#define SDIO_SPEED_SHS
#define SDIO_SPEED_BSS_SHIFT
#define SDIO_SPEED_BSS_MASK
#define SDIO_SPEED_SDR12
#define SDIO_SPEED_SDR25
#define SDIO_SPEED_SDR50
#define SDIO_SPEED_SDR104
#define SDIO_SPEED_DDR50
#define SDIO_SPEED_EHS

#define SDIO_CCCR_UHS
#define SDIO_UHS_SDR50
#define SDIO_UHS_SDR104
#define SDIO_UHS_DDR50

#define SDIO_CCCR_DRIVE_STRENGTH
#define SDIO_SDTx_MASK
#define SDIO_DRIVE_SDTA
#define SDIO_DRIVE_SDTC
#define SDIO_DRIVE_SDTD
#define SDIO_DRIVE_DTSx_MASK
#define SDIO_DRIVE_DTSx_SHIFT
#define SDIO_DTSx_SET_TYPE_B
#define SDIO_DTSx_SET_TYPE_A
#define SDIO_DTSx_SET_TYPE_C
#define SDIO_DTSx_SET_TYPE_D

#define SDIO_CCCR_INTERRUPT_EXT
#define SDIO_INTERRUPT_EXT_SAI
#define SDIO_INTERRUPT_EXT_EAI

/*
 * Function Basic Registers (FBR)
 */

#define SDIO_FBR_BASE(f)

#define SDIO_FBR_STD_IF

#define SDIO_FBR_SUPPORTS_CSA
#define SDIO_FBR_ENABLE_CSA

#define SDIO_FBR_STD_IF_EXT

#define SDIO_FBR_POWER

#define SDIO_FBR_POWER_SPS
#define SDIO_FBR_POWER_EPS

#define SDIO_FBR_CIS


#define SDIO_FBR_CSA

#define SDIO_FBR_CSA_DATA

#define SDIO_FBR_BLKSIZE

#endif /* LINUX_MMC_SDIO_H */