Skip to contentSkip to conversation

fix sdhci-pxav3 clock name and berlin clk clean up

PATCH Applied Jisheng Zhang 3 participants 12 messages Oct 12, 2015 – Oct 16, 2015

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

cover fix sdhci-pxav3 clock name and berlin clk clean up

The sdhci-pxav3's clock name isn't correct. The current "io" clock is really the PXAv3 SDHCI IP's "core" clock which is manadatory. The current "core" clock is really the IP's "axi" clock which is optional. We fix this in patch1.

The following patches add the axi clock properties to bg2q dtsi, then remove the CLK_IGNORE_UNUSED flag for sdio clk(s).

Jisheng Zhang (5):
mmc: sdhci-pxav3: fix optional clock name
ARM: dts: berlin: correct BG2Q's sdhci2 axi clock
ARM: dts: berlin: add axi clock for BG2Q sdhci0 and sdhci1
clk: berlin: bg2q: remove CLK_IGNORE_UNUSED flag for sdio clk
clk: berlin: bg2: remove CLK_IGNORE_UNUSED flag for sdio clk

 .../devicetree/bindings/mmc/sdhci-pxa.txt          |  8 ++---
 arch/arm/boot/dts/berlin2.dtsi                     |  6 ++--
 arch/arm/boot/dts/berlin2cd.dtsi                   |  2 +-
 arch/arm/boot/dts/berlin2q.dtsi                    | 10 +++---
 drivers/clk/berlin/bg2.c                           |  4 +--
 drivers/clk/berlin/bg2q.c                          |  2 +-
 drivers/mmc/host/sdhci-pxav3.c                     | 40 +++++++++++-----------
 7 files changed, 37 insertions(+), 35 deletions(-)
Signature · 1 line
2.6.1
#1 lore raw

PATCH 1/5 mmc: sdhci-pxav3: fix optional clock name

Commit 8afdc9cca27f ("mmc: sdhci-pxav3: Get optional core clock") adds additional optional clock support, but the clock names isn't correct. The current "io" clock is really the PXAv3 SDHCI IP's "core" clock which is manadatory. The current "core" clock is really the IP's "axi" clock which is optional.

---
 .../devicetree/bindings/mmc/sdhci-pxa.txt          |  8 ++---
 arch/arm/boot/dts/berlin2.dtsi                     |  6 ++--
 arch/arm/boot/dts/berlin2cd.dtsi                   |  2 +-
 arch/arm/boot/dts/berlin2q.dtsi                    |  2 +-
 drivers/mmc/host/sdhci-pxav3.c                     | 40 +++++++++++-----------
 5 files changed, 29 insertions(+), 29 deletions(-)
Documentation/devicetree/bindings/mmc/sdhci-pxa.txt +4 -4
index 3d1b449..25d5ba8 100644
@@ -17,9 +17,9 @@ Required properties:
 - reg names: should be "sdhci", "mbus", "conf-sdio3". only mandatory
   for "marvell,armada-380-sdhci"
 - clocks: Array of clocks required for SDHCI; requires at least one for
-    I/O clock.
+    core clock.
 - clock-names: Array of names corresponding to clocks property; shall be
-    "io" for I/O clock and "core" for optional core clock.
+    "core" for core clock and "axi" for optional axi clock.
 
 Optional properties:
 - mrvl,clk-delay-cycles: Specify a number of cycles to delay for tuning.
@@ -32,7 +32,7 @@ sdhci at d4280800 {
 	bus-width = <8>;
 	interrupts = <27>;
 	clocks = <&chip CLKID_SDIO1XIN>, <&chip CLKID_SDIO1>;
-	clock-names = "io", "core";
+	clock-names = "core", "axi";
 	non-removable;
 	mrvl,clk-delay-cycles = <31>;
 };
@@ -45,6 +45,6 @@ sdhci at d8000 {
 		<0x18454 0x4>;
 	interrupts = <0 25 0x4>;
 	clocks = <&gateclk 17>;
-	clock-names = "io";
+	clock-names = "core";
 	mrvl,clk-delay-cycles = <0x1F>;
 };
arch/arm/boot/dts/berlin2.dtsi +3 -3
index ef811de..9d0a945 100644
@@ -85,7 +85,7 @@
 			compatible = "mrvl,pxav3-mmc";
 			reg = <0xab0000 0x200>;
 			clocks = <&chip_clk CLKID_SDIO0XIN>, <&chip_clk CLKID_SDIO0>;
-			clock-names = "io", "core";
+			clock-names = "core", "axi";
 			interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
 		};
@@ -94,7 +94,7 @@
 			compatible = "mrvl,pxav3-mmc";
 			reg = <0xab0800 0x200>;
 			clocks = <&chip_clk CLKID_SDIO1XIN>, <&chip_clk CLKID_SDIO1>;
-			clock-names = "io", "core";
+			clock-names = "core", "axi";
 			interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
 		};
@@ -104,7 +104,7 @@
 			reg = <0xab1000 0x200>;
 			interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&chip_clk CLKID_NFC_ECC>, <&chip_clk CLKID_NFC>;
-			clock-names = "io", "core";
+			clock-names = "core", "axi";
 			pinctrl-0 = <&emmc_pmux>;
 			pinctrl-names = "default";
 			status = "disabled";
arch/arm/boot/dts/berlin2cd.dtsi +1 -1
index 900213d..11498ad 100644
@@ -82,7 +82,7 @@
 			compatible = "mrvl,pxav3-mmc";
 			reg = <0xab0000 0x200>;
 			clocks = <&chip_clk CLKID_SDIO0XIN>, <&chip_clk CLKID_SDIO0>;
-			clock-names = "io", "core";
+			clock-names = "core", "axi";
 			interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
 		};
arch/arm/boot/dts/berlin2q.dtsi +1 -1
index 63a4849..4ad585c 100644
@@ -120,7 +120,7 @@
 			reg = <0xab1000 0x200>;
 			interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&chip_clk CLKID_NFC_ECC>, <&chip_clk CLKID_NFC>;
-			clock-names = "io", "core";
+			clock-names = "core", "axi";
 			status = "disabled";
 		};
 
drivers/mmc/host/sdhci-pxav3.c +20 -20
index f5edf9d..cec95f1 100644
@@ -59,8 +59,8 @@
 #define SDCE_MISC_INT_EN	(1<<1)
 
 struct sdhci_pxa {
+	struct clk *clk_axi;
 	struct clk *clk_core;
-	struct clk *clk_io;
 	u8	power_mode;
 	void __iomem *sdio3_conf_reg;
 };
@@ -381,20 +381,20 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 	pltfm_host = sdhci_priv(host);
 	pltfm_host->priv = pxa;
 
-	pxa->clk_io = devm_clk_get(dev, "io");
-	if (IS_ERR(pxa->clk_io))
-		pxa->clk_io = devm_clk_get(dev, NULL);
-	if (IS_ERR(pxa->clk_io)) {
-		dev_err(dev, "failed to get io clock\n");
-		ret = PTR_ERR(pxa->clk_io);
+	pxa->clk_core = devm_clk_get(dev, "core");
+	if (IS_ERR(pxa->clk_core))
+		pxa->clk_core = devm_clk_get(dev, NULL);
+	if (IS_ERR(pxa->clk_core)) {
+		dev_err(dev, "failed to get core clock\n");
+		ret = PTR_ERR(pxa->clk_core);
 		goto err_clk_get;
 	}
-	pltfm_host->clk = pxa->clk_io;
-	clk_prepare_enable(pxa->clk_io);
+	pltfm_host->clk = pxa->clk_core;
+	clk_prepare_enable(pxa->clk_core);
 
-	pxa->clk_core = devm_clk_get(dev, "core");
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	pxa->clk_axi = devm_clk_get(dev, "axi");
+	if (!IS_ERR(pxa->clk_axi))
+		clk_prepare_enable(pxa->clk_axi);
 
 	/* enable 1/8V DDR capable */
 	host->mmc->caps |= MMC_CAP_1_8V_DDR;
@@ -475,8 +475,8 @@ err_add_host:
 err_of_parse:
 err_cd_req:
 err_mbus_win:
-	clk_disable_unprepare(pxa->clk_io);
 	clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_axi);
 err_clk_get:
 	sdhci_pltfm_free(pdev);
 	return ret;
@@ -494,8 +494,8 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
 
 	sdhci_remove_host(host, 1);
 
-	clk_disable_unprepare(pxa->clk_io);
 	clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_axi);
 
 	sdhci_pltfm_free(pdev);
 
@@ -542,9 +542,9 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
 	if (ret)
 		return ret;
 
-	clk_disable_unprepare(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_core);
+	if (!IS_ERR(pxa->clk_axi))
+		clk_disable_unprepare(pxa->clk_axi);
 
 	return 0;
 }
@@ -555,9 +555,9 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_pxa *pxa = pltfm_host->priv;
 
-	clk_prepare_enable(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	clk_prepare_enable(pxa->clk_core);
+	if (!IS_ERR(pxa->clk_axi))
+		clk_prepare_enable(pxa->clk_axi);
 
 	return sdhci_runtime_resume_host(host);
 }
Signature · 1 line
2.6.1
#2 lore raw

Re: [PATCH 1/5] mmc: sdhci-pxav3: fix optional clock name

Quoted 6 lines · Jisheng Zhang

Commit 8afdc9cca27f ("mmc: sdhci-pxav3: Get optional core clock") adds additional optional clock support, but the clock names isn't correct. The current "io" clock is really the PXAv3 SDHCI IP's "core" clock which is manadatory. The current "core" clock is really the IP's "axi" clock which is optional.

Quoted 8 lines
---
  .../devicetree/bindings/mmc/sdhci-pxa.txt          |  8 ++---
  arch/arm/boot/dts/berlin2.dtsi                     |  6 ++--
  arch/arm/boot/dts/berlin2cd.dtsi                   |  2 +-
  arch/arm/boot/dts/berlin2q.dtsi                    |  2 +-
  drivers/mmc/host/sdhci-pxav3.c                     | 40 +++++++++++-----------
  5 files changed, 29 insertions(+), 29 deletions(-)

Jisheng,

Please split the DT changes from the driver changes.

Documentation/devicetree/bindings/mmc/sdhci-pxa.txt Required properties: · line 22

Quoted 13 lines
Documentation/devicetree/bindings/mmc/sdhci-pxa.txt +2 -2
index 3d1b449..25d5ba8 100644
@@ -17,9 +17,9 @@ Required properties:
  - reg names: should be "sdhci", "mbus", "conf-sdio3". only mandatory
    for "marvell,armada-380-sdhci"
  - clocks: Array of clocks required for SDHCI; requires at least one for
-    I/O clock.
+    core clock.
  - clock-names: Array of names corresponding to clocks property; shall be
-    "io" for I/O clock and "core" for optional core clock.
+    "core" for core clock and "axi" for optional axi clock.

s/axi/bus/ ?

Documentation/devicetree/bindings/mmc/sdhci-pxa.txt sdhci at d4280800 { · line 35

Quoted 8 lines
Documentation/devicetree/bindings/mmc/sdhci-pxa.txt +1 -1
  Optional properties:
  - mrvl,clk-delay-cycles: Specify a number of cycles to delay for tuning.
@@ -32,7 +32,7 @@ sdhci at d4280800 {
  	bus-width = <8>;
  	interrupts = <27>;
  	clocks = <&chip CLKID_SDIO1XIN>, <&chip CLKID_SDIO1>;
-	clock-names = "io", "core";
+	clock-names = "core", "axi";

This will break backward compatibility, right?

Quoted 11 lines
Documentation/devicetree/bindings/mmc/sdhci-pxa.txt +1 -1
  	non-removable;
  	mrvl,clk-delay-cycles = <31>;
  };
@@ -45,6 +45,6 @@ sdhci at d8000 {
  		<0x18454 0x4>;
  	interrupts = <0 25 0x4>;
  	clocks = <&gateclk 17>;
-	clock-names = "io";
+	clock-names = "core";
  	mrvl,clk-delay-cycles = <0x1F>;
  };

[...]

drivers/mmc/host/sdhci-pxav3.c line 62

Quoted 9 lines
drivers/mmc/host/sdhci-pxav3.c +1 -0
index f5edf9d..cec95f1 100644
@@ -59,8 +59,8 @@
  #define SDCE_MISC_INT_EN	(1<<1)
 
  struct sdhci_pxa {
+	struct clk *clk_axi;

s/clk_axi/clk_bus/g

Quoted 6 lines
drivers/mmc/host/sdhci-pxav3.c +0 -1
  	struct clk *clk_core;
-	struct clk *clk_io;
  	u8	power_mode;
  	void __iomem *sdio3_conf_reg;
  };

drivers/mmc/host/sdhci-pxav3.c static int sdhci_pxav3_probe(struct platform_device *pdev) · line 384

Quoted 10 lines
drivers/mmc/host/sdhci-pxav3.c +1 -6
@@ -381,20 +381,20 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
  	pltfm_host = sdhci_priv(host);
  	pltfm_host->priv = pxa;
 
-	pxa->clk_io = devm_clk_get(dev, "io");
-	if (IS_ERR(pxa->clk_io))
-		pxa->clk_io = devm_clk_get(dev, NULL);
-	if (IS_ERR(pxa->clk_io)) {
-		dev_err(dev, "failed to get io clock\n");
-		ret = PTR_ERR(pxa->clk_io);
+	pxa->clk_core = devm_clk_get(dev, "core");

To maintain backward compatibility, we should still devm_clk_get(dev, "io") here - or even better, first probe for "io" to catch old binding semantics including old "core"/"bus" misnaming.

If we detected old semantics, print a warning that firmware should be updated.

Sebastian

Quoted 68 lines
drivers/mmc/host/sdhci-pxav3.c +18 -13
+	if (IS_ERR(pxa->clk_core))
+		pxa->clk_core = devm_clk_get(dev, NULL);
+	if (IS_ERR(pxa->clk_core)) {
+		dev_err(dev, "failed to get core clock\n");
+		ret = PTR_ERR(pxa->clk_core);
  		goto err_clk_get;
  	}
-	pltfm_host->clk = pxa->clk_io;
-	clk_prepare_enable(pxa->clk_io);
+	pltfm_host->clk = pxa->clk_core;
+	clk_prepare_enable(pxa->clk_core);
 
-	pxa->clk_core = devm_clk_get(dev, "core");
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	pxa->clk_axi = devm_clk_get(dev, "axi");
+	if (!IS_ERR(pxa->clk_axi))
+		clk_prepare_enable(pxa->clk_axi);
 
  	/* enable 1/8V DDR capable */
  	host->mmc->caps |= MMC_CAP_1_8V_DDR;
@@ -475,8 +475,8 @@ err_add_host:
  err_of_parse:
  err_cd_req:
  err_mbus_win:
-	clk_disable_unprepare(pxa->clk_io);
  	clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_axi);
  err_clk_get:
  	sdhci_pltfm_free(pdev);
  	return ret;
@@ -494,8 +494,8 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
 
  	sdhci_remove_host(host, 1);
 
-	clk_disable_unprepare(pxa->clk_io);
  	clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_axi);
 
  	sdhci_pltfm_free(pdev);
 
@@ -542,9 +542,9 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
  	if (ret)
  		return ret;
 
-	clk_disable_unprepare(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_core);
+	if (!IS_ERR(pxa->clk_axi))
+		clk_disable_unprepare(pxa->clk_axi);
 
  	return 0;
  }
@@ -555,9 +555,9 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
  	struct sdhci_pxa *pxa = pltfm_host->priv;
 
-	clk_prepare_enable(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	clk_prepare_enable(pxa->clk_core);
+	if (!IS_ERR(pxa->clk_axi))
+		clk_prepare_enable(pxa->clk_axi);
 
  	return sdhci_runtime_resume_host(host);
  }
#3 lore raw

Re: [PATCH 1/5] mmc: sdhci-pxav3: fix optional clock name

Dear Sebastian,

Quoted 17 lines · On Thu, 15 Oct 2015 23:41:22 +0200 Sebastian Hesselbarth…
Quoted 6 lines · Jisheng Zhang

Commit 8afdc9cca27f ("mmc: sdhci-pxav3: Get optional core clock") adds additional optional clock support, but the clock names isn't correct. The current "io" clock is really the PXAv3 SDHCI IP's "core" clock which is manadatory. The current "core" clock is really the IP's "axi" clock which is optional.

Quoted 8 lines
---
  .../devicetree/bindings/mmc/sdhci-pxa.txt          |  8 ++---
  arch/arm/boot/dts/berlin2.dtsi                     |  6 ++--
  arch/arm/boot/dts/berlin2cd.dtsi                   |  2 +-
  arch/arm/boot/dts/berlin2q.dtsi                    |  2 +-
  drivers/mmc/host/sdhci-pxav3.c                     | 40 +++++++++++-----------
  5 files changed, 29 insertions(+), 29 deletions(-)  
Quoted 3 lines

Jisheng,

Please split the DT changes from the driver changes.

Such split will break berlin SDHC functionality, I'm not sure whether this is acceptable.

Quoted 16 lines
Quoted 6 lines
Documentation/devicetree/bindings/mmc/sdhci-pxa.txt +0 -0
index 3d1b449..25d5ba8 100644

Documentation/devicetree/bindings/mmc/sdhci-pxa.txt Required properties: · line 22

Quoted 8 lines
Documentation/devicetree/bindings/mmc/sdhci-pxa.txt +2 -2
@@ -17,9 +17,9 @@ Required properties:
  - reg names: should be "sdhci", "mbus", "conf-sdio3". only mandatory
    for "marvell,armada-380-sdhci"
  - clocks: Array of clocks required for SDHCI; requires at least one for
-    I/O clock.
+    core clock.
  - clock-names: Array of names corresponding to clocks property; shall be
-    "io" for I/O clock and "core" for optional core clock.
+    "core" for core clock and "axi" for optional axi clock.  

s/axi/bus/ ?

HW call this clk as axi, "bus" seems more generic, right?

Quoted 45 lines

Documentation/devicetree/bindings/mmc/sdhci-pxa.txt sdhci at d4280800 { · line 35

Quoted 9 lines
Documentation/devicetree/bindings/mmc/sdhci-pxa.txt +1 -1
  Optional properties:
  - mrvl,clk-delay-cycles: Specify a number of cycles to delay for tuning.
@@ -32,7 +32,7 @@ sdhci at d4280800 {
  	bus-width = <8>;
  	interrupts = <27>;
  	clocks = <&chip CLKID_SDIO1XIN>, <&chip CLKID_SDIO1>;
-	clock-names = "io", "core";
+	clock-names = "core", "axi";  

This will break backward compatibility, right?

Quoted 11 lines
Documentation/devicetree/bindings/mmc/sdhci-pxa.txt +1 -1
  	non-removable;
  	mrvl,clk-delay-cycles = <31>;
  };
@@ -45,6 +45,6 @@ sdhci at d8000 {
  		<0x18454 0x4>;
  	interrupts = <0 25 0x4>;
  	clocks = <&gateclk 17>;
-	clock-names = "io";
+	clock-names = "core";
  	mrvl,clk-delay-cycles = <0x1F>;
  };  

[...]

drivers/mmc/host/sdhci-pxav3.c line 62

Quoted 9 lines
drivers/mmc/host/sdhci-pxav3.c +1 -0
index f5edf9d..cec95f1 100644
@@ -59,8 +59,8 @@
  #define SDCE_MISC_INT_EN	(1<<1)
 
  struct sdhci_pxa {
+	struct clk *clk_axi;  

s/clk_axi/clk_bus/g

Quoted 9 lines
drivers/mmc/host/sdhci-pxav3.c +0 -1
  	struct clk *clk_core;
-	struct clk *clk_io;
  	u8	power_mode;
  	void __iomem *sdio3_conf_reg;
  };
@@ -381,20 +381,20 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
  	pltfm_host = sdhci_priv(host);
  	pltfm_host->priv = pxa;
 
Quoted 9 lines

drivers/mmc/host/sdhci-pxav3.c static int sdhci_pxav3_probe(struct platform_device *pdev) · line 384

Quoted 7 lines
drivers/mmc/host/sdhci-pxav3.c +1 -6
-	pxa->clk_io = devm_clk_get(dev, "io");
-	if (IS_ERR(pxa->clk_io))
-		pxa->clk_io = devm_clk_get(dev, NULL);
-	if (IS_ERR(pxa->clk_io)) {
-		dev_err(dev, "failed to get io clock\n");
-		ret = PTR_ERR(pxa->clk_io);
+	pxa->clk_core = devm_clk_get(dev, "core");  

To maintain backward compatibility, we should still

I just grep the kernel source, found that only mrvl berlin SoCs have two clks, other SoCs just have one clk and don't provide clock name. So the question here is whether we can break linux backward compatibility for mrvl berlin SoCs. I think we could for the following reason:

1. rare boards outside mrvl can boot user self-built kernel, most boards should be protected by trust-chainloader mechanism.

2. mrvl berlin SoCs upgrade linux kernel and dtb at the same time

what do you think?

Is it better to refine patch 2, 3, 4, 5 to make use current "io","core" binding to clean up the clk's CLK_IGNORE_UNUSED flags? In fact, they doesn't depend on patch1. Could you please kindly give advice?

Thanks in advance,
Jisheng

Quoted 78 lines

devm_clk_get(dev, "io") here - or even better, first probe for "io" to catch old binding semantics including old "core"/"bus" misnaming.

If we detected old semantics, print a warning that firmware should be updated.

Sebastian

Quoted 68 lines
drivers/mmc/host/sdhci-pxav3.c +18 -13
+	if (IS_ERR(pxa->clk_core))
+		pxa->clk_core = devm_clk_get(dev, NULL);
+	if (IS_ERR(pxa->clk_core)) {
+		dev_err(dev, "failed to get core clock\n");
+		ret = PTR_ERR(pxa->clk_core);
  		goto err_clk_get;
  	}
-	pltfm_host->clk = pxa->clk_io;
-	clk_prepare_enable(pxa->clk_io);
+	pltfm_host->clk = pxa->clk_core;
+	clk_prepare_enable(pxa->clk_core);
 
-	pxa->clk_core = devm_clk_get(dev, "core");
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	pxa->clk_axi = devm_clk_get(dev, "axi");
+	if (!IS_ERR(pxa->clk_axi))
+		clk_prepare_enable(pxa->clk_axi);
 
  	/* enable 1/8V DDR capable */
  	host->mmc->caps |= MMC_CAP_1_8V_DDR;
@@ -475,8 +475,8 @@ err_add_host:
  err_of_parse:
  err_cd_req:
  err_mbus_win:
-	clk_disable_unprepare(pxa->clk_io);
  	clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_axi);
  err_clk_get:
  	sdhci_pltfm_free(pdev);
  	return ret;
@@ -494,8 +494,8 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
 
  	sdhci_remove_host(host, 1);
 
-	clk_disable_unprepare(pxa->clk_io);
  	clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_axi);
 
  	sdhci_pltfm_free(pdev);
 
@@ -542,9 +542,9 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
  	if (ret)
  		return ret;
 
-	clk_disable_unprepare(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_core);
+	if (!IS_ERR(pxa->clk_axi))
+		clk_disable_unprepare(pxa->clk_axi);
 
  	return 0;
  }
@@ -555,9 +555,9 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
  	struct sdhci_pxa *pxa = pltfm_host->priv;
 
-	clk_prepare_enable(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	clk_prepare_enable(pxa->clk_core);
+	if (!IS_ERR(pxa->clk_axi))
+		clk_prepare_enable(pxa->clk_axi);
 
  	return sdhci_runtime_resume_host(host);
  }
#4 lore raw

Re: [PATCH 1/5] mmc: sdhci-pxav3: fix optional clock name

Quoted 11 lines · Jisheng Zhang
Quoted 9 lines · On Thu, 15 Oct 2015 23:41:22 +0200 Sebastian Hesselbarth…
Quoted 8 lines · Jisheng Zhang

Commit 8afdc9cca27f ("mmc: sdhci-pxav3: Get optional core clock") adds additional optional clock support, but the clock names isn't correct. The current "io" clock is really the PXAv3 SDHCI IP's "core" clock which is manadatory. The current "core" clock is really the IP's "axi" clock which is optional.

---

[...]

Quoted 4 lines
Quoted 1 line

Please split the DT changes from the driver changes.

Such split will break berlin SDHC functionality, I'm not sure whether this is acceptable.

I am not going to funnel any driver stuff through berlin-tree anymore if it isn't really neccessary.

[...]

Quoted 10 lines
Quoted 8 lines

Documentation/devicetree/bindings/mmc/sdhci-pxa.txt Required properties: · line 22

Quoted 6 lines

- clocks: Array of clocks required for SDHCI; requires at least one for

Documentation/devicetree/bindings/mmc/sdhci-pxa.txt +2 -2
-    I/O clock.
+    core clock.
   - clock-names: Array of names corresponding to clocks property; shall be
-    "io" for I/O clock and "core" for optional core clock.
+    "core" for core clock and "axi" for optional axi clock.

s/axi/bus/ ?

HW call this clk as axi, "bus" seems more generic, right?

Yes, please pick the generic name. Given the age of that IP, I guess it will run on AHB instead of AXI on PXA.

[...]

Quoted 10 lines
Quoted 9 lines

drivers/mmc/host/sdhci-pxav3.c static int sdhci_pxav3_probe(struct platform_device *pdev) · line 384

Quoted 7 lines
drivers/mmc/host/sdhci-pxav3.c +1 -6
-	pxa->clk_io = devm_clk_get(dev, "io");
-	if (IS_ERR(pxa->clk_io))
-		pxa->clk_io = devm_clk_get(dev, NULL);
-	if (IS_ERR(pxa->clk_io)) {
-		dev_err(dev, "failed to get io clock\n");
-		ret = PTR_ERR(pxa->clk_io);
+	pxa->clk_core = devm_clk_get(dev, "core");

To maintain backward compatibility, we should still

Quoted 4 lines

I just grep the kernel source, found that only mrvl berlin SoCs have two clks, other SoCs just have one clk and don't provide clock name. So the question here is whether we can break linux backward compatibility for mrvl berlin SoCs. I think we could for the following reason:

That is the point: do not break it on purpose.

Try to separate DT and driver changes without breaking the tree in between.

Sebastian

Quoted 95 lines

1. rare boards outside mrvl can boot user self-built kernel, most boards should be protected by trust-chainloader mechanism.

2. mrvl berlin SoCs upgrade linux kernel and dtb at the same time

what do you think?

Is it better to refine patch 2, 3, 4, 5 to make use current "io","core" binding to clean up the clk's CLK_IGNORE_UNUSED flags? In fact, they doesn't depend on patch1. Could you please kindly give advice?

Thanks in advance,
Jisheng

Quoted 78 lines

devm_clk_get(dev, "io") here - or even better, first probe for "io" to catch old binding semantics including old "core"/"bus" misnaming.

If we detected old semantics, print a warning that firmware should be updated.

Sebastian

Quoted 68 lines
drivers/mmc/host/sdhci-pxav3.c +18 -13
+	if (IS_ERR(pxa->clk_core))
+		pxa->clk_core = devm_clk_get(dev, NULL);
+	if (IS_ERR(pxa->clk_core)) {
+		dev_err(dev, "failed to get core clock\n");
+		ret = PTR_ERR(pxa->clk_core);
   		goto err_clk_get;
   	}
-	pltfm_host->clk = pxa->clk_io;
-	clk_prepare_enable(pxa->clk_io);
+	pltfm_host->clk = pxa->clk_core;
+	clk_prepare_enable(pxa->clk_core);
 
-	pxa->clk_core = devm_clk_get(dev, "core");
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	pxa->clk_axi = devm_clk_get(dev, "axi");
+	if (!IS_ERR(pxa->clk_axi))
+		clk_prepare_enable(pxa->clk_axi);
 
   	/* enable 1/8V DDR capable */
   	host->mmc->caps |= MMC_CAP_1_8V_DDR;
@@ -475,8 +475,8 @@ err_add_host:
   err_of_parse:
   err_cd_req:
   err_mbus_win:
-	clk_disable_unprepare(pxa->clk_io);
   	clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_axi);
   err_clk_get:
   	sdhci_pltfm_free(pdev);
   	return ret;
@@ -494,8 +494,8 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
 
   	sdhci_remove_host(host, 1);
 
-	clk_disable_unprepare(pxa->clk_io);
   	clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_axi);
 
   	sdhci_pltfm_free(pdev);
 
@@ -542,9 +542,9 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
   	if (ret)
   		return ret;
 
-	clk_disable_unprepare(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_disable_unprepare(pxa->clk_core);
+	clk_disable_unprepare(pxa->clk_core);
+	if (!IS_ERR(pxa->clk_axi))
+		clk_disable_unprepare(pxa->clk_axi);
 
   	return 0;
   }
@@ -555,9 +555,9 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
   	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
   	struct sdhci_pxa *pxa = pltfm_host->priv;
 
-	clk_prepare_enable(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	clk_prepare_enable(pxa->clk_core);
+	if (!IS_ERR(pxa->clk_axi))
+		clk_prepare_enable(pxa->clk_axi);
 
   	return sdhci_runtime_resume_host(host);
   }
#5 lore raw

PATCH 2/5 ARM: dts: berlin: correct BG2Q's sdhci2 axi clock

In reply to Jisheng Zhang

The optional axi clock is CLKID_SDIO.

---
 arch/arm/boot/dts/berlin2q.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/berlin2q.dtsi +1 -1
index 4ad585c..2f12048 100644
@@ -119,7 +119,7 @@
 			compatible = "mrvl,pxav3-mmc";
 			reg = <0xab1000 0x200>;
 			interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&chip_clk CLKID_NFC_ECC>, <&chip_clk CLKID_NFC>;
+			clocks = <&chip_clk CLKID_NFC_ECC>, <&chip_clk CLKID_SDIO>;
 			clock-names = "core", "axi";
 			status = "disabled";
 		};
Signature · 1 line
2.6.1
#6 lore raw

PATCH 3/5 ARM: dts: berlin: add axi clock for BG2Q sdhci0 and sdhci1

In reply to Jisheng Zhang

Add the axi clock for BG2Q's sdhci0 and sdhci1. This would let the axi clock be disabled during runtime pm, so saves power a bit.

---
 arch/arm/boot/dts/berlin2q.dtsi | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/boot/dts/berlin2q.dtsi +4 -2
index 2f12048..a14c9e8 100644
@@ -102,7 +102,8 @@
 		sdhci0: sdhci at ab0000 {
 			compatible = "mrvl,pxav3-mmc";
 			reg = <0xab0000 0x200>;
-			clocks = <&chip_clk CLKID_SDIO1XIN>;
+			clocks = <&chip_clk CLKID_SDIO1XIN>, <&chip_clk CLKID_SDIO>;
+			clock-names = "core", "axi";
 			interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
 		};
@@ -110,7 +111,8 @@
 		sdhci1: sdhci at ab0800 {
 			compatible = "mrvl,pxav3-mmc";
 			reg = <0xab0800 0x200>;
-			clocks = <&chip_clk CLKID_SDIO1XIN>;
+			clocks = <&chip_clk CLKID_SDIO1XIN>, <&chip_clk CLKID_SDIO>;
+			clock-names = "core", "axi";
 			interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
 		};
Signature · 1 line
2.6.1
#7 lore raw

PATCH 4/5 clk: berlin: bg2q: remove CLK_IGNORE_UNUSED flag for sdio clk

In reply to Jisheng Zhang

Since we have added the necessary axi clk properties in dts, we can remove the "sdio" clk's CLK_IGNORE_UNUSED flag now.

---
 drivers/clk/berlin/bg2q.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/berlin/bg2q.c +1 -1
index 221f40c..243f421 100644
@@ -283,7 +283,7 @@ static const struct berlin2_gate_data bg2q_gates[] __initconst = {
 	{ "usb2",	"perif",	13 },
 	{ "usb3",	"perif",	14 },
 	{ "pbridge",	"perif",	15, CLK_IGNORE_UNUSED },
-	{ "sdio",	"perif",	16, CLK_IGNORE_UNUSED },
+	{ "sdio",	"perif",	16 },
 	{ "nfc",	"perif",	18 },
 	{ "pcie",	"perif",	22 },
 };
Signature · 1 line
2.6.1
#8 lore raw

Re: [PATCH 4/5] clk: berlin: bg2q: remove CLK_IGNORE_UNUSED flag for sdio clk

Quoting Jisheng Zhang (2015-10-11 22:46:35)

Quoted 4 lines

Since we have added the necessary axi clk properties in dts, we can remove the "sdio" clk's CLK_IGNORE_UNUSED flag now.

Applied to clk-next.

Regards,
Mike

Quoted 20 lines
---
 drivers/clk/berlin/bg2q.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/berlin/bg2q.c +1 -1
index 221f40c..243f421 100644
@@ -283,7 +283,7 @@ static const struct berlin2_gate_data bg2q_gates[] __initconst = {
        { "usb2",       "perif",        13 },
        { "usb3",       "perif",        14 },
        { "pbridge",    "perif",        15, CLK_IGNORE_UNUSED },
-       { "sdio",       "perif",        16, CLK_IGNORE_UNUSED },
+       { "sdio",       "perif",        16 },
        { "nfc",        "perif",        18 },
        { "pcie",       "perif",        22 },
 };
Signature · 1 line
2.6.1
#9 lore raw

Re: [PATCH 4/5] clk: berlin: bg2q: remove CLK_IGNORE_UNUSED flag for sdio clk

Quoted 7 lines · Michael Turquette

Quoting Jisheng Zhang (2015-10-11 22:46:35)

Quoted 4 lines

Since we have added the necessary axi clk properties in dts, we can remove the "sdio" clk's CLK_IGNORE_UNUSED flag now.

Applied to clk-next.

Mike,

these two patches will break Berlin SoCs if not applied after the sdhci and DT changes went in. Please hold them back until the discussion has been settled.

Thanks,
Sebastian

Quoted 21 lines
Quoted 21 lines
---
  drivers/clk/berlin/bg2q.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/berlin/bg2q.c +1 -2
index 221f40c..243f421 100644
@@ -283,7 +283,7 @@ static const struct berlin2_gate_data bg2q_gates[] __initconst = {
         { "usb2",       "perif",        13 },
         { "usb3",       "perif",        14 },
         { "pbridge",    "perif",        15, CLK_IGNORE_UNUSED },
-       { "sdio",       "perif",        16, CLK_IGNORE_UNUSED },
+       { "sdio",       "perif",        16 },
         { "nfc",        "perif",        18 },
         { "pcie",       "perif",        22 },
  };
--

2.6.1

#10 lore raw

PATCH 5/5 clk: berlin: bg2: remove CLK_IGNORE_UNUSED flag for sdio clk

In reply to Jisheng Zhang

The axi clock properties already exists, so there's no need to set this flag for sdio0 and sdio1 clk any more.

---
 drivers/clk/berlin/bg2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/berlin/bg2.c +2 -2
index 73153fc..23e0e3b 100644
@@ -490,8 +490,8 @@ static const struct berlin2_gate_data bg2_gates[] __initconst = {
 	{ "usb0",	"perif",	11 },
 	{ "usb1",	"perif",	12 },
 	{ "pbridge",	"perif",	13, CLK_IGNORE_UNUSED },
-	{ "sdio0",	"perif",	14, CLK_IGNORE_UNUSED },
-	{ "sdio1",	"perif",	15, CLK_IGNORE_UNUSED },
+	{ "sdio0",	"perif",	14 },
+	{ "sdio1",	"perif",	15 },
 	{ "nfc",	"perif",	17 },
 	{ "smemc",	"perif",	19 },
 	{ "audiohd",	"audiohd_pll",	26 },
Signature · 1 line
2.6.1
#11 lore raw

Re: [PATCH 5/5] clk: berlin: bg2: remove CLK_IGNORE_UNUSED flag for sdio clk

Quoting Jisheng Zhang (2015-10-11 22:46:36)

Quoted 4 lines

The axi clock properties already exists, so there's no need to set this flag for sdio0 and sdio1 clk any more.

Applied to clk-next.

Regards,
Mike

Quoted 22 lines
---
 drivers/clk/berlin/bg2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/berlin/bg2.c +2 -2
index 73153fc..23e0e3b 100644
@@ -490,8 +490,8 @@ static const struct berlin2_gate_data bg2_gates[] __initconst = {
        { "usb0",       "perif",        11 },
        { "usb1",       "perif",        12 },
        { "pbridge",    "perif",        13, CLK_IGNORE_UNUSED },
-       { "sdio0",      "perif",        14, CLK_IGNORE_UNUSED },
-       { "sdio1",      "perif",        15, CLK_IGNORE_UNUSED },
+       { "sdio0",      "perif",        14 },
+       { "sdio1",      "perif",        15 },
        { "nfc",        "perif",        17 },
        { "smemc",      "perif",        19 },
        { "audiohd",    "audiohd_pll",  26 },
Signature · 1 line
2.6.1