mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
89f8bb445f
In order to keep card endurance, it is best not to check the need for BKOPS every time the MMC is idle. However, the decision when to check the card need for BKOPS according to number of changed sectors doesn't fit all cards sizes. Therefore, the check for BKOPS need is based on percentages of changed sectors of the card size. In order to assure that BKOPS will be triggered again in case it was interrupted, the accumulated number of changed sectors is cleared only in case BKOPS was completed without interruption. Change-Id: I598f64b652a524a431b87d103fd5890b808f11b1 Signed-off-by: Maya Erez <merez@codeaurora.org>
148 lines
5.9 KiB
Text
148 lines
5.9 KiB
Text
SD and MMC Block Device Attributes
|
|
==================================
|
|
|
|
These attributes are defined for the block devices associated with the
|
|
SD or MMC device.
|
|
|
|
The following attributes are read/write.
|
|
|
|
force_ro Enforce read-only access even if write protect switch is off.
|
|
|
|
num_wr_reqs_to_start_packing This attribute is used to determine
|
|
the trigger for activating the write packing, in case the write
|
|
packing control feature is enabled.
|
|
|
|
When the MMC manages to reach a point where num_wr_reqs_to_start_packing
|
|
write requests could be packed, it enables the write packing feature.
|
|
This allows us to start the write packing only when it is beneficial
|
|
and has minimum affect on the read latency.
|
|
|
|
The number of potential packed requests that will trigger the packing
|
|
can be configured via sysfs by writing the required value to:
|
|
/sys/block/<block_dev_name>/num_wr_reqs_to_start_packing.
|
|
|
|
The default value of num_wr_reqs_to_start_packing was determined by
|
|
running parallel lmdd write and lmdd read operations and calculating
|
|
the max number of packed writes requests.
|
|
|
|
bkops_check_threshold This attribute is used to determine whether
|
|
the status bit that indicates the need for BKOPS should be checked.
|
|
The value should be given in percentages of the card size.
|
|
This value is used to calculate the minimum number of sectors that
|
|
needs to be changed in the device (written or discarded) in order to
|
|
require the status-bit of BKOPS to be checked.
|
|
The value can modified via sysfs by writing the required value to:
|
|
/sys/block/<block_dev_name>/bkops_check_threshold
|
|
|
|
SD and MMC Device Attributes
|
|
============================
|
|
|
|
All attributes are read-only.
|
|
|
|
cid Card Identification Register
|
|
csd Card Specific Data Register
|
|
scr SD Card Configuration Register (SD only)
|
|
date Manufacturing Date (from CID Register)
|
|
fwrev Firmware/Product Revision (from CID Register) (SD and MMCv1 only)
|
|
hwrev Hardware/Product Revision (from CID Register) (SD and MMCv1 only)
|
|
manfid Manufacturer ID (from CID Register)
|
|
name Product Name (from CID Register)
|
|
oemid OEM/Application ID (from CID Register)
|
|
prv Product Revision (from CID Register) (SD and MMCv4 only)
|
|
serial Product Serial Number (from CID Register)
|
|
erase_size Erase group size
|
|
preferred_erase_size Preferred erase size
|
|
raw_rpmb_size_mult RPMB partition size
|
|
rel_sectors Reliable write sector count
|
|
|
|
Note on Erase Size and Preferred Erase Size:
|
|
|
|
"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.
|
|
|
|
Note on raw_rpmb_size_mult:
|
|
"raw_rpmb_size_mult" is a mutliple of 128kB block.
|
|
RPMB size in byte is calculated by using the following equation:
|
|
RPMB partition size = 128kB x raw_rpmb_size_mult
|
|
|
|
SD/MMC/SDIO Clock Gating Attribute
|
|
==================================
|
|
|
|
Read and write access is provided to following attribute.
|
|
This attribute appears only if CONFIG_MMC_CLKGATE is enabled.
|
|
|
|
clkgate_delay Tune the clock gating delay with desired value in milliseconds.
|
|
|
|
echo <desired delay> > /sys/class/mmc_host/mmcX/clkgate_delay
|
|
|
|
SD/MMC/SDIO Clock Scaling Attributes
|
|
====================================
|
|
|
|
Read and write accesses are provided to following attributes.
|
|
|
|
polling_interval Measured in milliseconds, this attribute
|
|
defines how often we need to check the card
|
|
usage and make decisions on frequency scaling.
|
|
|
|
up_threshold This attribute defines what should be the
|
|
average card usage between the polling
|
|
interval for the mmc core to make a decision
|
|
on whether it should increase the frequency.
|
|
For example when it is set to '35' it means
|
|
that between the checking intervals the card
|
|
needs to be on average more than 35% in use to
|
|
scale up the frequency. The value should be
|
|
between 0 - 100 so that it can be compared
|
|
against load percentage.
|
|
|
|
down_threshold Similar to up_threshold, but on lowering the
|
|
frequency. For example, when it is set to '2'
|
|
it means that between the checking intervals
|
|
the card needs to be on average less than 2%
|
|
in use to scale down the clocks to minimum
|
|
frequency. The value should be between 0 - 100
|
|
so that it can be compared against load
|
|
percentage.
|
|
|
|
enable Enable clock scaling for hosts (and cards)
|
|
that support ultrahigh speed modes
|
|
(SDR104, DDR50, HS200).
|
|
|
|
echo <desired value> > /sys/class/mmc_host/mmcX/clk_scaling/polling_interval
|
|
echo <desired value> > /sys/class/mmc_host/mmcX/clk_scaling/up_threshold
|
|
echo <desired value> > /sys/class/mmc_host/mmcX/clk_scaling/down_threshold
|
|
echo <desired value> > /sys/class/mmc_host/mmcX/clk_scaling/enable
|