xref: /OK3568_Linux_fs/kernel/Documentation/driver-api/mmc/mmc-dev-attrs.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun==================================
2*4882a593SmuzhiyunSD and MMC Block Device Attributes
3*4882a593Smuzhiyun==================================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThese attributes are defined for the block devices associated with the
6*4882a593SmuzhiyunSD or MMC device.
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunThe following attributes are read/write.
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun	========		===============================================
11*4882a593Smuzhiyun	force_ro		Enforce read-only access even if write protect 					switch is off.
12*4882a593Smuzhiyun	========		===============================================
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunSD and MMC Device Attributes
15*4882a593Smuzhiyun============================
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunAll attributes are read-only.
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun	======================	===============================================
20*4882a593Smuzhiyun	cid			Card Identification Register
21*4882a593Smuzhiyun	csd			Card Specific Data Register
22*4882a593Smuzhiyun	scr			SD Card Configuration Register (SD only)
23*4882a593Smuzhiyun	date			Manufacturing Date (from CID Register)
24*4882a593Smuzhiyun	fwrev			Firmware/Product Revision (from CID Register)
25*4882a593Smuzhiyun				(SD and MMCv1 only)
26*4882a593Smuzhiyun	hwrev			Hardware/Product Revision (from CID Register)
27*4882a593Smuzhiyun				(SD and MMCv1 only)
28*4882a593Smuzhiyun	manfid			Manufacturer ID (from CID Register)
29*4882a593Smuzhiyun	name			Product Name (from CID Register)
30*4882a593Smuzhiyun	oemid			OEM/Application ID (from CID Register)
31*4882a593Smuzhiyun	prv			Product Revision (from CID Register)
32*4882a593Smuzhiyun				(SD and MMCv4 only)
33*4882a593Smuzhiyun	serial			Product Serial Number (from CID Register)
34*4882a593Smuzhiyun	erase_size		Erase group size
35*4882a593Smuzhiyun	preferred_erase_size	Preferred erase size
36*4882a593Smuzhiyun	raw_rpmb_size_mult	RPMB partition size
37*4882a593Smuzhiyun	rel_sectors		Reliable write sector count
38*4882a593Smuzhiyun	ocr 			Operation Conditions Register
39*4882a593Smuzhiyun	dsr			Driver Stage Register
40*4882a593Smuzhiyun	cmdq_en			Command Queue enabled:
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun					1 => enabled, 0 => not enabled
43*4882a593Smuzhiyun	======================	===============================================
44*4882a593Smuzhiyun
45*4882a593SmuzhiyunNote on Erase Size and Preferred Erase Size:
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun	"erase_size" is the  minimum size, in bytes, of an erase
48*4882a593Smuzhiyun	operation.  For MMC, "erase_size" is the erase group size
49*4882a593Smuzhiyun	reported by the card.  Note that "erase_size" does not apply
50*4882a593Smuzhiyun	to trim or secure trim operations where the minimum size is
51*4882a593Smuzhiyun	always one 512 byte sector.  For SD, "erase_size" is 512
52*4882a593Smuzhiyun	if the card is block-addressed, 0 otherwise.
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun	SD/MMC cards can erase an arbitrarily large area up to and
55*4882a593Smuzhiyun	including the whole card.  When erasing a large area it may
56*4882a593Smuzhiyun	be desirable to do it in smaller chunks for three reasons:
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun	     1. A single erase command will make all other I/O on
59*4882a593Smuzhiyun		the card wait.  This is not a problem if the whole card
60*4882a593Smuzhiyun		is being erased, but erasing one partition will make
61*4882a593Smuzhiyun		I/O for another partition on the same card wait for the
62*4882a593Smuzhiyun		duration of the erase - which could be a several
63*4882a593Smuzhiyun		minutes.
64*4882a593Smuzhiyun	     2. To be able to inform the user of erase progress.
65*4882a593Smuzhiyun	     3. The erase timeout becomes too large to be very
66*4882a593Smuzhiyun		useful.  Because the erase timeout contains a margin
67*4882a593Smuzhiyun		which is multiplied by the size of the erase area,
68*4882a593Smuzhiyun		the value can end up being several minutes for large
69*4882a593Smuzhiyun		areas.
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun	"erase_size" is not the most efficient unit to erase
72*4882a593Smuzhiyun	(especially for SD where it is just one sector),
73*4882a593Smuzhiyun	hence "preferred_erase_size" provides a good chunk
74*4882a593Smuzhiyun	size for erasing large areas.
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun	For MMC, "preferred_erase_size" is the high-capacity
77*4882a593Smuzhiyun	erase size if a card specifies one, otherwise it is
78*4882a593Smuzhiyun	based on the capacity of the card.
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun	For SD, "preferred_erase_size" is the allocation unit
81*4882a593Smuzhiyun	size specified by the card.
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun	"preferred_erase_size" is in bytes.
84*4882a593Smuzhiyun
85*4882a593SmuzhiyunNote on raw_rpmb_size_mult:
86*4882a593Smuzhiyun
87*4882a593Smuzhiyun	"raw_rpmb_size_mult" is a multiple of 128kB block.
88*4882a593Smuzhiyun
89*4882a593Smuzhiyun	RPMB size in byte is calculated by using the following equation:
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun		RPMB partition size = 128kB x raw_rpmb_size_mult
92