OSDN Git Service

mmc: sd: limit SD card power limit according to cards capabilities
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 2 Jan 2016 10:06:29 +0000 (10:06 +0000)
committerGerrit - the friendly Code Review server <code-review@localhost>
Mon, 12 Mar 2018 05:41:45 +0000 (22:41 -0700)
commit99593ab0218e19bff6280d882f2c8f241d3e3fd8
treeb3f5d42b6a2ac1c2dea9811db16df65b1643a25d
parent2c333d317ca7b59e37d3ed2e46374069397a99a8
mmc: sd: limit SD card power limit according to cards capabilities

The SD card specification allows cards to error out a SWITCH command
where the requested function in a group is not supported.  The spec
provides for a set of capabilities which indicate which functions are
supported.

In the case of the power limit, requesting an unsupported power level
via the SWITCH command fails, resulting in the power level remaining at
the power-on default of 0.72W, even though the host and card may support
higher powers levels.

This has been seen with SanDisk 8GB cards, which support the default
0.72W and 1.44W (200mA and 400mA) in combination with an iMX6 host,
supporting up to 2.88W (800mA).  This currently causes us to try to set
a power limit function value of '3' (2.88W) which the card errors out
on, and thereby causes the power level to remain at 0.72W rather than
the desired 1.44W.

Arrange to limit the selected current limit by the capabilities reported
by the card to avoid the SWITCH command failing.  Select the highest
current limit that the host and card combination support.

Change-Id: I7fbd035cdc606946e997fa4671ec5683acd3ed1b
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Fixes: a39ca6ae0a08 ("mmc: core: Simplify and fix
for SD switch processing")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Git-commit: d9812780a020bcec44565b5950b2a8b31afb5545
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Pradeep P V K <ppvk@codeaurora.org>
drivers/mmc/core/sd.c