linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ARM: MMC: USB: Fix clocking
@ 2016-09-08  9:11 Lee Jones
  2016-09-08  9:11 ` [PATCH 1/4] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB) Lee Jones
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Lee Jones @ 2016-09-08  9:11 UTC (permalink / raw)
  To: ulf.hansson, patrice.chotard, peter.griffin, robh
  Cc: linux-arm-kernel, linux-kernel, kernel, Lee Jones

Before we had critical-clock support, it was not possible to boot a kernel
without using the 'clk_ignore_unused' kernel command-line parameter.  This
was due to the existance of inter-connect clocks which weren't associated
with any physical device and thus could not be handled (think get, enable,
disable) correctly.  As a consequence the platform would catastrophically
fail when the Common Clock Framework tried to disable unused clocks.

Now we do have critical-clock support, it has identified some additional
clocks which are required for the successful functioning of some key IP.

With the introduction of critical-clock support in v4.8, our developers'
default configuration is to run with 'clk_ignore_unused' removed.  This
patch-set ensures they can achieve successful boot when a) booting from
an SD Card and when b) booting using USB->Eth adaptors for NFS booting.

Please consider this set for your respective -fixes branches for
inclusion into the v4.8-rcs.

Lee Jones (4):
  ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI
    (USB)
  ARM: dts: STiH407-family: Provide interconnect clock for consumption
    in ST SDHCI
  dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock
  mmc: sdhci-st: Handle interconnect clock

 Documentation/devicetree/bindings/mmc/sdhci-st.txt |  2 +-
 arch/arm/boot/dts/stih407-family.dtsi              | 10 ++++++----
 arch/arm/boot/dts/stih410.dtsi                     | 12 ++++++++----
 drivers/mmc/host/sdhci-st.c                        | 15 ++++++++++++++-
 4 files changed, 29 insertions(+), 10 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/4] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB)
  2016-09-08  9:11 [PATCH 0/4] ARM: MMC: USB: Fix clocking Lee Jones
@ 2016-09-08  9:11 ` Lee Jones
  2016-09-08 13:50   ` Patrice Chotard
  2016-09-08 14:06   ` Patrice Chotard
  2016-09-08  9:11 ` [PATCH 2/4] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI Lee Jones
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 14+ messages in thread
From: Lee Jones @ 2016-09-08  9:11 UTC (permalink / raw)
  To: ulf.hansson, patrice.chotard, peter.griffin, robh
  Cc: linux-arm-kernel, linux-kernel, kernel, Lee Jones, stable

The STiH4{07,10} platform contains some interconnect clocks which are used
by various IPs.  If this clock isn't handled correctly by ST's EHCI/OHCI
drivers, their hub won't be found, the following error be shown and the
result will be non-working USB:

  [   97.221963] hub 2-1:1.0: hub_ext_port_status failed (err = -110)

Cc: stable@vger.kernel.org
Tested-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/stih410.dtsi | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/stih410.dtsi b/arch/arm/boot/dts/stih410.dtsi
index 9ee5e20..f1aa34c 100644
--- a/arch/arm/boot/dts/stih410.dtsi
+++ b/arch/arm/boot/dts/stih410.dtsi
@@ -41,7 +41,8 @@
 			compatible = "st,st-ohci-300x";
 			reg = <0x9a03c00 0x100>;
 			interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>;
-			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
+			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
 			resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT0_SOFTRESET>;
 			reset-names = "power", "softreset";
@@ -57,7 +58,8 @@
 			interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_usb0>;
-			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
+			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
 			resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT0_SOFTRESET>;
 			reset-names = "power", "softreset";
@@ -71,7 +73,8 @@
 			compatible = "st,st-ohci-300x";
 			reg = <0x9a83c00 0x100>;
 			interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>;
-			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
+			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
 			resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT1_SOFTRESET>;
 			reset-names = "power", "softreset";
@@ -87,7 +90,8 @@
 			interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_usb1>;
-			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
+			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
 			resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT1_SOFTRESET>;
 			reset-names = "power", "softreset";
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/4] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI
  2016-09-08  9:11 [PATCH 0/4] ARM: MMC: USB: Fix clocking Lee Jones
  2016-09-08  9:11 ` [PATCH 1/4] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB) Lee Jones
@ 2016-09-08  9:11 ` Lee Jones
  2016-09-08 13:50   ` Patrice Chotard
  2016-09-08 14:07   ` Patrice Chotard
  2016-09-08  9:11 ` [PATCH 3/4] dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock Lee Jones
  2016-09-08  9:11 ` [PATCH 4/4] mmc: sdhci-st: Handle interconnect clock Lee Jones
  3 siblings, 2 replies; 14+ messages in thread
From: Lee Jones @ 2016-09-08  9:11 UTC (permalink / raw)
  To: ulf.hansson, patrice.chotard, peter.griffin, robh
  Cc: linux-arm-kernel, linux-kernel, kernel, Lee Jones, stable

The STiH4{07,10} platform contains some interconnect clocks which are used
by various IPs.  If these clocks aren't handled correctly by ST's SDHCI
driver MMC will break and the following output can be observed:

[   13.916949] mmc0: Timeout waiting for hardware interrupt.
[   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
[   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
[   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
[   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
[   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
[   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
[   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
[   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
[   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
[   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
[   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
[   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
[   13.992252] sdhci: Host ctl2: 0x00000000
[   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
[   14.001990] sdhci: ===========================================
[   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.

Cc: stable@vger.kernel.org
Tested-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/stih407-family.dtsi | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi
index 55ecfbe..744c5bc 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -550,8 +550,9 @@
 			interrupt-names = "mmcirq";
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_mmc0>;
-			clock-names = "mmc";
-			clocks = <&clk_s_c0_flexgen CLK_MMC_0>;
+			clock-names = "mmc", "icn";
+			clocks = <&clk_s_c0_flexgen CLK_MMC_0>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_HVA>;
 			bus-width = <8>;
 		};
 
@@ -564,8 +565,9 @@
 			interrupt-names = "mmcirq";
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_sd1>;
-			clock-names = "mmc";
-			clocks = <&clk_s_c0_flexgen CLK_MMC_1>;
+			clock-names = "mmc", "icn";
+			clocks = <&clk_s_c0_flexgen CLK_MMC_1>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_HVA>;
 			resets = <&softreset STIH407_MMC1_SOFTRESET>;
 			bus-width = <4>;
 		};
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/4] dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock
  2016-09-08  9:11 [PATCH 0/4] ARM: MMC: USB: Fix clocking Lee Jones
  2016-09-08  9:11 ` [PATCH 1/4] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB) Lee Jones
  2016-09-08  9:11 ` [PATCH 2/4] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI Lee Jones
@ 2016-09-08  9:11 ` Lee Jones
  2016-09-09 11:50   ` Ulf Hansson
  2016-09-12 12:35   ` Ulf Hansson
  2016-09-08  9:11 ` [PATCH 4/4] mmc: sdhci-st: Handle interconnect clock Lee Jones
  3 siblings, 2 replies; 14+ messages in thread
From: Lee Jones @ 2016-09-08  9:11 UTC (permalink / raw)
  To: ulf.hansson, patrice.chotard, peter.griffin, robh
  Cc: linux-arm-kernel, linux-kernel, kernel, Lee Jones

The interconnect (ICN) clock is required for functional working of
MMC on some ST platforms.  When not supplied it can result in
broken MMC and the following output:

        [   13.916949] mmc0: Timeout waiting for hardware interrupt.
        [   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
        [   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
        [   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
        [   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
        [   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
        [   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
        [   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
        [   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
        [   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
        [   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
        [   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
        [   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
        [   13.992252] sdhci: Host ctl2: 0x00000000
        [   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
        [   14.001990] sdhci: ===========================================
        [   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 Documentation/devicetree/bindings/mmc/sdhci-st.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mmc/sdhci-st.txt b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
index 88faa91..3cd4c43 100644
--- a/Documentation/devicetree/bindings/mmc/sdhci-st.txt
+++ b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
@@ -10,7 +10,7 @@ Required properties:
 			subsystem (mmcss) inside the FlashSS (available in STiH407 SoC
 			family).
 
-- clock-names:		Should be "mmc".
+- clock-names:		Should be "mmc" and "icn".  (NB: The latter is not compulsory)
 			See: Documentation/devicetree/bindings/resource-names.txt
 - clocks:		Phandle to the clock.
 			See: Documentation/devicetree/bindings/clock/clock-bindings.txt
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/4] mmc: sdhci-st: Handle interconnect clock
  2016-09-08  9:11 [PATCH 0/4] ARM: MMC: USB: Fix clocking Lee Jones
                   ` (2 preceding siblings ...)
  2016-09-08  9:11 ` [PATCH 3/4] dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock Lee Jones
@ 2016-09-08  9:11 ` Lee Jones
  2016-09-08 11:58   ` Lee Jones
  3 siblings, 1 reply; 14+ messages in thread
From: Lee Jones @ 2016-09-08  9:11 UTC (permalink / raw)
  To: ulf.hansson, patrice.chotard, peter.griffin, robh
  Cc: linux-arm-kernel, linux-kernel, kernel, Lee Jones, stable

Some ST platforms contain interconnect (ICN) clocks which must be handed
correctly in order to obtain full functionality of a given IP.  In this
case, if the ICN clocks are not handled properly by the ST SDHCI driver
MMC will break and the following output can be observed:

    [   13.916949] mmc0: Timeout waiting for hardware interrupt.
    [   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
    [   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
    [   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
    [   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
    [   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
    [   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
    [   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
    [   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
    [   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
    [   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
    [   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
    [   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
    [   13.992252] sdhci: Host ctl2: 0x00000000
    [   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
    [   14.001990] sdhci: ===========================================
    [   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.

A decent point was raised about minimising the use of a local variable that
we 'could' do without.  I've chosen consistency over the possibility of
reducing the local variable count by 1.  Thinking that it's more important
for the code to be grouped and authoured in a similar manner/style for
greater maintainability/readability.

Cc: stable@vger.kernel.org
Tested-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mmc/host/sdhci-st.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
index c95ba83..ed92ce7 100644
--- a/drivers/mmc/host/sdhci-st.c
+++ b/drivers/mmc/host/sdhci-st.c
@@ -28,6 +28,7 @@
 
 struct st_mmc_platform_data {
 	struct  reset_control *rstc;
+	struct  clk *icnclk;
 	void __iomem *top_ioaddr;
 };
 
@@ -353,7 +354,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
 	struct sdhci_host *host;
 	struct st_mmc_platform_data *pdata;
 	struct sdhci_pltfm_host *pltfm_host;
-	struct clk *clk;
+	struct clk *clk, *icnclk;
 	int ret = 0;
 	u16 host_version;
 	struct resource *res;
@@ -365,6 +366,11 @@ static int sdhci_st_probe(struct platform_device *pdev)
 		return PTR_ERR(clk);
 	}
 
+	/* ICN clock isn't compulsory, but use it if it's provided. */
+	icnclk = devm_clk_get(&pdev->dev, "icn");
+	if (IS_ERR(icnclk))
+		icnclk = NULL;
+
 	rstc = devm_reset_control_get(&pdev->dev, NULL);
 	if (IS_ERR(rstc))
 		rstc = NULL;
@@ -389,6 +395,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
 	}
 
 	clk_prepare_enable(clk);
+	clk_prepare_enable(icnclk);
 
 	/* Configure the FlashSS Top registers for setting eMMC TX/RX delay */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
@@ -400,6 +407,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
 	}
 
 	pltfm_host->clk = clk;
+	pdata->icnclk = icnclk;
 
 	/* Configure the Arasan HC inside the flashSS */
 	st_mmcss_cconfig(np, host);
@@ -422,6 +430,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
 	return 0;
 
 err_out:
+	clk_disable_unprepare(icnclk);
 	clk_disable_unprepare(clk);
 err_of:
 	sdhci_pltfm_free(pdev);
@@ -442,6 +451,8 @@ static int sdhci_st_remove(struct platform_device *pdev)
 
 	ret = sdhci_pltfm_unregister(pdev);
 
+	clk_disable_unprepare(pdata->icnclk);
+
 	if (rstc)
 		reset_control_assert(rstc);
 
@@ -462,6 +473,7 @@ static int sdhci_st_suspend(struct device *dev)
 	if (pdata->rstc)
 		reset_control_assert(pdata->rstc);
 
+	clk_disable_unprepare(pdata->icnclk);
 	clk_disable_unprepare(pltfm_host->clk);
 out:
 	return ret;
@@ -475,6 +487,7 @@ static int sdhci_st_resume(struct device *dev)
 	struct device_node *np = dev->of_node;
 
 	clk_prepare_enable(pltfm_host->clk);
+	clk_prepare_enable(pdata->icnclk);
 
 	if (pdata->rstc)
 		reset_control_deassert(pdata->rstc);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] mmc: sdhci-st: Handle interconnect clock
  2016-09-08  9:11 ` [PATCH 4/4] mmc: sdhci-st: Handle interconnect clock Lee Jones
@ 2016-09-08 11:58   ` Lee Jones
  2016-09-12 12:35     ` Ulf Hansson
  0 siblings, 1 reply; 14+ messages in thread
From: Lee Jones @ 2016-09-08 11:58 UTC (permalink / raw)
  To: ulf.hansson, patrice.chotard, peter.griffin, robh, adrian.hunter
  Cc: linux-arm-kernel, linux-kernel, kernel, stable, linux-mmc

Sorry Adrian, left you of the list.  Rectifying.

FYI, this patch is due for the v4.8 -rcs:

  http://www.spinics.net/lists/kernel/msg2338219.html

> Some ST platforms contain interconnect (ICN) clocks which must be handed
> correctly in order to obtain full functionality of a given IP.  In this
> case, if the ICN clocks are not handled properly by the ST SDHCI driver
> MMC will break and the following output can be observed:
> 
>     [   13.916949] mmc0: Timeout waiting for hardware interrupt.
>     [   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
>     [   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
>     [   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
>     [   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
>     [   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
>     [   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
>     [   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
>     [   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
>     [   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
>     [   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
>     [   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
>     [   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
>     [   13.992252] sdhci: Host ctl2: 0x00000000
>     [   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
>     [   14.001990] sdhci: ===========================================
>     [   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.
> 
> A decent point was raised about minimising the use of a local variable that
> we 'could' do without.  I've chosen consistency over the possibility of
> reducing the local variable count by 1.  Thinking that it's more important
> for the code to be grouped and authoured in a similar manner/style for
> greater maintainability/readability.
> 
> Cc: stable@vger.kernel.org
> Tested-by: Peter Griffin <peter.griffin@linaro.org>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/mmc/host/sdhci-st.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
> index c95ba83..ed92ce7 100644
> --- a/drivers/mmc/host/sdhci-st.c
> +++ b/drivers/mmc/host/sdhci-st.c
> @@ -28,6 +28,7 @@
>  
>  struct st_mmc_platform_data {
>  	struct  reset_control *rstc;
> +	struct  clk *icnclk;
>  	void __iomem *top_ioaddr;
>  };
>  
> @@ -353,7 +354,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
>  	struct sdhci_host *host;
>  	struct st_mmc_platform_data *pdata;
>  	struct sdhci_pltfm_host *pltfm_host;
> -	struct clk *clk;
> +	struct clk *clk, *icnclk;
>  	int ret = 0;
>  	u16 host_version;
>  	struct resource *res;
> @@ -365,6 +366,11 @@ static int sdhci_st_probe(struct platform_device *pdev)
>  		return PTR_ERR(clk);
>  	}
>  
> +	/* ICN clock isn't compulsory, but use it if it's provided. */
> +	icnclk = devm_clk_get(&pdev->dev, "icn");
> +	if (IS_ERR(icnclk))
> +		icnclk = NULL;
> +
>  	rstc = devm_reset_control_get(&pdev->dev, NULL);
>  	if (IS_ERR(rstc))
>  		rstc = NULL;
> @@ -389,6 +395,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
>  	}
>  
>  	clk_prepare_enable(clk);
> +	clk_prepare_enable(icnclk);
>  
>  	/* Configure the FlashSS Top registers for setting eMMC TX/RX delay */
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> @@ -400,6 +407,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
>  	}
>  
>  	pltfm_host->clk = clk;
> +	pdata->icnclk = icnclk;
>  
>  	/* Configure the Arasan HC inside the flashSS */
>  	st_mmcss_cconfig(np, host);
> @@ -422,6 +430,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
>  	return 0;
>  
>  err_out:
> +	clk_disable_unprepare(icnclk);
>  	clk_disable_unprepare(clk);
>  err_of:
>  	sdhci_pltfm_free(pdev);
> @@ -442,6 +451,8 @@ static int sdhci_st_remove(struct platform_device *pdev)
>  
>  	ret = sdhci_pltfm_unregister(pdev);
>  
> +	clk_disable_unprepare(pdata->icnclk);
> +
>  	if (rstc)
>  		reset_control_assert(rstc);
>  
> @@ -462,6 +473,7 @@ static int sdhci_st_suspend(struct device *dev)
>  	if (pdata->rstc)
>  		reset_control_assert(pdata->rstc);
>  
> +	clk_disable_unprepare(pdata->icnclk);
>  	clk_disable_unprepare(pltfm_host->clk);
>  out:
>  	return ret;
> @@ -475,6 +487,7 @@ static int sdhci_st_resume(struct device *dev)
>  	struct device_node *np = dev->of_node;
>  
>  	clk_prepare_enable(pltfm_host->clk);
> +	clk_prepare_enable(pdata->icnclk);
>  
>  	if (pdata->rstc)
>  		reset_control_deassert(pdata->rstc);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/4] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB)
  2016-09-08  9:11 ` [PATCH 1/4] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB) Lee Jones
@ 2016-09-08 13:50   ` Patrice Chotard
  2016-09-08 14:06   ` Patrice Chotard
  1 sibling, 0 replies; 14+ messages in thread
From: Patrice Chotard @ 2016-09-08 13:50 UTC (permalink / raw)
  To: Lee Jones, ulf.hansson, peter.griffin, robh
  Cc: linux-arm-kernel, linux-kernel, kernel, stable

Hi Lee


On 09/08/2016 11:11 AM, Lee Jones wrote:
> The STiH4{07,10} platform contains some interconnect clocks which are used
> by various IPs.  If this clock isn't handled correctly by ST's EHCI/OHCI
> drivers, their hub won't be found, the following error be shown and the
> result will be non-working USB:
>
>   [   97.221963] hub 2-1:1.0: hub_ext_port_status failed (err = -110)
>
> Cc: stable@vger.kernel.org
> Tested-by: Peter Griffin <peter.griffin@linaro.org>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  arch/arm/boot/dts/stih410.dtsi | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/boot/dts/stih410.dtsi b/arch/arm/boot/dts/stih410.dtsi
> index 9ee5e20..f1aa34c 100644
> --- a/arch/arm/boot/dts/stih410.dtsi
> +++ b/arch/arm/boot/dts/stih410.dtsi
> @@ -41,7 +41,8 @@
>  			compatible = "st,st-ohci-300x";
>  			reg = <0x9a03c00 0x100>;
>  			interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>;
> -			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
> +			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
>  			resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
>  				 <&softreset STIH407_USB2_PORT0_SOFTRESET>;
>  			reset-names = "power", "softreset";
> @@ -57,7 +58,8 @@
>  			interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>;
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&pinctrl_usb0>;
> -			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
> +			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
>  			resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
>  				 <&softreset STIH407_USB2_PORT0_SOFTRESET>;
>  			reset-names = "power", "softreset";
> @@ -71,7 +73,8 @@
>  			compatible = "st,st-ohci-300x";
>  			reg = <0x9a83c00 0x100>;
>  			interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>;
> -			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
> +			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
>  			resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
>  				 <&softreset STIH407_USB2_PORT1_SOFTRESET>;
>  			reset-names = "power", "softreset";
> @@ -87,7 +90,8 @@
>  			interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>;
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&pinctrl_usb1>;
> -			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
> +			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
>  			resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
>  				 <&softreset STIH407_USB2_PORT1_SOFTRESET>;
>  			reset-names = "power", "softreset";
Acked-by: Patrice Chotard <patrice.chotard@st.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI
  2016-09-08  9:11 ` [PATCH 2/4] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI Lee Jones
@ 2016-09-08 13:50   ` Patrice Chotard
  2016-09-08 14:07   ` Patrice Chotard
  1 sibling, 0 replies; 14+ messages in thread
From: Patrice Chotard @ 2016-09-08 13:50 UTC (permalink / raw)
  To: Lee Jones, ulf.hansson, peter.griffin, robh
  Cc: linux-arm-kernel, linux-kernel, kernel, stable

Hi Lee


On 09/08/2016 11:11 AM, Lee Jones wrote:
> The STiH4{07,10} platform contains some interconnect clocks which are used
> by various IPs.  If these clocks aren't handled correctly by ST's SDHCI
> driver MMC will break and the following output can be observed:
>
> [   13.916949] mmc0: Timeout waiting for hardware interrupt.
> [   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
> [   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
> [   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
> [   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
> [   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
> [   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
> [   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
> [   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
> [   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
> [   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
> [   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
> [   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
> [   13.992252] sdhci: Host ctl2: 0x00000000
> [   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
> [   14.001990] sdhci: ===========================================
> [   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.
>
> Cc: stable@vger.kernel.org
> Tested-by: Peter Griffin <peter.griffin@linaro.org>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  arch/arm/boot/dts/stih407-family.dtsi | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi
> index 55ecfbe..744c5bc 100644
> --- a/arch/arm/boot/dts/stih407-family.dtsi
> +++ b/arch/arm/boot/dts/stih407-family.dtsi
> @@ -550,8 +550,9 @@
>  			interrupt-names = "mmcirq";
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&pinctrl_mmc0>;
> -			clock-names = "mmc";
> -			clocks = <&clk_s_c0_flexgen CLK_MMC_0>;
> +			clock-names = "mmc", "icn";
> +			clocks = <&clk_s_c0_flexgen CLK_MMC_0>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_HVA>;
>  			bus-width = <8>;
>  		};
>  
> @@ -564,8 +565,9 @@
>  			interrupt-names = "mmcirq";
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&pinctrl_sd1>;
> -			clock-names = "mmc";
> -			clocks = <&clk_s_c0_flexgen CLK_MMC_1>;
> +			clock-names = "mmc", "icn";
> +			clocks = <&clk_s_c0_flexgen CLK_MMC_1>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_HVA>;
>  			resets = <&softreset STIH407_MMC1_SOFTRESET>;
>  			bus-width = <4>;
>  		};
Acked-by: Patrice Chotard <patrice.chotard@st.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/4] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB)
  2016-09-08  9:11 ` [PATCH 1/4] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB) Lee Jones
  2016-09-08 13:50   ` Patrice Chotard
@ 2016-09-08 14:06   ` Patrice Chotard
  1 sibling, 0 replies; 14+ messages in thread
From: Patrice Chotard @ 2016-09-08 14:06 UTC (permalink / raw)
  To: Lee Jones, ulf.hansson, peter.griffin, robh
  Cc: linux-arm-kernel, linux-kernel, kernel, stable

Hi Lee

On 09/08/2016 11:11 AM, Lee Jones wrote:
> The STiH4{07,10} platform contains some interconnect clocks which are used
> by various IPs.  If this clock isn't handled correctly by ST's EHCI/OHCI
> drivers, their hub won't be found, the following error be shown and the
> result will be non-working USB:
>
>   [   97.221963] hub 2-1:1.0: hub_ext_port_status failed (err = -110)
>
> Cc: stable@vger.kernel.org
> Tested-by: Peter Griffin <peter.griffin@linaro.org>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  arch/arm/boot/dts/stih410.dtsi | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/boot/dts/stih410.dtsi b/arch/arm/boot/dts/stih410.dtsi
> index 9ee5e20..f1aa34c 100644
> --- a/arch/arm/boot/dts/stih410.dtsi
> +++ b/arch/arm/boot/dts/stih410.dtsi
> @@ -41,7 +41,8 @@
>  			compatible = "st,st-ohci-300x";
>  			reg = <0x9a03c00 0x100>;
>  			interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>;
> -			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
> +			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
>  			resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
>  				 <&softreset STIH407_USB2_PORT0_SOFTRESET>;
>  			reset-names = "power", "softreset";
> @@ -57,7 +58,8 @@
>  			interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>;
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&pinctrl_usb0>;
> -			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
> +			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
>  			resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
>  				 <&softreset STIH407_USB2_PORT0_SOFTRESET>;
>  			reset-names = "power", "softreset";
> @@ -71,7 +73,8 @@
>  			compatible = "st,st-ohci-300x";
>  			reg = <0x9a83c00 0x100>;
>  			interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>;
> -			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
> +			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
>  			resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
>  				 <&softreset STIH407_USB2_PORT1_SOFTRESET>;
>  			reset-names = "power", "softreset";
> @@ -87,7 +90,8 @@
>  			interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>;
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&pinctrl_usb1>;
> -			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
> +			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
>  			resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
>  				 <&softreset STIH407_USB2_PORT1_SOFTRESET>;
>  			reset-names = "power", "softreset";

Applied

thanks

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI
  2016-09-08  9:11 ` [PATCH 2/4] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI Lee Jones
  2016-09-08 13:50   ` Patrice Chotard
@ 2016-09-08 14:07   ` Patrice Chotard
  1 sibling, 0 replies; 14+ messages in thread
From: Patrice Chotard @ 2016-09-08 14:07 UTC (permalink / raw)
  To: Lee Jones, ulf.hansson, peter.griffin, robh
  Cc: linux-arm-kernel, linux-kernel, kernel, stable

Hi Lee


On 09/08/2016 11:11 AM, Lee Jones wrote:
> The STiH4{07,10} platform contains some interconnect clocks which are used
> by various IPs.  If these clocks aren't handled correctly by ST's SDHCI
> driver MMC will break and the following output can be observed:
>
> [   13.916949] mmc0: Timeout waiting for hardware interrupt.
> [   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
> [   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
> [   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
> [   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
> [   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
> [   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
> [   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
> [   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
> [   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
> [   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
> [   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
> [   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
> [   13.992252] sdhci: Host ctl2: 0x00000000
> [   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
> [   14.001990] sdhci: ===========================================
> [   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.
>
> Cc: stable@vger.kernel.org
> Tested-by: Peter Griffin <peter.griffin@linaro.org>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  arch/arm/boot/dts/stih407-family.dtsi | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi
> index 55ecfbe..744c5bc 100644
> --- a/arch/arm/boot/dts/stih407-family.dtsi
> +++ b/arch/arm/boot/dts/stih407-family.dtsi
> @@ -550,8 +550,9 @@
>  			interrupt-names = "mmcirq";
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&pinctrl_mmc0>;
> -			clock-names = "mmc";
> -			clocks = <&clk_s_c0_flexgen CLK_MMC_0>;
> +			clock-names = "mmc", "icn";
> +			clocks = <&clk_s_c0_flexgen CLK_MMC_0>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_HVA>;
>  			bus-width = <8>;
>  		};
>  
> @@ -564,8 +565,9 @@
>  			interrupt-names = "mmcirq";
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&pinctrl_sd1>;
> -			clock-names = "mmc";
> -			clocks = <&clk_s_c0_flexgen CLK_MMC_1>;
> +			clock-names = "mmc", "icn";
> +			clocks = <&clk_s_c0_flexgen CLK_MMC_1>,
> +				 <&clk_s_c0_flexgen CLK_RX_ICN_HVA>;
>  			resets = <&softreset STIH407_MMC1_SOFTRESET>;
>  			bus-width = <4>;
>  		};

Applied

Thanks

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/4] dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock
  2016-09-08  9:11 ` [PATCH 3/4] dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock Lee Jones
@ 2016-09-09 11:50   ` Ulf Hansson
  2016-09-10 17:09     ` Lee Jones
  2016-09-12 12:35   ` Ulf Hansson
  1 sibling, 1 reply; 14+ messages in thread
From: Ulf Hansson @ 2016-09-09 11:50 UTC (permalink / raw)
  To: Lee Jones
  Cc: Patrice CHOTARD, Peter Griffin, Rob Herring, linux-arm-kernel,
	linux-kernel, kernel

On 8 September 2016 at 11:11, Lee Jones <lee.jones@linaro.org> wrote:
> The interconnect (ICN) clock is required for functional working of
> MMC on some ST platforms.  When not supplied it can result in
> broken MMC and the following output:
>
>         [   13.916949] mmc0: Timeout waiting for hardware interrupt.
>         [   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
>         [   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
>         [   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
>         [   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
>         [   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
>         [   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
>         [   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
>         [   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
>         [   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
>         [   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
>         [   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
>         [   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
>         [   13.992252] sdhci: Host ctl2: 0x00000000
>         [   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
>         [   14.001990] sdhci: ===========================================
>         [   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  Documentation/devicetree/bindings/mmc/sdhci-st.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/mmc/sdhci-st.txt b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
> index 88faa91..3cd4c43 100644
> --- a/Documentation/devicetree/bindings/mmc/sdhci-st.txt
> +++ b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
> @@ -10,7 +10,7 @@ Required properties:
>                         subsystem (mmcss) inside the FlashSS (available in STiH407 SoC
>                         family).
>
> -- clock-names:         Should be "mmc".
> +- clock-names:         Should be "mmc" and "icn".  (NB: The latter is not compulsory)
>                         See: Documentation/devicetree/bindings/resource-names.txt
>  - clocks:              Phandle to the clock.
>                         See: Documentation/devicetree/bindings/clock/clock-bindings.txt
> --
> 2.9.3
>

This looks good to me!

I am guessing you want this to go through my mmc tree, as I think
patch 3 and patch 4 should go together. If not, tell me.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/4] dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock
  2016-09-09 11:50   ` Ulf Hansson
@ 2016-09-10 17:09     ` Lee Jones
  0 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2016-09-10 17:09 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Patrice CHOTARD, Peter Griffin, Rob Herring, linux-arm-kernel,
	linux-kernel, kernel

On 9 September 2016 at 12:50, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 8 September 2016 at 11:11, Lee Jones <lee.jones@linaro.org> wrote:
>> The interconnect (ICN) clock is required for functional working of
>> MMC on some ST platforms.  When not supplied it can result in
>> broken MMC and the following output:
>>
>>         [   13.916949] mmc0: Timeout waiting for hardware interrupt.
>>         [   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
>>         [   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
>>         [   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
>>         [   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
>>         [   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
>>         [   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
>>         [   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
>>         [   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
>>         [   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
>>         [   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
>>         [   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
>>         [   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
>>         [   13.992252] sdhci: Host ctl2: 0x00000000
>>         [   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
>>         [   14.001990] sdhci: ===========================================
>>         [   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.
>>
>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>> ---
>>  Documentation/devicetree/bindings/mmc/sdhci-st.txt | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/mmc/sdhci-st.txt b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
>> index 88faa91..3cd4c43 100644
>> --- a/Documentation/devicetree/bindings/mmc/sdhci-st.txt
>> +++ b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
>> @@ -10,7 +10,7 @@ Required properties:
>>                         subsystem (mmcss) inside the FlashSS (available in STiH407 SoC
>>                         family).
>>
>> -- clock-names:         Should be "mmc".
>> +- clock-names:         Should be "mmc" and "icn".  (NB: The latter is not compulsory)
>>                         See: Documentation/devicetree/bindings/resource-names.txt
>>  - clocks:              Phandle to the clock.
>>                         See: Documentation/devicetree/bindings/clock/clock-bindings.txt
>> --
>> 2.9.3
>>
>
> This looks good to me!
>
> I am guessing you want this to go through my mmc tree, as I think
> patch 3 and patch 4 should go together. If not, tell me.

That's correct, thanks.

-- 
Lee Jones
Linaro ST Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/4] dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock
  2016-09-08  9:11 ` [PATCH 3/4] dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock Lee Jones
  2016-09-09 11:50   ` Ulf Hansson
@ 2016-09-12 12:35   ` Ulf Hansson
  1 sibling, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2016-09-12 12:35 UTC (permalink / raw)
  To: Lee Jones
  Cc: Patrice CHOTARD, Peter Griffin, Rob Herring, linux-arm-kernel,
	linux-kernel, kernel

On 8 September 2016 at 11:11, Lee Jones <lee.jones@linaro.org> wrote:
> The interconnect (ICN) clock is required for functional working of
> MMC on some ST platforms.  When not supplied it can result in
> broken MMC and the following output:
>
>         [   13.916949] mmc0: Timeout waiting for hardware interrupt.
>         [   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
>         [   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
>         [   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
>         [   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
>         [   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
>         [   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
>         [   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
>         [   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
>         [   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
>         [   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
>         [   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
>         [   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
>         [   13.992252] sdhci: Host ctl2: 0x00000000
>         [   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
>         [   14.001990] sdhci: ===========================================
>         [   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Thanks, applied for fixes!

Kind regards
Uffe

> ---
>  Documentation/devicetree/bindings/mmc/sdhci-st.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/mmc/sdhci-st.txt b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
> index 88faa91..3cd4c43 100644
> --- a/Documentation/devicetree/bindings/mmc/sdhci-st.txt
> +++ b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
> @@ -10,7 +10,7 @@ Required properties:
>                         subsystem (mmcss) inside the FlashSS (available in STiH407 SoC
>                         family).
>
> -- clock-names:         Should be "mmc".
> +- clock-names:         Should be "mmc" and "icn".  (NB: The latter is not compulsory)
>                         See: Documentation/devicetree/bindings/resource-names.txt
>  - clocks:              Phandle to the clock.
>                         See: Documentation/devicetree/bindings/clock/clock-bindings.txt
> --
> 2.9.3
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] mmc: sdhci-st: Handle interconnect clock
  2016-09-08 11:58   ` Lee Jones
@ 2016-09-12 12:35     ` Ulf Hansson
  0 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2016-09-12 12:35 UTC (permalink / raw)
  To: Lee Jones
  Cc: Patrice CHOTARD, Peter Griffin, Rob Herring, Adrian Hunter,
	linux-arm-kernel, linux-kernel, kernel, # 4.0+,
	linux-mmc

On 8 September 2016 at 13:58, Lee Jones <lee.jones@linaro.org> wrote:
> Sorry Adrian, left you of the list.  Rectifying.
>
> FYI, this patch is due for the v4.8 -rcs:
>
>   http://www.spinics.net/lists/kernel/msg2338219.html
>
>> Some ST platforms contain interconnect (ICN) clocks which must be handed
>> correctly in order to obtain full functionality of a given IP.  In this
>> case, if the ICN clocks are not handled properly by the ST SDHCI driver
>> MMC will break and the following output can be observed:
>>
>>     [   13.916949] mmc0: Timeout waiting for hardware interrupt.
>>     [   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
>>     [   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
>>     [   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
>>     [   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
>>     [   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
>>     [   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
>>     [   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
>>     [   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
>>     [   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
>>     [   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
>>     [   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
>>     [   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
>>     [   13.992252] sdhci: Host ctl2: 0x00000000
>>     [   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
>>     [   14.001990] sdhci: ===========================================
>>     [   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.
>>
>> A decent point was raised about minimising the use of a local variable that
>> we 'could' do without.  I've chosen consistency over the possibility of
>> reducing the local variable count by 1.  Thinking that it's more important
>> for the code to be grouped and authoured in a similar manner/style for
>> greater maintainability/readability.
>>
>> Cc: stable@vger.kernel.org
>> Tested-by: Peter Griffin <peter.griffin@linaro.org>
>> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Thanks, applied for fixes!

Adrian, please tell if you have any objections else I intend to send
this for the rcs later this week.

Kind regards
Uffe

>> ---
>>  drivers/mmc/host/sdhci-st.c | 15 ++++++++++++++-
>>  1 file changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
>> index c95ba83..ed92ce7 100644
>> --- a/drivers/mmc/host/sdhci-st.c
>> +++ b/drivers/mmc/host/sdhci-st.c
>> @@ -28,6 +28,7 @@
>>
>>  struct st_mmc_platform_data {
>>       struct  reset_control *rstc;
>> +     struct  clk *icnclk;
>>       void __iomem *top_ioaddr;
>>  };
>>
>> @@ -353,7 +354,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
>>       struct sdhci_host *host;
>>       struct st_mmc_platform_data *pdata;
>>       struct sdhci_pltfm_host *pltfm_host;
>> -     struct clk *clk;
>> +     struct clk *clk, *icnclk;
>>       int ret = 0;
>>       u16 host_version;
>>       struct resource *res;
>> @@ -365,6 +366,11 @@ static int sdhci_st_probe(struct platform_device *pdev)
>>               return PTR_ERR(clk);
>>       }
>>
>> +     /* ICN clock isn't compulsory, but use it if it's provided. */
>> +     icnclk = devm_clk_get(&pdev->dev, "icn");
>> +     if (IS_ERR(icnclk))
>> +             icnclk = NULL;
>> +
>>       rstc = devm_reset_control_get(&pdev->dev, NULL);
>>       if (IS_ERR(rstc))
>>               rstc = NULL;
>> @@ -389,6 +395,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
>>       }
>>
>>       clk_prepare_enable(clk);
>> +     clk_prepare_enable(icnclk);
>>
>>       /* Configure the FlashSS Top registers for setting eMMC TX/RX delay */
>>       res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>> @@ -400,6 +407,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
>>       }
>>
>>       pltfm_host->clk = clk;
>> +     pdata->icnclk = icnclk;
>>
>>       /* Configure the Arasan HC inside the flashSS */
>>       st_mmcss_cconfig(np, host);
>> @@ -422,6 +430,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
>>       return 0;
>>
>>  err_out:
>> +     clk_disable_unprepare(icnclk);
>>       clk_disable_unprepare(clk);
>>  err_of:
>>       sdhci_pltfm_free(pdev);
>> @@ -442,6 +451,8 @@ static int sdhci_st_remove(struct platform_device *pdev)
>>
>>       ret = sdhci_pltfm_unregister(pdev);
>>
>> +     clk_disable_unprepare(pdata->icnclk);
>> +
>>       if (rstc)
>>               reset_control_assert(rstc);
>>
>> @@ -462,6 +473,7 @@ static int sdhci_st_suspend(struct device *dev)
>>       if (pdata->rstc)
>>               reset_control_assert(pdata->rstc);
>>
>> +     clk_disable_unprepare(pdata->icnclk);
>>       clk_disable_unprepare(pltfm_host->clk);
>>  out:
>>       return ret;
>> @@ -475,6 +487,7 @@ static int sdhci_st_resume(struct device *dev)
>>       struct device_node *np = dev->of_node;
>>
>>       clk_prepare_enable(pltfm_host->clk);
>> +     clk_prepare_enable(pdata->icnclk);
>>
>>       if (pdata->rstc)
>>               reset_control_deassert(pdata->rstc);
>
> --
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-09-12 12:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-08  9:11 [PATCH 0/4] ARM: MMC: USB: Fix clocking Lee Jones
2016-09-08  9:11 ` [PATCH 1/4] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB) Lee Jones
2016-09-08 13:50   ` Patrice Chotard
2016-09-08 14:06   ` Patrice Chotard
2016-09-08  9:11 ` [PATCH 2/4] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI Lee Jones
2016-09-08 13:50   ` Patrice Chotard
2016-09-08 14:07   ` Patrice Chotard
2016-09-08  9:11 ` [PATCH 3/4] dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock Lee Jones
2016-09-09 11:50   ` Ulf Hansson
2016-09-10 17:09     ` Lee Jones
2016-09-12 12:35   ` Ulf Hansson
2016-09-08  9:11 ` [PATCH 4/4] mmc: sdhci-st: Handle interconnect clock Lee Jones
2016-09-08 11:58   ` Lee Jones
2016-09-12 12:35     ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).