Set cqe off during suspend flow
Subsystems (3)
cover Set cqe off during suspend flow
Wenbin Mei (3):
dt-bindings: mmc: Add optional cqe off properties
arm64: dts: mt8192: Add cqe off flag
mmc: core: Set cqe off during suspend flow
---
This patch depends on
[PATCH v7 3/4] arm64: dts: mt8192: add mmc device node
Please also accept this patch together with [1]
to avoid build and dt binding check error.
[1] https://patchwork.kernel.org/project/linux-mediatek/list/?series=364279
--- Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 7 +++++++ arch/arm64/boot/dts/mediatek/mt8192-evb.dts | 1 + drivers/mmc/core/host.c | 2 ++ drivers/mmc/core/mmc.c | 5 +++++ include/linux/mmc/pm.h | 1 + 5 files changed, 16 insertions(+)
--
2.18.0
PATCH 1/3 dt-bindings: mmc: Add optional cqe off properties
Add optional properties for cqe hosts which are used to set cqe off during suspend flow.
--- Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/mmc/mmc-controller.yaml +7 -0
@@ -164,6 +164,13 @@ properties: description: enable SDIO IRQ signalling on this interface + cqe-off-in-suspend: + $ref: /schemas/types.yaml#/definitions/flag + description: + After suspend, the mmc host is powered off by HW, and bring CQE register + to default state, so we add the flag to re-init CQE register after resume + back. + full-pwr-cycle: $ref: /schemas/types.yaml#/definitions/flag description:
Signature · 1 line
2.18.0
Rob Herring
maintainerRe: [PATCH v1 1/3] dt-bindings: mmc: Add optional cqe off properties
Quoted 13 lines · Wenbin Mei
Add optional properties for cqe hosts which are used to set cqe off during suspend flow.
Signed-off-by Wenbin Mei <[email protected]>--- Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/mmc/mmc-controller.yaml +0
-0
Documentation/devicetree/bindings/mmc/mmc-controller.yaml properties: · line 172
Quoted 9 lines
Documentation/devicetree/bindings/mmc/mmc-controller.yaml +6
-0@@ -164,6 +164,13 @@ properties: description: enable SDIO IRQ signalling on this interface + cqe-off-in-suspend: + $ref: /schemas/types.yaml#/definitions/flag + description: + After suspend, the mmc host is powered off by HW, and bring CQE register + to default state, so we add the flag to re-init CQE register after resume + back.
The driver change is before suspend, but this says on resume...
In any case, this should be implied by the SoC specific compatible.
Quoted 7 lines
Documentation/devicetree/bindings/mmc/mmc-controller.yaml +1
-0+ full-pwr-cycle: $ref: /schemas/types.yaml#/definitions/flag description:Signature · 1 line
2.18.0
Re: [PATCH v1 1/3] dt-bindings: mmc: Add optional cqe off properties
Quoted 26 lines · Rob Herring
Quoted 13 lines · Wenbin Mei
Add optional properties for cqe hosts which are used to set cqe off during suspend flow.
Signed-off-by Wenbin Mei <[email protected]>--- Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/mmc/mmc-controller.yaml +0
-0Documentation/devicetree/bindings/mmc/mmc-controller.yaml properties: · line 172
Quoted 9 lines
Documentation/devicetree/bindings/mmc/mmc-controller.yaml +6
-0@@ -164,6 +164,13 @@ properties: description: enable SDIO IRQ signalling on this interface + cqe-off-in-suspend: + $ref: /schemas/types.yaml#/definitions/flag + description: + After suspend, the mmc host is powered off by HW, and bring CQE register + to default state, so we add the flag to re-init CQE register after resume + back.The driver change is before suspend, but this says on resume...
Quoted 2 lines
In any case, this should be implied by the SoC specific compatible.
Thanks for your reply, I will drop this patchset, and resend another patchset for this issue.
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/mmc/mmc-controller.yaml +1
-0+ full-pwr-cycle: $ref: /schemas/types.yaml#/definitions/flag description:Signature · 1 line
2.18.0
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 2/3 arm64: dts: mt8192: Add cqe off flag
In reply to Wenbin MeiAdd cqe off flag for MT8192 mmc nodes.
--- arch/arm64/boot/dts/mediatek/mt8192-evb.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/mediatek/mt8192-evb.dts +1 -0
@@ -41,6 +41,7 @@ mmc-hs400-1_8v; supports-cqe; cap-mmc-hw-reset; + cqe-off-in-suspend; no-sdio; no-sd; hs400-ds-delay = <0x12814>;
Signature · 1 line
2.18.0
PATCH 3/3 mmc: core: Set cqe off during suspend flow
In reply to Wenbin MeiBefore 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.
--- drivers/mmc/core/host.c | 2 ++ drivers/mmc/core/mmc.c | 5 +++++ include/linux/mmc/pm.h | 1 + 3 files changed, 8 insertions(+)
drivers/mmc/core/host.c +2 -0
@@ -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" ))
drivers/mmc/core/mmc.c +5 -0
@@ -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); }
include/linux/mmc/pm.h +1 -0
@@ -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 */
Signature · 1 line
2.18.0