Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *  include/linux/mmc/sd.h
0004  *
0005  *  Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
0006  */
0007 
0008 #ifndef LINUX_MMC_SD_H
0009 #define LINUX_MMC_SD_H
0010 
0011 /* SD commands                           type  argument     response */
0012   /* class 0 */
0013 /* This is basically the same command as for MMC with some quirks. */
0014 #define SD_SEND_RELATIVE_ADDR     3   /* bcr                     R6  */
0015 #define SD_SEND_IF_COND           8   /* bcr  [11:0] See below   R7  */
0016 #define SD_SWITCH_VOLTAGE         11  /* ac                      R1  */
0017 
0018   /* class 10 */
0019 #define SD_SWITCH                 6   /* adtc [31:0] See below   R1  */
0020 
0021   /* class 5 */
0022 #define SD_ERASE_WR_BLK_START    32   /* ac   [31:0] data addr   R1  */
0023 #define SD_ERASE_WR_BLK_END      33   /* ac   [31:0] data addr   R1  */
0024 
0025   /* Application commands */
0026 #define SD_APP_SET_BUS_WIDTH      6   /* ac   [1:0] bus width    R1  */
0027 #define SD_APP_SD_STATUS         13   /* adtc                    R1  */
0028 #define SD_APP_SEND_NUM_WR_BLKS  22   /* adtc                    R1  */
0029 #define SD_APP_OP_COND           41   /* bcr  [31:0] OCR         R3  */
0030 #define SD_APP_SEND_SCR          51   /* adtc                    R1  */
0031 
0032   /* class 11 */
0033 #define SD_READ_EXTR_SINGLE      48   /* adtc [31:0]             R1  */
0034 #define SD_WRITE_EXTR_SINGLE     49   /* adtc [31:0]             R1  */
0035 
0036 /* OCR bit definitions */
0037 #define SD_OCR_S18R     (1 << 24)    /* 1.8V switching request */
0038 #define SD_ROCR_S18A        SD_OCR_S18R  /* 1.8V switching accepted by card */
0039 #define SD_OCR_XPC      (1 << 28)    /* SDXC power control */
0040 #define SD_OCR_CCS      (1 << 30)    /* Card Capacity Status */
0041 
0042 /*
0043  * SD_SWITCH argument format:
0044  *
0045  *      [31] Check (0) or switch (1)
0046  *      [30:24] Reserved (0)
0047  *      [23:20] Function group 6
0048  *      [19:16] Function group 5
0049  *      [15:12] Function group 4
0050  *      [11:8] Function group 3
0051  *      [7:4] Function group 2
0052  *      [3:0] Function group 1
0053  */
0054 
0055 /*
0056  * SD_SEND_IF_COND argument format:
0057  *
0058  *  [31:12] Reserved (0)
0059  *  [11:8] Host Voltage Supply Flags
0060  *  [7:0] Check Pattern (0xAA)
0061  */
0062 
0063 /*
0064  * SCR field definitions
0065  */
0066 
0067 #define SCR_SPEC_VER_0      0   /* Implements system specification 1.0 - 1.01 */
0068 #define SCR_SPEC_VER_1      1   /* Implements system specification 1.10 */
0069 #define SCR_SPEC_VER_2      2   /* Implements system specification 2.00-3.0X */
0070 
0071 /*
0072  * SD bus widths
0073  */
0074 #define SD_BUS_WIDTH_1      0
0075 #define SD_BUS_WIDTH_4      2
0076 
0077 /*
0078  * SD_SWITCH mode
0079  */
0080 #define SD_SWITCH_CHECK     0
0081 #define SD_SWITCH_SET       1
0082 
0083 /*
0084  * SD_SWITCH function groups
0085  */
0086 #define SD_SWITCH_GRP_ACCESS    0
0087 
0088 /*
0089  * SD_SWITCH access modes
0090  */
0091 #define SD_SWITCH_ACCESS_DEF    0
0092 #define SD_SWITCH_ACCESS_HS 1
0093 
0094 /*
0095  * Erase/discard
0096  */
0097 #define SD_ERASE_ARG            0x00000000
0098 #define SD_DISCARD_ARG          0x00000001
0099 
0100 #endif /* LINUX_MMC_SD_H */