summaryrefslogtreecommitdiff
path: root/include/linux/mmc (follow)
Commit message (Collapse)AuthorAge
...
* | | mmc: cmdq: support for command queue enabled hostVenkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds CMDQ support for command-queue compatible hosts. Command queue is added in eMMC-5.1 specification. This enables the controller to process upto 32 requests at a time. Change-Id: I0486495ef57c64bf8427e917daeb184c69b8dc73 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: add flush request support to command queueAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds flush request support to command-queue. This uses DCMD feature of the controller for sending commands in command-queue mode. DCMD is a direct command feature that uses a pre-configured slot for sending commands other than Class 11. Change-Id: Iebf6b74173dc91b0dc7230d1e87c65983d15148e Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: card: add read/write support in command queue modeVenkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Command queueing is defined in eMMC-5.1. It is designed for higher performance by ensuring upto 32 requests to be serviced at a time. Adds read/write support for CMDQ enabled devices. Change-Id: I136ddea8e5ca57eb4f85ca6e72c60001a7e24f78 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: Add command queue initialzation supportAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Command Queueing (CQ) feature is introduced to eMMC standard in revision 5.1. CQ includes new commands for issuing tasks to the device, for ordering the execution of previously issued tasks and for additional task management functions. This patch adds initialization and enabling of command queue in the card and controller. If the card and the controller support CQ, then it is enabled. Change-Id: I92d893d1503396d4b00848813cc546fc263e77fd Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: queue: initialization of command queueAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Command Queueing (CQ) feature is introduced to eMMC standard in revision 5.1. CQ includes new commands for issuing tasks to the device, for ordering the execution of previously issued tasks and for additional task management functions. The idea is to keep the legacy and CQ code as discrete as possible. Hence, a separate queue is created for CQ. The issuing path is non-blocking since several requests (max. 32) can be queued at a time. Change-Id: I5b48d1b3ed17585b907ec70ff7c8d583003ec9e1 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts & compilation error] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: devfreq: migrate to devfreq based clock scalingTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds the use of devfreq to MMC. Both eMMC and SD card will use it. For some workloads, such as video playback, it isn't necessary for these cards to run at high speed. Running at lower frequency, for example 52MHz, in such cases can still meet the deadlines for data transfers. Scaling down the clock frequency dynamically has power savings not only because the bus is running at lower frequency but also has an advantage of scaling down the system core voltage, if supported. Provide an ondemand clock scaling support similar to the cpufreq ondemand governor having two thresholds, up_threshold and down_threshold to decide whether to increase the frequency or scale it down respectively. The sampling interval is in the order of milliseconds. If sampling interval is too low, frequent switching of frequencies can lead to high power consumption and if sampling interval is too high, the clock scaling logic would take long time to realize that the underlying hardware (controller and card) is busy and scale up the clocks. Change-Id: I58ddbd93648ded82b304411956e035fb353cd97e Signed-off-by: Talel Shenhar <tatias@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts & compilation errors] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: add support for scheduling mmcqd on idle CPUDov Levenglick2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to boost mmc performance on various platforms, add support for configuring whether set_wake_up_idle() should be called on the mmc queue thread (mmcqd). The decision will be set in each individual platform's dts file. CRs-Fixed: 787554 Change-Id: I3989d3f5b8228785e6d3bc49c7eb01ebf2fa2f38 Signed-off-by: Dov Levenglick <dovl@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: Add support to read command queue parametersAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eMMC cards with EXT_CSD version >= 7, optionally support command queuing feature as defined by JEDEC eMMC5.1. Add support for probing command queue feature for such type of cards. Change-Id: I9454d0d6997ccbd1778a147354859467f4a9a7d3 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: block: add req pointer to mmc requestSahitya Tummala2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is needed by ICE (Inline Crypto Engine) driver to get the ICE configuration data from the request. Change-Id: Ie69c64f4dc0c31290dec50d905e8b3d436c86d62 Signed-off-by: Sahitya Tummala <stummala@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | mmc: quirks: add new quirk that allows Cache disableTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows us to prevent cache enable for certain cards that have broken cache functionality. Change-Id: Iea3f8c8f4e5498a8742fa408a19e3e169d1fa8cb Signed-off-by: Talel Shenhar <tatias@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: block: avoid HPI for some Kingston cardsTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain cards might get broken when HPI feature is used. This patch uses the HPI quirk to avoid the usage of HPI on Kingston MMC16G cards that have EXT_CSD_REV = 5 (mmc version 4.41) Change-Id: I4572eb9e71a281b56e25e5b4864d5777b16e2bc2 Signed-off-by: Talel Shenhar <tatias@codeaurora.org>
* | | mmc: quirks: add new quirk that allows HPI disableTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain cards might get broken when HPI feature is used. This patch allows host to avoid using HPI for such buggy cards by adding new quirk. As some of the other features like BKOPs/Cache are dependent on HPI feature, those features would also get disabled if HPI is disabled. Change-Id: I93a8810e4031eafcd44b5152296e065dc3330b63 Signed-off-by: Talel Shenhar <tatias@codeaurora.org>
* | | mmc: quirks: add support for quirks based on EXT_CSD_REVTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows the usage of quirks based on the register value of EXT_CSD_REV. It was seen for several eMMC cards that same issues, such as data corruption while using cache, were relevant for all eMMC cards having the same EXT_CSD_REV value. This change allows us to distinguish between cards based on this register. Change-Id: I1663891c367a59b520bc505641c6c4ddad56fd1a Signed-off-by: Talel Shenhar <tatias@codeaurora.org>
* | | mmc: core: Add workaround for hosts that need addtional tuning for HS400Venkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a capability to identify hosts that need additional tuning for HS400 and perform a post tuning process that maybe needed for proper HS400 functionality. Change-Id: I3895aabddce4dbecb208e3c522957e656f37e30d Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: Fix clock frequency transitions during invalid statesSujit Reddy Thumma2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eMMC and SD card specifications restrict the usage of a class of commands while commands in other class are in progress. For example, during erase operations the SD/eMMC spec. allows only CMD35, CMD36, CMD38. If clock scaling is enabled and decide to scale up the clocks it may be possible that CMD19/21 tuning commands are sent in between erase commands, which is illegal as per specification. Fix such illegal transactions to the card and also make clock scaling statistics accountable only for read/write commands instead of time consuming commands, like CMD38 erase, where transactions are independent of bus frequency. Change-Id: Iffba175787837e7f95bde8970f19d0f0f9d7d67d Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [merez@codeaurora.org: fix conflicts as mmc_update_clk_scaling is missing on 3.14] Signed-off-by: Maya Erez <merez@codeaurora.org>
* | | mmc: core: fix buffer overflow during memcpy of ext_csdSujit Reddy Thumma2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix buffer overflow while caching the mmc ext_csd content. Also, to avoid duplicate allocation keep the allocated ext_csd till the card is removed. CRs-Fixed: 583929 Change-Id: I5d69e37f6fd1f5249479d454c353be050df40b6d Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: add clock-scaling support to HS400 cardsAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds clock scaling support to HS400 cards. Scaling down to 52MHz from HS400 involves: - switching the bus-speed mode to HS at 52MHz Scaling up to HS400 would require all of the initialization process upto HS400 mode selection. Change-Id: I8196d6666bcc0ef327659253df53a17792fa51f7 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Krishna Konda <kkonda@codeaurora.org> [venkatg@codeaurora.org: fix mmc_select_hs args and MAX_DTRs as used in 3.14 kernel] Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: add wakeup functionality to sdio cardsAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch initializes wakeup source if the detected card is a sdio card and enables the wakeup capability. Platform drivers would have to invoke: * pm_wakeup_event on this card device to signal a wakeup * corresponding pm_relax have to be invoked Change-Id: Ic8d5c98073e8ed3f676eb42fc0ce1f13a11cb40f Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> [merez@codeaurora.org: fix conflicts due to different PM in 3.14] Signed-off-by: Maya Erez <merez@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: Add long power off notification supportTatyana Brokhman2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment only POWER_OFF_SHORT is sent to the device in case the host is suspended. This patch adds the support of sending POWER_OFF_LONG notification in case the device is powered off. According to device vendors the POWER_OFF_LONG notification will shorten the initialization time of the eMMC card during next boot up. Change-Id: I3c6f224398450cf10463cbb316613fd430d1e8d2 Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [merez@codeaurora.org: fix conflicts as some of the code was already included] Signed-off-by: Maya Erez <merez@codeaurora.org> [venkatg@codeaurora.org: Remove PM related code] Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: sdio: enable asynchronous interrupt support in 4-bit modeSubhash Jadavani2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SDIO 3.0 specification has added the support for asynchronous interrupt period during which card allows the clock to be gated off. Host needs to first read the "Support Asynchronous Interrupt" bit in CCCR register space to check if the card supports the feature or not. If yes and if the host wants to enable the feature, host needs to write '1' to "Enable Asynchronous Interrupt" bit in CCCR register space. This change allows the host controller driver to control whether to enable the asynchronous interrupt in card or not and if the asynchronous interrupt is enabled then clock gating feature would be enabled for such cards. Change-Id: I678cffb63af6a2013640a5eafa6ce9bfad8a51d6 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> [merez@codeaurora.org: fix CAPS2 index] Signed-off-by: Maya Erez <merez@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: Add support for notifying host driver while scaling clocksSujit Reddy Thumma2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Host drivers can participate in clock scaling by registering ->notify_load host operation, which allows host driver to carry out platform specific operations for further power savings or increasing throughput based on whether load is LOW or HIGH respectively. This can be applicable to non-ultra high speed cards as well so remove the check for ultra high speed cards to initialize clock scaling. Change-Id: Icaab9520135e384f5470db68b2f25c5cdce5663a Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [merez:codeaurora@org: fix conflicts due to removal of stop transmission] Signed-off-by: Maya Erez <merez@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: Log MMC clock frequency transitionsSujit Reddy Thumma2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use kernel's ftrace support to capture MMC clock frequency transitions which can be useful for debugging issues related to power consumption. Usage: mount -t debugfs none /sys/kernel/debug echo 1 > /sys/kernel/debug/tracing/events/mmc/mmc_clk/enable cat /sys/kernel/debug/tracing/trace_pipe Change-Id: I25c4ee39dcbe30e7665902a9f723a5a421b55ca3 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
* | | mmc: block: do not pack REQ_FUA requestKonstantin Dorfman2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change will prevent packing of a request marked with REQ_FUA flag, because it has the same semantics as REQ_FLUSH. Also packing statistics are updated with FUA stop reason. Change-Id: Iaad37044ec43f93e898ed0c011b0bce7b91ae13d Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
* | | mmc: Keep track of current hard partitionOluwafemi Adeyemi2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eMMC may have several hard partitions such as BOOT and RPMB in addition to the main USER partition. On resume(if card is reinitialized), the current hard partition is always switched to the default USER partition. But this switch to default partition is not propagated to the MMC block driver, which may have set the hard partition to any partition(BOOT/RPMB) other than USER before suspend. After resume, the MMC block driver still assumes it is accessing the previously set partition(BOOT/RPMB), and instead overwrites the USER partition(the current selected partition on the eMMC device). To prevent this, make MMC block driver aware of the partition switches done as part of card reinitialization. CRs-Fixed: 439313 Change-Id: I3e959101a1c56c1e6631da3d660f4b914e100503 Signed-off-by: Oluwafemi Adeyemi <aadeyemi@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: do not pack random requestsMaya Erez2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Packed commands causes higher latency since the completion of each request is sent to the upper layer upon completion of the complete packed request. The benefit from this feature is card dependent. Some of the card vendors do not have any benefit from using packed commands for random requests. In case there is no benefit in random requests packing, it is better to disable the packing to prevent this high latency. This patch also add the new stop packing reason to the write packing statistics. Change-Id: I141887dcef2ceee14848634cc27c3c85f8edc7a5 Signed-off-by: Maya Erez <merez@codeaurora.org> [merez@codeaurora.org: fix conflicts due to removal of BKOPS] Signed-off-by: Maya Erez <merez@codeaurora.org>
* | | mmc: core: interrupt Background Operations if it takes too longSubhash Jadavani2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we have 4 mins timeout for the blocking BKOPs to complete but we have seen instances where card is surprisingly taking even longer time to complete background operations. If card doesn't complete the BKOPs within specified timeout, we will send the HPI command to interrupt the ongoing BKOPs. Change-Id: I5df81bdfd9b19bee30a394ee0ff4390b292691d0 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> [merez@codeaurora.org: fix conflicts due to changes in 3.14] Signed-off-by: Maya Erez <merez@codeaurora.org>
* | | mmc: core: Add load based clock scaling supportSujit Reddy Thumma2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SD3.0/eMMC4.5/SDIO3.0 cards can support clock rates upto 200MHz (SDR104 or HS200 bus speed modes). For some workloads like video playback it isn't necessary for these cards to run at such high speed. Running at lower frequency, say 50MHz, in such cases can still meet the deadlines for data transfers. Scaling down the clock frequency dynamically has huge power savings not only because the bus is running at lower frequency but also has an advantage of scaling down the system core voltage, if supported. Provide an ondemand clock scaling support similar to cpufreq ondemand governor having two thresholds, up_threshold and down_threshold to decide whether to increase the frequency or scale it down respectively. The sampling interval is in the order of milliseconds and should be chosen by host drivers that enable MMC_CAP2_CLK_SCALE capability to take advantage of clock scaling. The sampling interval mainly depends on the the clock switching delays and hence a host driver decision. If sampling interval is too low frequent switching of frequencies can lead to high power consumption and if sampling interval is too high, the clock scaling logic would take long time to realize that the underlying hardware (controller and card) is busy and scale up the clocks. Change-Id: I22a5054beec41b0b66b3bf030ddfcf284de448b3 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [merez@codeaurora.org: fixed conflicts due to changes in 3.14] Signed-off-by: Maya Erez <merez@codeaurora.org> [venkatg@codeaurora.org: runtime pm related changes to accommodate pm framework from 3.14 kernel] Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed merge conflicts and fixed compilation errors] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: block: Add MMC write packing statisticsTatyana Brokhman2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The write packing statistics are used for the packed commands unit tests in order to determine test success or failure Change-Id: I5eea513991c794543fbb3d009d8b7db0b0912fc5 Signed-off-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: block: Add write packing controlTatyana Brokhman2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The write packing control will ensure that read requests latency is not increased due to long write packed commands. The trigger for enabling the write packing is managing to pack several write requests. 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 trigger for disabling the write packing is fetching a read request. Change-Id: I22e8ab04cd9aca220678784c39306068a0996790 Signed-off-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> [merez@codeaurora.org: fixed trivial conflicts] Signed-off-by: Maya Erez <merez@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: block: do not query the sd card if a fault is injectedAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the fault injection framework introduces an error to the data block, the current code queries the SD card to find the number of blocks actually programmed. This value would be as requested by the generic block layer. So the entire request would be completed. Say, request 0 is pulled from queue and submitted. When this is being processed, request 1 is pulled from queue and prepared. Request 0 though is successful, fault-injection framework injects an error and modifies the bytes_xferred variable to a random value less than requested transfer. Request 1 is not processed and during the handling of error, the SD card is queried for the actual bytes programmed. This would be the correct value. Thus blk_end_request would complete this request and the control would return to fetch request 2. In this process, request 1 is not processed at all and the application waits indefinitely for request 1 to be processed. No further requests are issued to the queue. This patch identifies, if the fault injection-framework has inserted an error to this request and doesn't query the card and uses bytes_xferred to complete the request. Change-Id: I496802e244745bc7550402027a594d967cf7b756 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: host: remove mmcq performance numbers statisticsSubhash Jadavani2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mmcq performance numbers are not captured since asynchronous MMC request support got added in MMC block driver. So printing out these numbers (which are all zeros) just adds confusion. This patch removes the printing of mmcq performance numbers statistics. CRs-Fixed: 364206 Change-Id: I7213b11c8e9e055894c9902af7e975de3be1c519 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: quirks: Fix data timeout values for certain SanDisk eMMC cardsPratibhasagar V2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some INAND MCP devices advertise incorrect data timeout values. This leads to data timeout errors on the platform. So, add a quirk for such devices to facilitate proper functionality. CRs-Fixed: 355347 Change-Id: If4fdd2724dc407450da8529222efca7ee94f50df Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org> [merez@codeaurora.org: fix num of quirk to an additional quirk on 3.14] Signed-off-by: Maya Erez <merez@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: capture performance numbers only when askedSubhash Jadavani2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently performance numbers are captured for each SDCC transfers unconditionally which may add the overhead and could reduce the SDCC read/write throughput numbers. This change adds additional control for enabling/disabling the capturing of performance numbers at runtime. We already have sysfs entry named "perf" for msm sdcc devices. Currently setting this entry to 0 clears the performance statistics. But now we are changing the definition of this entry as mentioned below: Disable performance capturing and clear the performance statistics: "echo 0 > /sys/devices/platform/msm_sdcc.<n>/perf" Enable performance capturing: "echo 1 > /sys/devices/platform/msm_sdcc.<n>/perf" CRs-fixed: 345170 Change-Id: I3ab9288fd87cc8a8ada6c0c3d066cac4f68d79b7 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: Add profiling code to measure performance at MMC layers.Aparna Mallavarapu2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Profiling code is added to measure read, write times for the MMC requests at various MMC layers. Profiling is done at the MMC queue and at the driver level. This information can be viewed through a sysfs entry called perf. Change-Id: I7c65bfe25a1f7774e3a9abf1f9539e690b3718ec Signed-off-by: Aparna Mallavarapu <aparnam@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflict] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: Export mmc_set_ios so that host drivers can use itSujit Reddy Thumma2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mmc_set_ios() is used by host drivers during suspend/resume routines in indirect way i.e., by calling host->ops->set_ios(). But now with MMC_CLKGATE enabled, mmc_set_ios() also updates host->clk_gated flag. So export this API so that host controller drivers can use it. Change-Id: Ib0c177635bb8d87ba68c98e08b8d940c73f2b80c Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [merez@codeaurora.org: fix trivial conflicts] Signed-off-by: Maya Erez <merez@codeaurora.org>
* | | mmc: core: Determine correct access mode for eMMC cards by reading OCRSujith Reddy Thumma2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MMC core reads SEC_COUNT information from EXT_CSD register and assumes that the card supports sector access mode. Some eMMC cards (<=2GB) do not support this mode even though they have SEC_COUNT value defined, causing failure while populating extended partitions. Sector/Byte access mode information is stored in OCR register. Hence, read OCR bit 30 and then confirm it with SEC_COUNT value to know whether the card supports sector access mode or byte access mode. Change-Id: Ifdfff35309e8667cd2c2ac2761b9a708d5b785d3 Signed-off-by: Sujith Reddy Thumma <sthumma@codeaurora.org>
* | | mmc: sdio: Fix sdio_disable_wide to properly handle 8 bit bus width.Murali Palnati2016-05-31
| | | | | | | | | | | | | | | Change-Id: I2e712f5d8f6ff8da9fdabe8cf30e378c560e067f Signed-off-by: Murali Palnati <palnatim@codeaurora.org>
* | | mmc: core: Fix race between runtime PM suspend and block requestsSujith Reddy Thumma2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a possible race with mmc_claim_host() in mmc_sd_suspend()/ mmc_suspend() and mmc_claim_host() in mmc_blk_issue_rq() when runtime pm is enabled. Fix this by blocking processing of requests until the previous runtime suspend is processed and then resume as part of msmsdcc_enable(). Previous fix has card detection failure as a side effect during resume. Change-Id: I9cb31269638d9db4e630eb22b973a5335af1bda4 Signed-off-by: Sujith Reddy Thumma <sthumma@codeaurora.org> [sboyd: Dropped msm driver change] Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflict] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: Fix MMC clock scaling in case of tuning failureSahitya Tummala2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the clock scaling state is changed from MMC_LOAD_LOW to MMC_LOAD_HIGH, the clocks are first scaled up and then tuning is performed. But in case of tuning failure, the current code does nothing but still retain the previous clock scale stats (state and curr_freq within struct clk_scaling). Hence, correct it to scale down the clocks in case of tuning failure so that clock scaling stats reflect the correct status. This also helps proceed with data transfers at lower clock rate in such cases. Change-Id: I7e9379d1e3ddc863132af31019604c22a42f8d59 Signed-off-by: Sahitya Tummala <stummala@codeaurora.org> [subhashj@codeaurora.org: fixed compilation error] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: core: export mmc_host_may_gate_card functionSubhash Jadavani2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MMC Host driver might want to use the mmc_host_may_gate_card() API to know whether the clock can be gated to the card or not hence export this function for usage outside its current scope. Change-Id: I9ec4173063e2505eca179161cdf8cda033a3fd4b Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> [merez@codeaurora.org: fix trivial conflicts] Signed-off-by: Maya Erez <merez@codeaurora.org>
* | | mmc: sdhci: add support nonhotplugGuoping Yu2016-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With some devices, SD card could not support hotplug as there is no cd-gpio, and also could not use polling way due to power comsumption. So add nonhotplug to meet such requirement and when SD card lost or removed manually, device will not crash until next reboot process to detect SD card. Change-Id: Ie8ea8ec57015f36689a119249003eeaa48391393 Signed-off-by: Guoping Yu <guopingy@codeaurora.org> [subhashj@codeaurora.org: fixed minor merge conflict] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | mmc: sdhci-msm: Fix issue with 1.8v switch sequence in 3.10 kernelSahitya Tummala2016-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SD3.0 voltage switch sequence to 1.8v would involve stopping the SDCLK before changing the voltage level and with recent changes in 3.10 kernel, the peripheral clocks are also getting disabled instead of just stopping the clock to the card. This patch makes sure this doesn't happen by marking the flag card_clock_off in struct mmc_host before starting the voltage switch sequence and checking it in host controller driver. Change-Id: If62378ba1dd369e69524365a4421d57317c22ca2 Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
* | | mmc: sdhci: Defer release of CPU DMA PM QoS vote in high load casesSujit Reddy Thumma2016-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PM QoS vote of default value mean that the CPU is allowed to move into deepest low power mode whenever possible. Currently, if there are back-to-back MMC requests, with a short delay, the PM QoS vote to default value is done immediately which cause the immediate request to have high latency as the CPU might have idle'd and moved to deepest low power mode. To avoid this defer the PM QoS vote till a defined timeout (pm_qos_timeout_us), so that back-to-back requests may not suffer from additional latencies. In addition, if the load on MMC is low, the additional latency may be sustainable. Hence, aggressively release the vote in order to achieve additional power savings. CRs-Fixed: 501712 Change-Id: I82166b0ce9416eb0d519f7da26e5a96956093cb2 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [subhashj@codeaurora.org: fixed minor merge conflict and fixed compilation errors] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | Revert "mmc: core: Remove the ->enable|disable() callbacks"Subhash Jadavani2016-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 40433267331bc6b9d70d5cdd14bfa2c8e3e5f0ec as MSM platforms still needs ->enable/disable() callbacks. Conflicts: drivers/mmc/core/core.c Change-Id: Ifd986825c10f1475bfcdac37ea1f3b99e5f6daaf Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | Revert "mmc: core: Remove MMC_CLKGATE"Subhash Jadavani2016-05-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9eadcc0581a8ccaf4c2378aa1c193fb164304f1d. Clock gating is needed for Qualcomm Platforms hence reverting this upstream patch. Change-Id: I96ac0c1c7627e8e5c2d18782e2fc08608f0a7f91 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | include: mmc: Export sanitized mmc headersVenkat Gopalakrishnan2016-03-23
|/ / | | | | | | | | | | | | Export sanitized mmc.h and core.h for userspace. Change-Id: I3a6eadde2023d974b0ce260a77082b01d8ba0b5d Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | mmc: Add "ignore mmc pm notify" functionalityDmitry Shmidt2016-02-16
| | | | | | | | Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
* | mmc: Add sdio_readb_ext() functionDmitry Shmidt2016-02-16
| | | | | | | | Change-Id: I9b410c8a13724795b23764012fd3be8f53747299
* | mmc: Add concept of an 'embedded' SDIO device.San Mehat2016-02-16
|/ | | | | | | | | | | | This is required to support chips which use SDIO for signaling/ communication but do not implement the various card enumeration registers as required for full SD / SDIO cards. mmc: sdio: Fix bug where we're freeing the CIS tables we never allocated when using EMBEDDED_SDIO mmc: Add max_blksize to embedded SDIO data Change-Id: Ibff2e3e991e5522f55ec8c6edc25ed09f2553736 Signed-off-by: San Mehat <san@google.com>
* mmc: mmc: extend the mmc_send_tuning()Chaotian Jing2015-10-27
| | | | | | | | | | | | | | | | The mmc_execute_tuning() has already prepared the opcode, there is no need to prepare it again at mmc_send_tuning(), and, there is a BUG of mmc_send_tuning() to determine the opcode by bus width, assume eMMC was running at HS200, 4bit mode, then the mmc_send_tuning() will overwrite the opcode from CMD21 to CMD19, then got error. in addition, extend an argument of "cmd_error" to allow getting if there was cmd error when tune response. Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com> [Ulf: Rebased patch] Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>