History

mmc: renesas_sdhi: really fix WP logic regressions

This reverts commit e060d376cc61 ("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 2ad1db059b9a ("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).

Wolfram Sang committed 8 years ago

Commit ef5332c1 parent 77252da3 files · +9 −0Browse files

Unified · Split

3 files
  1. drivers/mmc/host/renesas_sdhi_core.c +5 −0
  2. drivers/mmc/host/renesas_sdhi_internal_dmac.c +1 −0
  3. drivers/mmc/host/renesas_sdhi_sys_dmac.c +3 −0
drivers/mmc/host/renesas_sdhi_core.c+5−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/of_device.h>
2929 #include <linux/platform_device.h>
3030 #include <linux/mmc/host.h>
31+#include <linux/mmc/slot-gpio.h>
3132 #include <linux/mfd/tmio.h>
3233 #include <linux/sh_dma.h>
3334 #include <linux/delay.h>
@@ -534,6 +535,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, · 500 unmodified lines
534535 host->multi_io_quirk = renesas_sdhi_multi_io_quirk;
535536 host->dma_ops = dma_ops;
536537
538+ /* For some SoC, we disable internal WP. GPIO may override this */
539+ if (mmc_can_gpio_ro(host->mmc))
540+ mmc_data->capabilities2 &= ~MMC_CAP2_NO_WRITE_PROTECT;
541+
537542 /* SDR speeds are only available on Gen2+ */
538543 if (mmc_data->flags & TMIO_MMC_MIN_RCAR2) {
539544 /* card_busy caused issues on r8a73a4 (pre-Gen2) CD-less SDHI */
drivers/mmc/host/renesas_sdhi_internal_dmac.c+1−0
@@ -87,6 +87,7 @@ static const struct renesas_sdhi_of_data of_rcar_gen3_compatible = { · 86 unmodified lines
8787 TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,
8888 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
8989 MMC_CAP_CMD23,
90+ .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT,
9091 .bus_shift = 2,
9192 .scc_offset = 0x1000,
9293 .taps = rcar_gen3_scc_taps,
drivers/mmc/host/renesas_sdhi_sys_dmac.c+3−0
@@ -42,6 +42,7 @@ static const struct renesas_sdhi_of_data of_rz_compatible = { · 41 unmodified lines
4242 static const struct renesas_sdhi_of_data of_rcar_gen1_compatible = {
4343 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_CLK_ACTUAL,
4444 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
45+ .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT,
4546 };
4647
4748 /* Definitions for sampling clocks */
@@ -61,6 +62,7 @@ static const struct renesas_sdhi_of_data of_rcar_gen2_compatible = { · 13 unmodified lines
6162 TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,
6263 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
6364 MMC_CAP_CMD23,
65+ .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT,
6466 .dma_buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES,
6567 .dma_rx_offset = 0x2000,
6668 .scc_offset = 0x0300,
@@ -81,6 +83,7 @@ static const struct renesas_sdhi_of_data of_rcar_gen3_compatible = { · 14 unmodified lines
8183 TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,
8284 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
8385 MMC_CAP_CMD23,
86+ .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT,
8487 .bus_shift = 2,
8588 .scc_offset = 0x1000,
8689 .taps = rcar_gen3_scc_taps,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t