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
28#include <linux/of_device.h>28#include <linux/of_device.h>
29#include <linux/platform_device.h>29#include <linux/platform_device.h>
30#include <linux/mmc/host.h>30#include <linux/mmc/host.h>
31#include <linux/mmc/slot-gpio.h>
31#include <linux/mfd/tmio.h>32#include <linux/mfd/tmio.h>
32#include <linux/sh_dma.h>33#include <linux/sh_dma.h>
33#include <linux/delay.h>34#include <linux/delay.h>
@@ -534,6 +535,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, · 500 unmodified lines
534 host->multi_io_quirk = renesas_sdhi_multi_io_quirk;535 host->multi_io_quirk = renesas_sdhi_multi_io_quirk;
535 host->dma_ops = dma_ops;536 host->dma_ops = dma_ops;
536 537
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
537 /* SDR speeds are only available on Gen2+ */542 /* SDR speeds are only available on Gen2+ */
538 if (mmc_data->flags & TMIO_MMC_MIN_RCAR2) {543 if (mmc_data->flags & TMIO_MMC_MIN_RCAR2) {
539 /* card_busy caused issues on r8a73a4 (pre-Gen2) CD-less SDHI */544 /* 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
87 TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,87 TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,
88 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |88 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
89 MMC_CAP_CMD23,89 MMC_CAP_CMD23,
90 .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT,
90 .bus_shift = 2,91 .bus_shift = 2,
91 .scc_offset = 0x1000,92 .scc_offset = 0x1000,
92 .taps = rcar_gen3_scc_taps,93 .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
42static const struct renesas_sdhi_of_data of_rcar_gen1_compatible = {42static const struct renesas_sdhi_of_data of_rcar_gen1_compatible = {
43 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_CLK_ACTUAL,43 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_CLK_ACTUAL,
44 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,44 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
45 .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT,
45};46};
46 47
47/* Definitions for sampling clocks */48/* Definitions for sampling clocks */
@@ -61,6 +62,7 @@ static const struct renesas_sdhi_of_data of_rcar_gen2_compatible = { · 13 unmodified lines
61 TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,62 TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,
62 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |63 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
63 MMC_CAP_CMD23,64 MMC_CAP_CMD23,
65 .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT,
64 .dma_buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES,66 .dma_buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES,
65 .dma_rx_offset = 0x2000,67 .dma_rx_offset = 0x2000,
66 .scc_offset = 0x0300,68 .scc_offset = 0x0300,
@@ -81,6 +83,7 @@ static const struct renesas_sdhi_of_data of_rcar_gen3_compatible = { · 14 unmodified lines
81 TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,83 TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,
82 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |84 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
83 MMC_CAP_CMD23,85 MMC_CAP_CMD23,
86 .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT,
84 .bus_shift = 2,87 .bus_shift = 2,
85 .scc_offset = 0x1000,88 .scc_offset = 0x1000,
86 .taps = rcar_gen3_scc_taps,89 .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