]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: renesas_sdhi: really fix WP logic regressions
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Fri, 1 Jun 2018 11:00:37 +0000 (13:00 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 4 Jun 2018 09:16:58 +0000 (11:16 +0200)
commit2cbdf26433eebe53117bffb75d688066e6a7e6a2
tree454be2b7b20be91cdf6a330da99a8e5cd7432336
parente01dd6bc56bf138471c90e56e268e7d4a26adbb5
mmc: renesas_sdhi: really fix WP logic regressions

This reverts commit 25d22ac9ce29 ("mmc: renesas_sdhi: fix WP detection")
and adds some code to really fix the regressions.

It was missed so far that Renesas R-Car instantiations of SDHI chose to
disable internal WP and used the existence of "wp-gpios" to en/disable
WP at all.

With the first refactoring by Yamada-san with commit 7235978326e6 ("mmc:
renesas_sdhi: use MMC_CAP2_NO_WRITE_PROTECT instead of TMIO own flag"),
WP was always disabled even when GPIOs were present. With Wolfram's
first fix which gets now reverted, GPIOs were honored. But when not
available, the fallback was to internal WP and not to disabled WP. This
caused wrong WP status on uSD card slots.

Restore the old behaviour now. By default, WP is disabled. When a GPIO
is found, the GPIO re-enables WP. We will think about possible better
ways to handle this in the future.

Tested on a previously regressing Renesas Lager board (H2) and a still
working Renesas Salvator-X board (M3-W).

Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: stable@vger.kernel.org # v4.17+
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/renesas_sdhi_core.c
drivers/mmc/host/renesas_sdhi_internal_dmac.c
drivers/mmc/host/renesas_sdhi_sys_dmac.c