summaryrefslogtreecommitdiff
path: root/drivers/mmc (follow)
Commit message (Collapse)AuthorAge
...
* | | | mmc: host: Fix spinbug in performance sysfs nodesAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In CMDQ, the mmc_release_host runs in softirq context. There's a potential race condition between show/set_perf since it doesn't disable pre-emption. Change this to disable preemption. Change-Id: I20918a459e8b35ac666971b8ebf179f44aa9c40f Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: queue: issue requests when dcmd is in progressAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requests can still be issued when dcmd is in progress. Only when discard is in progress, should the requests not be issued. Change-Id: Ief70cf2f86e9eb3817f8a390626be8433180ed87 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: core: fix shutdown in cmdq modeAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the shutdown process, - Stop the queue - Flush all the pending requests - Halt the Controller - Put the card in legacy mode Change-Id: I5fe4e998bc04bfd8f50de63f3beae3cb25f1c8ba Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: sdhci-msm: increase number of testbuses to 60Venkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dump out testbus values till 60. This would facilitate triaging command-queue issues. Change-Id: Icac865629b21ce0207c46c1907cf25401d6e8339 Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
* | | | mmc: queue: add timeout capability to requestsAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Individual requests can have timeouts defined. The default timeout is set to 120 seconds. On a timeout, the block layer notifies the driver and error can be handled thereafter. Change-Id: Ifcd690411770ab266c12a01bb0993f92b0f18bc6 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: sdhci: propagate error to command queue engineAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eMMC controller detects error, generates error interrupt and notifies the CQE. Hence, parse the correct error and propagate it to CQE handler for further processing. Command queue interrupt handler may return IRQ_NONE or IRQ_HANDLED. Check for the return value and either proceed or return from handler. Change-Id: I29c7b22848d3d728a79ba215f8d2f594d19fba63 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: block: Add error handling to command queue hostAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On error, the CMDQ engine stops processing requests. It is then halted and error handled. The error have been categorized as below: 1. Command error a. time-out - invalidate all pending tags & requeue - reset both card & controller b. crc - end the error mrq - tune - unhalt 2. Data error a. time-out - invalidate all pending tags & requeue - reset both card and controller b. crc - end the error mrq - tune - unhalt 3. RED error This is device specific error and is not recoverable. The card and controller are reset in this case and all pending tags are invalidated and requeued. Change-Id: I791d05f6b31d8f9b35a56fe85007b320c14e8b46 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 support for partition switchAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There could be a switch of partition while RPMB access. RPMB thread would then hand-off the control to mmc-cmdq-thread in the following state: - partition set to RPMB in card - CMDQ mode disabled in card - Controller in halt state When the next request is received, the following has to be done - switch partition to the current partition - enable CMDQ in card - unhalt controller Change-Id: I9eca350572fd88476dfee9642696a223c5cd7ada Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed compilation error] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | | mmc: sdhci-msm: do not disable test-busVenkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a hardware ring-buffer that logs the commands sent and doorbells rung. This is helpful for debugging in case of errors. This requires that the testbus be enabled. Hence don't disable testbus. Change-Id: I9c2fa984740aa9a0f8135d2196be6b3639ec22d1 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: sdhci-msm: add support for command-queueVenkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for command-queue (CQ). MSM driver supports CQ in the hardware. The controller can send commands to the card and read statuses from the device. This patch adds support for the same. Change-Id: I1b19a2ce4c124c96dc6c3852d8f58ad076851f4b Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: sdhci: add command queue support to sdhciAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds command-queue support to SDHCi compliant drivers. Change-Id: I1efee7f1c86e102364083e9158e4d45c887dd06e 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 and compilation error] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | | mmc: cmdq-host: add halt support to command queue hostAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Halt can be used in error cases to get control of the bus. This is used to remove a task from device queue and/or other recovery mechanisms. Change-Id: I4ada286aefe57b90bfd20d60f8fbe2c013d9db71 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: core: Add halt supportAsutosh Das2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Halt is a controller feature that can change the controller mode from command-queue to legacy. This feature is very helpful in error cases. Change-Id: I7f1465b609afed68886256bd605d4019716964f4 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | 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: sdhci: Add Inline Crypto Engine (ICE) supportSahitya Tummala2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds ICE support to sdhci driver. It uses the new ICE host->ops like config/reset to configure/reset the ICE HW as appropriate. Change-Id: I64946d15d2f6ec8981e95c8817e82a2115b1196c Signed-off-by: Sahitya Tummala <stummala@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: sdhci-msm: Add Inline Crypto Engine (ICE) supportSahitya Tummala2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add ICE support to low-level driver sdhci-msm.c. This code is primarily responsible for enabling ICE (if present), managing ICE clocks, managing ICE suspend/resume and also provides a few host->ops for sdhci driver to use ICE functionality. Change-Id: I3ec62146982c9db0263d5e19f60274163f514859 Signed-off-by: Krishna Konda <kkonda@codeaurora.org> Signed-off-by: Sahitya Tummala <stummala@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: sdhci-msm-ice: Add Inline Crypto Engine (ICE) supportSahitya Tummala2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eMMC controller may have an Inline Crypto Engine (ICE) attached, which can be used to encrypt/decrypt data going to/from eMMC. This patch adds a new client driver sdhci-msm-ice.c which interacts with ICE driver present in (drivers/crypto/msm/) and thus provides an interface to the low-level SDHCI driver to do the data encryption/decryption. Change-Id: I6ac78072563f77c481425a5ec149ec46a9b0a80d Signed-off-by: Krishna Konda <kkonda@codeaurora.org> Signed-off-by: Sahitya Tummala <stummala@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: Fix crash in mmc clk-scalingRitesh Harjani2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kernel crashes with below signature on trying to acquire uninitialized clk-scaling spinlock. Fix it by checking that clk scaling is initialized before acquiring this lock. BUG: spinlock bad magic on CPU#0, kworker/0:1/39 Backtrace: __delay+0x1c __const_udelay+0x24 msm_trigger_wdog_bite+0xbc spin_bug+0x8c do_raw_spin_lock+0x34 _raw_spin_lock_irqsave+0x28 mmc_reset_clk_scale_stats+0x40 mmc_host_clk_hold+0x5c mmc_start_request+0x1ec mmc_wait_for_req+0x98 mmc_wait_for_cmd+0x70 __mmc_switch+0xd0 mmc_switch+0x18 mmc_flush_cache+0x4c _mmc_suspend.isra.8+0x6c mmc_runtime_suspend+0x38 mmc_runtime_suspend+0x18 __rpm_callback+0x40 rpm_callback+0x44 rpm_suspend+0x2a4 pm_runtime_work+0x78 process_one_work+0x264 worker_thread+0x1f8 kthread+0xdc ret_from_fork+0x10 Change-Id: I8347e2d5ad1816f549ef8ab2607546203aa4a21d Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
* | | | mmc: fix MMC clock scaling to meet upstream HS400 implementationTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On the 3.10 kernel branch we had an implementation supporting HS400 that was different than that in the Linux community code base. As part of the transition to kernel 3.14, the community's implementation was used. However, as this implementation does not properly support up/down clock scaling - this patch adds the missing functionality. Change-Id: I096132bc715909b1ff2ac84448ec0adb32ca06ba Signed-off-by: Talel Shenhar <tatias@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>
* | | | Revert "mmc: sdhci-msm: Disable pm functionalities"Venkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2fabf4b6aea9f66fb340f556f3cad1d0d99c8e0f. Reverting the temporarily disabled clk gating feature. Clk scaling still remains disabled. Change-Id: If984ff1f393968c0d76eb6eb8a98c83fb5a7bc92 Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] 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: sdhci-msm: Fix clk gating on MSM8996-v2/v3 revisionsTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MSM8996-V2 and MSM8996-V3 has different sdcc minor number compared to MSM8996-v1. Include these minor numbers as well for fixing clk-gating logic. Change-Id: Ie9c797589151bcfc17c7ddee33dd93d9ea683822 Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org> Signed-off-by: Talel Shenhar <tatias@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: sdhci-msm: Move common definitions to header fileSahitya Tummala2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is needed by Inline Crypto Engine (ICE) driver. Change-Id: Ibfe151098f4f0395b5b9dbdc463723b8e0265487 Signed-off-by: Sahitya Tummala <stummala@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@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: sd: fix SD card runtime suspend sequence for clock scalingTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes the sequence for runtime suspend. Before this change, clock scaling logic was initialized during runtime suspend instead of calling destruction API of clock scaling. This change fixes this issue by calling the right clock scaling API during SD runtime suspend/resume. Change-Id: I6044f65de55f3eb683747a09b1e20322342222c2 Signed-off-by: Talel Shenhar <tatias@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | | mmc: sdhci-msm: Dont enable PWRSAVE_DLL for certain sdhc hostsRitesh Harjani2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SDHC core with new 14lpp tech DLL should not enable PWRSAVE_DLL since such controller's internal gating cannot meet following MCLK requirement: when MCLK is gated OFF, it is not gated for less than 0.5us and MCLK must be switched on for at-least 1us before DATA starts coming. Add support for this new requirement. Change-Id: Ief03926e0b9c6ff2f6335a422c576dd489fba9d5 Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
* | | | mmc: sdhci: Call host ops set_clock when disabling clocksVenkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sdhci_set_clock() has been turned into a generic library function, all calls to change clock rate needs to call the platform specific set_clock which will call into the generic library after performing platform specific operations. Fix this when disabling clocks. Change-Id: Ib01b1984291682dad709a3e38500ad31e2d3e4bc Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: sd: Use locally stored ocr on paranoid initVenkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevent null pointer dereference when accessing ocr stored in the card structure in case mmc_sd_init_card() had failed before allocating the card structure and we are retrying the init. Change-Id: I15365804e0986e01339ccaefdffdfaf9fd319160 Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: sdhci-msm: Add tracepoints to enhance pm debuggingKonstantin Dorfman2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instrument the sdhci-msm platform driver with tracepoints to aid in debugging issues and identifying latencies in the following paths: * System suspend/resume * Runtime suspend/resume Change-Id: I4fed1c2ccba7d5d7f978f161e7985c98e869d1d8 Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
* | | | mmc: core: Add tracepoints to enhance pm debuggingKonstantin Dorfman2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instrument the mmc core layer with tracepoints to aid in debugging issues and identifying latencies in the following paths: * System suspend/resume * Runtime suspend/resume Change-Id: I1e0fa7d3f8b54c102b4055f910b58a42412748da Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | | mmc: sdhci-msm: enable 64-bit ADMAVenkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SDHC controller capability was limited to 32-bit ADMA if the system on chip supported only 32-bit address bus width, eventhough the controller was 64-bit ADMA capable for potential memory savings. Remove this limitation on systems that support larger address bus width. Change-Id: I79b296bc4dff015dac76036c231d197748aa03cb Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: sdhci-msm: support dual voltage pad for eMMCKrishna Konda2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only 1.8V is used on IO pad lines for eMMCs' on msm platforms. So this means for any SDHC core on msm platforms used with eMMCs' should have PAD_PWR_SWITCH bit set indicating that 1.8V is used for IO lines. So far this did not matter as all eMMCs' SDHC pads were single voltage and the PAD_PWR_SWTICH bit did not make a difference. But when a SDHC core that supports dual voltage pad is used for initializing eMMC, the BUS_ON pwr_irq generated would cause the pad to be set at a logical HIGH in the driver (as it should since the bus is being turned ON) but then the driver does not set or clear the PAD_PWR_SWITCH for eMMCs which causes the communication between the host and card to break down. So even though the IO pad is driven at 1.8V, the host is not told that it should switch to 1.8V IO from 3.0V (default). This does not matter for SD cards for when they are turned ON, they always start with 3.0V on IO pad. But for eMMC instead of not setting or clearing the PAD_PWR_SWITCH bit when the bus is turned ON, check the voltage being supplied on the IO pad and based on that set or clear the PAD_PWR_SWITCH. Change-Id: I7756731760298c6766d00a22160c6328faaaf4a7 Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
* | | | mmc: sdhci: Fix setting clock for HS400Venkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The platform specific set_clock must be called even if the clock rates are same but the timing modes are different as there may be some platform specific handling required for different timing modes. Change-Id: Ia7102b29a8979ad88820c60ed5874d4b2dab71a0 Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: core: fix disable clock scalingKonstantin Dorfman2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable clock scaling only when clock scaling was properly initialized. Change-Id: I7ec45e49c5ce18ea6aef0e272e79325fa8952c5b Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
* | | | mmc: sdhci-msm: add registration to pm core frameworkKonstantin Dorfman2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add registration and initialization of platform driver to pm core for system suspend/resume and runtime suspend/resume. Platform device runtime power management uses the autosuspend pm core feature with MSM_AUTOSUSPEND_DELAY (100ms). MMC core power management is configured to aggressively suspend the card on runtime suspend (and full initialization on runtime resume). Change-Id: I45f0b2f1709361f41f7c38c57b95f692f8a0e486 Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
* | | | mmc: sdhci-msm: move pwr_irq to sdhci_msm_hostKonstantein Dorfman2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep pwr_irq as field in sdhci_msm_host struct instead of local sdhci_msm_probe variable. It will be used later in power management callbacks. Change-Id: I7b3629b958e953bab66c32e6131b7fd577c7c9f2 Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org> [subhashj@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | | | mmc: sdhci: Fix mmc_power_off sequenceVenkat Gopalakrishnan2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During mmc_power_off in sdhci_do_set_ios clock to the card needs to be turned off as a last step after the power is turned off. The existing check turns off the clock first and thereby never turns off the power. Change-Id: I961b090c814d9182aff11da7a3b090d9a84fc299 Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | | | mmc: block: use pr_err_ratelimited for command errorsTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch to using pr_err_ratelimited in order to avoid flooding the logs in case of error function gets called repeatedly. Change-Id: I636dc933915127a43ad4da87a565f8f585e6df90 Signed-off-by: Talel Shenhar <tatias@codeaurora.org>
* | | | mmc: card: fix asymmetric claim host in mmc_blk_ioctl_rpmb_cmdMaya Erez2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On kernel-3.14 mmc_claim_host is replaced by mmc_get_card to also call pm_runtime_get_sync. mmc_blk_ioctl_rpmb_cmd has asymmetric claim and release as mmc_claim_host was used to get the lock, but mmc_put_card was used for the release. To fix this and prevent bad counter of runtime PM, mmc_claim_host should be replaced with mmc_get_card. Change-Id: I7c2218623fddfbeed0489aed330c9fe6e8bc5338 Signed-off-by: Maya Erez <merez@codeaurora.org>
* | | | mmc: card: disable cache for specific Kingston cardsTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change prevents enabling cache for cards with product name MMC16G. This change is workaround the problem of long timeouts for cache operations. Change-Id: Ib683809faed8afc74bf0faff8636ead210013e6f Signed-off-by: Talel Shenhar <tatias@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: block: handle flush request timeoutTalel Shenhar2016-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of a flush request timeout, an error is returned to the block layer. The problem with this is that the eMMC card is left in programming state and while the device is in the programming state it cannot serve any request. This commit moves the card out of the programming state, in case of timeout, by issuing HPI, thereby allowing the device to continue serving requests. Some filesystems, such as EXT4, remount the partition as read-only after receiving an error from the block layer, thus this change will allow the remounted partition to work as the card can serve read request thanks to the HPI. In case where the card doesn't even respond to HPI it cannot serve any request, thereby, this commit reset the card in such catastrophic cases. Change-Id: Idbca6ff3a420a954c61cf4fb79c9094542888d89 Signed-off-by: Talel Shenhar <tatias@codeaurora.org>