Commit Graph

722 Commits

Author SHA1 Message Date
Luca Stefani ff1ebfd98d This is the 3.10.102 stable release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXXS5iAAoJEE44bZycYXAvDj8P/jbhmGAgW6tw2cnS90QIZDqG
 M/nclEId61jICNvbfP6zsioKeWyrmzr5G7NjqTThsSNhCo/DXs3ddMqLy3pOaFdq
 mytXtHIUpwZoplEib+ODinW40CMqnu11XSWEcee2nrsPuGNsnc7BY0wmFBa6UVCV
 rOZef9SN9lJcZSYY/auvgLDXOXdQ+NMxp5hau30aF5HBO8hTDXStjPRcUwCvz7aR
 govTQJHlS4HzLH3JOYS3Dt8IYFDOrKhQIby2nFdw7eiUxHCRy2F0asabTh3DzCw1
 iLvFroozjyVXwozfWMqLCvMa+514MXJy8Nkva6xiAHraC8UrgfPtcNsTdgtkdH9T
 V2Am9b0L7yiBdG6hsZLxkU3akk7vU/0dtppwzvudANT6i2tGcDSBeaZq3T2pAv7B
 7coY53GzHZdQnbdTZbYeS1fxebxyXw50D5OJkF8DyLhoL7Uj2Dvv0QdjKv+U/e5D
 VQ+ZyGcBdCLuOzflXysI10E01y0/M3FrkubgGBM4Oh0eYKCHJaHG/NCZy5JY/qxy
 S0phem8RbeZPbcL14z+5buWIi1lUkTiCIMG8c32ZEmDh84drnICqABA0RzKmqdkj
 ucQa+PzkMQ1DyhAMUl/CwpBfSqf1Zs3agLo78Kp5MTGfeAA90m0SeVqhmDgWhwqG
 HhSlsPFfMfmJl5S0uJpQ
 =UhFl
 -----END PGP SIGNATURE-----

Merge tag 'v3.10.102' into HEAD

This is the 3.10.102 stable release

Change-Id: Ic7d338fb190966b26aa151361fc37414f701d8b2
2017-04-18 17:22:08 +02:00
Luca Stefani 84d647cae9 mmc: dos2unix
Change-Id: If55e77f51b0257e17067c69949f427d14881a70d
2017-04-18 17:18:58 +02:00
LuK1337 fc9499e55a Import latest Samsung release
* Package version: T713XXU2BQCO

Change-Id: I293d9e7f2df458c512d59b7a06f8ca6add610c99
2017-04-18 03:43:52 +02:00
Veerabhadrarao Badiganti dbceeaf8ea mmc: block: Fix issue with deferred resume when CQ is enabled
In CQ mode, the legacy commands will be sent after CQ is put in
halt state. But when deferred resume is enabled, the resume
happens in mmc_wait_for_req(), which will enable CQ again
overiding the caller's state. This causes legacy commands to fail.

Fix this by moving the deferred resume from all the places to
mmc_rpm_hold() which is always the first step done in both
CQ/legacy commands and thus avoids the above issue scneario.

Fix: fbb7cbf8ea (mmc: core: Add deferred resume for command queue mode)
Change-Id: I97fb9d654968b294dc1fb6986b8b9431e22233c0
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2016-12-07 21:53:08 -08:00
Ritesh Harjani e4e5ea9e1e mmc: core: Remove flag MMC_PM_WAKE_SDIO_IRQ in mmc_resume_host
MMC_PM_WAKE_SDIO_IRQ flag is used by platform driver(sdhci-msm
here) to determine if SDIO wakeup IRQ needs to be enabled
or not. If this flag is not removed in every mmc_resume_host,
then while suspend, platform driver will configure the sdio
wakeup IRQ even though wlan is disabled from UI.
This flag can be enabled by wlan driver before entring into suspend.

In this case since Wlan is not enable and thus not entering WoW mode,
pull up present on this SDIO GPIO line will pull the line high (which
otherwise is pulled low by wlan firmware in WoW mode and triggers
interrupt by pulling it high in WoW mode) which eventually will
trigger a false SDIO wakeup interrupt thus breaking the suspend
everytime.

Hence disable the flag everytime in mmc_resume_host and let
wlan driver enables it (-by sdio_set_host_pm_flags)
before entering into suspend if needed
for sdio wakeup part.

Change-Id: Iecf9eef4d91a741116bc8b8bb59c49ae7f2891fd
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2016-07-29 21:12:20 -07:00
Ritesh Harjani 226b74c3d2 mmc: sdio: Add MMC_CAP2_BROKEN_PWR_CYCLE & fix mmc_sdio_init_card
Power supply to card QCA9377 & QCA6574 is used for wlan and
bluetooth as well.

Now if SDIO card is switched to 1.8V signaling voltage, it will not
switch back to 3.3V without a power cycle. CMD0 will not make SD (SDIO)
card enter 3.3V signalling voltage. Since the power supply
for mentioned card is also used to power bluetooth along with
wlan, so card cannot be power cycled for wlan alone from such mmc
host

This patch adds a capability for such host which cannot power cycle
the card. Thus during resume of sdio (mmc_sdio_resume), it checks
if host has MMC_CAP2_BROKEN_PWR_CYCLE capability set. In case if this
capability is set we do mmc_sdio_power_restore.

This patch also fixes the resume path that if there is an oldcard
present and it's an UHS card then CMD11 may give no response. In that
case we need to switch only host signal voltage to 1.8V as card is
already in 1.8V.

Without this patch software assumes that card is switched to 3.3V on
power cycle and tries voltage switch sequence which fails
(because host driver will not control this power supply and thus
card will never enter into 3.3V supply). Thus UHS mode is not entered.

Change-Id: I1fae116fd3c5b3854761ac09da1ffec7f6ddfec9
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
2016-07-29 15:12:08 -07:00
Matt Gumbel e9e0c8aded mmc: longer timeout for long read time quirk
commit 32ecd320db39bcb007679ed42f283740641b81ea upstream.

008GE0 Toshiba mmc in some Intel Baytrail tablets responds to
MMC_SEND_EXT_CSD in 450-600ms.

This patch will...

() Increase the long read time quirk timeout from 300ms to 600ms. Original
   author of that quirk says 300ms was only a guess and that the number
   may need to be raised in the future.

() Add this specific MMC to the quirk

Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
2016-06-07 10:42:55 +02:00
Adrian Hunter e94c917abb mmc: mmc: Fix partition switch timeout for some eMMCs
commit 1c447116d017a98c90f8f71c8c5a611e0aa42178 upstream.

Some eMMCs set the partition switch timeout too low.

Now typically eMMCs are considered a critical component (e.g. because
they store the root file system) and consequently are expected to be
reliable.  Thus we can neglect the use case where eMMCs can't switch
reliably and we might want a lower timeout to facilitate speedy
recovery.

Although we could employ a quirk for the cards that are affected (if
we could identify them all), as described above, there is little
benefit to having a low timeout, so instead simply set a minimum
timeout.

The minimum is set to 300ms somewhat arbitrarily - the examples that
have been seen had a timeout of 10ms but were sometimes taking 60-70ms.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
2016-06-07 10:42:55 +02:00
Asutosh Das e941d25bdf mmc: host: set correct state when suspend fails
During the suspend of class device (mmc_host), it is
legal for the suspend to fail. For e.g in case of SDIO
the wlan may refuse to suspend at that point of time.

In such a scenario the device should not be marked as
suspended. Its state should be restored to resumed.
Otherwise, the device never enters suspend again.

write mem to /sys/power/state -> suspend is triggered
[0: ksdioirqd/mmc2:25044] HIFsuspendwow TODO
wma_suspend_fw: wow suspend successful
system_server: 1226] vfsspi_regulator_onoff: off
kworker/u16:2:23854] mmc2: mmc_host_suspend: start
wma_check_scan_in_progress: scan in progress on interface
hifDeviceSuspend: Scan in progress. Aborting suspend
kworker/u16:2:23854] wlan suspend failed error=-1

Wlan refuses to suspend above

mmc2: mmc_host_suspend: failed: ret: -1 .
mmc2: mmc_host_suspend: end -->
dpm_run_callback(): mmc_host_suspend+0x0/0x2d8 returns -1
PM: Device mmc2 failed to suspend async: error -1
PM: Some devices failed to suspend

Since wlan refuses to suspend, SDIO doesn't suspend too.
But the class device is still marked to be suspended
[state: 2] incorrectly.
It should be marked as resumed, since suspend had failed.

After this, the device never suspends:

!@suspend_thread_func: write mem to /sys/power/state
PM: suspend entry 2016-03-29 10:52:42.456889406 UTC
mmc2: sdio_irq_thread: 130: acquired wlock: state: 2 ->
incorrectly marked as suspended.

mmc2: sdio_irq_thread: 130: acquired wlock: state: 2
PM: Syncing filesystems ... done.
active wakeup source: mmc2:0001->wakeup event by mmc2

CRs-fixed: 997876
Change-Id: Ib08a72b2ab21c4d4a76bac8e65d06c13ccbd1482
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
2016-04-13 03:56:29 -07:00
Asutosh Das 356dd17120 mmc: core: Add deferred resume for command queue mode
Do not resume the eMMC device as part of the system resume.
Only resume it when there's a request to be processed.

CRs-fixed: 972118
Change-Id: Ia4b3fcafb3fb5eabaad9d32bd776a03f45d4ab40
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Pavan Anamula <pavana@codeaurora.org>
2016-03-18 16:36:16 +05:30
Ritesh Harjani fdfd38be90 mmc: debugfs: Add HS400 timing mode info in debugfs
Currently ios->timing mode for HS400 mode is missing
from debugfs and thus taken as invalid.
Fix this by adding HS400 timing mode info in
mmc_ios_show.

Change-Id: I49d1e93862d97de6e2f0e2fa5da2b1be03ee60b1
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2016-02-15 22:04:49 -08:00
Sayali Lokhande ce58571b65 mmc: core: Remove bus vote after resume/suspend if no card is present
To remove bus vote we expect clk-gating to kick in. But when SDcard is not
inserted, we are never turning the clocks on and hence gating will never
kick in. Thus bus voting will be always put to true.

Fix this by notifying the sdhci_msm about the pm_status only when card
is present(if host->bus_ops is NOT NULL) and remove bus vote in case of
error in mmc_suspend_host/mmc_resume_host.

Change-Id: I1f244e312f0716f99cdc53c991d37b102d40b8bc
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2016-01-19 21:47:06 +05:30
Pavan Anamula 5e6c089279 mmc: core: Card specific custom settings for SDIO
Add quirk to modify custom settings for QCA6574 and
QCA9377 cards

CRs-Fixed: 948742
Change-Id: I05e70efa71a8b8b931dfff758194af6220a8bc46
[riteshh@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Signed-off-by: Pavan Anamula <pavana@codeaurora.org>
2015-12-30 22:22:38 +05:30
Krishna Konda 5542892b2f mmc: core: expose info about enhanced rpmb support
Following eMMC JEDEC JESD84-B51 standard, an ehannced form of
rpmb is supported. What this enhanced mode supports is in
addition to be able to write one rpmb or two rpmb frames at a
time,32 frames can be written at a time.

Expose this information present in ext csd field so that the
user space application that wants to make use of this can do
so.

Change-Id: I53fd962fd7e04b5d2d7804c289d7865c2c5618d5
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
Signed-off-by: Pavan Anamula <pavana@codeaurora.org>
2015-12-23 11:23:34 +05:30
Sahitya Tummala 36354b8cb4 mmc: core: Add hs400 enhanced strobe mode support
This adds hs400 enhanced strobe mode support
in mmc core layer which is emmc 5.1 feature.

Change-Id: Ifa80d8ed1544212629193f58f05db4bd0e163adc
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2015-12-09 09:18:03 +05:30
Linux Build Service Account 8bdc809e8d Merge "mmc: core: disable clock scaling before mmc suspend" 2015-12-04 12:43:58 -08:00
Ritesh Harjani 02a34eb670 mmc: core: cmdq helper for reset and claim host context
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>
2015-12-01 11:40:53 +05:30
Ritesh Harjani f9fd6cae32 mmc: core: Call cmdq_post_req with tag info instead of mrq
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>
2015-12-01 11:40:53 +05:30
Sahitya Tummala 74ab5d4642 mmc: core: disable clock scaling before mmc suspend
This is to ensure that clock scaling work is either cancelled
or completely done if it is already running before the MMC/SD
suspend is started. Otherwise, the system suspend may fail
unnecessarily if it cannot claim the host due to pending
clock scaling work.

Change-Id: Icc465a607451b29d51e27b733e506060ca9f9dc0
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2015-11-27 01:55:46 -08:00
Sahitya Tummala 0ce2e5d703 mmc: core: fix debugfs path to read ext_csd
After reading ext_csd, the host is not claimed while
doing unhalt if the card is in CQ mode. This may race
with RPMB context which tries to halt and disable CQ
in the card. This may unhalt the controller while RPMB
is still going on, resulting in software request timeout
for RPMB commands that are supposed to be sent in
legacy mode with controller in halt state.

Fix this by claiming the host till the unhalt is done
in mmc_ext_csd_open() so as to prevent race with RPMB
context.

Change-Id: I6d2738b21c3cd44c8fb6c99f63291059d5b18ee1
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2015-11-07 12:12:54 -08:00
Sahitya Tummala 71ea17b5cf Revert "mmc: core: Handle card shutdown from mmc_bus"
This reverts commit 5df1d211b6.
This is because it breaks the existing shutdown for eMMC and SD
card.

Change-Id: Id78b8bfd0f4ad29a13e006fa1ce866b36f180011
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2015-10-12 09:43:40 +05:30
Sahitya Tummala 2b72e9710e mmc: core: revert recent changes in shutdown handling code
This change reverts the following gerrits as they break the
existing shutdown functionality for eMMC and SD card.

8635767 "mmc: core: Extend shutdown sequence to handle bus operations"
b4f9379 "mmc: core: Add shutdown callback for (e)MMC bus_ops"
e3126b8 "mmc: core: Add shutdown callback for SD bus_ops"

Change-Id: I3d34404e653600d52015afe851ae55b7e60e07dd
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2015-10-12 09:43:40 +05:30
Jialing Fu ab7a4b4b9d mmc: core: fix race condition in mmc_wait_data_done
commit 71f8a4b81d040b3d094424197ca2f1bf811b1245 upstream.

The following panic is captured in ker3.14, but the issue still exists
in latest kernel.
---------------------------------------------------------------------
[   20.738217] c0 3136 (Compiler) Unable to handle kernel NULL pointer dereference
at virtual address 00000578
......
[   20.738499] c0 3136 (Compiler) PC is at _raw_spin_lock_irqsave+0x24/0x60
[   20.738527] c0 3136 (Compiler) LR is at _raw_spin_lock_irqsave+0x20/0x60
[   20.740134] c0 3136 (Compiler) Call trace:
[   20.740165] c0 3136 (Compiler) [<ffffffc0008ee900>] _raw_spin_lock_irqsave+0x24/0x60
[   20.740200] c0 3136 (Compiler) [<ffffffc0000dd024>] __wake_up+0x1c/0x54
[   20.740230] c0 3136 (Compiler) [<ffffffc000639414>] mmc_wait_data_done+0x28/0x34
[   20.740262] c0 3136 (Compiler) [<ffffffc0006391a0>] mmc_request_done+0xa4/0x220
[   20.740314] c0 3136 (Compiler) [<ffffffc000656894>] sdhci_tasklet_finish+0xac/0x264
[   20.740352] c0 3136 (Compiler) [<ffffffc0000a2b58>] tasklet_action+0xa0/0x158
[   20.740382] c0 3136 (Compiler) [<ffffffc0000a2078>] __do_softirq+0x10c/0x2e4
[   20.740411] c0 3136 (Compiler) [<ffffffc0000a24bc>] irq_exit+0x8c/0xc0
[   20.740439] c0 3136 (Compiler) [<ffffffc00008489c>] handle_IRQ+0x48/0xac
[   20.740469] c0 3136 (Compiler) [<ffffffc000081428>] gic_handle_irq+0x38/0x7c
----------------------------------------------------------------------
Because in SMP, "mrq" has race condition between below two paths:
path1: CPU0: <tasklet context>
  static void mmc_wait_data_done(struct mmc_request *mrq)
  {
     mrq->host->context_info.is_done_rcv = true;
     //
     // If CPU0 has just finished "is_done_rcv = true" in path1, and at
     // this moment, IRQ or ICache line missing happens in CPU0.
     // What happens in CPU1 (path2)?
     //
     // If the mmcqd thread in CPU1(path2) hasn't entered to sleep mode:
     // path2 would have chance to break from wait_event_interruptible
     // in mmc_wait_for_data_req_done and continue to run for next
     // mmc_request (mmc_blk_rw_rq_prep).
     //
     // Within mmc_blk_rq_prep, mrq is cleared to 0.
     // If below line still gets host from "mrq" as the result of
     // compiler, the panic happens as we traced.
     wake_up_interruptible(&mrq->host->context_info.wait);
  }

path2: CPU1: <The mmcqd thread runs mmc_queue_thread>
  static int mmc_wait_for_data_req_done(...
  {
     ...
     while (1) {
           wait_event_interruptible(context_info->wait,
                   (context_info->is_done_rcv ||
                    context_info->is_new_req));
     	   static void mmc_blk_rw_rq_prep(...
           {
           ...
           memset(brq, 0, sizeof(struct mmc_blk_request));

This issue happens very coincidentally; however adding mdelay(1) in
mmc_wait_data_done as below could duplicate it easily.

   static void mmc_wait_data_done(struct mmc_request *mrq)
   {
     mrq->host->context_info.is_done_rcv = true;
+    mdelay(1);
     wake_up_interruptible(&mrq->host->context_info.wait);
    }

At runtime, IRQ or ICache line missing may just happen at the same place
of the mdelay(1).

This patch gets the mmc_context_info at the beginning of function, it can
avoid this race condition.

Signed-off-by: Jialing Fu <jlfu@marvell.com>
Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
Fixes: 2220eedfd7 ("mmc: fix async request mechanism ....")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-01 12:07:32 +02:00
Linux Build Service Account 7560b9446b Merge "Merge commit '8dd7ff6f6d00965a2de2a3877cb4707cc2a4adb1' into private_redfox64_mbr" 2015-09-25 12:52:52 -07:00
Linux Build Service Account 8a02c8bfaf Merge "Merge remote-tracking branch 'quic/tmp-d8ff506' into LA.BR.1.3.3 HEAD" 2015-09-25 12:52:44 -07:00
Ritesh Harjani 7d75319b67 mmc: host: Fix CQE state if suspend host fails
During system suspend mmc_host_suspend halts CQE and then
disables it. At the same time, if any req is pulled by
mmc_cmdq_thread and acquires mmc_claim_host.

mmc_suspend_host -> will return -EBUSY then but currently
we dont re-nable the CQE state if mmc_suspend_host returns an
error. This causes all request to timeout.

Fix this by try to claim host before calling mmc_suspend_host
(in case of CQ) & enbling CQE back and unhalting it in case
mmc_suspend_host fails (for both runtime/system suspend)

Change-Id: Ieb8e094ec216679dc6c9d5f9b4f870da9ff6963f
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2015-09-22 15:08:51 +05:30
Sahitya Tummala 92d874bb43 mmc: core: Fix CQ runtime suspend
Fix the timeout issue with mmc_cmdq_halt() that happens in the
below scenario -

1. Let us say an RPMB request is processed just before the
runtime suspend. The RPMB request will put the controller in HALT
state and will put the card in legacy mode.

2. So during runtime suspend, the SW will check for card's state and
since it is in legacy mode, it won't call CQ disable host->op.
But CQ HW will get reset due to SW reset that gets issued during suspend.

3. If we get another RPMB request, we try to do the runtime resume.
But since SW did not invoke CQ disable host->op, it thinks that CQ is still
enabled and returns here without enabling CQ.

4. Now the RPMB request tries to put the controller in HALT state but
timesout since CQ is still not enabled.

Fix this issue by checking for host->card->cmdq_init to determine
if the controller is initialized in CQ mode instead of checking for
card's state in runtime suspend. This will ensure CQ will be disabled
as part of runtime suspend and will be enabled again during
runtime resume.

Change-Id: I26bf97962d31522a9cb25009c6a048dfff6e4535
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2015-09-17 02:25:42 -07:00
Ulf Hansson 107cd6cb6c mmc: core: Use mmc_flush_cache() during mmc suspend
Earlier we disabled the cache during suspend, which meant a flush was
internally at the eMMC performed as well.

To simplify code we can make use of the mmc_flush_cache(), during mmc
suspend, which makes the mmc_cache_ctrl() redundant so then we can
remove it.

Change-Id: I80c6cbf9ad3e81943aee4b844c267c8e4f360257
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
Git-commit: 1a6fd1533dfa409e48f377db1d92ef1cc6b0c4ce
Git-repo: https://android.googlesource.com/kernel/common.git
[kaushalk@codeaurora.org: Resolved context conflicts]
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2015-09-16 18:20:22 +05:30
Ulf Hansson 58dd0915dd mmc: core: Fixup Oops for SDIO shutdown
Commit "mmc: core: Handle card shutdown from mmc_bus" introduced an
Oops in the shutdown sequence for SDIO.

The drv pointer, does not exist for SDIO since the probing of the SDIO
card from the mmc_bus perspective is expected to fail by returning
-ENODEV.

This patch adds the proper check for the pointer before calling it.

Change-Id: I31b014f9c6600683e79738e161fcb946a1f4948b
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reported-by: Stephen Warren <swarren@wwwdotorg.org>
Reported-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Tested-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Git-commit: b807de244fa78d579fa7283b37fc21b3c13eddab
Git-repo: https://android.googlesource.com/kernel/common.git
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2015-09-16 18:20:22 +05:30
Ulf Hansson 07096fa0de mmc: core: Add DT-bindings for MMC_CAP2_FULL_PWR_CYCLE
The DT-binding for MMC_CAP2_FULL_PWR_CYCLE, is used to indicate whether
it is possible to perform a full power cycle of the card.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Git-commit: 823b9ed01bbcb01d5119f822142f8620cc897571
Git-repo: https://android.googlesource.com/kernel/common.git
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2015-09-16 18:20:21 +05:30
Ulf Hansson 97c8310d50 mmc: core: Invent MMC_CAP2_FULL_PWR_CYCLE
MMC_CAP2_FULL_PWR_CYCLE shall be set by host drivers which are able to
do a complete power cycle of the card. In the eMMC case that includes
both vcc and vccq.

This CAP is providing the protocol layer with important information,
needed to take optimized decisions during card initialization and in
the suspend/resume sequence.

MMC_CAP2_POWEROFF_NOTIFY is replaced by MMC_CAP2_FULL_PWR_CYCLE, since
it makes sense to use a wider scope for it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Git-commit: 211f8b40b27a83c8513bcade87188ab168aece90
Git-repo: https://android.googlesource.com/kernel/common.git
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2015-09-16 18:20:21 +05:30
Ulf Hansson 3a594af2bf mmc: core: Enable power_off_notify for eMMC shutdown sequence
In suspend mode it is important to save power. If the host is able to
cut buth vcc and vccq, the MMC_CAP2_POWEROFF_NOTIFY shall be set. It
will mean the card will be completely powered down at suspend and the
power off notification cmd will be sent prior power down.

It seems common not being able to cut both vcc and vccq for a host. In
this situation we issue the sleep cmd in favor of the power off
notification cmd, to save more power.

While maintainng the above policy, we also want to make use of the
power off notification in the shutdown sequence, even in the case were
the host has not set MMC_CAP2_POWEROFF_NOTIFY, since we know vcc and
vccq will regardless be cut.

We accomplish this by always enabling the power off notification byte
in the EXT_CSD and issue the power off notification when either
MMC_CAP2_POWEROFF_NOTIFY is set or we are executing a shutdown.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Git-commit: 020586d24e5dce45b0738d9340636c9f1688237f
Git-repo: https://android.googlesource.com/kernel/common.git
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2015-09-16 18:20:21 +05:30
Ulf Hansson 86b94fb2d0 mmc: core: Add shutdown callback for (e)MMC bus_ops
The shutdown sequence of an (e)MMC is very similar to a suspend. We
re-use the suspend function and tell it we are not in suspend context.

Change-Id: Id81922dce7227759f84c24e864d0c24c8aee0fb1
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Git-commit: eb91ee02bce94d96560b670508f64a86544f2ecc
Git-repo: https://android.googlesource.com/kernel/common.git
[kaushalk@codeaurora.org: Resolved context conflicts]
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2015-09-16 18:20:21 +05:30
Ulf Hansson 5a6809765b mmc: core: Handle both poweroff notification types for eMMC
Depending on the context of the operation while powering down the card,
either POWER_OFF_NOTIFY_SHORT or POWER_OFF_NOTIFY_LONG will be used. In
suspend context a short timeout is preferred while a long timeout would
be acceptable in a shutdown/hibernation context.

We add a new parameter to the mmc_suspend function so we can provide an
indication of what notification type to use.

Change-Id: I4a1db618d8b41dc7851e4cc95f801e3585b665e8
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Git-commit: bb09907fdbc4451448e9efb9009f0ef538e52861
Git-repo: https://android.googlesource.com/kernel/common.git
[kaushalk@codeaurora.org: Resolved context conflicts]
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2015-09-16 18:20:21 +05:30
Ulf Hansson 3ad5ee8261 mmc: core: Add shutdown callback for SD bus_ops
For the SD .shutdown callback we re-use the SD suspend function since
it performs the relevant actions.

Change-Id: Ibbc3dbdf9fa368c16d590ccdd7c62333c11ad50d
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Git-commit: 2a68a68a88ce0fac7b69792776355ff5bdd69962
Git-repo: https://android.googlesource.com/kernel/common.git
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2015-09-16 18:20:21 +05:30
Ulf Hansson de7b3fa044 mmc: core: Extend shutdown sequence to handle bus operations
By adding an optional .shutdown callback to the bus_ops struct we
provide the possibility to let each bus type handle it's shutdown
requirements.

Change-Id: Ie746b03c24f1e6b3b54aaefb09fa15cc10a731b3
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Git-commit: c53cd1c90652a7109da51238a92f8075f86902ec
Git-repo: https://android.googlesource.com/kernel/common.git
[kaushalk@codeaurora.org: Resolved context conflicts]
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2015-09-16 18:20:21 +05:30
Ulf Hansson 5df1d211b6 mmc: core: Handle card shutdown from mmc_bus
Considering shutdown of the card, the responsibility to initate this
sequence shall be driven from the mmc_bus.

This patch enables the mmc_bus to handle this sequence properly. A new
.shutdown callback is added in the mmc_driver struct which is used to
shutdown the blk device.

Change-Id: I2327f396b2cf01f30f31b46b025a1867ccf7d92a
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Git-commit: feaf40b94634f3ae497465b023c56fbda1d1877e
Git-repo: https://android.googlesource.com/kernel/common.git
[kaushalk@codeaurora.org: Resolved context conflicts]
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2015-09-16 18:20:20 +05:30
Asutosh Das 9384ee40b6 mmc: card: read the firmware version from ext_csd
Read the firmware version from ext_csd register and print it
for debugging purpose.

Change-Id: I4c1fefd5bff753915c9858fb35c958335986c778
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2015-08-31 21:47:25 -07:00
Asutosh Das ae2d23188b mmc: card: read the firmware version from ext_csd
Read the firmware version from ext_csd register and print it
for debugging purpose.

Change-Id: I4c1fefd5bff753915c9858fb35c958335986c778
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2015-08-30 22:39:59 -07:00
Linux Build Service Account cd86617027 Merge "mmc: sdhci: Notify sdhci-msm with mmc host PM state" 2015-08-18 17:07:05 -07:00
Ritesh Harjani f2ac898d2c mmc: host: Notify LLD with mmc dev PM status
This adds support in mmc host layer to notify LLD
with mmc suspend/resume state.
This information is needed by LLD for optimizing
suspend/resume latency.

Change-Id: Ib8d8f63b4b228079f0e7ef79164e243a55eb2559
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2015-08-18 07:47:56 -07:00
Sahitya Tummala 2b2081b089 mmc: core: Add support for DDR52 mode during eMMC clock scaling
Add support to use the DDR52 bus speed mode during eMMC clock
scaling, if the host supports it. This patch currently adds
support only for scaling up/down from HS400<->DDR52.

Change-Id: I21282c3dcef4605584ed7b1817165cc85b2de034
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2015-08-14 00:31:57 -07:00
Konstantin Dorfman 066e1095f9 mmc: core: fix system resume for cmdq
There is no action taken if the card is runtime suspended by the time
system suspend is triggered. During system resume, the card remains
runtime suspended and also no action taken.
However, when the card in system suspend was not runtime suspended and
the suspend sequence was executed as part of the system suspend
sequence, on system resume there is resume sequence to execute. For
command queueing mode, before suspending the card the CQE was halted,
therefore after resuming the card during system resume the CQE un-halt
must be executed.

This change executes CQE un-halt sequence only in case the card resume
sequence was done.

Change-Id: I41eaa9fe050bbba22cf4a9e118268579f08a1e3c
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
2015-07-31 13:43:06 +05:30
Konstantin Dorfman 1f22862005 mmc: block: fix dump cmdq registers on request timeout
Timeout handler executed on softirq context. cmdq dumpstate() api resumes
platform device and it can't be executed on softirq context. Request
completion callback schedules error handler work in case of timeout error.
This change moves CQE registers dump to the error handler callback.

Change-Id: Iea26ca5240f6031218dcf374cafcf2708df1f125
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
2015-07-31 13:43:05 +05:30
xiaonian c2c3c78710 mmc: core: set REL_WR_SEC_C register to 0x1 per eMMC 5.0 spec
Some eMMC vendors violate eMMC 5.0 spec and set REL_WR_SEC_C
register to 0x10 to indicate the ability of RPMB throughput
improvement thus lead to failure when TZ module write data to
RPMB partition. This change will check bit[4] of EXT_CSD[166]
and if it is not set then change value of  REL_WR_SEC_C to 0x1
directly ignoring value of EXT_CSD[222].

CRs-Fixed: 866059
Change-Id: Ibd12c94ad691eca1fa3ea2049b750a6e98178678
Signed-off-by: xiaonian <xiaonian@codeaurora.org>
2015-07-18 12:37:57 -07:00
Ritesh Harjani 0f9d90b9e0 mmc: core: Fix debugfs and IOCTL calls in cmdq mode
Currently getting status/ext_csd using debugfs or IOCTL
calls in cmdq mode is not working.
Fix it by halting the cmdq engine and making sure that
card queue is empty before issuing these cmds.

Change-Id: Idb89def9ff5c2fee6866759b9a8c652049552933
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2015-07-01 01:02:23 -07:00
xiaonian e49c44be42 mmc: core: detect removal of suspended SD card
When CONFIG_MMC_BLOCK_DEFERRED_RESUME was enabled,
if sleep and wake up the phone, then remove SD card,
the removal event will not be detected. This change
will ensure removal detection of SD card even if it
has not been resumed if the card is removed after
waking up the phone.

Change-Id: Ib99d1915b6fc150979c77dc3fbf6af79e5558db6
Signed-off-by: xiaonian <xiaonian@codeaurora.org>
2015-06-29 10:42:13 +08:00
Konstantin Dorfman 026fb6d834 mmc: core: ignore cmdq halt failure when no change is needed
During system suspend CQE halted by queue suspend even before mmc host
suspend. When mmc host suspend calls halt helper, CQE is already halted.

This change ignores error value of halt helper.

Change-Id: I2d1456333f1d04f0e7a77485443b80a0ccaa3b4e
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
2015-06-24 19:01:11 +03:00
Ritesh Harjani 8509fa81d0 mmc: core: Add clock hold and release pair for cmdq_ops
mmc_host_clk_hold/release pair should be added for relevant
cmdq_ops. Since it enables host->clock which is needed
for register access as well (apart from
MCLK).

Change-Id: I6d9d15a421225c5b4179cb19e467a17d01ad176f
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2015-06-22 20:01:50 +05:30
Sahitya Tummala f295d19cc9 mmc: core: Update PON based on the system state
As per eMMC specification, the PON (Power Off Notification)
must be sent by host to the card before turning off the power.
This will allow card to prepare itself for the power off and
may even reduce the initialization of eMMC upon next boot-up.

Send long PON during system power off and send short PON during
system reboot to reduce the reboot latency.

Change-Id: If4188b8b80aaa0e6c4e00e1807aa9589d5e7efdb
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2015-06-16 08:56:46 +05:30