Skip to contentSkip to conversation

mmc: sdhci-msm: Set ice clk rate

PATCH In review Ram Prakash Gupta 4 participants 10 messages May 29 – Jun 18

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover mmc: sdhci-msm: Set ice clk rate

Add support to configure the ICE clock to the maximum supported frequency to address the review comments from the below ICE upsteaming discussion:
https://lore.kernel.org/all/[email protected]/

And also to address performance degradation of ~50%-70%.
https://lore.kernel.org/all/[email protected]/

Below is the link for the ICE upstreaming where ice clock is being configured to max frequency:
https://lore.kernel.org/all/20251121-enable-ufs-ice-clock-scaling-v2-3-66cb72998041@oss.qualcomm.com/

Ram Prakash Gupta (1):
mmc: sdhci-msm: Set ice clk rate

 drivers/mmc/host/sdhci-msm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 mmc: sdhci-msm: Set ice clk rate

Set ice clk rate from sdhci msm platform driver, needed for target which are having legacy ice support, and need sdhci msm platform driver to set rate.

---
 drivers/mmc/host/sdhci-msm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/mmc/host/sdhci-msm.c +12 -0
index b4131b12df56..c6a073718aa4 100644
@@ -286,6 +286,7 @@ struct sdhci_msm_host {
 	/* core, iface, cal and sleep clocks */
 	struct clk_bulk_data bulk_clks[4];
 #ifdef CONFIG_MMC_CRYPTO
+	struct clk *ice_clk;	/* ICE clock */
 	struct qcom_ice *ice;
 #endif
 	unsigned long clk_rate;
@@ -2708,6 +2709,17 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 			return ret;
 	}
 
+#ifdef CONFIG_MMC_CRYPTO
+	/* Setup ICE clock */
+	msm_host->ice_clk = devm_clk_get(&pdev->dev, "ice");
+	if (!IS_ERR(msm_host->ice_clk)) {
+		/* Vote for max. clk rate for max. performance */
+		ret = clk_set_rate(msm_host->ice_clk, INT_MAX);
+		if (ret)
+			dev_err(&pdev->dev, "ice clk set rate failed (%d)\n", ret);
+	}
+#endif
+
 	/* Setup main peripheral bus clock */
 	clk = devm_clk_get(&pdev->dev, "iface");
 	if (IS_ERR(clk)) {
Signature · 1 line
2.34.1
#2 lore raw
Quoted 23 lines · Ram Prakash Gupta

Set ice clk rate from sdhci msm platform driver, needed for target which are having legacy ice support, and need sdhci msm platform driver to set rate.

---
 drivers/mmc/host/sdhci-msm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/mmc/host/sdhci-msm.c +1 -0
index b4131b12df56..c6a073718aa4 100644
@@ -286,6 +286,7 @@ struct sdhci_msm_host {
 	/* core, iface, cal and sleep clocks */
 	struct clk_bulk_data bulk_clks[4];
 #ifdef CONFIG_MMC_CRYPTO
+	struct clk *ice_clk;	/* ICE clock */
 	struct qcom_ice *ice;
 #endif
 	unsigned long clk_rate;
@@ -2708,6 +2709,17 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 			return ret;

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2719

Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +8 -0
 	}
 
+#ifdef CONFIG_MMC_CRYPTO
+	/* Setup ICE clock */
+	msm_host->ice_clk = devm_clk_get(&pdev->dev, "ice");
+	if (!IS_ERR(msm_host->ice_clk)) {
+		/* Vote for max. clk rate for max. performance */
+		ret = clk_set_rate(msm_host->ice_clk, INT_MAX);
+		if (ret)
+			dev_err(&pdev->dev, "ice clk set rate failed (%d)\n", ret);

If we keep dev_err(), the failure path should probably go to bus_clk_disable. However, since boosting the core clock to max is kept optional,
I think dev_warn() is more appropriate here and avoids making this a fatal error.

Abhinaba Rakshit

#3 lore raw
Quoted 39 lines · Abhinaba Rakshit
Quoted 23 lines · Ram Prakash Gupta

Set ice clk rate from sdhci msm platform driver, needed for target which are having legacy ice support, and need sdhci msm platform driver to set rate.

---
 drivers/mmc/host/sdhci-msm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/mmc/host/sdhci-msm.c +1 -0
index b4131b12df56..c6a073718aa4 100644
@@ -286,6 +286,7 @@ struct sdhci_msm_host {
 	/* core, iface, cal and sleep clocks */
 	struct clk_bulk_data bulk_clks[4];
 #ifdef CONFIG_MMC_CRYPTO
+	struct clk *ice_clk;	/* ICE clock */
 	struct qcom_ice *ice;
 #endif
 	unsigned long clk_rate;
@@ -2708,6 +2709,17 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 			return ret;

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2719

Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +8 -0
 	}
 
+#ifdef CONFIG_MMC_CRYPTO
+	/* Setup ICE clock */
+	msm_host->ice_clk = devm_clk_get(&pdev->dev, "ice");
+	if (!IS_ERR(msm_host->ice_clk)) {
+		/* Vote for max. clk rate for max. performance */
+		ret = clk_set_rate(msm_host->ice_clk, INT_MAX);
+		if (ret)
+			dev_err(&pdev->dev, "ice clk set rate failed (%d)\n", ret);

If we keep dev_err(), the failure path should probably go to bus_clk_disable. However, since boosting the core clock to max is kept optional,
I think dev_warn() is more appropriate here and avoids making this a fatal error.

Quoted 1 line

Abhinaba Rakshit

Here its only setting rate of clk, so no clean up is needed, hence logging is sufficient here, but I agree dev_warn should suffice instead of dev_err. I will update this to dev_warn.

Thanks,
Ram

maintainer
#4 lore raw
In reply to Ram Prakash Gupta
Quoted 3 lines · Ram Prakash Gupta

Set ice clk rate from sdhci msm platform driver, needed for target which are having legacy ice support, and need sdhci msm platform driver to set rate.

Please expand upon what "legacy" means here?

For CQ case, qcom_ice_create() prefers "ice_core_clk" before "ice". How does that relate to this? Please clarify that in the commit message also.

Quoted 11 lines
---
 drivers/mmc/host/sdhci-msm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/mmc/host/sdhci-msm.c +0 -0
index b4131b12df56..c6a073718aa4 100644

drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 289

Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +1 -0
@@ -286,6 +286,7 @@ struct sdhci_msm_host {
 	/* core, iface, cal and sleep clocks */
 	struct clk_bulk_data bulk_clks[4];
 #ifdef CONFIG_MMC_CRYPTO
+	struct clk *ice_clk;	/* ICE clock */

Why keep ice_clk?

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2715

Quoted 11 lines
drivers/mmc/host/sdhci-msm.c +4 -0
 	struct qcom_ice *ice;
 #endif
 	unsigned long clk_rate;
@@ -2708,6 +2709,17 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 			return ret;
 	}
 
+#ifdef CONFIG_MMC_CRYPTO
+	/* Setup ICE clock */
+	msm_host->ice_clk = devm_clk_get(&pdev->dev, "ice");
+	if (!IS_ERR(msm_host->ice_clk)) {

Does not attempt to deal with -EPROBE_DEFER, although bus_clk above doesn't either.

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2721

Quoted 6 lines
drivers/mmc/host/sdhci-msm.c +6 -0
+		/* Vote for max. clk rate for max. performance */
+		ret = clk_set_rate(msm_host->ice_clk, INT_MAX);
+		if (ret)
+			dev_err(&pdev->dev, "ice clk set rate failed (%d)\n", ret);
+	}
+#endif

Could put this in a helper+stub function in the "Inline Crypto Engine (ICE) support" section, to save having #ifdef CONFIG_MMC_CRYPTO here

Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +1 -0
+
 	/* Setup main peripheral bus clock */
 	clk = devm_clk_get(&pdev->dev, "iface");
 	if (IS_ERR(clk)) {
#5 lore raw
Quoted 7 lines · Adrian Hunter
Quoted 3 lines · Ram Prakash Gupta

Set ice clk rate from sdhci msm platform driver, needed for target which are having legacy ice support, and need sdhci msm platform driver to set rate.

Please expand upon what "legacy" means here?

for devices where ice node is not created as separate device node those are referred here as legacy, separate device node for ice starts with below change: https://lore.kernel.org/all/[email protected]/

also I will update legacy that ice nodes which are created withing mmc dt node, so that ambiguity about legacy is clear.

Quoted 4 lines

For CQ case, qcom_ice_create() prefers "ice_core_clk" before "ice". How does that relate to this? Please clarify that in the commit message also.

"ice" is the naming convention used for emmc ice core clk in dt and "ice_core_clk" is the naming convention for ufs ice core clk. In the function you referred, since ice driver is common for both storage media, it tries to parse both the clock.

Here we are handling "ice" as this is needed for emmc only. I will add the same in commit message.

Quoted 6 lines
Quoted 6 lines
---
 drivers/mmc/host/sdhci-msm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 12 lines

drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 289

Quoted 9 lines
drivers/mmc/host/sdhci-msm.c +1 -0
index b4131b12df56..c6a073718aa4 100644
@@ -286,6 +286,7 @@ struct sdhci_msm_host {
 	/* core, iface, cal and sleep clocks */
 	struct clk_bulk_data bulk_clks[4];
 #ifdef CONFIG_MMC_CRYPTO
+	struct clk *ice_clk;	/* ICE clock */

Why keep ice_clk?

here we need this ice_clk because rate set is required only when ice clk is added with emmc node in dt, and in case we try to use the clk entry of qcom_ice structure it will set the rate for new ice node as well which is separate.

but also we can avoid this, since this one time operation, and we can reuse local variable clk inside sdhci_msm_probe, so it wont be needed. I will remove this in next patchset.

Quoted 7 lines
Quoted 7 lines
drivers/mmc/host/sdhci-msm.c +0 -0
 	struct qcom_ice *ice;
 #endif
 	unsigned long clk_rate;
@@ -2708,6 +2709,17 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 			return ret;
 	}
 
Quoted 8 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2715

Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +4 -0
+#ifdef CONFIG_MMC_CRYPTO
+	/* Setup ICE clock */
+	msm_host->ice_clk = devm_clk_get(&pdev->dev, "ice");
+	if (!IS_ERR(msm_host->ice_clk)) {

Does not attempt to deal with -EPROBE_DEFER, although bus_clk above doesn't either.

here need is just to set the rate, rest of the enablement part would be taken care in ice driver, hence we can avoid this handling here.

Quoted 10 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2721

Quoted 6 lines
drivers/mmc/host/sdhci-msm.c +6 -0
+		/* Vote for max. clk rate for max. performance */
+		ret = clk_set_rate(msm_host->ice_clk, INT_MAX);
+		if (ret)
+			dev_err(&pdev->dev, "ice clk set rate failed (%d)\n", ret);
+	}
+#endif

Could put this in a helper+stub function in the "Inline Crypto Engine (ICE) support" section, to save having #ifdef CONFIG_MMC_CRYPTO here

sure, will take care of this in next patchset.

Quoted 5 lines
Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +1 -0
+
 	/* Setup main peripheral bus clock */
 	clk = devm_clk_get(&pdev->dev, "iface");
 	if (IS_ERR(clk)) {
maintainer
#6 lore raw
Quoted 75 lines · Ram Prakash Gupta
Quoted 7 lines · Adrian Hunter
Quoted 3 lines · Ram Prakash Gupta

Set ice clk rate from sdhci msm platform driver, needed for target which are having legacy ice support, and need sdhci msm platform driver to set rate.

Please expand upon what "legacy" means here?

for devices where ice node is not created as separate device node those are referred here as legacy, separate device node for ice starts with below change: https://lore.kernel.org/all/[email protected]/

also I will update legacy that ice nodes which are created withing mmc dt node, so that ambiguity about legacy is clear.

Quoted 4 lines

For CQ case, qcom_ice_create() prefers "ice_core_clk" before "ice". How does that relate to this? Please clarify that in the commit message also.

"ice" is the naming convention used for emmc ice core clk in dt and "ice_core_clk" is the naming convention for ufs ice core clk. In the function you referred, since ice driver is common for both storage media, it tries to parse both the clock.

Here we are handling "ice" as this is needed for emmc only. I will add the same in commit message.

Quoted 6 lines
Quoted 6 lines
---
 drivers/mmc/host/sdhci-msm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 12 lines

drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 289

Quoted 9 lines
drivers/mmc/host/sdhci-msm.c +1 -0
index b4131b12df56..c6a073718aa4 100644
@@ -286,6 +286,7 @@ struct sdhci_msm_host {
 	/* core, iface, cal and sleep clocks */
 	struct clk_bulk_data bulk_clks[4];
 #ifdef CONFIG_MMC_CRYPTO
+	struct clk *ice_clk;	/* ICE clock */

Why keep ice_clk?

here we need this ice_clk because rate set is required only when ice clk is added with emmc node in dt, and in case we try to use the clk entry of qcom_ice structure it will set the rate for new ice node as well which is separate.

but also we can avoid this, since this one time operation, and we can reuse local variable clk inside sdhci_msm_probe, so it wont be needed. I will remove this in next patchset.

Quoted 7 lines
Quoted 7 lines
drivers/mmc/host/sdhci-msm.c +0 -0
 	struct qcom_ice *ice;
 #endif
 	unsigned long clk_rate;
@@ -2708,6 +2709,17 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 			return ret;
 	}
 
Quoted 8 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2715

Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +4 -0
+#ifdef CONFIG_MMC_CRYPTO
+	/* Setup ICE clock */
+	msm_host->ice_clk = devm_clk_get(&pdev->dev, "ice");
+	if (!IS_ERR(msm_host->ice_clk)) {

Does not attempt to deal with -EPROBE_DEFER, although bus_clk above doesn't either.

Quoted 2 lines

here need is just to set the rate, rest of the enablement part would be taken care in ice driver, hence we can avoid this handling here.

If devm_clk_get() returns -EPROBE_DEFER, then the rate will not be set, so you are relying on devm_clk_get() never to return -EPROBE_DEFER.

Quoted 20 lines
Quoted 11 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2721

Quoted 7 lines
drivers/mmc/host/sdhci-msm.c +6 -0
+		/* Vote for max. clk rate for max. performance */
+		ret = clk_set_rate(msm_host->ice_clk, INT_MAX);
+		if (ret)
+			dev_err(&pdev->dev, "ice clk set rate failed (%d)\n", ret);
+	}
+#endif

Could put this in a helper+stub function in the "Inline Crypto Engine (ICE) support" section, to save having #ifdef CONFIG_MMC_CRYPTO here

sure, will take care of this in next patchset.

Quoted 5 lines
Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +1 -0
+
 	/* Setup main peripheral bus clock */
 	clk = devm_clk_get(&pdev->dev, "iface");
 	if (IS_ERR(clk)) {
#7 lore raw
Quoted 76 lines · Adrian Hunter
Quoted 75 lines · Ram Prakash Gupta
Quoted 7 lines · Adrian Hunter
Quoted 3 lines · Ram Prakash Gupta

Set ice clk rate from sdhci msm platform driver, needed for target which are having legacy ice support, and need sdhci msm platform driver to set rate.

Please expand upon what "legacy" means here?

for devices where ice node is not created as separate device node those are referred here as legacy, separate device node for ice starts with below change: https://lore.kernel.org/all/[email protected]/

also I will update legacy that ice nodes which are created withing mmc dt node, so that ambiguity about legacy is clear.

Quoted 4 lines

For CQ case, qcom_ice_create() prefers "ice_core_clk" before "ice". How does that relate to this? Please clarify that in the commit message also.

"ice" is the naming convention used for emmc ice core clk in dt and "ice_core_clk" is the naming convention for ufs ice core clk. In the function you referred, since ice driver is common for both storage media, it tries to parse both the clock.

Here we are handling "ice" as this is needed for emmc only. I will add the same in commit message.

Quoted 6 lines
Quoted 6 lines
---
 drivers/mmc/host/sdhci-msm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 12 lines

drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 289

Quoted 9 lines
drivers/mmc/host/sdhci-msm.c +1 -0
index b4131b12df56..c6a073718aa4 100644
@@ -286,6 +286,7 @@ struct sdhci_msm_host {
 	/* core, iface, cal and sleep clocks */
 	struct clk_bulk_data bulk_clks[4];
 #ifdef CONFIG_MMC_CRYPTO
+	struct clk *ice_clk;	/* ICE clock */

Why keep ice_clk?

here we need this ice_clk because rate set is required only when ice clk is added with emmc node in dt, and in case we try to use the clk entry of qcom_ice structure it will set the rate for new ice node as well which is separate.

but also we can avoid this, since this one time operation, and we can reuse local variable clk inside sdhci_msm_probe, so it wont be needed. I will remove this in next patchset.

Quoted 15 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2715

Quoted 11 lines
drivers/mmc/host/sdhci-msm.c +4 -0
 	struct qcom_ice *ice;
 #endif
 	unsigned long clk_rate;
@@ -2708,6 +2709,17 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 			return ret;
 	}
 
+#ifdef CONFIG_MMC_CRYPTO
+	/* Setup ICE clock */
+	msm_host->ice_clk = devm_clk_get(&pdev->dev, "ice");
+	if (!IS_ERR(msm_host->ice_clk)) {

Does not attempt to deal with -EPROBE_DEFER, although bus_clk above doesn't either.

Quoted 6 lines
Quoted 2 lines

here need is just to set the rate, rest of the enablement part would be taken care in ice driver, hence we can avoid this handling here.

If devm_clk_get() returns -EPROBE_DEFER, then the rate will not be set, so you are relying on devm_clk_get() never to return -EPROBE_DEFER.

here -EPROBE_DEFER can be returned when clk driver is not ready, in that case other clks, core & iface, would also fail to get enabled and then driver would run into issues.

In case we get -EPROBE_DEFER for "ice" clk only then as you said rate will not be set for ice clk to max but warning log regarding ice clk rate not being set would be printed, and the ice clock would be set to 19.2MHz and in my opinion its not fatal.

so -EPROBE_DEFER handling seems overkill here for ice clk.

Quoted 21 lines
Quoted 20 lines
Quoted 11 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2721

Quoted 7 lines
drivers/mmc/host/sdhci-msm.c +6 -0
+		/* Vote for max. clk rate for max. performance */
+		ret = clk_set_rate(msm_host->ice_clk, INT_MAX);
+		if (ret)
+			dev_err(&pdev->dev, "ice clk set rate failed (%d)\n", ret);
+	}
+#endif

Could put this in a helper+stub function in the "Inline Crypto Engine (ICE) support" section, to save having #ifdef CONFIG_MMC_CRYPTO here

sure, will take care of this in next patchset.

Quoted 5 lines
Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +1 -0
+
 	/* Setup main peripheral bus clock */
 	clk = devm_clk_get(&pdev->dev, "iface");
 	if (IS_ERR(clk)) {
#8 lore raw
Quoted 86 lines · Ram Prakash Gupta
Quoted 76 lines · Adrian Hunter
Quoted 75 lines · Ram Prakash Gupta
Quoted 7 lines · Adrian Hunter
Quoted 3 lines · Ram Prakash Gupta

Set ice clk rate from sdhci msm platform driver, needed for target which are having legacy ice support, and need sdhci msm platform driver to set rate.

Please expand upon what "legacy" means here?

for devices where ice node is not created as separate device node those are referred here as legacy, separate device node for ice starts with below change: https://lore.kernel.org/all/[email protected]/

also I will update legacy that ice nodes which are created withing mmc dt node, so that ambiguity about legacy is clear.

Quoted 4 lines

For CQ case, qcom_ice_create() prefers "ice_core_clk" before "ice". How does that relate to this? Please clarify that in the commit message also.

"ice" is the naming convention used for emmc ice core clk in dt and "ice_core_clk" is the naming convention for ufs ice core clk. In the function you referred, since ice driver is common for both storage media, it tries to parse both the clock.

Here we are handling "ice" as this is needed for emmc only. I will add the same in commit message.

Quoted 6 lines
Quoted 6 lines
---
 drivers/mmc/host/sdhci-msm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 12 lines

drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 289

Quoted 9 lines
drivers/mmc/host/sdhci-msm.c +1 -0
index b4131b12df56..c6a073718aa4 100644
@@ -286,6 +286,7 @@ struct sdhci_msm_host {
 	/* core, iface, cal and sleep clocks */
 	struct clk_bulk_data bulk_clks[4];
 #ifdef CONFIG_MMC_CRYPTO
+	struct clk *ice_clk;	/* ICE clock */

Why keep ice_clk?

here we need this ice_clk because rate set is required only when ice clk is added with emmc node in dt, and in case we try to use the clk entry of qcom_ice structure it will set the rate for new ice node as well which is separate.

but also we can avoid this, since this one time operation, and we can reuse local variable clk inside sdhci_msm_probe, so it wont be needed. I will remove this in next patchset.

Quoted 15 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2715

Quoted 11 lines
drivers/mmc/host/sdhci-msm.c +4 -0
 	struct qcom_ice *ice;
 #endif
 	unsigned long clk_rate;
@@ -2708,6 +2709,17 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 			return ret;
 	}
 
+#ifdef CONFIG_MMC_CRYPTO
+	/* Setup ICE clock */
+	msm_host->ice_clk = devm_clk_get(&pdev->dev, "ice");
+	if (!IS_ERR(msm_host->ice_clk)) {

Does not attempt to deal with -EPROBE_DEFER, although bus_clk above doesn't either.

Quoted 6 lines
Quoted 2 lines

here need is just to set the rate, rest of the enablement part would be taken care in ice driver, hence we can avoid this handling here.

If devm_clk_get() returns -EPROBE_DEFER, then the rate will not be set, so you are relying on devm_clk_get() never to return -EPROBE_DEFER.

Quoted 9 lines

here -EPROBE_DEFER can be returned when clk driver is not ready, in that case other clks, core & iface, would also fail to get enabled and then driver would run into issues.

In case we get -EPROBE_DEFER for "ice" clk only then as you said rate will not be set for ice clk to max but warning log regarding ice clk rate not being set would be printed, and the ice clock would be set to 19.2MHz and in my opinion its not fatal.

my bad here, we wont get the print, I will add else case for log.

Quoted 24 lines

so -EPROBE_DEFER handling seems overkill here for ice clk.

Quoted 21 lines
Quoted 20 lines
Quoted 11 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2721

Quoted 7 lines
drivers/mmc/host/sdhci-msm.c +6 -0
+		/* Vote for max. clk rate for max. performance */
+		ret = clk_set_rate(msm_host->ice_clk, INT_MAX);
+		if (ret)
+			dev_err(&pdev->dev, "ice clk set rate failed (%d)\n", ret);
+	}
+#endif

Could put this in a helper+stub function in the "Inline Crypto Engine (ICE) support" section, to save having #ifdef CONFIG_MMC_CRYPTO here

sure, will take care of this in next patchset.

Quoted 5 lines
Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +1 -0
+
 	/* Setup main peripheral bus clock */
 	clk = devm_clk_get(&pdev->dev, "iface");
 	if (IS_ERR(clk)) {
#9 lore raw
In reply to Ram Prakash Gupta
Quoted 75 lines · Ram Prakash Gupta
Quoted 7 lines · Adrian Hunter
Quoted 3 lines · Ram Prakash Gupta

Set ice clk rate from sdhci msm platform driver, needed for target which are having legacy ice support, and need sdhci msm platform driver to set rate.

Please expand upon what "legacy" means here?

for devices where ice node is not created as separate device node those are referred here as legacy, separate device node for ice starts with below change: https://lore.kernel.org/all/[email protected]/

also I will update legacy that ice nodes which are created withing mmc dt node, so that ambiguity about legacy is clear.

Quoted 4 lines

For CQ case, qcom_ice_create() prefers "ice_core_clk" before "ice". How does that relate to this? Please clarify that in the commit message also.

"ice" is the naming convention used for emmc ice core clk in dt and "ice_core_clk" is the naming convention for ufs ice core clk. In the function you referred, since ice driver is common for both storage media, it tries to parse both the clock.

Here we are handling "ice" as this is needed for emmc only. I will add the same in commit message.

Quoted 6 lines
Quoted 6 lines
---
 drivers/mmc/host/sdhci-msm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 12 lines

drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 289

Quoted 9 lines
drivers/mmc/host/sdhci-msm.c +1 -0
index b4131b12df56..c6a073718aa4 100644
@@ -286,6 +286,7 @@ struct sdhci_msm_host {
 	/* core, iface, cal and sleep clocks */
 	struct clk_bulk_data bulk_clks[4];
 #ifdef CONFIG_MMC_CRYPTO
+	struct clk *ice_clk;	/* ICE clock */

Why keep ice_clk?

here we need this ice_clk because rate set is required only when ice clk is added with emmc node in dt, and in case we try to use the clk entry of qcom_ice structure it will set the rate for new ice node as well which is separate.

but also we can avoid this, since this one time operation, and we can reuse local variable clk inside sdhci_msm_probe, so it wont be needed. I will remove this in next patchset.

Quoted 7 lines
Quoted 7 lines
drivers/mmc/host/sdhci-msm.c +0 -0
 	struct qcom_ice *ice;
 #endif
 	unsigned long clk_rate;
@@ -2708,6 +2709,17 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 			return ret;
 	}
 
Quoted 8 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2715

Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +4 -0
+#ifdef CONFIG_MMC_CRYPTO
+	/* Setup ICE clock */
+	msm_host->ice_clk = devm_clk_get(&pdev->dev, "ice");
+	if (!IS_ERR(msm_host->ice_clk)) {

Does not attempt to deal with -EPROBE_DEFER, although bus_clk above doesn't either.

Quoted 5 lines

here need is just to set the rate, rest of the enablement part would be taken care in ice driver, hence we can avoid this handling here.

Quoted 2 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 2717

Quoted 2 lines
drivers/mmc/host/sdhci-msm.c +2 -0
+		/* Vote for max. clk rate for max. performance */
+		ret = clk_set_rate(msm_host->ice_clk, INT_MAX);

This will cause crashes or at least brownouts because it carries no votes for the parent power domains (CX etc.). DT should be updated instead, this is a dead path

Konrad