Andrei Warkentin | 371a689 | 2011-04-11 18:10:25 -0500 | [diff] [blame] | 1 | SD and MMC Block Device Attributes |
| 2 | ================================== |
| 3 | |
| 4 | These attributes are defined for the block devices associated with the |
| 5 | SD or MMC device. |
| 6 | |
| 7 | The following attributes are read/write. |
| 8 | |
| 9 | force_ro Enforce read-only access even if write protect switch is off. |
| 10 | |
Tatyana Brokhman | c879b06 | 2014-12-03 23:38:06 +0200 | [diff] [blame] | 11 | num_wr_reqs_to_start_packing This attribute is used to determine |
| 12 | the trigger for activating the write packing, in case the write |
| 13 | packing control feature is enabled. |
| 14 | |
| 15 | When the MMC manages to reach a point where num_wr_reqs_to_start_packing |
| 16 | write requests could be packed, it enables the write packing feature. |
| 17 | This allows us to start the write packing only when it is beneficial |
| 18 | and has minimum affect on the read latency. |
| 19 | |
| 20 | The number of potential packed requests that will trigger the packing |
| 21 | can be configured via sysfs by writing the required value to: |
| 22 | /sys/block/<block_dev_name>/num_wr_reqs_to_start_packing. |
| 23 | |
| 24 | The default value of num_wr_reqs_to_start_packing was determined by |
| 25 | running parallel lmdd write and lmdd read operations and calculating |
| 26 | the max number of packed writes requests. |
| 27 | |
Adrian Hunter | dfe86cb | 2010-08-11 14:17:46 -0700 | [diff] [blame] | 28 | SD and MMC Device Attributes |
| 29 | ============================ |
| 30 | |
| 31 | All attributes are read-only. |
| 32 | |
Sujit Reddy Thumma | 00d52ac | 2012-11-07 21:23:14 +0530 | [diff] [blame] | 33 | cid Card Identification Register |
Adrian Hunter | dfe86cb | 2010-08-11 14:17:46 -0700 | [diff] [blame] | 34 | csd Card Specific Data Register |
| 35 | scr SD Card Configuration Register (SD only) |
| 36 | date Manufacturing Date (from CID Register) |
| 37 | fwrev Firmware/Product Revision (from CID Register) (SD and MMCv1 only) |
| 38 | hwrev Hardware/Product Revision (from CID Register) (SD and MMCv1 only) |
| 39 | manfid Manufacturer ID (from CID Register) |
| 40 | name Product Name (from CID Register) |
| 41 | oemid OEM/Application ID (from CID Register) |
Bernie Thompson | 51e7e8b | 2013-02-27 12:19:17 -0800 | [diff] [blame] | 42 | prv Product Revision (from CID Register) (SD and MMCv4 only) |
Adrian Hunter | dfe86cb | 2010-08-11 14:17:46 -0700 | [diff] [blame] | 43 | serial Product Serial Number (from CID Register) |
| 44 | erase_size Erase group size |
| 45 | preferred_erase_size Preferred erase size |
Loic Pallardy | 188cc04 | 2012-08-06 17:12:29 +0200 | [diff] [blame] | 46 | raw_rpmb_size_mult RPMB partition size |
| 47 | rel_sectors Reliable write sector count |
Bojan Prtvar | 5fb06af | 2016-07-04 13:56:55 +0200 | [diff] [blame] | 48 | ocr Operation Conditions Register |
Bojan Prtvar | 6825a60 | 2016-07-19 11:16:38 +0200 | [diff] [blame] | 49 | dsr Driver Stage Register |
Adrian Hunter | dfe86cb | 2010-08-11 14:17:46 -0700 | [diff] [blame] | 50 | |
| 51 | Note on Erase Size and Preferred Erase Size: |
| 52 | |
| 53 | "erase_size" is the minimum size, in bytes, of an erase |
| 54 | operation. For MMC, "erase_size" is the erase group size |
| 55 | reported by the card. Note that "erase_size" does not apply |
| 56 | to trim or secure trim operations where the minimum size is |
| 57 | always one 512 byte sector. For SD, "erase_size" is 512 |
| 58 | if the card is block-addressed, 0 otherwise. |
| 59 | |
| 60 | SD/MMC cards can erase an arbitrarily large area up to and |
| 61 | including the whole card. When erasing a large area it may |
| 62 | be desirable to do it in smaller chunks for three reasons: |
| 63 | 1. A single erase command will make all other I/O on |
| 64 | the card wait. This is not a problem if the whole card |
| 65 | is being erased, but erasing one partition will make |
| 66 | I/O for another partition on the same card wait for the |
| 67 | duration of the erase - which could be a several |
| 68 | minutes. |
| 69 | 2. To be able to inform the user of erase progress. |
| 70 | 3. The erase timeout becomes too large to be very |
| 71 | useful. Because the erase timeout contains a margin |
| 72 | which is multiplied by the size of the erase area, |
| 73 | the value can end up being several minutes for large |
| 74 | areas. |
| 75 | |
| 76 | "erase_size" is not the most efficient unit to erase |
| 77 | (especially for SD where it is just one sector), |
| 78 | hence "preferred_erase_size" provides a good chunk |
| 79 | size for erasing large areas. |
| 80 | |
| 81 | For MMC, "preferred_erase_size" is the high-capacity |
| 82 | erase size if a card specifies one, otherwise it is |
| 83 | based on the capacity of the card. |
| 84 | |
| 85 | For SD, "preferred_erase_size" is the allocation unit |
| 86 | size specified by the card. |
| 87 | |
| 88 | "preferred_erase_size" is in bytes. |
Sujit Reddy Thumma | 597dd9d79 | 2011-11-14 13:53:29 +0530 | [diff] [blame] | 89 | |
Loic Pallardy | 188cc04 | 2012-08-06 17:12:29 +0200 | [diff] [blame] | 90 | Note on raw_rpmb_size_mult: |
| 91 | "raw_rpmb_size_mult" is a mutliple of 128kB block. |
| 92 | RPMB size in byte is calculated by using the following equation: |
| 93 | RPMB partition size = 128kB x raw_rpmb_size_mult |
Subhash Jadavani | dff3126 | 2016-04-19 16:21:16 -0700 | [diff] [blame] | 94 | |
| 95 | SD/MMC/SDIO Clock Gating Attribute |
| 96 | ================================== |
| 97 | |
| 98 | Read and write access is provided to following attribute. |
| 99 | This attribute appears only if CONFIG_MMC_CLKGATE is enabled. |
| 100 | |
| 101 | clkgate_delay Tune the clock gating delay with desired value in milliseconds. |
| 102 | |
| 103 | echo <desired delay> > /sys/class/mmc_host/mmcX/clkgate_delay |
Sujit Reddy Thumma | 00d52ac | 2012-11-07 21:23:14 +0530 | [diff] [blame] | 104 | |
| 105 | SD/MMC/SDIO Clock Scaling Attributes |
| 106 | ==================================== |
| 107 | |
| 108 | Read and write accesses are provided to following attributes. |
| 109 | |
| 110 | polling_interval Measured in milliseconds, this attribute |
| 111 | defines how often we need to check the card |
| 112 | usage and make decisions on frequency scaling. |
| 113 | |
| 114 | up_threshold This attribute defines what should be the |
| 115 | average card usage between the polling |
| 116 | interval for the mmc core to make a decision |
| 117 | on whether it should increase the frequency. |
| 118 | For example when it is set to '35' it means |
| 119 | that between the checking intervals the card |
| 120 | needs to be on average more than 35% in use to |
| 121 | scale up the frequency. The value should be |
| 122 | between 0 - 100 so that it can be compared |
| 123 | against load percentage. |
| 124 | |
| 125 | down_threshold Similar to up_threshold, but on lowering the |
| 126 | frequency. For example, when it is set to '2' |
| 127 | it means that between the checking intervals |
| 128 | the card needs to be on average less than 2% |
| 129 | in use to scale down the clocks to minimum |
| 130 | frequency. The value should be between 0 - 100 |
| 131 | so that it can be compared against load |
| 132 | percentage. |
| 133 | |
| 134 | enable Enable clock scaling for hosts (and cards) |
| 135 | that support ultrahigh speed modes |
| 136 | (SDR104, DDR50, HS200). |
| 137 | |
| 138 | echo <desired value> > /sys/class/mmc_host/mmcX/clk_scaling/polling_interval |
| 139 | echo <desired value> > /sys/class/mmc_host/mmcX/clk_scaling/up_threshold |
| 140 | echo <desired value> > /sys/class/mmc_host/mmcX/clk_scaling/down_threshold |
| 141 | echo <desired value> > /sys/class/mmc_host/mmcX/clk_scaling/enable |