drivers: mmc: udpated driver from sony aosp release

commit e132b94a8bb0c10f8172a04af539891cb84a4484
Author: Maya Erez <merez@codeaurora.org>
Date:   Tue Jan 29 21:42:02 2013 +0200

    mmc: core: Fix a deadlock due to race between suspend and delayed BKOPS

    mmc_stop_bkops calls cancel_delayed_work_sync while the host is taken.
    This can cause a deadlock since the delayed work is blocked on claiming
    the host. In order to prevent that, mmc_start_bkops will not
    be blocked waiting on mmc_claim_host and if the host is already taken
    BKOPS will not be performed.

    CRs-Fixed: 446090
    Change-Id: I5cda5489e254764b3231b8a12da9e3c241c969c3
    Signed-off-by: Maya Erez <merez@codeaurora.org>
    (cherry picked from commit 8571386b83bea1cbadd81c75bf0614da30b6b7c0)

commit 5df5a41725c37e10fefa44f2f633bb69b4109c8d
Author: Maya Erez <merez@codeaurora.org>
Date:   Thu Jan 24 12:54:03 2013 +0200

    mmc: core: Cancel BKOPS checking in case MMC is suspended

    If there is a race condition between the delayed BKOPS work and
    the runtime suspend, and the suspend occurs before the delayed work,
    the delayed work should be canceled.
    Since mmc_claim_host can fail in case the host is suspended, we should
    check if the delayed work is canceled before trying to claim the host.

    CRs-Fixed: 443236
    Change-Id: I9df506de4da6f9277a89ed608724f5b6e8585bfd
    Signed-off-by: Maya Erez <merez@codeaurora.org>
    (cherry picked from commit 5a3d216c005725baad96b6858dbcd370056e470c)

commit c9eafd72412dafcd814c9cbcd3ed5839f893b1e8
Author: Maya Erez <merez@codeaurora.org>
Date:   Wed Jan 16 09:48:25 2013 +0200

    mmc: use percentage changed sectors as indication to check BKOPS need

    In order to keep card endurance, it is best not to check the need for
    BKOPS every time the MMC is idle.
    However, the decision when to check the card need for BKOPS according
    to number of changed sectors doesn't fit all cards sizes. Therefore,
    the check for BKOPS need is based on percentages of changed sectors
    of the card size.
    In order to assure that BKOPS will be triggered again in case it was
    interrupted, the accumulated number of changed sectors is cleared only
    in case BKOPS was completed without interruption.

    Change-Id: I598f64b652a524a431b87d103fd5890b808f11b1
    Signed-off-by: Maya Erez <merez@codeaurora.org>
    (cherry picked from commit e1eae988976536834759a45cf7f62e1cb2b82838)

commit c6c9d26a35bb01fa71c8941cd893bc5dd99f47a6
Author: Maya Erez <merez@codeaurora.org>
Date:   Wed Jan 16 09:43:45 2013 +0200

    mmc: Do not perform blocking BKOPS

    BKOPS operations can take long time and cause bad user experience and
    failure of time critical operations as EFS sync.
    In order to prevent the above failures all the levels will be handled only
    in idle time BKOPS handling and will allow interrupting the BKOPS when
    needed.
    In case the card raised an exception with a need for BKOPS, a flag will
    be set to indicate MMC to start the BKOPS activity when it becomes idle.

    Fixed-CRs: 432027
    Change-Id: I5f7b43569c0242f0fea83355f76f286b1ad037bc
    Signed-off-by: Maya Erez <merez@codeaurora.org>
    (cherry picked from commit 5f8ac3b955e44def61c2238192000ffe5f126714)

commit 52f64ea3a7ec08115a08289d9b5b1558c7078c0d
Author: Maya Erez <merez@codeaurora.org>
Date:   Fri Jan 4 11:04:47 2013 +0200

    mmc: increase BKOPS polling duration before suspend

    The timeout for the BKOPS polling is increased in order to allow the
    card to complete the BKOPS before going to suspend.
    In case we exit due to timeout we need to stop the BKOPS activity
    performed by the card.

    Change-Id: I39686de0c06a57242f11c8b1c9ae50b33417c088
    Signed-off-by: Maya Erez <merez@codeaurora.org>
    (cherry picked from commit ea1385e6d7542d4e3ad510de94ead00bece7823e)

commit 95792457754b208872607a12996f482d059452dc
Author: Maya Erez <merez@codeaurora.org>
Date:   Mon Dec 31 16:17:58 2012 +0200

    mmc: core: disable the cache before suspend only after stopping BKOPS

    mmc_cache_ctrl was called in runtime suspend before MMC interrupted
    BKOPS in case it is still running on the card. This caused the cache
    disable to timeout.
    Therefore, mmc_cache_ctrl has to move to mmc_suspend where we are sure
    that the card can go into suspend and there is no pending activity.

    CRs-Fixed: 436805
    Change-Id: I76281a766f48ccacc24685a64067df4e60cfe1d8
    Signed-off-by: Maya Erez <merez@codeaurora.org>
    (cherry picked from commit 67a51386fd99be62e5e68f4bc76ee00c19099cd6)

commit 37d48a55c2f1f50e95a5551fc32ceafc0797601b
Author: Maya Erez <merez@codeaurora.org>
Date:   Wed Jan 16 09:29:10 2013 +0200

    mmc: core: Reduce the time to check for BKOPS need on idle

    In order to allow the card to perform BKOPS as early as possible without
    causing degradation to a flow of requests, we reduce the time of the
    BKOPS delayed work to 200ms.
    Based on experience, 200ms will allow requests to be performed without
    a delay of checking the BKOPS.
    This patch also allows the host controller to set any other time if
    required.

    Change-Id: I1e56bfd0c9471abf4da50befe6d14fe0199129e7
    Signed-off-by: Maya Erez <merez@codeaurora.org>
    (cherry picked from commit 70b00220e7564b00e3b0747260fe2c2dbe62f45d)

commit 16a78c92d28d0c4039b74a8ff88caf6425b9765f
Author: Yaniv Gardi <ygardi@codeaurora.org>
Date:   Tue Dec 4 16:42:58 2012 +0200

    mmc: card: fix timeout on erase/trim command due to sanitize

    Sanitize command should never be issued with timeout argument of 0,
    cause then it invokes timeout.
    Moreover, sanitize command should not be called from routines that
    does erase/trim/secure-discard commands, but only from a routine that
    issues the sanitize spesifically.(mmc_blk_issue_sanitize_rq)

    Change-Id: Ia3e3737f4bad149edc2248b8a30d74a9bd812be1
    Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
    (cherry picked from commit 9a87427db940047907aee0dc86965645656f1ca9)
    Signed-off-by: Neha Pandey <nehap@codeaurora.org>

commit f49c1b81df832f0baddc6585ae66191237020095
Author: Sujit Reddy Thumma <sthumma@codeaurora.org>
Date:   Sun Feb 10 17:01:30 2013 +0530

    mmc: msm_sdcc: Hard reset controller on errors

    For APQ8064 V2 (SDCC version = 0x06000018) doing a soft
    reset on errors doesn't reset the state machine that
    handles side-band signalling with SPS-BAM fully and can
    lead to controller hang for the data transfers after
    the reset.

    Since there is no register interface to soft reset such
    state machine inside the controller, we do hard reset of
    the controller in case of errors. SDCC hard reset is
    defined as assert and de-assert of asynchronous clock
    reset line of the controller.

    CRs-Fixed: 451632
    Change-Id: I366856e7508a3843688c8acead8a701e7b06fc19
    Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>

commit c6b065feda03521eab5d6dcbe1320d09f9daaefa
Author: Subhash Jadavani <subhashj@codeaurora.org>
Date:   Sat Dec 15 22:05:54 2012 +0530

    mmc: msm_sdcc: don't print the timeout errors for BKOPs

    We have seen instances where card is surprisingly taking lot of time
    to complete their bkops operations. And if we let the card take long
    time to complete the BKOPs then it would affect the user experience
    if user tries to launch some application (or any other user operation
    resulting in read from the card) while card is busy doing BKOPs.

    User experience is most important aspect so we are reducing the maximum
    BKOPs timeout to max 30 secs and if card doesn't complete the BKOPs in
    the timeout specified above, we will send the HPI command to interrupt
    the on going BKOPs.

    If reduce the timeout to 30 secs then we may see the request timeout
    errors during BKOPs so let's silence them out.

    Change-Id: I31b11f60d1fae098770aa5797742eaf623b09ac9
    Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
    (cherry picked from commit 926a9cb47ebfa40428b49f110135fde9e82f9cbe)

commit 6a69346058390e17ea36f37cf5b2d22f9bb7a4ed
Author: Subhash Jadavani <subhashj@codeaurora.org>
Date:   Sat Dec 15 21:58:44 2012 +0530

    mmc: core: reduce the maximum timeout for BKOPs

    Currently we have 4 mins timeout for the blocking bkops to be completed
    but we have seen instances where card is surprisingly taking even more
    time to complete their bkops operations. So if we let the card take
    more than 4 mins then it would affect the user experience if user tries
    to launch some application (or any other user operation resulting in
    read from the card) while card is busy doing BKOPs.

    User experience is most important aspect so we are reducing the maximum
    BKOPs timeout to max 30 secs and if card doesn't complete the BKOPs in
    the timeout specified above, we will send the HPI command to interrupt
    the on going BKOPs.

    Change-Id: I14355fb79979058f388cd726091752797c316503
    Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
    (cherry picked from commit 188b2a8723b4728c7c0c4c445e1aefe6e42895c9)

commit 5fc0b4ca2178fcb3098b083ac7e7360ad35ca682
Author: Subhash Jadavani <subhashj@codeaurora.org>
Date:   Wed Dec 19 19:06:38 2012 +0530

    mmc: core: interrupt Background Operations if it takes too long

    Currently we have 4 mins timeout for the blocking BKOPs to complete
    but we have seen instances where card is surprisingly taking even
    longer time to complete background operations.

    If card doesn't complete the BKOPs within specified timeout, we
    will send the HPI command to interrupt the ongoing BKOPs.

    Change-Id: I5df81bdfd9b19bee30a394ee0ff4390b292691d0
    Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
    (cherry picked from commit 1b22222ec61924de9b8ac51f08de113548946eb5)

commit 396a0cec994b5591225b285e52f2036c0b7a188f
Author: Subhash Jadavani <subhashj@codeaurora.org>
Date:   Wed Dec 19 19:05:02 2012 +0530

    mmc: msm_sdcc: don't perform busy wait for CMD13 (status command)

    Currently SDCC driver is waiting for the PROG_DONE interrupt after
    sending out the CMD13 to card  even if command flags doesn't indicate
    so. This may cause the issue in when we try to HPI (High Priority
    Interrupt) the ongoing BKOPs (Background Operations). Hence this
    change removes the busy wait (PROG_DONE) for CMD13.

    Change-Id: I8fb6ab4908bf1c4c5a939413d27eec29cde22f68
    Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
    (cherry picked from commit 56fd45187495f27a7f9c3ebe947c1ffc9851fffd)

commit c4e1840f124ae574cff645b9e99463f705d1cacf
Author: Maya Erez <merez@codeaurora.org>
Date:   Tue Feb 5 13:19:52 2013 +0200

    mmc: msm_sdcc: Reset SDCC controller if check for Tx/Rx active fails

    Reset SDCC controller if the check for TX/RX ACTIVE bit fails while
    carrying out DPSM reset after the end of current transaction
    instead of taking the entire system down by doing BUG().

    CRs-Fixed: 423356
    Change-Id: I9e2e945eb9a31d12e0a435df29a8215ae634724b
    Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
    (cherry picked from commit 0a29588be6d3d6bd9122191e7e850c687bb1b166)

    Signed-off-by: Maya Erez <merez@codeaurora.org>

commit abc7dddd0eb7d88de2213d2ddb34a3ac8232fcee
Author: Sujit Reddy Thumma <sthumma@codeaurora.org>
Date:   Thu Dec 27 17:24:45 2012 +0530

    mmc: msm_sdcc: Fix SDCC-BAM, DML reset sequence

    Resetting SDCC-BAM after reset of SDCC-DML causes
    interface disconnect between SDCC-BAM and SDCC-DML
    and lead to hang when SDCC driver initiates data
    transfer in BAM mode. Modify the SDCC reset sequence
    to reset SDCC-DML after reset of SDCC-BAM.

    CRs-Fixed: 423399
    Change-Id: Ia31d40e30cbf95befba3b1133a525a81903789f2
    Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
    (cherry picked from commit b745eeb229a476d81ee4177adfe168d3a35bda47)

commit 53dcd8e9c35da499cd5ea0faa97c50ae13439d13
Author: Sujit Reddy Thumma <sthumma@codeaurora.org>
Date:   Sat Nov 17 13:03:27 2012 +0530

    mmc: msm_sdcc: Reset SDCC controller if check for Tx/Rx active fails

    Reset SDCC controller if the check for TX/RX ACTIVE bit fails while
    carrying out DPSM reset after the end of current transaction
    instead of taking the entire system down by doing BUG().

    CRs-Fixed: 423356
    Change-Id: I9e2e945eb9a31d12e0a435df29a8215ae634724b
    Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>

commit f2208eb16d1de2808b51422b0300b3705525e0af
Author: Subhash Jadavani <subhashj@codeaurora.org>
Date:   Tue Nov 27 12:28:13 2012 +0530

    mmc: sdio: fix resume failure

    If SDIO keep power flag (MMC_PM_KEEP_POWER) is not set, card would
    be reinitialized during resume but as we are not resetting
    (CMD52 reset) the SDIO card during this reinitialization, card may
    fail to respond back to subsequent commands (CMD5 etc...).

    This change resets the card before the reinitialization of card
    during resume.

    (cherry picked from commit 2679307563a616af7ab189706604a245c6a3be92)
    CRs-Fixed: 424805

    Change-Id: I1ccd93e9221de631a407064219793e7378ac8f31
    Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
    Signed-off-by: Neha Pandey <nehap@codeaurora.org>

commit 48a65602fa540a8e90c669a80a1cf34b084499e0
Author: Maya Erez <merez@codeaurora.org>
Date:   Wed Nov 28 23:55:57 2012 +0200

    mmc: msm_sdcc: Enable write packing capability

    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>

commit 84f696d968566eff3fce0e4eb30b8ace661a1410
Author: Giulio Cervera <giulio.cervera@cyanogenmod.org>
Date:   Mon May 6 00:23:28 2013 +0200

    Revert "arm/dt: msm8974: Add sd card hot plug support"

    This reverts commit b6da693fa36dafafb3ff89ae915504193c88532f.

    Conflicts:
    	arch/arm/boot/dts/msm8974-cdp.dts

    Change-Id: I95e6719b4af7de15c3b50bd153f14b91614abdbf

commit fa933e4ea45f8c062a28c91d94b2b6518e8655a0
Author: Giulio Cervera <giulio.cervera@cyanogenmod.org>
Date:   Mon May 6 00:22:39 2013 +0200

    Revert "mmc: msm_sdcc: Print data line status in case of errors"

    This reverts commit 74bff7cf272ebebc04de8e99a216c32519df52fa.

commit 3354793d97b675c50e30e6b6b2824c6a2bc6f3a2
Author: Giulio Cervera <giulio.cervera@cyanogenmod.org>
Date:   Mon May 6 00:22:31 2013 +0200

    Revert "mmc: msm_sdcc: add support for AUTO_CMD19 control"

    This reverts commit e5c2e715eb8ecc487a906469ab9ea19696437760.

commit 4269b83ef6adc364a51d808fbe5b98f1d809ec65
Author: Giulio Cervera <giulio.cervera@cyanogenmod.org>
Date:   Mon May 6 00:21:59 2013 +0200

    Revert "mmc: msm_sdcc: correct the hardware version number"

    This reverts commit f6486f1a7350e9a98cfb4fcc528097cbe746b1f0.

commit 251f19b4cbfe702f78f74d5c0cc27cc8fb7bc434
Author: Giulio Cervera <giulio.cervera@cyanogenmod.org>
Date:   Mon May 6 00:21:54 2013 +0200

    Revert "mmc: msm_sdcc: add support for AUTO_CMD21"

    This reverts commit 2bb781e25ef7494ffab79d169c9e51672acabd49.

commit 7f99664a2e3fcbb1a7f8f9e0bbd0e5912e248fae
Author: Giulio Cervera <giulio.cervera@cyanogenmod.org>
Date:   Mon May 6 00:19:11 2013 +0200

    Revert "mmc: msm_sdcc: Enable write packing capability"

    This reverts commit 94a78f62307a53e9051e6f3970e1a937361078ba.

commit 3a59e6e4f1c92b22de5bf3725dbcd5f126314376
Author: Giulio Cervera <giulio.cervera@cyanogenmod.org>
Date:   Mon May 6 00:18:31 2013 +0200

    Revert "mmc: msm_sdcc: enable the write packing control"

    This reverts commit 681c3b752850b8d8a8ef8e16905e1b1fb290551a.

commit 71f883a230986416cebb821bdaf1f1f712a66fb8
Author: Giulio Cervera <giulio.cervera@cyanogenmod.org>
Date:   Mon May 6 00:11:41 2013 +0200

    Revert "mmc: msm_sdcc: Prevent NULL pointer dereference in IRQ"

    This reverts commit 53b638c7b5933781ee6e0e5f7d6d68599e000ebe.

commit bbf79e2fc6d0f1fdda19128bbf690e19665ee5ae
Author: Giulio Cervera <giulio.cervera@cyanogenmod.org>
Date:   Mon May 6 00:11:15 2013 +0200

    revert sony 10.1.A.350 mmc changes

    Change-Id: If2ff154bb661a21007caa30d44104c502a828c44

Change-Id: Idaf2927fdd3cc73f5086a9704855175550ad254e
ASoC: audio: fix unlock Null pointer issue

-In afe_open, trying to unlock mutex on variable
that is already freed.
-correct the sequence by unlock mutex first then
free the variable.

CRs-Fixed: 423196
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
(cherry picked from commit 4c120ae85c6c5ac2adfdf61956b45d02461a93e3)

Change-Id: I6c29a58e7138d29fe1a5c0641be795f6f4fbbd47
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
Merge "drivers: mmc: udpated driver from sony aosp release" into cm-10.1