summaryrefslogtreecommitdiff
path: root/include/linux/mmc (unfollow)
Commit message (Collapse)Author
2019-09-12msm: mmc: Check card structure for NULL pointerAmandeep Singh
Check card structure for NULL pointer before dereferencing it to check for asynchronous interrupt support. Change-Id: Ie433d076c4624616a0fceb02b7d9754116669da4 Signed-off-by: Amandeep Singh <amansing@codeaurora.org>
2018-08-06brcmfmac: Add support for bcm43364 wireless chipsetSean Lanigan
[ Upstream commit 9c4a121e82634aa000a702c98cd6f05b27d6e186 ] Add support for the BCM43364 chipset via an SDIO interface, as used in e.g. the Murata 1FX module. The BCM43364 uses the same firmware as the BCM43430 (which is already included), the only difference is the omission of Bluetooth. However, the SDIO_ID for the BCM43364 is 02D0:A9A4, giving it a MODALIAS of sdio:c00v02D0dA9A4, which doesn't get recognised and hence doesn't load the brcmfmac module. Adding the 'A9A4' ID in the appropriate place triggers the brcmfmac driver to load, and then correctly use the firmware file 'brcmfmac43430-sdio.bin'. Signed-off-by: Sean Lanigan <sean@lano.id.au> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-26mmc: core: Initialize temperature controlled clock scalingRam Prakash Gupta
Register and deregister for temperature controlled clk scaling when card is attached and dettached from the device. This will allow to control the clock frequency based on temperature. Change-Id: Ie01d573406c273847fb31a5dd64e2b39671e4ac0 Signed-off-by: Ram Prakash Gupta <rampraka@codeaurora.org>
2018-06-25mmc: core: Update SD card removal logic based on cd gpio stateVeerabhadrarao Badiganti
Update SD card removal event processing logic. Instead of pinging the card to know the card presence rely on card-detect gpio state. On multi-card tray designs, the same card-tray would be used for SD card and SIM cards. If SD card is placed at the rightmost location in the tray, then SIM card may come in contact with SD card power- supply while removing the tray. It may result in SIM damage. For protecting SIM from this issue, in multi-card tray designs, a h/w fix done such that pmic gets a notification of SD card removal event (through hardwiring) and it turns off the SD card voltage regulators immediately. All this will be done much before SD card driver starts processing card removal event. To support this design, SD card driver shouldn't turn-on the regulator while processing card removal event. But the present mmc driver turns-on regulator (multiple times if the card was in suspend state). To avoid turning on SD card regulator in card removal path, updating the card removal processing logic is based on card detect gpio state. Change-Id: I13708a60c9378519713ebec8071ae3b130012a93 Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2018-06-22mmc: core: hibernation support for mmc cardsVijay Viswanath
eMMC is the storage device for hibernation image. As such it needs to be working when hibernation image is created and written. Also for loading hibernation image after reboot, eMMC driver needs to be probed and running. During reboot, kernel comes up and does its own eMMC probe and sets speed for eMMC. A late system call then checks for hibernation image. If there is a hibernation image, the current kernel will stay only temporarily. Once the hibernation image is found and loaded, the temporary kernel suspends the eMMC device and then gives control to kernel in hibernation image. The hibernation image then restores the eMMC device based on the eMMC driver state saved just before creating hibernation image. This gives rise to a possible missmatch between the HW state of eMMC (Specifically the bus speed) when temporary kernel suspends it and the state driver restores after hibernation restore. So a synchornization has been done by making the eMMC run in max speed during: 1. Just before hibernation image is created (So the driver state in hibernation image will be for max speed mode). 2. After reboot, just before temporary kernel loads image and suspends (so the mmc driver in temporary kernel will put the eMMC in suspend while HW state is in highest speed mode. This ensures that the HW state, mmc_resume post the hibernation expects, will be same as the HW state actually present in the eMMC at the point of hibernation restore. This also ensures we save the hibernation image in max performance and we restore the hibernation image also in max performance. Change-Id: Ia9deceacade97ac89e4f25b40ce074d75bbb2bbc Signed-off-by: Vijay Viswanath <vviswana@codeaurora.org>
2018-04-16mmc: card: Service RPMB requests with priority over other requestsVeerabhadrarao Badiganti
RPMB requests are initiated from TZ and TZ gets blocked from servicing other tasks/requests till it completes RPMB request. Delays in servicing RPMB request may result in system-level stability/performance issues. Below is the issue observed: 1. TZ rpmb API is called to update TA rollback information. TZ forwards the request to HLOS mmc driver via rpmb-service. 2. mmc driver services the rpmb requests only after finishing the outstanding IO requests. 3. As part of handling an IO requests, mmc driver makes ICE call for getting encryption keys, which in-turn makes call to TZ. 4. Since ICE driver finds TZ is busy/blocked it returns ice request with -EBUSY error. 5. The failed requests with -EBUSY error would re-queued back. 6. The IO requests keep getting failed and keep getting re-queued and mmc driver never gets a chance to service rpmb requests. 7. This results in a deadlock senario. So RPMB requests need to be serviced immediately. If there is any outstanding RPMB request, then mmc driver should stop pulling any more new requests. The moment its done with serving ongoing requests, It should start processing RPMB request. Change-Id: I2d0f98a11716ef946551cc1a967e70a38e91d6ac Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2018-03-29mmc: core: implement enhanced strobe supportShawn Lin
Controllers use data strobe line to latch data from devices under hs400 mode, but not for cmd line. So since emmc 5.1, JEDEC introduces enhanced strobe mode for latching cmd response from emmc devices to host controllers. This new feature is optional, so it depends both on device's cap and host's cap to decide whether to use it or not. Change-Id: I1ca2bff37ae697f5c502975d1dc54d534151a3cd Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Tested-by: Douglas Anderson <dianders@chromium.org> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Git-commit: 81ac2af65793ecfbd79875d45043ff4adc0982b8 Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git [vviswana@codeaurora.org: Adjusted patch for internal driver] Signed-off-by: Vijay Viswanath <vviswana@codeaurora.org>
2018-01-19blkdev: Refactoring block io latency histogram codesHyojun Kim
The current io_latency_state structure includes entries for read and write requests. There are special types of write commands such as sync and discard (trim) commands, and the current implementation is not general enough if we want to separate latency histogram for such special commands. This change makes io_latency_state structure request-type neutral. It also changes to print the latency average. Signed-off-by: Hyojun Kim <hyojun@google.com>
2017-11-07mmc: core: Return error if fallback to lower speed mode failsWanhyeong Ryu
If there are continuous data-CRC errors in higher speed modes (SDR104 mode), then driver fallbacks to lower speed mode. But if at all it fails to fallback to lower speed mode, then that error should be propagated to the caller so that caller will handle it appropriately. Without this change, sometime while processing card removal event, driver fails to detect card removal and treats card as present eventhough its removed. Change-Id: I89544d41c5b014eb9227ba33ef9ec1917b6793dc Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-10-08mmc: sdio: fix alignment issue in struct sdio_funcHeiner Kallweit
[ Upstream commit 5ef1ecf060f28ecef313b5723f1fd39bf5a35f56 ] Certain 64-bit systems (e.g. Amlogic Meson GX) require buffers to be used for DMA to be 8-byte-aligned. struct sdio_func has an embedded small DMA buffer not meeting this requirement. When testing switching to descriptor chain mode in meson-gx driver SDIO is broken therefore. Fix this by allocating the small DMA buffer separately as kmalloc ensures that the returned memory area is properly aligned for every basic data type. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Tested-by: Helmut Klein <hgkr.klein@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-26mmc: core: add mmc flush detect work.Ankit Jain
Block device should be available before mounting of root device. In some cases block device is not available at the time of root device mounting because mmc detect work is not completed by that time which is causing mount failure. To fix this, flush mmc detect work after device probe completion. Change-Id: I785a1e01a691652cfdb5a82acee2475e23fe3766 Signed-off-by: Ankit Jain <jankit@codeaurora.org>
2017-08-29mmc: core: Ignore bus resume flags when card removal event is detectedVeerabhadrarao Badiganti
Ignore bus resume flags in the resume path if there is an outstanding card removal event. With deferred resume feature enabled, we don't check for card presence (i.e., mmc_detect_change) in the resume path. This is to improve the resume latency. If at all card is removed during suspend state, in some cases we may not detect the card removal immediately but only when a request was issued to it. In some scenarios, card removal in suspend state leading to card suspend to fail (since the card is removed) and which is causing system suspend to fail. And we don't try to resume card because of deferred resume it leading to system suspend to fail continuously. To fix this scenario, ignore the bus resume flag in the resume path only if there an outstanding card removal event. By doing so, we are ensuring that the driver would check for card presence (mmc_detect_change) in the resume path (mmc_pm_notify) and it will mark the card as removed if it finds the card is no more present. Change-Id: I7d075c2a5c2aaba1ff92f4072fdd2541bb98aa95 Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-06-09mmc: core: Ignore CRC errors with CMD13 while executing tuningVeerabhadrarao Badiganti
While executing tuning in case CMD19 fails, the driver sends CMD13 multiple times to ensure the card is ready to receive the next tuning command. If this status command fails with CRC error, it will trigger tuning. This will result in back to back tuning multiple times. To avoid this situation, ignore CRCs error generated with CMD13 while executing tuning. Change-Id: Ife338768264ebebebc655fe11874e905abdf7482 Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-06-02mmc: sdhci-msm: Store clock scaling frequencies in a dedicated tableVeerabhadrarao Badiganti
Use a separate table to store the platform specific clock-scaling frequencies. The generic table where these frequencies used to be stored, would get updated (in some cases) during clock scaling initialization. But when a new card is inserted (In the case of a removable card), the frequencies supported by the card should be compared against the platform specific frequencies. By storing these values in a separate table, these values would remain intact and this table can be used for initializing the generic table during clock-scaling initialization. Change-Id: I5729f18a975f849bc2965a946473a9cdbd81e94a Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-05-24mmc: core: extend SDR104 workaround for other pathsSahitya Tummala
UHS-I SD cards support SDR104 mode which runs the SD card interface clock upto 208 MHz. But we may see repeated CRC errors in SDR104 with some SDCC controllers. If this happens, commit <aafc430b36f3> ("mmc: sd: reduce the bus speed in case of multiple CRC errors") would reinit the card to lower speed (SDR50) hoping that CRC error rate would reduce at lower clock speed (100MHz for SDR50). As the error may happen for any cmd, this change tries to fix several other paths - clock scaling, mmc_rescan, non-data commands error path. Change-Id: I8ccbbf7e330cde3862d9660d3be4d67fb00d97ca Signed-off-by: Sahitya Tummala <stummala@codeaurora.org> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-04-04mmc: core: Remove unused variable cached_ext_csdSayali Lokhande
There is one variable defined in mmc_card, which is not being used anywhere. Also it is wrongly being freed from mmc_remove_card and causing "double kfree" related issues. To handle this, remove unused cached_ext_csd variable. Change-Id: I75f376ec787a46a2a16c38f88f444bd8ff9c86c4 Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2017-04-03mmc: sd: reduce the bus speed in case of multiple CRC errors in SDR104Asutosh Das
UHS-I SD cards support SDR104 mode which runs the SD card interface clock upto 208 MHz. But we may see repeated CRC errors in SDR104 with some SDCC controllers. If this happens, this change would reinit the card to lower speed (SDR50) hoping that CRC error rate would reduce at lower clock speed (100MHz for SDR50). Change-Id: I140d29fdf500bb89881a0f2c1f768fe0c5afa9d5 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2017-04-03mmc: sdhci-msm: add SDR104 CRC workaround enablement controlSubhash Jadavani
On Certain chipsets, SDR104 mode might be unstable causing CRC error on the interface. So we need a workaround which would skip printing register dumps on CRC errors and also downgrade bus speed mode to SDR50/DDR50 in case of continuous CRC errors. This patch adds "qcom,sdr104-wa" property to enable this workaround if required. Change-Id: I626d8ef45a97e8e6558e7f20be496de1f5a2a438 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2017-03-20BACKPORT: mmc: core: Export device lifetime information through sysfsJungseung Lee
In the eMMC 5.0 version of the spec, several EXT_CSD fields about device lifetime are added. - Two types of estimated indications reflected by averaged wear out of memory - An indication reflected by average reserved blocks Export the information through sysfs. Signed-off-by: Jungseung Lee <js07.lee@samsung.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-03-06mmc: mmc-debugfs: add error stateLiangliang Lu
This change adds support to allow user space query if low level eMMC driver has encountered any error or not, this state can be read/cleared via debugfs. CRs-Fixed: 1056483 Change-Id: Idc4ea375e9f308446dec04d443d062fe502658bd Signed-off-by: Liangliang Lu <luliang@codeaurora.org> Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2017-03-03mmc: core: Retry claim host in mmc_sd_detectVeerabhadrarao Badiganti
Use mmc_try_claim_host with a timeout instead of mmc_claim_host in mmc_sd_detect. This is to ensure that mmc rescan work item is doesn't get blocked on claim_host for longer period. In the pm_suspend path, we cancel the mmc_rescan work item. If this work item is already scheduled, suspend would be blocked till mmc_rescan gets finished. In case, mmc_rescan is blocked on claim_host lock, pm_suspend could get blocked for longer period. This can result in momentary UI freeze since pm_suspend is blocked for longer duration. This change is to prevent this scenario. Change-Id: Ib93bae6745a153bad3579ae42f46c3c3a7c1b95a Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-03-03mmc: cmdq_hci: ice: Handle ICE HCI errors in cmdq modeVeerabhadrarao Badiganti
With ICE HCI addition in SDHC, couple of errors conditions got introduced. These errors would be detected by ICE HCI and triggers interrupt. The two errors are: 1. Generic Crypto Error (GCE): This error is detected during the transfer. Need to reset SDHC to recover. 2. Invalid Crypto Configuration Error (ICCE): The HW detects it before the beginning of the transfer and terminates the transfer before actual execution started. Driver has to handle these error for recovering ICE-HCI from these error conditions. This patch is for handling there errors in cmdq mode. Change-Id: Ia10075aca429cbc49ccccdae5c0499c7a176b8a2 Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-01-11mmc: host: Add Ring buffer logging for MMC.Sayali Lokhande
Add ring buffer to enable tracing of significant events of eMMC in both CQ and Legacy mode for debug purpose. CONFIG_MMC_RING_BUFFER should be enabled to use ring buffer logging. Change-Id: Iceb404d77fca19e133c319bc66ec15b2d77c7c54 Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2016-10-12Fix a build breakage in IO latency hist code.Mohan Srinivasan
Fix a build breakage where MMC is enabled, but BLOCK is not. Change-Id: I0eb422d12264f0371f3368ae7c37342ef9efabaa Signed-off-by: Mohan Srinivasan <srmohan@google.com>
2016-10-04Fix a build breakage in IO latency hist code.Mohan Srinivasan
Fix a build breakage where MMC is enabled, but BLOCK is not. Change-Id: I0eb422d12264f0371f3368ae7c37342ef9efabaa Signed-off-by: Mohan Srinivasan <srmohan@google.com>
2016-09-24mmc: dw_mmc: use resource_size_t to store physical addressArnd Bergmann
commit 260b31643691e8a58683a4ccc3bdf7abfd86f54a upstream. The dw_mmc driver stores the physical address of the MMIO registers in a pointer, which requires the use of type casts, and is actually broken if anyone ever has this device on a 32-bit SoC in registers above 4GB. Gcc warns about this possibility when the driver is built with ARM LPAE enabled: mmc/host/dw_mmc.c: In function 'dw_mci_edmac_start_dma': mmc/host/dw_mmc.c:702:17: warning: cast from pointer to integer of different size cfg.dst_addr = (dma_addr_t)(host->phy_regs + fifo_offset); ^ mmc/host/dw_mmc-pltfm.c: In function 'dw_mci_pltfm_register': mmc/host/dw_mmc-pltfm.c:63:19: warning: cast to pointer from integer of different size host->phy_regs = (void *)(regs->start); This changes the code to use resource_size_t, which gets rid of the warning, the bug and the useless casts. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-14Android: Fix build breakages.Mohan Srinivasan
The IO latency histogram change broke allmodconfig and allnoconfig builds. This fixes those breakages. Change-Id: I9cdae655b40ed155468f3cef25cdb74bb56c4d3e Signed-off-by: Mohan Srinivasan <srmohan@google.com>
2016-09-14Android: MMC/UFS IO Latency Histograms.Mohan Srinivasan
This patch adds a new sysfs node (latency_hist) and reports IO (svc time) latency histograms. Disabled by default, can be enabled by echoing 0 into latency_hist, stats can be cleared by writing 2 into latency_hist. This commit fixes the 32 bit build breakage in the previous commit. Tested on both 32 bit and 64 bit arm devices. Bug: 30677035 Change-Id: I9a615a16616d80f87e75676ac4d078a5c429dcf9 Signed-off-by: Mohan Srinivasan <srmohan@google.com>
2016-09-08Android: Fix build breakages.Mohan Srinivasan
The IO latency histogram change broke allmodconfig and allnoconfig builds. This fixes those breakages. Change-Id: I9cdae655b40ed155468f3cef25cdb74bb56c4d3e Signed-off-by: Mohan Srinivasan <srmohan@google.com>
2016-09-06Android: MMC/UFS IO Latency Histograms.Mohan Srinivasan
This patch adds a new sysfs node (latency_hist) and reports IO (svc time) latency histograms. Disabled by default, can be enabled by echoing 0 into latency_hist, stats can be cleared by writing 2 into latency_hist. This commit fixes the 32 bit build breakage in the previous commit. Tested on both 32 bit and 64 bit arm devices. Bug: 30677035 Change-Id: I9a615a16616d80f87e75676ac4d078a5c429dcf9 Signed-off-by: Mohan Srinivasan <srmohan@google.com>
2016-08-25Revert "Android: MMC/UFS IO Latency Histograms."Mohamad Ayyash
This reverts commit 8d525c512280bb7d8218fd59c04de985b1886eca. Change-Id: I69350b98d9de9b1c9f591e03a90f133e328ba72a
2016-08-24Android: MMC/UFS IO Latency Histograms.Mohan Srinivasan
This patch adds a new sysfs node (latency_hist) and reports IO (svc time) latency histograms. Disabled by default, can be enabled by echoing 0 into latency_hist, stats can be cleared by writing 2 into latency_hist. Bug: 30677035 Change-Id: I625938135ea33e6e87cf6af1fc7edc136d8b4b32 Signed-off-by: Mohan Srinivasan <srmohan@google.com>
2016-06-15mmc: Fix pm_notifier obeying deferred resumeDmitry Shmidt
Do not resume if deferred resume is enabled. Only resume when a request is received. Change-Id: I1eae7dffec97d34b066bb5738c84a7e5a82f68d7 Git-commit: ac9ac6f26904c94e8aec47cab6936dd241c2eb66 Git-repo: git://git-android.quicinc.com/kernel/msm-3.10 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com> [asutoshd@codeaurora.org: merge conflicts resolved] Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
2016-06-15mmc: core: Add deferred bus resume policy.San Mehat
A card driver can now specify that the underlying bus should *not* auto-resume with the rest of the system. This is useful for reducing resume latency as well as saving power when the card driver is not using the bus. In the future, we'll add support for manual suspend Change-Id: I077d7dc9311ff12e6e16de631abeac965c8facd9 Signed-off-by: San Mehat <san@google.com> Git-commit: b44e6c88fc57e08562ff6b4fd68ba89cc2aa21bc Git-repo: git://git-android.quicinc.com/kernel/msm-3.10 [asutoshd@codeaurora.org: merge conflicts resolved and similar changes were updated in a different file; due to changes in kernel version] Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-06-13mmc: core: fix reading the bkops status from cardAsutosh Das
The bkops status is indicated by the bit 0 and 1 of the 246th byte of the ext_csd register. The current code doesn't ignore the rest of the byte. Fix this by extracting the bit 0 and 1 only for the current bkops urgency. The exception level is defined by the least significant nibble of 54th byte in the ext_csd register. The current code doesn't ignore the rest of the byte. Fix this by extracting the nibble(LSB) for exception status. Change-Id: Ic90fe26a676ae7dd2063e17bc3771db83605f4dc Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: auto bkops fixesSubhash Jadavani
Change "man_bkops_en" to "bkops_en" to hold the status of both manual and auto bkops. Change-Id: I60029bae67cebb2c91147ad741b96f4caed9c1d9 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: card: fix quirk bit mapSubhash Jadavani
There seems to be bit map usage overlap between few MMC_QUIRKS_*, this change fixes it. Change-Id: I717a2de1261ed2de1a8c730b005b137f0687d969 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: block: Add quirk and increase read data timeout for hynix emmcRitesh Harjani
Hynix emmc cards are causing read data timeout. Increase timeout value to max of 4sec and add card quirk for all Hynix emmc cards. Change-Id: I78637dc787964ec5cafe297587d6a12ecf1d31c6 Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2016-05-31mmc: core: postpone runtime suspend in case BKOPS is requiredKonstantin Dorfman
Some devices require long BKOPs time in order to provide high performance. In the current solution, the host disables auto BKOPs or stops manual BKOPs in runtime suspend, regardless of the device need for BKOPs. This patch adds a check for device BKOPs status and defers suspend in case when BKOPs need. CRs-Fixed: 979630 Change-Id: Ib38d1ce58e4195d4969e9a367b5738c8e598d0ba Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org> [subhashj@codeaurora.org: fixed merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: block: Error handling fixes and support of reset_allRitesh Harjani
This does following: 1. Adds support to handle multiple cmdq software requests timeout. Currently we schedule error handling work for the first timedout request. We requeue all pending tasks, knock off all tasks from device queue and reset card and controller as part of this, then for all other software requests timeout, if it comes while executing error work, we return BLK_EH_NOT_HANDLED. This fixes BUG_ON in case of multiple requests timesout together. 2. Current code resets CQE, power cycle the card and requeue all the requests in case of any error. 3. mmc_blk_cmdq_err work takes care freeing up all resource allocation like clk and rpm hold, in case of reset_all. 4. Currently we were never clearing error CMDQ_STATE_ERR in case of any error. This patch takes care of this bug. Change-Id: I83d483c11fe2d7f2e462086cc3c0932057304c0d Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org> [subhashj@codeaurora.org: fixed compilation error] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: core: cmdq helper for reset and claim host contextRitesh Harjani
This patch does following- This adds an API(mmc_cmdq_hw_reset), for RESET_ALL of SDHCI, power cycle mmc card and reintialize it, which enables cmdq as well(if supported). This acquires claim_host before calling mmc_power_restore. mmc_power_restore should be called with claim_host acquired, since this function is required from non-claim-host context in cmdq error handling. Change-Id: I31c4449dead1d4ad4e10a4822cce2298ec5fb4b6 Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org> [subhashj@codeaurora.org: fixed merge conflicts, dropped some changes related to mmc_do_hw_reset] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: core: Call cmdq_post_req with tag info instead of mrqRitesh Harjani
Call mmc_/cmdq_post_req with tag number instead of mrq. This is needed in error handling as part of multiple request error handling. Change-Id: I175432639d28378ec74669e31deb4d1667c49bb8 Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2016-05-31mmc: cmdq_hci: Helper API/info in cmdq for haltRitesh Harjani
This patch adds following helper API/info - 1. cmdq_halt_poll to halt the controller using polling method. This is to be mainly used in case of an error from cmdq_irq context. 2. Adds num_cq_slots & dcmd_cq_slot info to mmc_host structure. This can be useful info for mmc host structure like in case of handling of multiple error requests 3. Adds CMDQ_STATE_CQ_DISABLE for cmdq host. In case of an error if halt also fails, CQE error handling code will disable CQ. So block layer needs to know - to not pull any requests in such case. Change-Id: I8e9a8d5094db82336917fcca4361ce84316c34ef Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org> [subhashj@codeaurora.org: fixed merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: sdhci: revert MMC_PM_KEEP_POWER changes related to emmcSahitya Tummala
This change reverts the following gerrits as they cause the timeout issues with Hynix cards. Also, the latest code supports sleep/awake through CMD5 and hence MMC_PM_KEEP_POWER need not be set for Hynix eMMC cards. edcf5be "mmc: host: add detect vops chain" 09287cb "mmc: sdhci-msm: configure MMC_PM_KEEP_POWER for SDIO" 7cf603a "mmc: schci: add support for MMC_PM_KEEP_POWER in eMMC" c085820 "mmc: core: set MMC_PM_KEEP_POWER for certain Hynix mmc cards" CRs-Fixed: 947299 Change-Id: If863771191ee7c2b717d5817f4a88e4ad936653a Signed-off-by: Sahitya Tummala <stummala@codeaurora.org> [subhashj@codeaurora.org: fixed merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: core: support DDR52 bus-speed during eMMC clock scalingAsutosh Das
Add support for DDR52 bus-speed mode during clock scaling. The reason for this change is DDR52 can be supported at SVS mode. Change-Id: I68e5fca57ae5cbc154f5dd7001df368900cb3f57 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
2016-05-31mmc: sdhci: Add asynchronous interrupt support for sdio cardsRitesh Harjani
SD host controller have asynchronous interrupt support capability to detect card(sdio) interrupt even when clocks are gated(to save power). This patch add support and enable this capability/feature to of SD host controllers for sdio cards. Change-Id: Ic1945355a19ebfdb3bd000bf8138d8001cea53f6 Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org> [subhashj@codeaurora.org: fixed merge conflicts & compilatione error] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: block: workaround for timeout issue with some vendor devicesSubhash Jadavani
Commit 66a7393a3ba9685d1eddfbce72e3ef8f4848f19f ("mmc: block: ensure CMDQ is empty before queuing cache flush") added a workaround for particular vendor's eMMC devices. Workaround was to wait for all the outstanding requests to finish up before queuing the flush request. Now detailed root cause analysis from vendor shows that original issue can happen only if DCMD command is sent to device too quickly (within less than 6 microseconds) after completion of previous small sector (less than 8 sectors) read operations. Hence with this change, we are fine tuning the previous workaround such that it would almost have no impact on the storage benchmark performance numbers. Change-Id: I1df1c5d7bbcd7b526236651077b7dade2626cb30 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: block: ensure CMDQ is empty before queuing cache flushSubhash Jadavani
Some devices might stop responding to new commands if device cache flush is queued to host controller while host controller is still processing outstanding requests. To workaround this issue, we are making the cmdq thread to wait for all the oustanding requests to be finished before queuing cache flush command on host controller. Change-Id: I15387734f51ca4cadfc9e11270f14d8a0806a00f Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: core: Card specific custom settings for SDIOPavan Anamula
Add quirk to modify custom settings for QCA6574 and QCA9377 cards. Change-Id: I05e70efa71a8b8b931dfff758194af6220a8bc46 Signed-off-by: Pavan Anamula <pavana@codeaurora.org> Signed-off-by: Sahitya Tummala <stummala@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-05-31mmc: cmdq_hci: Add cyclic buffer to keep history of last 32 tasksVenkat Gopalakrishnan
Keep track of task history for the last 32 tasks and dump it along with registers in case of any error for debugging. The log is of the following format: [index] <DATA|DCMD> Task: <lower 32bits> | Args: <upper 32bits> of the task descriptor structure. The values need to be decoded accordingly depending on the data or dcmd task descriptor. The last entry index denotes the latest entry in this list. ---- Circular Task History ---- cmdq-host: Last entry index: 1 cmdq-host: [00]DATA Task: 0x0400002f | Args: 0x00d37d18 cmdq-host: [01]DATA Task: 0x0400002f | Args: 0x00d38118 cmdq-host: [02]DCMD Task: 0x0186402f | Args: 0x03200101 Add a debugfs entry to enable/disable this dynamically. It is disabled by default. This applies only to eMMC devices. Usage: echo Y > /sys/kernel/debug/mmcX/cmdq_task_history X - denotes the slot id Change-Id: I6abf29aa928d3d8270405cfc104241043dadfe45 Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed compilation error] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>