Skip to contentSkip to conversation

mmc: sdhci-of-arasan: Add support to request the "gate" clock

PATCH In review Swati Agarwal 4 participants 7 messages Feb 23, 2023 – Mar 9, 2023

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

PATCH 1/1 mmc: sdhci-of-arasan: Add support to request the "gate" clock

Add support to read the optional "gate" clock property and request the clock which will be used to ungate the DLL clock.

For Xilinx platforms which has DLL module, dll clock must be ungated/enabled when SD controller operates at higher frequencies like 50 MHz, 100 MHz and 200 MHz. This will be done by explicitly requesting gate clock from the driver.

---
 drivers/mmc/host/sdhci-of-arasan.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/host/sdhci-of-arasan.c +7 -0
index 4eebbf801b41..1fd7528c14fc 100644
@@ -1870,6 +1870,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	int ret;
 	struct device_node *node;
 	struct clk *clk_xin;
+	struct clk *clk_dll;
 	struct sdhci_host *host;
 	struct sdhci_pltfm_host *pltfm_host;
 	struct device *dev = &pdev->dev;
@@ -1943,6 +1944,12 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 		goto clk_dis_ahb;
 	}
 
+	clk_dll = devm_clk_get_optional_enabled(dev, "gate");
+	if (IS_ERR(clk_dll)) {
+		ret = dev_err_probe(dev, PTR_ERR(clk_dll), "failed to get dll clk\n");
+		goto clk_disable_all;
+	}
+
 	if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
 		sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_FORCE_CDTEST;
 
Signature · 1 line
2.17.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 28 lines · Swati Agarwal

Add support to read the optional "gate" clock property and request the clock which will be used to ungate the DLL clock.

For Xilinx platforms which has DLL module, dll clock must be ungated/enabled when SD controller operates at higher frequencies like 50 MHz, 100 MHz and 200 MHz. This will be done by explicitly requesting gate clock from the driver.

---
  drivers/mmc/host/sdhci-of-arasan.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/mmc/host/sdhci-of-arasan.c +1 -0
index 4eebbf801b41..1fd7528c14fc 100644
@@ -1870,6 +1870,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
  	int ret;
  	struct device_node *node;
  	struct clk *clk_xin;
+	struct clk *clk_dll;
  	struct sdhci_host *host;
  	struct sdhci_pltfm_host *pltfm_host;
  	struct device *dev = &pdev->dev;
@@ -1943,6 +1944,12 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
  		goto clk_dis_ahb;
  	}

drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_probe(struct platform_device *pdev) · line 1955

Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c +6 -0
 
+	clk_dll = devm_clk_get_optional_enabled(dev, "gate");
+	if (IS_ERR(clk_dll)) {
+		ret = dev_err_probe(dev, PTR_ERR(clk_dll), "failed to get dll clk\n");
+		goto clk_disable_all;
+	}
+
  	if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
  		sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_FORCE_CDTEST;
 

Based on available information, that it is not clear what gate clock really is and what it is used for, I think the patch is correct.

Thanks,
Michal

#2 lore raw
In reply to Swati Agarwal
Quoted 8 lines · Swati Agarwal

Add support to read the optional "gate" clock property and request the clock which will be used to ungate the DLL clock.

For Xilinx platforms which has DLL module, dll clock must be ungated/enabled when SD controller operates at higher frequencies like 50 MHz, 100 MHz and 200 MHz. This will be done by explicitly requesting gate clock from the driver.

I guess we need to update the DT bindings too?

Kind regards
Uffe

Quoted 34 lines
---
 drivers/mmc/host/sdhci-of-arasan.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/host/sdhci-of-arasan.c +7 -1
index 4eebbf801b41..1fd7528c14fc 100644
@@ -1870,6 +1870,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
        int ret;
        struct device_node *node;
        struct clk *clk_xin;
+       struct clk *clk_dll;
        struct sdhci_host *host;
        struct sdhci_pltfm_host *pltfm_host;
        struct device *dev = &pdev->dev;
@@ -1943,6 +1944,12 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
                goto clk_dis_ahb;
        }
 
+       clk_dll = devm_clk_get_optional_enabled(dev, "gate");
+       if (IS_ERR(clk_dll)) {
+               ret = dev_err_probe(dev, PTR_ERR(clk_dll), "failed to get dll clk\n");
+               goto clk_disable_all;
+       }
+
        if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
                sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_FORCE_CDTEST;
 
--

2.17.1

maintainer
#3 lore raw
Quoted 8 lines · Ulf Hansson

CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.

Quoted 4 lines · Swati Agarwal

Add support to read the optional "gate" clock property and request the clock which will be used to ungate the DLL clock.

Quoted 6 lines
Quoted 4 lines

For Xilinx platforms which has DLL module, dll clock must be ungated/enabled when SD controller operates at higher frequencies like 50 MHz, 100 MHz and 200 MHz. This will be done by explicitly requesting gate clock from the driver.

I guess we need to update the DT bindings too?

DT binding has it already. It is just not used.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml?h=v6.2#n110

Thanks,
Michal

#4 lore raw
Quoted 17 lines · Michal Simek
Quoted 13 lines · Ulf Hansson

CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.

Quoted 8 lines · Swati Agarwal

Add support to read the optional "gate" clock property and request the clock which will be used to ungate the DLL clock.

For Xilinx platforms which has DLL module, dll clock must be ungated/enabled when SD controller operates at higher frequencies like 50 MHz, 100 MHz and 200 MHz. This will be done by explicitly requesting gate clock from the driver.

Quoted 5 lines
Quoted 1 line

I guess we need to update the DT bindings too?

DT binding has it already. It is just not used.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml?h=v6.2#n110

Aha, thanks for the pointer!

Kind regards
Uffe

maintainer Acked-by on v1 1/1
#5 lore raw
In reply to Swati Agarwal
Quoted 9 lines · Swati Agarwal

Add support to read the optional "gate" clock property and request the clock which will be used to ungate the DLL clock.

For Xilinx platforms which has DLL module, dll clock must be ungated/enabled when SD controller operates at higher frequencies like 50 MHz, 100 MHz and 200 MHz. This will be done by explicitly requesting gate clock from the driver.

Quoted 29 lines
---
 drivers/mmc/host/sdhci-of-arasan.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/host/sdhci-of-arasan.c +7 -0
index 4eebbf801b41..1fd7528c14fc 100644
@@ -1870,6 +1870,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	int ret;
 	struct device_node *node;
 	struct clk *clk_xin;
+	struct clk *clk_dll;
 	struct sdhci_host *host;
 	struct sdhci_pltfm_host *pltfm_host;
 	struct device *dev = &pdev->dev;
@@ -1943,6 +1944,12 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 		goto clk_dis_ahb;
 	}
 
+	clk_dll = devm_clk_get_optional_enabled(dev, "gate");
+	if (IS_ERR(clk_dll)) {
+		ret = dev_err_probe(dev, PTR_ERR(clk_dll), "failed to get dll clk\n");
+		goto clk_disable_all;
+	}
+
 	if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
 		sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_FORCE_CDTEST;
 
#6 lore raw
In reply to Swati Agarwal
Quoted 10 lines · Swati Agarwal

Add support to read the optional "gate" clock property and request the clock which will be used to ungate the DLL clock.

For Xilinx platforms which has DLL module, dll clock must be ungated/enabled when SD controller operates at higher frequencies like 50 MHz, 100 MHz and 200 MHz. This will be done by explicitly requesting gate clock from the driver.

Applied for next, thanks!

Kind regards
Uffe

Quoted 32 lines
---
 drivers/mmc/host/sdhci-of-arasan.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/host/sdhci-of-arasan.c +7 -1
index 4eebbf801b41..1fd7528c14fc 100644
@@ -1870,6 +1870,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
        int ret;
        struct device_node *node;
        struct clk *clk_xin;
+       struct clk *clk_dll;
        struct sdhci_host *host;
        struct sdhci_pltfm_host *pltfm_host;
        struct device *dev = &pdev->dev;
@@ -1943,6 +1944,12 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
                goto clk_dis_ahb;
        }
 
+       clk_dll = devm_clk_get_optional_enabled(dev, "gate");
+       if (IS_ERR(clk_dll)) {
+               ret = dev_err_probe(dev, PTR_ERR(clk_dll), "failed to get dll clk\n");
+               goto clk_disable_all;
+       }
+
        if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
                sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_FORCE_CDTEST;
 
--

2.17.1