Commit graph

5059 commits

Author SHA1 Message Date
Linux Build Service Account
abe0d1ce01 Merge "mmc: core: Fix deadlock in suspend & rescan path" 2017-02-21 05:33:14 -08:00
Linux Build Service Account
82ab22b4ae Merge "mmc: sdhci-msm: Dont wait infinitely for pwr_irq interrupt" 2017-02-21 05:33:13 -08:00
Veerabhadrarao Badiganti
43464aa84e mmc: cmdq_hci: Enable legacy interrupts immediately after halt
Enable the legacy interrupts immediately after halt interrupt is
handled, from cmdq_irq() itself.

When cmdq halt is initiated, as per existing logic driver waits either
for halt interrupt to fire or for certain period of time.  In case if
cmdq is halted but halt interrupt got delayed than wait-timeout period,
driver disables cmdq interrupts since cmdq is in halt state.
The delayed halt interrupt gets fired only when cmdq is unhalted next
time and cmdq interrupts are enabled. And this delayed interrupt is
treated as an unexpected interrupt.

By enabling legacy interrupts (i.e., disabling cmdq interrupts) from
cmdq_irq(), we can ensure that we don't disable cmdq interrupts until
halt interrupt get fired. So we can avoid above mentioned scenario.

Change-Id: Ic052d41fac789b6390a5d80dfaee91767bdb783f
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-02-21 17:20:14 +05:30
Veerabhadrarao Badiganti
23a7da0be7 mmc: cmdq_hci: Increase HAC interrupt wait time in halt path
When system is heavily loaded, in some cases interrupt servicing
is getting effected and cmdq halt interrupt handler is getting invoked
after 1 sec delay. Since wait time of HAC interrupt in cmdq driver
is 1 sec, the delayed interrupt is being treated as unexpected
interrupt.
For fixing this case, increasing the timeout to 10 seconds.

Change-Id: I55879095aa2b81a10f40963aee02b2068a3305b4
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-02-21 17:18:48 +05:30
Sayali Lokhande
23fc79cd39 mmc: cmdq_hci: CQ Register changes for sdm660
For SDHC version 5.0 onwards, ICE3.0 specific
registers are added in CQ register space, due to
which few CQ registers(like CQ_VENDOR_GFG,
CQ_CMD_DBG_RAM) are shifted. This change is to
update CQ register offset for sdm660.

Change-Id: Ie85b8f6c68511dccd2b545bd9cc17c747f3da8e7
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2017-02-21 13:46:54 +05:30
Siba Prasad
3b2628faf3 mmc: card: block: check the user controlled parameters to avoid overflow
According to specs, some commands require a delay after
issuing the command. idata->ic struct is received from
user in mmc_blk_ioctl_cmd(). So idata->ic.postsleep_min_us,
idata->ic.postsleep_max_us are user controlled. If the min
and max values are set such as max < min, then operation in
the function do_usleep_range will overflow. For avoiding this,
put a condition for checking max < min. If the condition is
true, then print the error message with respective values and
return error.

Change-Id: I76828b58aa46fc4e195da4ae0babb02a7abf6bbe
Signed-off-by: Siba Prasad <sibap@codeaurora.org>
2017-02-15 12:40:01 +05:30
Alex Shi
106bdd9b95 Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android 2017-02-10 12:01:01 +08:00
Linux Build Service Account
70135dc083 Merge "mmc: block: Fix issue with deferred resume when CQ is enabled" 2017-02-09 13:16:03 -08:00
Dmitry Shmidt
5edfa05a10 This is the 4.4.48 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAlicFCgACgkQONu9yGCS
 aT4TLg//QVqQvdkxyy0lKQfOxmo4RSErmpFstgkvuVgucGh6Akvh8OV9hHJKabjK
 RUn3BNASoWfQF+G1vn7EQWcTGDgJhF/P39DvMu3zvpRbSYMMeX7og9iDnoNn2WtG
 l89l+5YfQG7Y8eJWj1mnTW2ul9pUxJFg4j2rjmcLhfgKPvJPCn+cpU2XKUxpj7gM
 yd/nbVuQlMFW6qfEES1W1RbDEOQ1KWJgdupsMEgodRxb/dlg8KldBQFmv1fGcrA6
 5jFqWzsQQ7AyfMWIRDBm9mJlHuvdoGCEGkyTbsZoSyuN72/cyfPSfTZPInpi09bb
 l0sod1nzcZsuQVJzaQHTKlvpMEduIDQVxy2/pNW/pKnGAS++fkK+uJCsu0mz+6+8
 zntaPdVoboiwwoK5dgP27vgWpYpw2QoCpPqWno7NIVNZfUcWWng3NS49goN+ytvY
 m1i1ih4KU1bMqMrT0qZugQwHHqaE9IJ8xyDMdXc86cMH1ylTo8ZnOOyGxRKKLOW1
 nVs4aQT2i7E9yQ8TjVJplLxtU3t/Q3D1qqPr5U70XJyEgT5X4/V0mXJaRRWXAzXP
 2IBJOLznqwbwuIHV8ocp7i76qtpVqbJkpMx2NhB0tFP0XjffqpZvv0v8aBTAdBS2
 060nyG8fZad6L++tWVODt7nd7gkD4NN/I8BqD0XzXx6zbOJexqA=
 =GUZe
 -----END PGP SIGNATURE-----

Merge tag 'v4.4.48' into android-4.4.y

This is the 4.4.48 stable release
2017-02-09 10:59:15 -08:00
Linux Build Service Account
3b74b552e9 Merge "mmc: sdhci-msm: Provide module/cmdline parameter for disabling cmdq" 2017-02-09 03:11:09 -08:00
Gabriel Krisman Bertazi
3a8e217851 mmc: sdhci: Ignore unexpected CARD_INT interrupts
commit 161e6d44a5e2d3f85365cb717d60e363171b39e6 upstream.

One of our kernelCI boxes hanged at boot because a faulty eSDHC device
was triggering spurious CARD_INT interrupts for SD cards, causing CMD52
reads, which are not allowed for SD devices.  This adds a sanity check
to the interruption path, preventing that illegal command from getting
sent if the CARD_INT interruption should be disabled.

This quirk allows that particular machine to resume boot despite the
faulty hardware, instead of getting hung dealing with thousands of
mishandled interrupts.

Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Acked-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>
2017-02-09 08:02:46 +01:00
Alex Shi
5bee6fb934 Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android 2017-02-04 12:11:17 +08:00
Ritesh Harjani
6794d0e2d0 mmc: core: Fix deadlock in suspend & rescan path
Due to deferred resume enabled ->
		|
	in system suspend
		|
	dpm_prepare
		|
	mmc_pm_notify with PREPARE_SUSPEND
	 This will return from here and will not wait
	for mmc_rescan to complete.

Because of above system has deadlocked in which =>
mmc_rescan after acquiring device's mutex_lock, has
scheduled a work on WQ_FREEZABLE(bdi_wq) which will not run
since system freeze state has already completed.
This will only complete once tasks are unfreezed
which means only after system resume is completed.

And system suspend, is unpreparing the devices from dpm_prepared_list.
During which this process is trying to acquire card->device's mutex lock
which is held by above process. Thus a deadlock.

Change-Id: I926bb3783e62892ce842e5d4da44a3c24c8f244d
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2017-02-02 01:25:00 -08:00
Ritesh Harjani
fd967eb3e0 mmc: sdhci-msm: Dont wait infinitely for pwr_irq interrupt
Currently there is one rare case where suspend thread trying
to suspend sdhci-msm waits infinitely for pwr_irq interrupt
from hardware which never gets raised and thus watchdog barks
happens.

Change this waiting to wait_for_completion_timeout.

Change-Id: Ic4e9bca91b5496409b4afe2be2892c83aa390e95
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2017-02-02 01:24:36 -08:00
Veerabhadrarao Badiganti
5f133c6433 mmc: sdhci-msm-ice: Changes for supporting ICE HCI in non CMDQ mode
SDHC v5.0 onwards, SDHC includes the inline interface for
cryptographic operations which is ICE HCI.

This patch includes the driver changes for supporting crypto
operations with ICE HCI in noncq mode.

Change-Id: I3253b796212f63853cb3f6cf130f0a8542595428
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-02-02 06:56:59 +05:30
Veerabhadrarao Badiganti
a60300ce47 mmc: sdhci-msm-ice: Add new sdhci host_op for updating ice config
Add new sdhci host_op for updating ice configuration while sending
request through cmdq. Adding provision for supporting the ice
context configuration for ICE HCI.

Change-Id: I0e7299cfb1064c117aa94fb2416cc5cc4f1ec5f6
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-02-02 06:56:58 +05:30
Veerabhadrarao Badiganti
2df488a185 mmc: cmdq_hci: ice: Changes for supporting ICE HCI in CMDQ mode
On SDHC v5.0 onwards, SDHC includes the inline interface
for cryptographic operations which is ICE HCI.

This patch includes the driver changes for supporting crypto
operations with ICE HCI in cmdq mode.

Change-Id: I618a0a4b7356f2f19c31d67fca1664daa51b09f9
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-02-02 06:56:58 +05:30
Veerabhadrarao Badiganti
0a8547207f mmc: sdhci-mmc-ice: Factor out ice_cfg_start from sdhci_msm_ice_cfg
Factor out the logic of getting ice config parameters from
sdhci_msm_ice_cfg().

With ICE2.0, same sdhci_msm_ice_cfg function is being called from cmdq
and noncq. But with ICE3.0 support, cmdq needs a separate host op.
Since this logic of getting ice config is common for noncq and cmdq,
by having it in separate function, same can be reused
in cmdq host op as-well.

Change-Id: If2cf26667acd54cb7ee7bd6283d8f24fcbf60791
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-02-02 06:54:03 +05:30
Veerabhadrarao Badiganti
bd4fadcb01 mmc: sdhci-msm-ice: Factor out update config from sdhci_msm_ice_cfg
Factor out the logic of updating the SDHC ICE config registers
from sdhci_msm_ice_cfg().

For ICE3.0, different set of SDHC ICE registers are need to be updated.
So having this logic in separate functions, we can have logical
separation for ICE2.0 and ICE3.0.

Change-Id: Ib3d3f9701875000985dc9382bdcdf5fb0e872a43
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-02-02 06:35:34 +05:30
Linux Build Service Account
f8478b9862 Merge "mmc: sdhci-msm: Update ICE reset register offset for ICE HCI" 2017-01-31 14:01:08 -08:00
Linux Build Service Account
d8dbdec2b2 Merge "mmc: sdhci-msm-ice: Enable ICE HCI if supported" 2017-01-31 14:01:08 -08:00
Veerabhadrarao Badiganti
8265e5eb2f mmc: sdhci-msm: Update ICE reset register offset for ICE HCI
SDHC v5.0 onwards the ICE reset register offset got updated.
Update the register offset based on the SDHC version.

Change-Id: I9c1250460cddf72837446b54fe03e3c52f11b234
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-01-31 20:51:19 +05:30
Veerabhadrarao Badiganti
92907bcb94 mmc: sdhci-msm-ice: Enable ICE HCI if supported
Check if the SDHC has ICE HCI support. If support is present,
enable the cryptoghrapic support inside SDHC.

Also ensure that it is re-enabled after SDHC is reset.
By default ICE HCI is disabled.

Change-Id: I43a65279088d70b415c396bc3e51e0e510bb7f9c
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-01-31 20:50:00 +05:30
Sayali Lokhande
283e8d1b93 mmc: sdhci-msm: Disable controller clocks in suspend
Generally, during card suspend we call mmc_power_off
and disable controller clocks.
Now consider below sequence of events :
suspend -> resume -> suspend.
1) During first platform suspend, mmc_power_off will
be called and clocks would be disabled.
2) As a part of platform resume, we enable controller
clocks and defer card resume when
MMC_BUSRESUME_NEEDS_RESUME flag is set.
3) During next suspend we check if card is already
suspended (i.e MMC_BUSRESUME_NEEDS_RESUME is set)
and return without doing actual suspend (where we
call mmc_power_off and disable controller clocks).

So in this scenario, controller clocks will remain ON
even though card state is SUSPENDED.

Fix this by disabling controller clocks during suspend
if controller clock was ON.

CRs-Fixed: 1088893
Change-Id: Id54a15d7f6a7131dab609eec1db158c64ada83ce
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2017-01-30 22:03:09 -08:00
Linux Build Service Account
c6eacb9bdb Merge "mmc: card: use blk_cleanup_queue() during shutdown/reboot" 2017-01-28 00:46:51 -08:00
Dmitry Shmidt
e9a82a4cbe This is the 4.4.45 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAliJpBoACgkQONu9yGCS
 aT54KRAAm2BjHOgU3FlM/mTal6ZVNIPKS/Xy9W0YXdQ+9URDKWNb0fwuqWAsf7LP
 n6ozLIB2n8FNlMWro7VHVNXKiUtw3BSRcjNamMm61XQcR1g0xY4iW6uhtpoTblAG
 PdeK3WAUfROxJEAxciFSTqfPKgSDQeaQRDSG10KTP5qIAPQM0T0/VU+20K0w7Cbf
 UZEJaGDOZS0XIRvNOak2DvQQxeXzwfvY5JTdx/MBOHw6e1MPfndeuhRFDJrIeOZC
 hKaG1ipkMQANcftHWTmJQ0gZEZMgVokqDtyQO3hqyrqLgVChM24j6mD7KvguCfPQ
 +ixC5oDQzBMQnp2uienP6FbDg1BZjHxO2R8z0vscXk++QtB3Mjxk8LBKZqeA636k
 E1fuGCrRf6Ec/0d7loMqOOO4KCUxOu+0JuhmlvmQDtrtGvQa5Qqd5WEF8ecOm6Y+
 5yKI11P5yiFANEkz4ysfTlyEltvIxp4Psu0YBrnVM6x5vNYEnr9wuGdikL21FI6F
 kS2FRB9+u2H4n2qNz7PGMt0tPub/F34W7RvD/zII4wqRrFz3wtw3UufAGgiT6X2n
 EIye5DErGfDcpHJ13kKYd7kCXl1u1y8tsBISRqYxl1sqshIZis0ktsb3ZtE5NMXF
 Qbh72lvpUU78E452ER1XDmk6keb98zUWbOtlBfbqJZ4iVpQ4GGY=
 =lShl
 -----END PGP SIGNATURE-----

Merge tag 'v4.4.45' into android-4.4.y

This is the 4.4.45 stable release
2017-01-26 13:42:20 -08:00
Stefan Wahren
8f6f508f70 mmc: mxs-mmc: Fix additional cycles after transmission stop
commit 01167c7b9cbf099c69fe411a228e4e9c7104e123 upstream.

According to the code the intention is to append 8 SCK cycles
instead of 4 at end of a MMC_STOP_TRANSMISSION command. But this
will never happened because it's an AC command not an ADTC command.
So fix this by moving the statement into the right function.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: e4243f13d1 (mmc: mxs-mmc: add mmc host driver for i.MX23/28)
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-26 08:23:48 +01:00
Ritesh Harjani
f5f7ed7afd mmc: sdhci-msm: Provide module/cmdline parameter for disabling cmdq
This provides module/cmdline parameter for disabling cmdq.
This may be required sometimes for testing cmdq v/s non-cmdq
mode for performance or other stability testing.
Pass cmdline parameter as (sdhci-msm.nocmdq=1) for disabling
cmdq via cmdline.

Change-Id: Ic0993a58d79f9c9b92daa7a581a5bce9ea24ed03
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
2017-01-24 20:21:25 -08:00
Linux Build Service Account
b24a83ae61 Merge "mmc: core: Add sysfs entry to print ring buffer" 2017-01-20 13:48:26 -08:00
Linux Build Service Account
c51bfb9f3d Merge "mmc: cmdq_hci: Add tracing events for CQ mode." 2017-01-20 13:48:25 -08:00
Linux Build Service Account
f6e430bf1b Merge "mmc: core: Add mmc tracing events in suspend and resume" 2017-01-20 13:48:25 -08:00
Linux Build Service Account
f0cd2ed1ad Merge "mmc: sdhci: Add mmc tracing events for legacy mode." 2017-01-20 13:48:24 -08:00
Linux Build Service Account
7280bd073e Merge "mmc: host: Add Ring buffer logging for MMC." 2017-01-20 13:48:24 -08:00
Linux Build Service Account
a3a6fc8dc6 Merge "mmc: sdhci-msm-ice: Update ice config vop to config_start" 2017-01-19 19:10:30 -08:00
Veerabhadrarao Badiganti
78d5bbde21 mmc: sdhci-msm-ice: Update ice config vop to config_start
The config vop of the ice driver has been updated to config_start.
Updated the sdhci-ice driver to reflect this change.

Change-Id: I7c44cc5011c6a7c88b9acf9cb9d8e61ef3f8e33a
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-01-19 16:57:30 +05:30
Linux Build Service Account
7fdc634254 Merge "ARM: config: Enable DEFERRED RESUME flag on SDM660" 2017-01-18 23:48:54 -08:00
Veerabhadrarao Badiganti
14093fed20 ARM: config: Enable DEFERRED RESUME flag on SDM660
Enabling deferred resume feature on SDM660. With this feature
enabled, MMC devices won't be resumed as part of the system
resume. It will be resumed only when there's a request to be
processed.

Change-Id: I901a888269b8bc0de006c8174546fd5f5c30baa8
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
2017-01-18 13:24:19 +05:30
Dmitry Shmidt
f103e3b0d8 This is the 4.4.43 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAlh7bhIACgkQONu9yGCS
 aT5KKRAAw7baMz//gshbaXZuZZHJjqB+rBekdnzgBMBo4P2OJwiuFi7N27dRxiaO
 6uFAB5BUlFoc16AExAnmQJIiWB8lWeAt8S20RBLaiGGQ0iPTr4W7bsVH4Tk3zEaF
 gjCt3Tv8kzbno64lWk02xDilkxFO09y3ZtiMVkleUDpI1DRm5iAF11j+C42OG1Ox
 U1QPsjCoWJyZ9Ta7SEyoQsuJcU32Wl0IW1VAroqfYAJJF5yLOxGoJQfWsiyvwEjQ
 VQg+Yd2LlJkHjuOp4lSAaYjNrCjvV91KwcwOocyI2iw69vyyCQpbKeg50wA1+jBO
 2+b0WKTIYSA6EruAivIj0646UqnzzpUGf9DfeH2NIApO7PvTGWaIWk5uvheOf3Vz
 yVviVGYdedtMXixdzHVXgRVZQThlhLe2D5bvYB0bFInDrY8LlMZJVwjrbJuVQaUy
 u0eguKvOIXSsUwtDOLCEKKh7bH1605JXVm0yUAYRmTPbRjs8LQHu0kPpS70L5tYI
 MaftvgPFyLev88cDns+VjnJxm1cOHrSRyLigM4ArCrZdNs8EKPScFeV3bKcR2Gwi
 u05MdpwagOMSFqKdPFhiGYjjcpAeieeAOkmMro9C1KvIRhVt83cAlbP6L9R0PYSK
 n/wfpvrcbDKl0vcAPVscw1iM590WbRPGGrqlDGv+ak4cjsCb8ro=
 =kCbR
 -----END PGP SIGNATURE-----

Merge tag 'v4.4.43' into android-4.4.y

This is the 4.4.43 stable release
2017-01-17 12:44:14 -08:00
Vijay Viswanath
6d15d790dc MMC : host: clear interrupt after halt in case of error
During error scenario, if interrupt status of CQ controller is cleared
before halting the controller, the CQ controller can send commands to
card in the time delay between clearing of interrupt and halting. The
response of card to these commands can overwrite the error information
stored in Response Arg register. So, if an error is detected, the CQ
must be halted first and then the interrupt must be cleared.

Change-Id: Ief7039226b01b50fc71cf17a4eb625afd8c9bd06
Signed-off-by: Vijay Viswanath <vviswana@codeaurora.org>
2017-01-17 01:37:34 -08:00
Alex Shi
e30546378e Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android 2017-01-13 12:01:52 +08:00
Dan Carpenter
85baf9416b mmc: mmc_test: Uninitialized return value
commit 16652a936e96f5dae53c3fbd38a570497baadaa8 upstream.

We never set "ret" to RESULT_OK.

Fixes: 9f9c4180f8 ("mmc: mmc_test: add test for non-blocking transfers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-12 11:22:49 +01:00
Ritesh Harjani
b93aab4d22 mmc: mmc: Don't send CMD13 after switch command while switching speed modes
Do not send CMD13 after sending switch command for HS, HS_DDR,
HS200 and HS400 modes. It seems that below problem can occur -
1. After sending switch CMD6, card will switch to mentioned bus speed
mode.
2. At this moment the controller will be in different bus speed mode,
unless the timing of the controller is switched to match with that of
card.

During this time, if CMD13 follows CMD6 to switch the bus speed
mode in card. Then it may cause timeouts or other errors because
of mismatch in timing of controller and card.

Thus send CMD13 to see the status once both controller and card are
switched to same timings.

Change-Id: If796c8cfce2cbdc1bce460460e3276886ae1be0c
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2017-01-11 12:20:08 +05:30
Sayali Lokhande
36bde09c50 mmc: core: Add sysfs entry to print ring buffer
Add sysfs entry to print MMC ring buffer events.
usage: cat /sys/kernel/debug/mmc0/ring_buffer

Change-Id: I1fb6b0f65a11cd574e56df9937a96acd74a84341
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2017-01-11 09:44:20 +05:30
Sayali Lokhande
c9891681ac mmc: cmdq_hci: Add tracing events for CQ mode.
Add ring buffer tracing events in CQ for
debugging purpose. Tracing events includes
cpu, timestamp, CQ metadata per tag(task
descripter, tag, CQIS ,halt-unhalt,
enable-disable).

Example:
<6> 1211721243963: cmdq_request : tag: 0
<6> 1211721856723: cmdq_irq: mmc0: CQIS: 0x2 err: 0
<6> 1211721863286: cmdq_irq: mmc0: completing tag -> 0
<6> 1211722496046: cmdq_prep_dcmd_desc: mmc0: DCMD:
Task: 0x0163402f | Args: 0x015f2538
<6> 1211722505994: cmdq_request : tag: 31
<6> 1211722538025: cmdq_irq: mmc0: CQIS: 0x2 err: 0
<6> 1211722544588: cmdq_irq: mmc0: completing tag -> 31

Change-Id: I7642bfc33513fa6b09da03220fd4dd12f47bbac5
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2017-01-11 09:43:05 +05:30
Sayali Lokhande
94112c0a58 mmc: core: Add mmc tracing events in suspend and resume
Add mmc tracing events in suspend and resume.

Change-Id: I5ca1c3f667003c4b4224b65d2a5db50766b44d75
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2017-01-11 09:41:07 +05:30
Sayali Lokhande
fc9fbe345b mmc: sdhci: Add mmc tracing events for legacy mode.
Add ring buffer tracing events in legacy mode for
debug purpose.
Tracing events include cpu, timestamp, legacy command
opcode, argument, response, interrupts.

Example:
<5> 171912889412: sdhci_prepare_data: mmc0: 0x28=0x0000003c
0x3E=0x00000000
<5> 171912901235: sdhci_set_transfer_mode: mmc0: 0x00=0x00000000
<5> 171912908579: sdhci_send_command: mmc0: updated
0x8=0x00000000 0xC=0x00000013 0xE=0x0000083a
<5> 171912920922: sdhci_irq: mmc0: resp 0: 0x00000900
resp 1: 0x00000000 resp 2: 0x00000000 resp 3: 0x00000000
<5> 171912931339: sdhci_irq: mmc0: intmask: 0x1
<5> 171912938839: sdhci_irq: mmc0: intmask: 0x2
<5> 171912945766: sdhci_finish_data: mmc0: 0x24=0x01f80000

Change-Id: I26d2de3ddf72a74dd84199a9772d48da128796f4
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2017-01-11 09:35:48 +05:30
Sayali Lokhande
b88a7af704 mmc: host: Add Ring buffer logging for MMC.
Add ring buffer to enable tracing of significant events
of eMMC in both CQ and Legacy mode for debug purpose.

CONFIG_MMC_RING_BUFFER should be enabled to use ring
buffer logging.

Change-Id: Iceb404d77fca19e133c319bc66ec15b2d77c7c54
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
2017-01-11 09:30:55 +05:30
Alex Shi
7785301d92 Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android 2017-01-10 12:01:14 +08:00
Adrian Hunter
842ec27cd3 mmc: sdhci: Fix recovery from tuning timeout
commit 61e53bd0047d58caee0c7170613045bf96de4458 upstream.

Clearing the tuning bits should reset the tuning circuit. However there is
more to do. Reset the command and data lines for good measure, and then
for eMMC ensure the card is not still trying to process a tuning command by
sending a stop command.

Note the JEDEC eMMC specification says the stop command (CMD12) can be used
to stop a tuning command (CMD21) whereas the SD specification is silent on
the subject with respect to the SD tuning command (CMD19). Considering that
CMD12 is not a valid SDIO command, the stop command is sent only when the
tuning command is CMD21 i.e. for eMMC. That addresses cases seen so far
which have been on eMMC.

Note that this replaces the commit fe5fb2e3b58f ("mmc: sdhci: Reset cmd and
data circuits after tuning failure") which is being reverted for v4.9+.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Dan O'Donovan <dan@emutex.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-09 08:07:43 +01:00
Sahitya Tummala
4923b2f8d6 mmc: card: use blk_cleanup_queue() during shutdown/reboot
It is preferred to use blk_cleanup_queue() instead of
blk_stop_queue() during reboot/shutdown due to these reasons -

1. blk_cleanup_queue() marks the queue as dying/dead which prevents
the new requests from getting inserted into the queue after MMC
driver shutdown.

If we just use blk_stop_queue(), the requests are still allowed into the
request_queue but are not dispatched to the low level MMC driver as the
queue is marked as stopped. This may result into deadlock/hang issue during
shutdown, if FS (as part of emergency remount) is waiting for the queued
request to be completed without relinquishing the CPU. If some CPU bound
workqueues related to shutdown are pending on that CPU, then shutdown
may hang.

2. blk_cleanup_queue() also drains the queue completely by processing
all the pending requests from the elevator queue even though those are
not yet dispatched to request_queue and also waits for the completion
of all those requests.

Also, do not override the queue_lock in request_queue structure with
md->lock as this will cause below problem when using blk_cleanup_queue() in
shutdown. This happens because blk_cleanup_queue() changes queue_lock
from driver md->lock to it's original request_queue lock.

Callstack:
<6> BUG: spinlock already unlocked on CPU#6, iozone/4391
<6> lock: 0xffffffc06ab8be80, .magic: dead4ead,
.owner: <none>/-1, .owner_cpu: -1
[ffffffc0420e3b28] __delay at ffffffc00031a328
[ffffffc0420e3b38] __const_udelay at ffffffc00031a304
[ffffffc0420e3b58] msm_trigger_wdog_bite at ffffffc0004476cc
[ffffffc0420e3b68] spin_bug at ffffffc0000e4554
[ffffffc0420e3b98] do_raw_spin_unlock at ffffffc0000e47a0
[ffffffc0420e3bc8] _raw_spin_unlock_irq at ffffffc000db3ee0
[ffffffc0420e3be8] blk_queue_bio at ffffffc0002ff1e4
[ffffffc0420e3bf8] generic_make_request at ffffffc0002fd210
[ffffffc0420e3c58] submit_bio at ffffffc0002fd328
[ffffffc0420e3ca8] submit_bio_wait at ffffffc0002f5768
[ffffffc0420e3d00] compat_sys_call_table at ffffffc00008e000
[ffffffc0420e3d18] submit_bio_wait at ffffffc0002f574c
[ffffffc0420e3d38] __blkdev_issue_flush at ffffffc00030043c
[ffffffc0420e3da8] blkdev_issue_flush at ffffffc000300494
[ffffffc0420e3dd8] ext4_sync_fs at ffffffc0002597a4

Change-Id: Iaa26944ccc6c279390215869f5003156400840ed
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2017-01-06 12:55:20 +05:30