Notifying the device of the hosts intention to power it off, gives the
device the ability to better prepare itself.
(cherry picked from commit f495d1b0d837af16a9e9881dbbcd7908abf88b33)
Change-Id: I43a6c576ea48508d60723f1002fc0fb26e9eafe4
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
(cherry picked from commit 916072e4cb9373c054bc5a91ff289ac769958993)
This patch fixes up the broken suspend sequence for eMMC with sleep
support. Additionally it reworks the eMMC4.5 Power Off Notification
feature so it fits together with the existing sleep feature.
The CMD0 based re-initialization of the eMMC at resume is re-introduced
to maintain compatiblity for devices using sleep.
A host shall use MMC_CAP2_POWEROFF_NOTIFY to enable the Power Off
Notification feature. We might be able to remove this cap later on,
if we think that Power Off Notification always is preferred over
sleep, even if the host is not able to cut the eMMC VCCQ power.
[merez@codeaurora.org: resolved various merge conflicts.
Fix in mmc_resume already exists]
(cherry picked from commit cec02a451276a70cdeb0576ec89d6b5b76e4e18b)
Change-Id: I4f29c213d745dcb1ec50b34b535657328042b4b2
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Saugata Das <saugata.das@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
(cherry picked from commit 91cf2698afab3f0707f739a02eb639205798f1dc)
When a failure occurs while creating a device attribute,
we need to remove previously created attributes prior to deleting
the disk.
(cherry picked from commit 8d006d3f139c46beaeee138bda9d0807185661a9)
Change-Id: Ic5ebba9c06f3811534f5b5e8c0399809e5dc9f23
Signed-off-by: Maya Erez <merez@codeaurora.org>
(cherry picked from commit 7256cdc299a4d42c1d316afbac98d320154ce6da)
The version of PON support accepted by the linux community is
slightly different from the one that was merged. This revert is needed
in order to upload the latest version from the linux community.
This reverts commit 76058d7388c6edde07fd6289ce082dc1a1813b26.
(cherry picked from commit 8b458cf768db937d3a2274e216819a1a217e97f8)
Change-Id: I0cb611698b25de600dbaa54678edae661456e485
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
(cherry picked from commit 6e3e74d3ba5c825108b0a63018376b12e61592f9)
In the current soft reset sequence performed as part of
CMD/DATA error recovery we do the following:
1) Write 1 to DML_SW_RESET
2) Reset CPSM/DPSM by clearing MCI_CMD and MCI_DATA_CTL
or by writing to MCI_SW_RST_CONFIG.
3) Re-init DML
4) Reconfigure both consumer and producer BAM pipes.
The BAM pipe reset does not reset the sideband signals, since
only SDCC side is reset SDCC - BAM communication will go out
of sync and cause DML to be stuck without transferring data.
Hence reset BAM core every time SDCC is reset (which is on
error recovery).
Fix error handling for sps pipe or device reset.
(cherry picked from commit 3ca90f02963ddbbdb300eb55c49aca18091c3f49)
Change-Id: I82bd6c5f3db6ac71da912cef935dfd179b099ed4
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
(cherry picked from commit 9b2f00f099f4f17025a9834eb38fc67254164608)
Signed-off-by: Maya Erez <merez@codeaurora.org>
Due to the revert and cherry-pick of latest version from
the community, we had some errors in the final code of packed
commands. This patch fixes this mismatch
(cherry picked from commit 47b37929ebffeb2672a4bcbea38ae4e79d7d4e26)
Change-Id: Iff688ca3aaa893d9bd7f876a8d2d7c3d4d750a8a
Signed-off-by: Maya Erez <merez@codeaurora.org>
(cherry picked from commit e05b4d698362433009b4cdef75952c72de0f38cf)
mmc_cache_ctrl is called during the suspend path and it used
mmc_claim_host which is a blocking call and the device never
really suspends as it waits for the host to be available.
This also leads to race conditions during runtime power
management operation, for example, runtime suspend can start
while the device is being runtime resumed. So in order to
prevent this, mmc_try_claim_host should be used during
suspend path, which is non-blocking.
(cherry picked from commit 4d6b6238793e836189db5ec00c8c7890b11c9997)
Change-Id: Ib63a00b1c31159eefa4e5c4fa646c4cf77905f05
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
(cherry picked from commit 2638637f5b68a339cbac6e5841218761d7926b8c)
This attribute is used to determine whether the status bit that
indicates the need for BKOPS should be checked. The value is stored in
this attribute represents the minimum number of sectors that needs to
be changed in the device (written or discarded) in order to require
the status-bit of BKOPS to be checked
(cherry picked from commit e6c6b4b14ac2f10aa34cf42b6f558152e438bb37)
Change-Id: I3b05a0826fc9397a13d6b03ee028293f877f8d66
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
(cherry picked from commit 15ecbe1c5f6b2f2af5974f23cd494fce0c5bf81a)
Expose the following packed commands tests:
- Test the write packed commands list preparation
- Simulate a returned error code
- Send an invalid packed command to the card
(cherry picked from commit 09b010d749e40e86b42e62406f8886956e03f3bd)
Change-Id: I563a17b8dc313e65c20ed24d542d29ab7b432741
Signed-off-by: Lee Susman <lsusman@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
(cherry picked from commit 1dc976ea347887060c162a80b3180a0981b5d1bd)
Devices have various maintenance operations need to perform internally.
In order to reduce latencies during time critical operations like read
and write, it is better to execute maintenance operations in other
times - when the host is not being serviced. Such operations are called
Background operations (BKOPS).
The device notifies the status of the BKOPS need by updating BKOPS_STATUS
(EXT_CSD byte [246]).
According to the standard a host that supports BKOPS shall check the
status periodically and start background operations as needed, so that
the device has enough time for its maintenance operations.
This patch adds support for this periodic check of the BKOPS status.
Since foreground operations are of higher priority than background
operations the host will check the need for BKOPS when it is idle,
and in case of an incoming request the BKOPS operation will be
interrupted.
When the mmcqd thread is idle, a delayed work is created to check the
need for BKOPS. The time to start the delayed work is calculated based
on the host controller suspend timeout, in case it was set. If not, a
default time is used.
If BKOPS are required in level 1, which is non-blocking, there will be
polling of the card status to wait for the BKOPS completion and prevent
suspend that will interrupt the BKOPS.
If the card raised an exception, the need for urgent BKOPS (level 2/3)
will be checked immediately and if needed, the BKOPS will be performed
without waiting for the next idle time.
(cherry picked from commit 5f360698caa2894f7cc854199ffba285241d152e)
Change-Id: I6605ce396188807bed93f437224f2243b178523f
Signed-off-by: Maya Erez <merez@codeaurora.org>
(cherry picked from commit 833940e728c5903f0263c20e349bbead7a79e535)
This patch adds "large sector size" as a reason for stop packing
to the packing statistics mechanism
(cherry picked from commit 1718ef21fb791a2ea25bd3fbf236913de64ca85f)
Change-Id: I595f7839fa9156d5ed26040943c1d5e3011c2a60
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
(cherry picked from commit bd8d562c886ffe3a07b9a56a446eb5b5b7db23ed)
The write packing statistics are used for the packed commands unit tests
in order to determine test success or failure
(cherry picked from commit 464fbe1af0248b7e85044ccebf4d4d96dd8fdeaa)
Change-Id: If5465118e0ea1b4c78b73a43b664d5b6bc9cae31
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
(cherry picked from commit db2e25650ab5fb62143ff39fcaea083176403fd1)
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.
(cherry picked from commit 0cc76400d65f0d7b3f2f8f1ece3c8061652a35d7)
Change-Id: I51a44d2673e40e4e404317ddb632a9fb204e9a06
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
(cherry picked from commit fd402c28f1571b64f4d695d191778e9dd595806a)
This patch supports packed write command of eMMC4.5 device.
Several writes can be grouped in packed command and all data
of the individual commands can be sent in a single transfer
on the bus.
[tlinder@codeaurora.org: Difference in definition:
R1_EXP_EVENT -- > R1_EXCEPTION_EVENT]
(cherry picked from commit 53f8f574c6c68687098cd064af8224da44de2484)
Change-Id: I26ee7c0b957a3aec5e4ffc6d6df806ea38435784
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Reviewed-by: Maya Erez <merez@codeaurora.org>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
(cherry picked from commit 6d24bc3b6e86412cbfbc37377bbbf196cbdebce9)
This patch adds packed command feature of eMMC4.5.
The maximum number for packing read(or write) is offered
and exception event relevant to packed command which is
used for error handling is enabled. If host wants to use
this feature, MMC_CAP2_PACKED_CMD should be set.
(cherry picked from commit c70e9669bffa2f2ffe4d8f9768980e1cd08df4b2)
Change-Id: If3af1299c7dbdc9f66b13ec5b99038225d5b17f0
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Reviewed-by: Maya Erez <merez@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
(cherry picked from commit 458c9b55dd3e06d6cd36158bd96a6d4935ed4fea)
The write packing allows sending several requests in a single command
to the card and increases the eMMC performance in sequential write
operations.
(cherry picked from commit 34a444f2041763d617391be44f4a9ac1b7d6eab7)
Change-Id: I45978c8130d3898b21e36309696647c380521a87
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
(cherry picked from commit 94a78f62307a53e9051e6f3970e1a937361078ba)
Signed-off-by: Maya Erez <merez@codeaurora.org>
The version of packing support excepted by the linux community is
slightly different from the one that was merged. This revert is needed
in order to upload the latest version from the linux community.
This patch reverts the following commits:
1.mmc: card: Add eMMC4.5 write packed commands unit-tests
2.mmc: card: Fix packing control enabling algorithm
3.mmc: block: Add MMC write packing statistics
4.mmc: msm_sdcc: enable the write packing control
5.mmc: msm_sdcc: Enable write packing capability
6.mmc: block: Add write packing control
7.mmc: core: Support packed write command for eMMC4.5 device
8.mmc: core: Add packed command feature of eMMC4.5
(cherry picked from commit f94cf3da103b344b13fa4d6665fd21dad1b95ead)
Change-Id: I2efc6dc8d8f6d5cc7e9efa99ec74914ffff96fcd
commit: 9b54d88c6a11ebfe069b7fdebcb521da21754c3f
commit: e2ecb58a6c5011549aac3e86fb1c13e7b7c65104
commit: e544d700e2dac1584a8172c4dc347d81ede203bd
commit: 8afe8d2a98a1bbf3804162ff5c95a56226935f5a
commit: 25e2261a556c4393f79d58bce814bb3df34b9549
commit: 63c61d6d8b8f37c71b4162b3affffdf72ac06811
commit: 968c774ea6466fa7adbf2eac333220132acda306
commit: 516994eee39282b8648b509e449ff83b49833209.
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
(cherry picked from commit 31fe84d6edae65f9df5663538e528697897be86e)
Signed-off-by: Maya Erez <merez@codeaurora.org>
Set MMC_CAP2_INIT_BKOPS. This will set the BKOPS_EN bit in the
ext_csd register. The BKOPS_EN bit is one time programmable.
(cherry picked from commit b7f382b25fbd363c43af2332b4ff490e13aab6e4)
Change-Id: Ie913561b2b82ff28366ffe564ffcafe8fc19a96a
Signed-off-by: Maya Erez <merez@codeaurora.org>
(cherry picked from commit 2d29e0d34e3304d976291d3ab29c7c893c12d740)
If the card and the host support BKOPS, and BKOPS is not enabled
yet, set the BKOPS_EN bit to enable BKOPS.
This bit is one time programmable.
(cherry picked from commit e966c1ca32d118b26ca6e26267f0c13c9c0e0052)
Change-Id: I2b97898857bed676021fe56a6f6e49762cf609fa
Signed-off-by: Maya Erez <merez@codeaurora.org>
(cherry picked from commit 5ebe331e59e9c30bffead8e3030e3581ee699895)
Enable eMMC background operations (BKOPS) feature.
If URGENT_BKOPS is set after a response, note that BKOPS are required.
Immediately run BKOPS if required. Read/write operations should be
requested during BKOPS(LEVEL-1), then issue HPI to interrupt the
ongoing BKOPS and service the foreground operation.
(This patch only controls the LEVEL2/3.)
When repeating the writing 1GB data, at a certain time, performance is
decreased. At that time, card triggers the Level-3 or Level-2. After
running bkops, performance is recovered.
Future considerations:
* Check BKOPS_LEVEL=1 and start BKOPS in a preventive manner.
* Interrupt ongoing BKOPS before powering off the card.
* How do we get BKOPS_STATUS value (periodically send ext_csd command)?
* If using periodic bkops, also consider runtime_pm control.
(cherry picked from commit 6807769f7bf68984a5aeda4b9b521f1167cbaf00)
[merez@codeaurora.org: core.c: release_host when stopping BKOPs for
non SDIO cards in suspend]
(cherry picked from commit c1a56a1247341d13af7c8f84d5ac1211a3c4b376)
Change-Id: I5ac2ac909222e2b4e94cd97ce7da79f4488f06f0
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
Reviewed-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
(cherry picked from commit 653abe2434532e4d2886d27dfdc3f42ae1c7ade1)
A newer version of BKOps should be picked from the community.
Therefore the old support is reverted.
Revert the following commits:
9db69fca22bd2970f6b14b50cf8533a1edb64364
8ac659eb3d96e31b8bb6b8d09143ddd6eb83ae19
f886c80ee2f4c29aeaab2d76c9303c00263bb428
(cherry picked from commit 3402d2b725a5af16bc62a2e788913a46d3f7e54a)
Change-Id: I5df105753bef7ee10215526006187673b85bb0c1
Signed-off-by: Maya Erez <merez@codeaurora.org>
(cherry picked from commit b5763af04035cd5e3264225f40270d175985adc5)
Add necessary functions for AR6004 to control BT related GPIO.
This change will only be used by AR6004
(cherry picked from commit 9baad179a8a7996e1912de14eb6f02f17c932e03)
(cherry picked from commit 493557fce821ae201b4cc3c6a125d703ac5de60e)
Signed-off-by: Ming-yi Lin <mylin@codeaurora.org>
Change-Id: I0fb3a59761dc3e994254bdc0241281e4bbcdf402
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
In one corner case, the SD card is stuck in a bad state with its DAT0
line pulled low, and SDCC is waiting on the interrupt when the line
goes back high. But due its bad state eventually the SD card is removed
from the system.
Later during re-scanning of the devices, the SD card is power-cycled and
added to the system. But now the pending interrupts for SD card is
received as the interrupt MASK register (MCI_MASK0) was not cleared.
To prevent such cases reset the interrupt MASK register (MCI_MASK0) while
powering off to prevent any pending interrupts after power-cycle.
(cherry picked from commit a3f8f793b21782c79a9fcc5f7aa1cc27fcbf246e)
CRs-Fixed: 396706
Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org>
Change-Id: Idfae18895abf47769328b0a768f83eba2ef573f7
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
Setting DDR timing mode in controller before setting the clock
rate will make sure that card don't see the double clock rate
even for very small amount duration. Some eMMC cards seems to lock
up if they see clock frequency > 52MHz.
(cherry picked from commit 2877d919135791d5223a9ba94b2cfc9ba50bc3df)
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Change-Id: I7a4ace461e2def6d53863db4b768ec7e497b3095
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
dml busy status is supposed to be checked for during bam-to-bam mode
and not in bam-to-system mode. So removing the check for dml busy status
since the driver does not support bam-to-bam mode.
Change-Id: I1496ac441d70dd5efc831768f5ed3bfa11a3f94c
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
(cherry picked from commit 7a05d53e4aec382db2ce646805f6a69756337fdc)
(cherry picked from commit d1a6364ccb9523aca0e5dd6359437bfc3dda51b2)
This reverts commit def5e24abe4787b22b22138623eeb495ef8fec0d.
Reverted commit was added 3 years back due to this reason:
Some eMMC cards (SanDisk iNand eMMC cards to be specific) needed
this additional delay of 1 ms after sending the switch command to
card. This is a result of some issue with the SanDisk cards itself
and apparently they were going to fix this in their ASIC within
year or so. And Since Sandisk is one of the big players in the
eMMC space, it was important that our software works fine with their
cards.
But now we don't see any need of this additional delay on any of the
latest eMMC chipsets. Even open source version of this file doesn't
have this delay.
Change-Id: Iad5baa897f8fc0a360a17944fb87eb8e21e9bc53
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
(cherry picked from commit 581dd72b2e965e88f8ad93531c03a0c799e6384a)
SDCC4 controller has IO_PAD_PWR_SWITCH control bit in MCI_CLK register.
Driver should set this bit to 1 if the IO voltage level is within
low voltage range (1.7v - 1.9v) else clear it.
But driver sets this bit to 1 only if the MMC core layer initiates
the voltage switch sequence. So if voltage switch sequence is not
initiated (which is the case with non UHS-I cards) then even if
the IO voltage level is within low voltage range, IO_PAD_PWR_SWITCH
bit remains cleared.
This change checks the IO voltage level and based on that sets the
IO_PAD_PWR_SWITCH bit.
CRs-Fixed: 386445
Change-Id: Id0648b0f87ea9bcc942e855e30da810e0fe5ebf5
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
(cherry picked from commit 341b9e7dbaf0a3caf6e41d37486e3bccc9795feb)
commit 386ad800716b6660d40c677b57ee4bf8e4430329 msm-3.4
What is the race condition? (NOTE: RPM stands for Runtime Power Management)
1. SDCC is in RPM_SUSPENEDED state and SDCC platform suspend gets
triggered and then system goes into suspend.
2. During platform resume, SDCC platform resume is triggered
which blindly sets the pending_resume flag in SDCC host structure.
3. If new MMC transfer request comes then MMC block driver calls
mmc_claim_host() which internally calls msmsdcc_enable().
4. msmsdcc_enable() checks for following 3 conditions to be true:
1. host->sdcc_suspended == true
2. host->pending_resume == true
3. pm_runtime_suspended() == false
But as SDCC state is RPM_SUSPENDED, 3rd condition is not be satisfied
so msmsdcc_enable() don't clear the host->pending_resume flag and simply
calls pm_runtime_get_sync() to resume the SDCC. Once SDCC is resumed,
host->sdcc_suspended = false, runtime_status = RPM_ACTIVE but
host->pending_resume is still set.
5. Now after RPM idle timeout, SDCC runtime suspend gets triggered which
calls SDCC driver's runtime suspend callback (msmsdcc_runtime_suspend).
Note that before executing the RPM suspend calllback, SDCC RPM status
is set to RPM_SUSPENDING.
6. As SDCC driver's runtime suspend callback gets executed, it sets the
host->sdcc_suspended to true. But now before the RPM framework
sets the SDCC RPM status to RPM_SUSPENDED, on other active CPU core,
new MMC transfer reques comes in which would first call msmsdcc_enable()
and all of the 3 conditions below is true:
1. host->sdcc_suspended == true
2. host->pending_resume == true
3. pm_runtime_suspended() == false (RPM status is RPM_SUSPENDING)
As these conditions are satisfied, msmsdcc_enable() does not call
pm_runtime_get_sync(), instead just calls pm_runtime_get_noresume() and
msmsdcc_runtime_resume(). This means even after execution of
msmsdcc_enable(), SDCC RPM status is either RPM_SUSPENDING or
RPM_SUSPENDED.
7. RPM suspend framework on 1st core sets the SDCC RPM status to
RPM_SUSPENDED once SDCC runtime suspend callback returns.
8. Now once MMC transfer request is completed on other core, it will call
msmsdcc_disable(). This function calls pm_runtime_put_sync() which
returns -EAGAIN error as RPM status is already RPM_SUSPENED.
This error gets returned to MMC layer so MMC layer thinks that
SDCC is still enabled and skips call to msmsdcc_enable() until
msmsdcc_disable() succeeds.
8. Note when msmsdcc_disable() returned error, RPM usage_counter was set to
0 so next call to msmsdcc_disable() decrements RPM usage_counter to -1
(remember msmsdcc_enable() was skipped).
9. Now new MMC request comes in and it will first call msmsdcc_enable()
which calls pm_runtime_get_sync() and it sets the usage_counter to 0
and blindly resumes the SDCC as it was already suspended. After this
RPM status will be RPM_ACTIVE.
10. Once MMC request is processed, it will call smsdcc_disable() which
calls pm_runtime_put_sync() and it decrements RPM usage counter to -1
and skips scheduling runtime suspend callback as RPM usage counter
is not 0. RPM status remains in RPM_ACTIVE.
11. Now onwards for every new MMC transfer requests, 9 and 10 repeats and
SDCC always stays in RPM_ACTIVE state forever.
How is this race condition fixed?
Above race is created because host->pending_resume is remaining sticky.
Following changes are done to ensure that pending_resume gets set and
cleared at appropriate places:
1. In SDCC platform resume callback, set the host->pending_resume flag
only if RPM status is RPM_ACTIVE.
2. Clear the pending_resume flag once msmsdcc_runtime_resume() is
completed.
3. In msmsdcc_enable() function, if pending_resume flag is set skip calling
pm_runtime_get_sync() instead directly call msmsdcc_runtime_resume()
because RPM status is RPM_ACTIVE.
In addition, this patch adds WARN() messages in case of failures in
msmsdcc_enable() and msmsdcc_disable() functions to capture more details
in error conditions.
CRs-Fixed: 373338
Change-Id: I50d1bd63480c668dd2b83f01567f912661f0c606
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Some device has problems in packed write for eMMC.
So we can set packed write feature in platform data.
Change-Id: I7e76c78fd076fa5cb0d540c1312fd6ae69aae1b4
Some eMMC cards dont come out of sleep when running in HS200 mode and
so to ensure that the eMMC card is reliably brought out of sleep.
Change-Id: Ic9b68111c5e7e62400767ae5f71a56c3fe2be281
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
Hardware reset is not implemented in SD card. To circumvent this,
a power-cycle is issued to the card & it is reinitialized.
This would help recovering from 'card stuck in programming state'
situations.
mmc_can_reset: Added check for SD card.
CRs-fixed: 375869
Change-Id: I8bd7dc071f3569898371d5becca06ec2fe937d4a
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
In error situations, sometimes the card doesn't respond to commands.
To recover from such situations, a power-cycle is issued to the card
and it is reinitialized.
msmsdcc_hw_reset: Defined in mmc host operations 'hw_reset'.
This function power-cycles the card.
CRs-fixed: 375869
Change-Id: I2b02649ae3befe700a7a2401b93eb69c8014a4ce
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Use platform_get_resource_byname API instead of
explicitly parsing the platform device for resource
structures from the driver.
Change-Id: I6dd3e23f1d88569f8fddf8a0331e4578ef1f1a1b
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
In newer SDCC v4 versions, the internal single port RAM is
replaced by dual-Port RAM which requires clock muxing after
RX transactions. To ensure clock switch is completed
successfully, the driver has to poll for TX/RX active bits
de-assertion in status register before initiating new transaction.
Change-Id: Idcd7732fa4fa490017e69d62535dbff6eb335eb6
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
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>
Sampling clock tuning is really not required if card clock is less than
100MHz. This change makes sure that we do tuning only if clock is >100MHz.
In additional, this change also makes sure that if tuning is enabled then
CDR (clock-data recovery) should be enabled only for data read operations.
Change-Id: I5bf26edd8de28d1f53bd258a064475cb0b67b5b5
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
In mmc_wait_for_req_done() function, change the call wait_for_completion()
to wait_for_compltion_io(). This change makes the kernel account for
wait time as I/O wait and through another configuration, this io wait
is treated as busy which makes the acpu clock to scale up.
Change-Id: Iebdc7b1b22871bf845f10a55e2272816c72d9964
Signed-off-by: Murali Palnati <palnatim@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
With commit (d5d59dc) setting AUTO_PROG_DONE bit for Multi
block write command (CMD25) is broken. Fix this by setting
wait_for_auto_prog_done flag for CMD25 preceded with CMD23.
Change-Id: Ic81550b199162b657ad4ef5de47ec0c2d4de25c8
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
SDC1 and SDC2 interfaces on copper target has dedicated
TLMM pins and SDC3, SDC4 have GPIOs muxed with other
subsystems.
Change-Id: I6f924ccb0c27e8ecde95c0a7d8beb6614c25378d
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
This test write data to the card, then send DISCARD on random
addresses on the card, send SANITIZE to the card to erase all
the unmapped areas.
Change-Id: I2904023ccd258e64b99b004bacfbe576b0ead59a
Signed-off-by: Maya Erez <merez@codeaurora.org>
Add a sysfs attribute to configure the runtime PM idle timer value
In some cases (eg. audio playback) the power consumption drops if
runtime idle PM timeout is set to 10sec. So this sysfs attribute
should be used to configure the idle timeout for SDCC per target.
The value must be greater than 5secs or else will have a major
performance hit.
Change-Id: Ia5a9a81ce46e9c66a325fd1ec1ccd2e0f89a981f
Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org>
BAM driver provides a callback mechanism for global BAM device
error or when a AHB access error occurs. This change adds and
registers the callback along with the necessary error handling
and cleanup.
Change-Id: Ib5028ea4b189010da87f6669f0292a146fc05838
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
Expose the packing control test.
Test the packing control feature under these scenarios:
- Packing expected: entering write packing state,
staying in write packing state.
- Packing not expected: not entering write packing state
when not supposed to.
- Mixed states: test the ability to shift from packing
to no-packing and back, and the opposite.
Change-Id: I5a93df8b5b7c48d355c3cc881699a3f9592914e6
Signed-off-by: Lee Susman <lsusman@codeaurora.org>
Expose the following packed commands tests:
- Test the write packed commands list preparation
- Simulate a returned error code
- Send an invalid packed command to the card
Change-Id: I9e061a1992cc09f3203d25eba14418d9ebde371a
Signed-off-by: Lee Susman <lsusman@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
CONFIG_MMC_MSM_CARD_HW_DETECTION is no longer used so this
patch removes it completely from kconfig as well as from
defconfigs.
Change-Id: I8e7220722e0e90296d379105c61787ca54a1afd4
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Newer versions of SDCCv4 controller has added a soft
reset mechanism to reset the controller state machine
or reset the entire controller to default power on state.
MCI_POWER[SW_RST] - The impact of this reset bit will be
similar to the impact of the reset by doing clk_reset() on
host controller clock (HCLK). With this all SW registers
and all internal logic is reset.
MCI_POWER[SW_RST_CONFIG] - Resets the controller state machines
without resetting configuration registers (MCI_POWER, MCI_CLK,
MCI_INT_MASKn).
Change-Id: I7fd13e736b23dff16c20bd9f865ca97e7daaf304
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>