include/linux/mmc/sd_uhs2.h

Source file repositories/reference/linux-study-clean/include/linux/mmc/sd_uhs2.h

File Facts

System
Linux kernel
Corpus path
include/linux/mmc/sd_uhs2.h
Extension
.h
Size
8535 bytes
Lines
241
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef LINUX_MMC_UHS2_H
#define LINUX_MMC_UHS2_H

/* LINK Layer definition */
/*
 * UHS2 Header:
 * Refer to UHS-II Addendum Version 1.02 Figure 5-2, the format of CCMD Header is described below:
 *      bit [3:0]  : DID(Destination ID = Node ID of UHS2 card)
 *      bit [6:4]  : TYP(Packet Type)
 *                   000b: CCMD(Control command packet)
 *                   001b: DCMD(Data command packet)
 *                   010b: RES(Response packet)
 *                   011b: DATA(Data payload packet)
 *                   111b: MSG(Message packet)
 *                   Others: Reserved
 *      bit [7]    : NP(Native Packet)
 *      bit [10:8] : TID(Transaction ID)
 *      bit [11]   : Reserved
 *      bit [15:12]: SID(Source ID 0: Node ID of Host)
 *
 * Broadcast CCMD issued by Host is represented as DID=SID=0.
 */
/*
 * UHS2 Argument:
 * Refer to UHS-II Addendum Version 1.02 Figure 6-5, the format of CCMD Argument is described below:
 *      bit [3:0]  : MSB of IOADR
 *      bit [5:4]  : PLEN(Payload Length)
 *                   00b: 0 byte
 *                   01b: 4 bytes
 *                   10b: 8 bytes
 *                   11b: 16 bytes
 *      bit [6]    : Reserved
 *      bit [7]    : R/W(Read/Write)
 *                   0: Control read command
 *                   1: Control write command
 *      bit [15:8] : LSB of IOADR
 *
 * I/O Address specifies the address of register in UHS-II I/O space accessed by CCMD.
 * The unit of I/O Address is 4 Bytes. It is transmitted in MSB first, LSB last.
 */
#define UHS2_NATIVE_PACKET_POS	7
#define UHS2_NATIVE_PACKET	(1 << UHS2_NATIVE_PACKET_POS)

#define UHS2_PACKET_TYPE_POS	4
#define UHS2_PACKET_TYPE_CCMD	(0 << UHS2_PACKET_TYPE_POS)
#define UHS2_PACKET_TYPE_DCMD	(1 << UHS2_PACKET_TYPE_POS)
#define UHS2_PACKET_TYPE_RES	(2 << UHS2_PACKET_TYPE_POS)
#define UHS2_PACKET_TYPE_DATA	(3 << UHS2_PACKET_TYPE_POS)
#define UHS2_PACKET_TYPE_MSG	(7 << UHS2_PACKET_TYPE_POS)

#define UHS2_DEST_ID_MASK	0x0F
#define UHS2_DEST_ID		0x1

#define UHS2_SRC_ID_POS		12
#define UHS2_SRC_ID_MASK	0xF000

#define UHS2_TRANS_ID_POS	8
#define UHS2_TRANS_ID_MASK	0x0700

/* UHS2 MSG */
#define UHS2_MSG_CTG_POS	5
#define UHS2_MSG_CTG_LMSG	0x00
#define UHS2_MSG_CTG_INT	0x60
#define UHS2_MSG_CTG_AMSG	0x80

#define UHS2_MSG_CTG_FCREQ	0x00
#define UHS2_MSG_CTG_FCRDY	0x01
#define UHS2_MSG_CTG_STAT	0x02

#define UHS2_MSG_CODE_POS			8
#define UHS2_MSG_CODE_FC_UNRECOVER_ERR		0x8
#define UHS2_MSG_CODE_STAT_UNRECOVER_ERR	0x8
#define UHS2_MSG_CODE_STAT_RECOVER_ERR		0x1

/* TRANS Layer definition */

/* Native packets*/
#define UHS2_NATIVE_CMD_RW_POS	7
#define UHS2_NATIVE_CMD_WRITE	(1 << UHS2_NATIVE_CMD_RW_POS)
#define UHS2_NATIVE_CMD_READ	(0 << UHS2_NATIVE_CMD_RW_POS)

#define UHS2_NATIVE_CMD_PLEN_POS	4
#define UHS2_NATIVE_CMD_PLEN_4B		(1 << UHS2_NATIVE_CMD_PLEN_POS)
#define UHS2_NATIVE_CMD_PLEN_8B		(2 << UHS2_NATIVE_CMD_PLEN_POS)
#define UHS2_NATIVE_CMD_PLEN_16B	(3 << UHS2_NATIVE_CMD_PLEN_POS)

#define UHS2_NATIVE_CCMD_GET_MIOADR_MASK	0xF00
#define UHS2_NATIVE_CCMD_MIOADR_MASK		0x0F

#define UHS2_NATIVE_CCMD_LIOADR_POS		8

Annotation

Implementation Notes