All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wenbin Mei <wenbin.mei@mediatek.com>
To: Ulf Hansson <ulf.hansson@linaro.org>, Rob Herring <robh+dt@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	<irq-linux@rere.qmqm.pl>, Wenbin Mei <wenbin.mei@mediatek.com>,
	Veerabhadrarao Badiganti <vbadigan@codeaurora.org>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Baolin Wang <baolin.wang@linaro.org>,
	Ludovic Barre <ludovic.barre@st.com>,
	Krishna Konda <kkonda@codeaurora.org>,
	Bradley Bolen <bradleybolen@gmail.com>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	<linux-mmc@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<srv_heupstream@mediatek.com>
Subject: [PATCH v1 3/3] mmc: core: Set cqe off during suspend flow
Date: Thu, 12 Nov 2020 15:52:08 +0800	[thread overview]
Message-ID: <20201112075208.28183-4-wenbin.mei@mediatek.com> (raw)
In-Reply-To: <20201112075208.28183-1-wenbin.mei@mediatek.com>

Before we got these errors on MT8192 platform:
[   59.153891] Restarting tasks ...
[   59.154540] done.
[   59.159175] PM: suspend exit
[   59.218724] mtk-msdc 11f60000.mmc: phase: [map:fffffffe] [maxlen:31]
[final:16]
[  119.776083] mmc0: cqhci: timeout for tag 9
[  119.780196] mmc0: cqhci: ============ CQHCI REGISTER DUMP ===========
[  119.786709] mmc0: cqhci: Caps:      0x100020b6 | Version:  0x00000510
[  119.793225] mmc0: cqhci: Config:    0x00000101 | Control:  0x00000000
[  119.799706] mmc0: cqhci: Int stat:  0x00000000 | Int enab: 0x00000000
[  119.806177] mmc0: cqhci: Int sig:   0x00000000 | Int Coal: 0x00000000
[  119.812670] mmc0: cqhci: TDL base:  0x00000000 | TDL up32: 0x00000000
[  119.819149] mmc0: cqhci: Doorbell:  0x003ffc00 | TCN:      0x00000200
[  119.825656] mmc0: cqhci: Dev queue: 0x00000000 | Dev Pend: 0x00000000
[  119.832155] mmc0: cqhci: Task clr:  0x00000000 | SSC1:     0x00001000
[  119.838627] mmc0: cqhci: SSC2:      0x00000000 | DCMD rsp: 0x00000000
[  119.845174] mmc0: cqhci: RED mask:  0xfdf9a080 | TERRI:    0x0000891c
[  119.851654] mmc0: cqhci: Resp idx:  0x00000000 | Resp arg: 0x00000000
[  119.865773] mmc0: cqhci: : ===========================================
[  119.872358] mmc0: running CQE recovery
From these logs, we found TDL base was back to the default value.

After suspend, the mmc host is powered off by HW, and bring CQE register
to the default value, so CQE need to be re-initialized after resuming back.

Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com>
---
 drivers/mmc/core/host.c | 2 ++
 drivers/mmc/core/mmc.c  | 5 +++++
 include/linux/mmc/pm.h  | 1 +
 3 files changed, 8 insertions(+)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index ce43f7573d80..c98486c8fb3b 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -284,6 +284,8 @@ int mmc_of_parse(struct mmc_host *host)
 	if (device_property_read_bool(dev, "wakeup-source") ||
 	    device_property_read_bool(dev, "enable-sdio-wakeup")) /* legacy */
 		host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
+	if (device_property_read_bool(dev, "cqe-off-in-suspend"))
+		host->pm_caps |= MMC_PM_CQE_OFF_IN_SUSPEND;
 	if (device_property_read_bool(dev, "mmc-ddr-3_3v"))
 		host->caps |= MMC_CAP_3_3V_DDR;
 	if (device_property_read_bool(dev, "mmc-ddr-1_8v"))
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index b3fa193de846..f5ae1f13a867 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -2047,6 +2047,11 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
 		err = mmc_deselect_cards(host);
 
 	if (!err) {
+		if (host->cqe_enabled &&
+		    (host->pm_caps & MMC_PM_CQE_OFF_IN_SUSPEND)) {
+			host->cqe_ops->cqe_disable(host);
+			host->cqe_enabled = false;
+		}
 		mmc_power_off(host);
 		mmc_card_set_suspended(host->card);
 	}
diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h
index 3549f8045784..3dd1046f2c8f 100644
--- a/include/linux/mmc/pm.h
+++ b/include/linux/mmc/pm.h
@@ -23,5 +23,6 @@ typedef unsigned int mmc_pm_flag_t;
 
 #define MMC_PM_KEEP_POWER	(1 << 0)	/* preserve card power during suspend */
 #define MMC_PM_WAKE_SDIO_IRQ	(1 << 1)	/* wake up host system on SDIO IRQ assertion */
+#define MMC_PM_CQE_OFF_IN_SUSPEND  (1 << 2)	/* cqe off during suspend */
 
 #endif /* LINUX_MMC_PM_H */
-- 
2.18.0


WARNING: multiple messages have this Message-ID (diff)
From: Wenbin Mei <wenbin.mei@mediatek.com>
To: Ulf Hansson <ulf.hansson@linaro.org>, Rob Herring <robh+dt@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	Bradley Bolen <bradleybolen@gmail.com>,
	Wenbin Mei <wenbin.mei@mediatek.com>,
	Baolin Wang <baolin.wang@linaro.org>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	irq-linux@rere.qmqm.pl, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org, srv_heupstream@mediatek.com,
	linux-mediatek@lists.infradead.org,
	Ludovic Barre <ludovic.barre@st.com>,
	Krishna Konda <kkonda@codeaurora.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
Subject: [PATCH v1 3/3] mmc: core: Set cqe off during suspend flow
Date: Thu, 12 Nov 2020 15:52:08 +0800	[thread overview]
Message-ID: <20201112075208.28183-4-wenbin.mei@mediatek.com> (raw)
In-Reply-To: <20201112075208.28183-1-wenbin.mei@mediatek.com>

Before we got these errors on MT8192 platform:
[   59.153891] Restarting tasks ...
[   59.154540] done.
[   59.159175] PM: suspend exit
[   59.218724] mtk-msdc 11f60000.mmc: phase: [map:fffffffe] [maxlen:31]
[final:16]
[  119.776083] mmc0: cqhci: timeout for tag 9
[  119.780196] mmc0: cqhci: ============ CQHCI REGISTER DUMP ===========
[  119.786709] mmc0: cqhci: Caps:      0x100020b6 | Version:  0x00000510
[  119.793225] mmc0: cqhci: Config:    0x00000101 | Control:  0x00000000
[  119.799706] mmc0: cqhci: Int stat:  0x00000000 | Int enab: 0x00000000
[  119.806177] mmc0: cqhci: Int sig:   0x00000000 | Int Coal: 0x00000000
[  119.812670] mmc0: cqhci: TDL base:  0x00000000 | TDL up32: 0x00000000
[  119.819149] mmc0: cqhci: Doorbell:  0x003ffc00 | TCN:      0x00000200
[  119.825656] mmc0: cqhci: Dev queue: 0x00000000 | Dev Pend: 0x00000000
[  119.832155] mmc0: cqhci: Task clr:  0x00000000 | SSC1:     0x00001000
[  119.838627] mmc0: cqhci: SSC2:      0x00000000 | DCMD rsp: 0x00000000
[  119.845174] mmc0: cqhci: RED mask:  0xfdf9a080 | TERRI:    0x0000891c
[  119.851654] mmc0: cqhci: Resp idx:  0x00000000 | Resp arg: 0x00000000
[  119.865773] mmc0: cqhci: : ===========================================
[  119.872358] mmc0: running CQE recovery
From these logs, we found TDL base was back to the default value.

After suspend, the mmc host is powered off by HW, and bring CQE register
to the default value, so CQE need to be re-initialized after resuming back.

Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com>
---
 drivers/mmc/core/host.c | 2 ++
 drivers/mmc/core/mmc.c  | 5 +++++
 include/linux/mmc/pm.h  | 1 +
 3 files changed, 8 insertions(+)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index ce43f7573d80..c98486c8fb3b 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -284,6 +284,8 @@ int mmc_of_parse(struct mmc_host *host)
 	if (device_property_read_bool(dev, "wakeup-source") ||
 	    device_property_read_bool(dev, "enable-sdio-wakeup")) /* legacy */
 		host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
+	if (device_property_read_bool(dev, "cqe-off-in-suspend"))
+		host->pm_caps |= MMC_PM_CQE_OFF_IN_SUSPEND;
 	if (device_property_read_bool(dev, "mmc-ddr-3_3v"))
 		host->caps |= MMC_CAP_3_3V_DDR;
 	if (device_property_read_bool(dev, "mmc-ddr-1_8v"))
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index b3fa193de846..f5ae1f13a867 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -2047,6 +2047,11 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
 		err = mmc_deselect_cards(host);
 
 	if (!err) {
+		if (host->cqe_enabled &&
+		    (host->pm_caps & MMC_PM_CQE_OFF_IN_SUSPEND)) {
+			host->cqe_ops->cqe_disable(host);
+			host->cqe_enabled = false;
+		}
 		mmc_power_off(host);
 		mmc_card_set_suspended(host->card);
 	}
diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h
index 3549f8045784..3dd1046f2c8f 100644
--- a/include/linux/mmc/pm.h
+++ b/include/linux/mmc/pm.h
@@ -23,5 +23,6 @@ typedef unsigned int mmc_pm_flag_t;
 
 #define MMC_PM_KEEP_POWER	(1 << 0)	/* preserve card power during suspend */
 #define MMC_PM_WAKE_SDIO_IRQ	(1 << 1)	/* wake up host system on SDIO IRQ assertion */
+#define MMC_PM_CQE_OFF_IN_SUSPEND  (1 << 2)	/* cqe off during suspend */
 
 #endif /* LINUX_MMC_PM_H */
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Wenbin Mei <wenbin.mei@mediatek.com>
To: Ulf Hansson <ulf.hansson@linaro.org>, Rob Herring <robh+dt@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	Bradley Bolen <bradleybolen@gmail.com>,
	Wenbin Mei <wenbin.mei@mediatek.com>,
	Baolin Wang <baolin.wang@linaro.org>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	irq-linux@rere.qmqm.pl, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org, srv_heupstream@mediatek.com,
	linux-mediatek@lists.infradead.org,
	Ludovic Barre <ludovic.barre@st.com>,
	Krishna Konda <kkonda@codeaurora.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
Subject: [PATCH v1 3/3] mmc: core: Set cqe off during suspend flow
Date: Thu, 12 Nov 2020 15:52:08 +0800	[thread overview]
Message-ID: <20201112075208.28183-4-wenbin.mei@mediatek.com> (raw)
In-Reply-To: <20201112075208.28183-1-wenbin.mei@mediatek.com>

Before we got these errors on MT8192 platform:
[   59.153891] Restarting tasks ...
[   59.154540] done.
[   59.159175] PM: suspend exit
[   59.218724] mtk-msdc 11f60000.mmc: phase: [map:fffffffe] [maxlen:31]
[final:16]
[  119.776083] mmc0: cqhci: timeout for tag 9
[  119.780196] mmc0: cqhci: ============ CQHCI REGISTER DUMP ===========
[  119.786709] mmc0: cqhci: Caps:      0x100020b6 | Version:  0x00000510
[  119.793225] mmc0: cqhci: Config:    0x00000101 | Control:  0x00000000
[  119.799706] mmc0: cqhci: Int stat:  0x00000000 | Int enab: 0x00000000
[  119.806177] mmc0: cqhci: Int sig:   0x00000000 | Int Coal: 0x00000000
[  119.812670] mmc0: cqhci: TDL base:  0x00000000 | TDL up32: 0x00000000
[  119.819149] mmc0: cqhci: Doorbell:  0x003ffc00 | TCN:      0x00000200
[  119.825656] mmc0: cqhci: Dev queue: 0x00000000 | Dev Pend: 0x00000000
[  119.832155] mmc0: cqhci: Task clr:  0x00000000 | SSC1:     0x00001000
[  119.838627] mmc0: cqhci: SSC2:      0x00000000 | DCMD rsp: 0x00000000
[  119.845174] mmc0: cqhci: RED mask:  0xfdf9a080 | TERRI:    0x0000891c
[  119.851654] mmc0: cqhci: Resp idx:  0x00000000 | Resp arg: 0x00000000
[  119.865773] mmc0: cqhci: : ===========================================
[  119.872358] mmc0: running CQE recovery
From these logs, we found TDL base was back to the default value.

After suspend, the mmc host is powered off by HW, and bring CQE register
to the default value, so CQE need to be re-initialized after resuming back.

Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com>
---
 drivers/mmc/core/host.c | 2 ++
 drivers/mmc/core/mmc.c  | 5 +++++
 include/linux/mmc/pm.h  | 1 +
 3 files changed, 8 insertions(+)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index ce43f7573d80..c98486c8fb3b 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -284,6 +284,8 @@ int mmc_of_parse(struct mmc_host *host)
 	if (device_property_read_bool(dev, "wakeup-source") ||
 	    device_property_read_bool(dev, "enable-sdio-wakeup")) /* legacy */
 		host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
+	if (device_property_read_bool(dev, "cqe-off-in-suspend"))
+		host->pm_caps |= MMC_PM_CQE_OFF_IN_SUSPEND;
 	if (device_property_read_bool(dev, "mmc-ddr-3_3v"))
 		host->caps |= MMC_CAP_3_3V_DDR;
 	if (device_property_read_bool(dev, "mmc-ddr-1_8v"))
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index b3fa193de846..f5ae1f13a867 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -2047,6 +2047,11 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
 		err = mmc_deselect_cards(host);
 
 	if (!err) {
+		if (host->cqe_enabled &&
+		    (host->pm_caps & MMC_PM_CQE_OFF_IN_SUSPEND)) {
+			host->cqe_ops->cqe_disable(host);
+			host->cqe_enabled = false;
+		}
 		mmc_power_off(host);
 		mmc_card_set_suspended(host->card);
 	}
diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h
index 3549f8045784..3dd1046f2c8f 100644
--- a/include/linux/mmc/pm.h
+++ b/include/linux/mmc/pm.h
@@ -23,5 +23,6 @@ typedef unsigned int mmc_pm_flag_t;
 
 #define MMC_PM_KEEP_POWER	(1 << 0)	/* preserve card power during suspend */
 #define MMC_PM_WAKE_SDIO_IRQ	(1 << 1)	/* wake up host system on SDIO IRQ assertion */
+#define MMC_PM_CQE_OFF_IN_SUSPEND  (1 << 2)	/* cqe off during suspend */
 
 #endif /* LINUX_MMC_PM_H */
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-11-12  7:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12  7:52 [PATCH v1 0/3] Set cqe off during suspend flow Wenbin Mei
2020-11-12  7:52 ` Wenbin Mei
2020-11-12  7:52 ` Wenbin Mei
2020-11-12  7:52 ` [PATCH v1 1/3] dt-bindings: mmc: Add optional cqe off properties Wenbin Mei
2020-11-12  7:52   ` Wenbin Mei
2020-11-12  7:52   ` Wenbin Mei
2020-11-16 19:28   ` Rob Herring
2020-11-16 19:28     ` Rob Herring
2020-11-16 19:28     ` Rob Herring
2020-11-18  3:26     ` Wenbin Mei
2020-11-18  3:26       ` Wenbin Mei
2020-11-18  3:26       ` Wenbin Mei
2020-11-12  7:52 ` [PATCH v1 2/3] arm64: dts: mt8192: Add cqe off flag Wenbin Mei
2020-11-12  7:52   ` Wenbin Mei
2020-11-12  7:52   ` Wenbin Mei
2020-11-12  7:52 ` Wenbin Mei [this message]
2020-11-12  7:52   ` [PATCH v1 3/3] mmc: core: Set cqe off during suspend flow Wenbin Mei
2020-11-12  7:52   ` Wenbin Mei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112075208.28183-4-wenbin.mei@mediatek.com \
    --to=wenbin.mei@mediatek.com \
    --cc=baolin.wang@linaro.org \
    --cc=bradleybolen@gmail.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=irq-linux@rere.qmqm.pl \
    --cc=kkonda@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ludovic.barre@st.com \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=srv_heupstream@mediatek.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vbadigan@codeaurora.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.