Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: tmio: use MMC_CAP2_NO_WRITE_PROTECT instead of TMIO own flag

TMIO_MMC_WRPROTECT_DISABLE is equivalent to MMC_CAP2_NO_WRITE_PROTECT.

Only the difference is the TMIO_... makes tmio_mmc_get_ro() return 0
(i.e. it does not affect mmc_gpio_get_ro() at all), while MMC_CAP2_...
returns 0 before calling ->get_ro() hook (i.e. it affects both IP own
logic and GPIO detection).

The TMIO MMC drivers do not set-up gpio_ro by themselves. Only the
possibility, if any, would be DT specifies "wp-gpios" property, and
gpio_ro is set by mmc_gpiod_request_ro() called from mmc_of_parse().
However, it does not make sense to specify "wp-gpios" property and
"toshiba,mmc-wrprotect-disable" at the same time.

I checked under arch/arm/boot/dts/ and arch/arm64/boot/dts/renesas/,
and I did not see any Renesas boards with "wp-gpios". So, this
conversion should be safe.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

authored by

Masahiro Yamada and committed by
Ulf Hansson
7c53b797 3ca1507b

+3 -3
+3 -3
drivers/mmc/host/tmio_mmc_core.c
··· 1114 1114 } 1115 1115 1116 1116 static void tmio_mmc_of_parse(struct platform_device *pdev, 1117 - struct tmio_mmc_data *pdata) 1117 + struct mmc_host *mmc) 1118 1118 { 1119 1119 const struct device_node *np = pdev->dev.of_node; 1120 1120 ··· 1122 1122 return; 1123 1123 1124 1124 if (of_get_property(np, "toshiba,mmc-wrprotect-disable", NULL)) 1125 - pdata->flags |= TMIO_MMC_WRPROTECT_DISABLE; 1125 + mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; 1126 1126 } 1127 1127 1128 1128 struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev, ··· 1157 1157 goto free; 1158 1158 } 1159 1159 1160 - tmio_mmc_of_parse(pdev, pdata); 1160 + tmio_mmc_of_parse(pdev, mmc); 1161 1161 1162 1162 platform_set_drvdata(pdev, host); 1163 1163