linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] [-next] mmc: host: msm: Add optional full power cycle property.
@ 2020-08-14 15:21 Konrad Dybcio
  2020-08-14 15:22 ` [PATCH 2/2] [-next] arm64: dts: qcom: kitakami: Enable qcom,full-pwr-cycle on SDHCI1 Konrad Dybcio
  2020-08-14 22:14 ` [PATCH 1/2] [-next] mmc: host: msm: Add optional full power cycle property Konrad Dybcio
  0 siblings, 2 replies; 3+ messages in thread
From: Konrad Dybcio @ 2020-08-14 15:21 UTC (permalink / raw)
  To: ~postmarketos/upstreaming
  Cc: Konrad Dybcio, Ulf Hansson, Rob Herring, Andy Gross,
	Bjorn Andersson, Adrian Hunter, linux-mmc, devicetree,
	linux-kernel, linux-arm-msm

On some eMMCs (at least the ones used on Sony msm8994 boards)
enabling full power cycle is required to prevent permanent damage
to the flash memory, whereas on others it results in better performance.

Signed-off-by: Konrad Dybcio <konradybcio@gmail.com>
---
 Documentation/devicetree/bindings/mmc/sdhci-msm.txt | 4 ++++
 drivers/mmc/host/sdhci-msm.c                        | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/sdhci-msm.txt b/Documentation/devicetree/bindings/mmc/sdhci-msm.txt
index 3b602fd6180b..939c8df2a25c 100644
--- a/Documentation/devicetree/bindings/mmc/sdhci-msm.txt
+++ b/Documentation/devicetree/bindings/mmc/sdhci-msm.txt
@@ -54,6 +54,10 @@ Required properties:
 - qcom,dll-config: Chipset and Platform specific value. Use this field to
 	specify the DLL_CONFIG register value as per Hardware Programming Guide.
 
+- qcom,full-pwr-cycle: Enable full power cycle CAP2. This is required for optimal
+	performance on some eMMCs, whereas others need it to prevent permanent
+	damage to the flash memory.
+
 Optional Properties:
 * Following bus parameters are required for interconnect bandwidth scaling:
 - interconnects: Pairs of phandles and interconnect provider specifier
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 5a33389037cd..8d5c65e13dca 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -2242,6 +2242,12 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 
 	msm_host->saved_tuning_phase = INVALID_TUNING_PHASE;
 
+	if (of_find_property(pdev->dev.of_node, "qcom,full-pwr-cycle", NULL))
+		msm_host->mmc->caps2 |= MMC_CAP2_FULL_PWR_CYCLE;
+
+	else
+		dev_info(&pdev->dev, "MMC full power cycle is not enabled. This might result in subpar performance or permanent damage on some devices.\n");
+
 	/* Setup SDCC bus voter clock. */
 	msm_host->bus_clk = devm_clk_get(&pdev->dev, "bus");
 	if (!IS_ERR(msm_host->bus_clk)) {
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] [-next] arm64: dts: qcom: kitakami: Enable qcom,full-pwr-cycle on SDHCI1
  2020-08-14 15:21 [PATCH 1/2] [-next] mmc: host: msm: Add optional full power cycle property Konrad Dybcio
@ 2020-08-14 15:22 ` Konrad Dybcio
  2020-08-14 22:14 ` [PATCH 1/2] [-next] mmc: host: msm: Add optional full power cycle property Konrad Dybcio
  1 sibling, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2020-08-14 15:22 UTC (permalink / raw)
  To: ~postmarketos/upstreaming
  Cc: Konrad Dybcio, Ulf Hansson, Rob Herring, Andy Gross,
	Bjorn Andersson, Adrian Hunter, linux-mmc, devicetree,
	linux-kernel, linux-arm-msm

This is required to prevent permanent eMMC damage.

Signed-off-by: Konrad Dybcio <konradybcio@gmail.com>
---
 arch/arm64/boot/dts/qcom/msm8994-sony-xperia-kitakami.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8994-sony-xperia-kitakami.dtsi b/arch/arm64/boot/dts/qcom/msm8994-sony-xperia-kitakami.dtsi
index 30cb3aa7d734..eb806d1e4454 100644
--- a/arch/arm64/boot/dts/qcom/msm8994-sony-xperia-kitakami.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8994-sony-xperia-kitakami.dtsi
@@ -439,6 +439,8 @@ &sdhc1 {
 	 * vmmc-supply = <&pm8994_l20>;
 	 * vqmmc-supply = <&pm8994_s4>;
 	 */
+
+	qcom,full-pwr-cycle;
 };
 
 &sdhc2 {
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] [-next] mmc: host: msm: Add optional full power cycle property.
  2020-08-14 15:21 [PATCH 1/2] [-next] mmc: host: msm: Add optional full power cycle property Konrad Dybcio
  2020-08-14 15:22 ` [PATCH 2/2] [-next] arm64: dts: qcom: kitakami: Enable qcom,full-pwr-cycle on SDHCI1 Konrad Dybcio
@ 2020-08-14 22:14 ` Konrad Dybcio
  1 sibling, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2020-08-14 22:14 UTC (permalink / raw)
  Cc: Ulf Hansson, Rob Herring, Andy Gross, Bjorn Andersson,
	Adrian Hunter, linux-mmc, DTML, Linux Kernel Mailing List,
	linux-arm-msm

As I mentioned in the next email, please ignore this patch. The whole
idea is incorrect and does not solve the problem.

Konrad

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-14 22:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-14 15:21 [PATCH 1/2] [-next] mmc: host: msm: Add optional full power cycle property Konrad Dybcio
2020-08-14 15:22 ` [PATCH 2/2] [-next] arm64: dts: qcom: kitakami: Enable qcom,full-pwr-cycle on SDHCI1 Konrad Dybcio
2020-08-14 22:14 ` [PATCH 1/2] [-next] mmc: host: msm: Add optional full power cycle property Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).