mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 10:46:49 +07:00
dfe86cba76
SD/MMC cards tend to support an erase operation. In addition, eMMC v4.4 cards can support secure erase, trim and secure trim operations that are all variants of the basic erase command. SD/MMC device attributes "erase_size" and "preferred_erase_size" have been added. "erase_size" is the minimum size, in bytes, of an erase operation. For MMC, "erase_size" is the erase group size reported by the card. Note that "erase_size" does not apply to trim or secure trim operations where the minimum size is always one 512 byte sector. For SD, "erase_size" is 512 if the card is block-addressed, 0 otherwise. SD/MMC cards can erase an arbitrarily large area up to and including the whole card. When erasing a large area it may be desirable to do it in smaller chunks for three reasons: 1. A single erase command will make all other I/O on the card wait. This is not a problem if the whole card is being erased, but erasing one partition will make I/O for another partition on the same card wait for the duration of the erase - which could be a several minutes. 2. To be able to inform the user of erase progress. 3. The erase timeout becomes too large to be very useful. Because the erase timeout contains a margin which is multiplied by the size of the erase area, the value can end up being several minutes for large areas. "erase_size" is not the most efficient unit to erase (especially for SD where it is just one sector), hence "preferred_erase_size" provides a good chunk size for erasing large areas. For MMC, "preferred_erase_size" is the high-capacity erase size if a card specifies one, otherwise it is based on the capacity of the card. For SD, "preferred_erase_size" is the allocation unit size specified by the card. "preferred_erase_size" is in bytes. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Acked-by: Jens Axboe <axboe@kernel.dk> Cc: Kyungmin Park <kmpark@infradead.org> Cc: Madhusudhan Chikkature <madhu.cr@ti.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Ben Gardiner <bengardiner@nanometrics.ca> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
89 lines
2.3 KiB
C
89 lines
2.3 KiB
C
/*
|
|
* include/linux/mmc/sd.h
|
|
*
|
|
* Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
* your option) any later version.
|
|
*/
|
|
|
|
#ifndef MMC_SD_H
|
|
#define MMC_SD_H
|
|
|
|
/* SD commands type argument response */
|
|
/* class 0 */
|
|
/* This is basically the same command as for MMC with some quirks. */
|
|
#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
|
|
#define SD_SEND_IF_COND 8 /* bcr [11:0] See below R7 */
|
|
|
|
/* class 10 */
|
|
#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
|
|
|
|
/* class 5 */
|
|
#define SD_ERASE_WR_BLK_START 32 /* ac [31:0] data addr R1 */
|
|
#define SD_ERASE_WR_BLK_END 33 /* ac [31:0] data addr R1 */
|
|
|
|
/* Application commands */
|
|
#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
|
|
#define SD_APP_SD_STATUS 13 /* adtc R1 */
|
|
#define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */
|
|
#define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */
|
|
#define SD_APP_SEND_SCR 51 /* adtc R1 */
|
|
|
|
/*
|
|
* SD_SWITCH argument format:
|
|
*
|
|
* [31] Check (0) or switch (1)
|
|
* [30:24] Reserved (0)
|
|
* [23:20] Function group 6
|
|
* [19:16] Function group 5
|
|
* [15:12] Function group 4
|
|
* [11:8] Function group 3
|
|
* [7:4] Function group 2
|
|
* [3:0] Function group 1
|
|
*/
|
|
|
|
/*
|
|
* SD_SEND_IF_COND argument format:
|
|
*
|
|
* [31:12] Reserved (0)
|
|
* [11:8] Host Voltage Supply Flags
|
|
* [7:0] Check Pattern (0xAA)
|
|
*/
|
|
|
|
/*
|
|
* SCR field definitions
|
|
*/
|
|
|
|
#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */
|
|
#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */
|
|
#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */
|
|
|
|
/*
|
|
* SD bus widths
|
|
*/
|
|
#define SD_BUS_WIDTH_1 0
|
|
#define SD_BUS_WIDTH_4 2
|
|
|
|
/*
|
|
* SD_SWITCH mode
|
|
*/
|
|
#define SD_SWITCH_CHECK 0
|
|
#define SD_SWITCH_SET 1
|
|
|
|
/*
|
|
* SD_SWITCH function groups
|
|
*/
|
|
#define SD_SWITCH_GRP_ACCESS 0
|
|
|
|
/*
|
|
* SD_SWITCH access modes
|
|
*/
|
|
#define SD_SWITCH_ACCESS_DEF 0
|
|
#define SD_SWITCH_ACCESS_HS 1
|
|
|
|
#endif
|
|
|