Skip to contentSkip to conversation

amlogic: t7: give the MMC bus pipeline clock real consumers

PATCH Applied Lucas Tanure 7 participants 20 messages Sep 5 – Oct 10

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

v2 cover amlogic: t7: give the MMC bus pipeline clock real consumers

The previous series for the intermittent boot hangs on the VIM4 marked sys_ampipe_nand as critical. But as Chuan Liu from Amlogic explained, sys_ampipe_nand clocks a pipeline stage that the hardware design inserts in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric to help timing closure.

So the clock has real consumers: reference it from the three MMC controller nodes and drop CLK_IS_CRITICAL instead.

The series crosses three trees; patch 4 (clk) must only land after patches 1-3, otherwise the DMA hangs fixed by 43e1705ecab9 come back.

Changes since v1 [3]:
- Dropped the Fixes: tag; this series is an improvement and should not be picked up by stable (Jerome Brunet)
- Moved the patch 4 dependency note below the --- so it is not kept for posterity (Jerome Brunet)
- Dropped the e-mail address from the Assisted-by trailer, see Documentation/process/coding-assistants.rst (Jerome Brunet)
- Fixed the space-indented error path added to meson_mmc_probe() in patch 2, it did not pass checkpatch
- Dropped the CLK_PIPELINE() macro from patch 2; has_pipeline_clk is a capability flag, not an SD_EMMC_CLOCK register field

Thanks,
Lucas

Lucas Tanure (4):
dt-bindings: mmc: amlogic,meson-gx-mmc: document the T7 pipeline clock
mmc: meson-gx: enable the bus pipeline clock on T7
arm64: dts: amlogic: t7: add the pipeline clock to the MMC controllers
clk: meson: t7: don't mark sys_ampipe_nand as critical

 .../bindings/mmc/amlogic,meson-gx-mmc.yaml    | 29 ++++++++++++++++++-
 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   | 15 ++++++----
 drivers/clk/meson/t7-peripherals.c            | 10 +++----
 drivers/mmc/host/meson-gx-mmc.c               | 20 +++++++++++++
 4 files changed, 62 insertions(+), 12 deletions(-)
Signature · 1 line
2.55.0
#1 lore raw

PATCH v2 1/4 dt-bindings: mmc: amlogic,meson-gx-mmc: document the T7 pipeline clock

The SD/eMMC controllers of the T7 SoC are physically far from the NIC_MATRIX bus fabric, so the hardware design inserts a pipeline stage in the middle of the bus path to help timing closure. This stage is fed by its own gate clock and, when that clock is disabled, a controller that starts a DMA transfer can never complete it.

Allow a fourth clock entry, named "pipeline", and require it for the amlogic,t7-mmc compatible. The other controllers of this family keep the existing three clocks.

Assisted-by Claude:claude-fable-5
---
 .../bindings/mmc/amlogic,meson-gx-mmc.yaml    | 29 ++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mmc/amlogic,meson-gx-mmc.yaml +28 -1
index 976f36de2091..12342b1d78e5 100644
@@ -15,6 +15,23 @@ maintainers:
 
 allOf:
   - $ref: mmc-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: amlogic,t7-mmc
+    then:
+      properties:
+        clocks:
+          minItems: 4
+        clock-names:
+          minItems: 4
+    else:
+      properties:
+        clocks:
+          maxItems: 3
+        clock-names:
+          maxItems: 3
 
 properties:
   compatible:
@@ -38,13 +55,23 @@ properties:
       - description: card detect
 
   clocks:
-    maxItems: 3
+    minItems: 3
+    items:
+      - description: core clock
+      - description: clock input 0 of the internal mux
+      - description: clock input 1 of the internal mux
+      - description:
+          clock of the pipeline stage inserted in the bus path between
+          the controller and the DRAM. Without it, the controller cannot
+          complete DMA transfers.
 
   clock-names:
+    minItems: 3
     items:
       - const: core
       - const: clkin0
       - const: clkin1
+      - const: pipeline
 
   resets:
     maxItems: 1
Signature · 1 line
2.55.0
maintainer
#3 lore raw

Re: [PATCH v2 1/4] dt-bindings: mmc: amlogic,meson-gx-mmc: document the T7 pipeline clock

In reply to Lucas Tanure
Quoted 9 lines · Lucas Tanure

The SD/eMMC controllers of the T7 SoC are physically far from the NIC_MATRIX bus fabric, so the hardware design inserts a pipeline stage in the middle of the bus path to help timing closure. This stage is fed by its own gate clock and, when that clock is disabled, a controller that starts a DMA transfer can never complete it.

Allow a fourth clock entry, named "pipeline", and require it for the amlogic,t7-mmc compatible. The other controllers of this family keep the existing three clocks.

Did the SD controller not work without this clock? If it did, then this is an ABI break which is evident by the current warning in linux-next.

Rob

#4 lore raw

Re: [PATCH v2 1/4] dt-bindings: mmc: amlogic,meson-gx-mmc: document the T7 pipeline clock

Quoted 7 lines · Rob Herring
Quoted 6 lines · Lucas Tanure

The SD/eMMC controllers of the T7 SoC are physically far from the NIC_MATRIX bus fabric, so the hardware design inserts a pipeline stage in the middle of the bus path to help timing closure. This stage is fed by its own gate clock and, when that clock is disabled, a controller that starts a DMA transfer can never complete it.

Quoted 8 lines
Quoted 3 lines

Allow a fourth clock entry, named "pipeline", and require it for the amlogic,t7-mmc compatible. The other controllers of this family keep the existing three clocks.

Did the SD controller not work without this clock? If it did, then this is an ABI break which is evident by the current warning in linux-next.

Rob

Yes, the SD controller doesn't work with this clock, so I don't think is a ABI break, as the current code doesn't work and the board crashes a lot. And a few patches got merged from my work, so I will resubmit a new series for this.

Thanks
Lucas

#5 lore raw

PATCH v2 2/4 mmc: meson-gx: enable the bus pipeline clock on T7

In reply to Lucas Tanure

On the T7 SoC, the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric goes through a pipeline stage inserted by the hardware design to help timing closure. The stage has its own gate clock and, when that clock is disabled, a controller that starts a DMA transfer can never complete it, hanging the storage devices and, from there, the whole system.

Add a dedicated match data for the amlogic,t7-mmc compatible that makes the driver claim and enable the "pipeline" clock for as long as the device is bound.

The clock is deliberately not optional: the hardware cannot do DMA without it, and failing the probe with a clear error is preferable to booting and hitting an undiagnosable DMA hang later.

Assisted-by Claude:claude-fable-5
---
 drivers/mmc/host/meson-gx-mmc.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/mmc/host/meson-gx-mmc.c +20 -0
index 694bb443d5f3..c0f1e929fc13 100644
@@ -139,6 +139,7 @@ struct meson_mmc_data {
 	unsigned int always_on;
 	unsigned int adjust;
 	unsigned int irq_sdio_sleep;
+	bool has_pipeline_clk;
 };
 
 struct sd_emmc_desc {
@@ -1204,6 +1205,15 @@ static int meson_mmc_probe(struct platform_device *pdev)
 	if (IS_ERR(core_clk))
 		return PTR_ERR(core_clk);
 
+	if (host->data->has_pipeline_clk) {
+		struct clk *pipe_clk;
+
+		pipe_clk = devm_clk_get_enabled(&pdev->dev, "pipeline");
+		if (IS_ERR(pipe_clk))
+			return dev_err_probe(&pdev->dev, PTR_ERR(pipe_clk),
+					     "missing pipeline clock\n");
+	}
+
 	ret = meson_mmc_clk_init(host);
 	if (ret)
 		return ret;
@@ -1322,12 +1332,22 @@ static const struct meson_mmc_data meson_axg_data = {
 	.irq_sdio_sleep	= CLK_V3_IRQ_SDIO_SLEEP,
 };
 
+static const struct meson_mmc_data meson_t7_data = {
+	.tx_delay_mask	= CLK_V3_TX_DELAY_MASK,
+	.rx_delay_mask	= CLK_V3_RX_DELAY_MASK,
+	.always_on	= CLK_V3_ALWAYS_ON,
+	.adjust		= SD_EMMC_V3_ADJUST,
+	.irq_sdio_sleep	= CLK_V3_IRQ_SDIO_SLEEP,
+	.has_pipeline_clk = true,
+};
+
 static const struct of_device_id meson_mmc_of_match[] = {
 	{ .compatible = "amlogic,meson-gx-mmc",		.data = &meson_gx_data },
 	{ .compatible = "amlogic,meson-gxbb-mmc", 	.data = &meson_gx_data },
 	{ .compatible = "amlogic,meson-gxl-mmc",	.data = &meson_gx_data },
 	{ .compatible = "amlogic,meson-gxm-mmc",	.data = &meson_gx_data },
 	{ .compatible = "amlogic,meson-axg-mmc",	.data = &meson_axg_data },
+	{ .compatible = "amlogic,t7-mmc",		.data = &meson_t7_data },
 	{}
 };
 MODULE_DEVICE_TABLE(of, meson_mmc_of_match);
Signature · 1 line
2.55.0
maintainer Reviewed-by on v2 2/4
#6 lore raw

Re: [PATCH v2 2/4] mmc: meson-gx: enable the bus pipeline clock on T7

Quoted 62 lines · Lucas Tanure

On the T7 SoC, the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric goes through a pipeline stage inserted by the hardware design to help timing closure. The stage has its own gate clock and, when that clock is disabled, a controller that starts a DMA transfer can never complete it, hanging the storage devices and, from there, the whole system.

Add a dedicated match data for the amlogic,t7-mmc compatible that makes the driver claim and enable the "pipeline" clock for as long as the device is bound.

The clock is deliberately not optional: the hardware cannot do DMA without it, and failing the probe with a clear error is preferable to booting and hitting an undiagnosable DMA hang later.

Assisted-by Claude:claude-fable-5
---
  drivers/mmc/host/meson-gx-mmc.c | 20 ++++++++++++++++++++
  1 file changed, 20 insertions(+)
drivers/mmc/host/meson-gx-mmc.c +19 -0
index 694bb443d5f3..c0f1e929fc13 100644
@@ -139,6 +139,7 @@ struct meson_mmc_data {
  	unsigned int always_on;
  	unsigned int adjust;
  	unsigned int irq_sdio_sleep;
+	bool has_pipeline_clk;
  };
 
  struct sd_emmc_desc {
@@ -1204,6 +1205,15 @@ static int meson_mmc_probe(struct platform_device *pdev)
  	if (IS_ERR(core_clk))
  		return PTR_ERR(core_clk);
 
+	if (host->data->has_pipeline_clk) {
+		struct clk *pipe_clk;
+
+		pipe_clk = devm_clk_get_enabled(&pdev->dev, "pipeline");
+		if (IS_ERR(pipe_clk))
+			return dev_err_probe(&pdev->dev, PTR_ERR(pipe_clk),
+					     "missing pipeline clock\n");
+	}
+
  	ret = meson_mmc_clk_init(host);
  	if (ret)
  		return ret;
@@ -1322,12 +1332,22 @@ static const struct meson_mmc_data meson_axg_data = {
  	.irq_sdio_sleep	= CLK_V3_IRQ_SDIO_SLEEP,
  };
 
+static const struct meson_mmc_data meson_t7_data = {
+	.tx_delay_mask	= CLK_V3_TX_DELAY_MASK,
+	.rx_delay_mask	= CLK_V3_RX_DELAY_MASK,
+	.always_on	= CLK_V3_ALWAYS_ON,
+	.adjust		= SD_EMMC_V3_ADJUST,
+	.irq_sdio_sleep	= CLK_V3_IRQ_SDIO_SLEEP,
+	.has_pipeline_clk = true,
+};
+

drivers/mmc/host/meson-gx-mmc.c static const struct meson_mmc_data meson_axg_data = { · line 1353

Quoted 10 lines
drivers/mmc/host/meson-gx-mmc.c +1 -0
  static const struct of_device_id meson_mmc_of_match[] = {
  	{ .compatible = "amlogic,meson-gx-mmc",		.data = &meson_gx_data },
  	{ .compatible = "amlogic,meson-gxbb-mmc", 	.data = &meson_gx_data },
  	{ .compatible = "amlogic,meson-gxl-mmc",	.data = &meson_gx_data },
  	{ .compatible = "amlogic,meson-gxm-mmc",	.data = &meson_gx_data },
  	{ .compatible = "amlogic,meson-axg-mmc",	.data = &meson_axg_data },
+	{ .compatible = "amlogic,t7-mmc",		.data = &meson_t7_data },
  	{}
  };
  MODULE_DEVICE_TABLE(of, meson_mmc_of_match);

Thanks,
Neil

#7 lore raw

PATCH v2 3/4 arm64: dts: amlogic: t7: add the pipeline clock to the MMC controllers

In reply to Lucas Tanure

The SD/eMMC controllers reach the DRAM through a pipeline stage that the hardware design inserts in the bus path to the NIC_MATRIX fabric, clocked by CLKID_SYS_AMPIPE_NAND. When that clock is disabled, a controller that starts a DMA transfer can never complete it.

Reference the clock from the three MMC controller nodes so the driver keeps it running, instead of relying on the clock being marked critical in the clock controller.

Assisted-by Claude:claude-fable-5
---
 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi +9 -6
index c3dc479b137d..dbb4a95652c6 100644
@@ -730,8 +730,9 @@ sd_emmc_a: mmc@88000 {
 				interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clkc_periphs CLKID_SYS_SD_EMMC_A>,
 					 <&clkc_periphs CLKID_SD_EMMC_A>,
-					 <&scmi_clk CLKID_FCLK_DIV2>;
-				clock-names = "core", "clkin0", "clkin1";
+					 <&scmi_clk CLKID_FCLK_DIV2>,
+					 <&clkc_periphs CLKID_SYS_AMPIPE_NAND>;
+				clock-names = "core", "clkin0", "clkin1", "pipeline";
 				resets = <&reset RESET_SD_EMMC_A>;
 				assigned-clocks = <&clkc_periphs CLKID_SD_EMMC_A_SEL>;
 				assigned-clock-parents = <&xtal>;
@@ -744,8 +745,9 @@ sd_emmc_b: mmc@8a000 {
 				interrupts = <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>;
 				clocks = <&clkc_periphs CLKID_SYS_SD_EMMC_B>,
 					 <&clkc_periphs CLKID_SD_EMMC_B>,
-					 <&scmi_clk CLKID_FCLK_DIV2>;
-				clock-names = "core", "clkin0", "clkin1";
+					 <&scmi_clk CLKID_FCLK_DIV2>,
+					 <&clkc_periphs CLKID_SYS_AMPIPE_NAND>;
+				clock-names = "core", "clkin0", "clkin1", "pipeline";
 				resets = <&reset RESET_SD_EMMC_B>;
 				assigned-clocks = <&clkc_periphs CLKID_SD_EMMC_B_SEL>;
 				assigned-clock-parents = <&xtal>;
@@ -758,8 +760,9 @@ sd_emmc_c: mmc@8c000 {
 				interrupts = <GIC_SPI 178 IRQ_TYPE_EDGE_RISING>;
 				clocks = <&clkc_periphs CLKID_SYS_SD_EMMC_C>,
 					 <&clkc_periphs CLKID_SD_EMMC_C>,
-					 <&scmi_clk CLKID_FCLK_DIV2>;
-				clock-names = "core", "clkin0", "clkin1";
+					 <&scmi_clk CLKID_FCLK_DIV2>,
+					 <&clkc_periphs CLKID_SYS_AMPIPE_NAND>;
+				clock-names = "core", "clkin0", "clkin1", "pipeline";
 				resets = <&reset RESET_SD_EMMC_C>;
 				assigned-clocks = <&clkc_periphs CLKID_SD_EMMC_C_SEL>;
 				assigned-clock-parents = <&xtal>;
Signature · 1 line
2.55.0
maintainer Reviewed-by on v2 3/4
#8 lore raw

Re: [PATCH v2 3/4] arm64: dts: amlogic: t7: add the pipeline clock to the MMC controllers

Quoted 45 lines · Lucas Tanure

The SD/eMMC controllers reach the DRAM through a pipeline stage that the hardware design inserts in the bus path to the NIC_MATRIX fabric, clocked by CLKID_SYS_AMPIPE_NAND. When that clock is disabled, a controller that starts a DMA transfer can never complete it.

Reference the clock from the three MMC controller nodes so the driver keeps it running, instead of relying on the clock being marked critical in the clock controller.

Assisted-by Claude:claude-fable-5
---
  arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi | 15 +++++++++------
  1 file changed, 9 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi +6 -4
index c3dc479b137d..dbb4a95652c6 100644
@@ -730,8 +730,9 @@ sd_emmc_a: mmc@88000 {
  				interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
  				clocks = <&clkc_periphs CLKID_SYS_SD_EMMC_A>,
  					 <&clkc_periphs CLKID_SD_EMMC_A>,
-					 <&scmi_clk CLKID_FCLK_DIV2>;
-				clock-names = "core", "clkin0", "clkin1";
+					 <&scmi_clk CLKID_FCLK_DIV2>,
+					 <&clkc_periphs CLKID_SYS_AMPIPE_NAND>;
+				clock-names = "core", "clkin0", "clkin1", "pipeline";
  				resets = <&reset RESET_SD_EMMC_A>;
  				assigned-clocks = <&clkc_periphs CLKID_SD_EMMC_A_SEL>;
  				assigned-clock-parents = <&xtal>;
@@ -744,8 +745,9 @@ sd_emmc_b: mmc@8a000 {
  				interrupts = <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>;
  				clocks = <&clkc_periphs CLKID_SYS_SD_EMMC_B>,
  					 <&clkc_periphs CLKID_SD_EMMC_B>,
-					 <&scmi_clk CLKID_FCLK_DIV2>;
-				clock-names = "core", "clkin0", "clkin1";
+					 <&scmi_clk CLKID_FCLK_DIV2>,
+					 <&clkc_periphs CLKID_SYS_AMPIPE_NAND>;
+				clock-names = "core", "clkin0", "clkin1", "pipeline";
  				resets = <&reset RESET_SD_EMMC_B>;
  				assigned-clocks = <&clkc_periphs CLKID_SD_EMMC_B_SEL>;
  				assigned-clock-parents = <&xtal>;
@@ -758,8 +760,9 @@ sd_emmc_c: mmc@8c000 {
  				interrupts = <GIC_SPI 178 IRQ_TYPE_EDGE_RISING>;

arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi sd_emmc_c: mmc@8c000 { · line 768

Quoted 10 lines
arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi +3 -2
  				clocks = <&clkc_periphs CLKID_SYS_SD_EMMC_C>,
  					 <&clkc_periphs CLKID_SD_EMMC_C>,
-					 <&scmi_clk CLKID_FCLK_DIV2>;
-				clock-names = "core", "clkin0", "clkin1";
+					 <&scmi_clk CLKID_FCLK_DIV2>,
+					 <&clkc_periphs CLKID_SYS_AMPIPE_NAND>;
+				clock-names = "core", "clkin0", "clkin1", "pipeline";
  				resets = <&reset RESET_SD_EMMC_C>;
  				assigned-clocks = <&clkc_periphs CLKID_SD_EMMC_C_SEL>;
  				assigned-clock-parents = <&xtal>;

Thanks,
Neil

#9 lore raw

PATCH v2 4/4 clk: meson: t7: don't mark sys_ampipe_nand as critical

In reply to Lucas Tanure

sys_ampipe_nand clocks the pipeline stage inserted in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric. It does have identifiable consumers - the three MMC controllers - so marking it critical was the wrong tool: the clock should be referenced from the consumer nodes and claimed by the mmc driver instead.

Drop the CLK_IS_CRITICAL flag and update the comment accordingly. sys_am2axi0..2 remain critical as they clock the AXI DMA bus itself and have no single identifiable consumer.

Assisted-by Claude:claude-fable-5

---
This patch depends on the MMC controllers actually referencing the clock:
the dt-bindings, mmc driver and t7 DTS changes adding the "pipeline" clock must land before this patch, otherwise the boot hangs and memory corruption this clock caused are reintroduced.

 drivers/clk/meson/t7-peripherals.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/meson/t7-peripherals.c +5 -5
index 55d09e78593b..2f429ea86796 100644
@@ -945,13 +945,13 @@ static T7_SYS_PCLK(sys_aucpu,		SYS_CLK_EN0_REG0, 14,	0);
 static T7_SYS_PCLK(sys_cec,		SYS_CLK_EN0_REG0, 16,	0);
 static T7_SYS_PCLK(sys_gdc,		SYS_CLK_EN0_REG0, 17,	0);
 static T7_SYS_PCLK(sys_deswarp,		SYS_CLK_EN0_REG0, 18,	0);
+static T7_SYS_PCLK(sys_ampipe_nand,	SYS_CLK_EN0_REG0, 19,	0);
+static T7_SYS_PCLK(sys_ampipe_eth,	SYS_CLK_EN0_REG0, 20,	0);
 /*
- * NOTE: sys_ampipe_nand and sys_am2axi0..2 provide the clock to the AXI bus
- * used for DMA between the peripherals and the DRAM. After the clocks are
- * disabled, a device that starts a transfer cannot complete it.
+ * NOTE: sys_am2axi0..2 provide the clock to the AXI bus used for DMA between
+ * the peripherals and the DRAM. After the clocks are disabled, a device that
+ * starts a transfer cannot complete it.
  */
-static T7_SYS_PCLK(sys_ampipe_nand,	SYS_CLK_EN0_REG0, 19,	CLK_IS_CRITICAL);
-static T7_SYS_PCLK(sys_ampipe_eth,	SYS_CLK_EN0_REG0, 20,	0);
 static T7_SYS_PCLK(sys_am2axi0,		SYS_CLK_EN0_REG0, 21,	CLK_IS_CRITICAL);
 static T7_SYS_PCLK(sys_am2axi1,		SYS_CLK_EN0_REG0, 22,	CLK_IS_CRITICAL);
 static T7_SYS_PCLK(sys_am2axi2,		SYS_CLK_EN0_REG0, 23,	CLK_IS_CRITICAL);
Signature · 1 line
2.55.0
maintainer Reviewed-by on v2 4/4
#10 lore raw

Re: [PATCH v2 4/4] clk: meson: t7: don't mark sys_ampipe_nand as critical

Quoted 34 lines · Lucas Tanure

sys_ampipe_nand clocks the pipeline stage inserted in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric. It does have identifiable consumers - the three MMC controllers - so marking it critical was the wrong tool: the clock should be referenced from the consumer nodes and claimed by the mmc driver instead.

Drop the CLK_IS_CRITICAL flag and update the comment accordingly. sys_am2axi0..2 remain critical as they clock the AXI DMA bus itself and have no single identifiable consumer.

Assisted-by Claude:claude-fable-5

---
This patch depends on the MMC controllers actually referencing the clock:
the dt-bindings, mmc driver and t7 DTS changes adding the "pipeline" clock must land before this patch, otherwise the boot hangs and memory corruption this clock caused are reintroduced.

  drivers/clk/meson/t7-peripherals.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/meson/t7-peripherals.c +2 -2
index 55d09e78593b..2f429ea86796 100644
@@ -945,13 +945,13 @@ static T7_SYS_PCLK(sys_aucpu,		SYS_CLK_EN0_REG0, 14,	0);
  static T7_SYS_PCLK(sys_cec,		SYS_CLK_EN0_REG0, 16,	0);
  static T7_SYS_PCLK(sys_gdc,		SYS_CLK_EN0_REG0, 17,	0);
  static T7_SYS_PCLK(sys_deswarp,		SYS_CLK_EN0_REG0, 18,	0);
+static T7_SYS_PCLK(sys_ampipe_nand,	SYS_CLK_EN0_REG0, 19,	0);
+static T7_SYS_PCLK(sys_ampipe_eth,	SYS_CLK_EN0_REG0, 20,	0);
  /*
- * NOTE: sys_ampipe_nand and sys_am2axi0..2 provide the clock to the AXI bus
- * used for DMA between the peripherals and the DRAM. After the clocks are

drivers/clk/meson/t7-peripherals.c static T7_SYS_PCLK(sys_aucpu, SYS_CLK_EN0_REG0, 14, 0); · line 957

Quoted 10 lines
drivers/clk/meson/t7-peripherals.c +3 -3
- * disabled, a device that starts a transfer cannot complete it.
+ * NOTE: sys_am2axi0..2 provide the clock to the AXI bus used for DMA between
+ * the peripherals and the DRAM. After the clocks are disabled, a device that
+ * starts a transfer cannot complete it.
   */
-static T7_SYS_PCLK(sys_ampipe_nand,	SYS_CLK_EN0_REG0, 19,	CLK_IS_CRITICAL);
-static T7_SYS_PCLK(sys_ampipe_eth,	SYS_CLK_EN0_REG0, 20,	0);
  static T7_SYS_PCLK(sys_am2axi0,		SYS_CLK_EN0_REG0, 21,	CLK_IS_CRITICAL);
  static T7_SYS_PCLK(sys_am2axi1,		SYS_CLK_EN0_REG0, 22,	CLK_IS_CRITICAL);
  static T7_SYS_PCLK(sys_am2axi2,		SYS_CLK_EN0_REG0, 23,	CLK_IS_CRITICAL);

Thanks,
Neil

#11 lore raw

Re: [PATCH v2 4/4] clk: meson: t7: don't mark sys_ampipe_nand as critical

In reply to Lucas Tanure

Hi Lucas,

Quoted 10 lines · Lucas Tanure

sys_ampipe_nand clocks the pipeline stage inserted in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric. It does have identifiable consumers - the three MMC controllers - so marking it critical was the wrong tool: the clock should be referenced from the consumer nodes and claimed by the mmc driver instead.

Drop the CLK_IS_CRITICAL flag and update the comment accordingly. sys_am2axi0..2 remain critical as they clock the AXI DMA bus itself and have no single identifiable consumer.

Quoted 7 lines
Assisted-by Claude:claude-fable-5

---
This patch depends on the MMC controllers actually referencing the clock:
the dt-bindings, mmc driver and t7 DTS changes adding the "pipeline" clock must land before this patch, otherwise the boot hangs and memory corruption this clock caused are reintroduced.

This series should be merged together in one tree? Which tree? I can provide an Acked-by if it should go through the mmc tree.

Brian

#12 lore raw

Re: [PATCH v2 4/4] clk: meson: t7: don't mark sys_ampipe_nand as critical

Quoted 22 lines · Brian Masney

Hi Lucas,

Quoted 10 lines · Lucas Tanure

sys_ampipe_nand clocks the pipeline stage inserted in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric. It does have identifiable consumers - the three MMC controllers - so marking it critical was the wrong tool: the clock should be referenced from the consumer nodes and claimed by the mmc driver instead.

Drop the CLK_IS_CRITICAL flag and update the comment accordingly. sys_am2axi0..2 remain critical as they clock the AXI DMA bus itself and have no single identifiable consumer.

Quoted 7 lines
Assisted-by Claude:claude-fable-5

---
This patch depends on the MMC controllers actually referencing the clock:
the dt-bindings, mmc driver and t7 DTS changes adding the "pipeline" clock must land before this patch, otherwise the boot hangs and memory corruption this clock caused are reintroduced.

Quoted 5 lines

This series should be merged together in one tree? Which tree? I can provide an Acked-by if it should go through the mmc tree.

Brian

It's definitely best to keep the series together in one tree to avoid boot regressions,
but I think the clk tree is the better fit since the core changes revolve around clock logic.
Could you accept it ?

thanks
lucas

maintainer
#13 lore raw

Re: [PATCH v2 4/4] clk: meson: t7: don't mark sys_ampipe_nand as critical

Quoted 26 lines · Lucas Tanure
Quoted 25 lines · Brian Masney

Hi Lucas,

Quoted 10 lines · Lucas Tanure

sys_ampipe_nand clocks the pipeline stage inserted in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric. It does have identifiable consumers - the three MMC controllers - so marking it critical was the wrong tool: the clock should be referenced from the consumer nodes and claimed by the mmc driver instead.

Drop the CLK_IS_CRITICAL flag and update the comment accordingly. sys_am2axi0..2 remain critical as they clock the AXI DMA bus itself and have no single identifiable consumer.

Quoted 7 lines
Assisted-by Claude:claude-fable-5

---
This patch depends on the MMC controllers actually referencing the clock:
the dt-bindings, mmc driver and t7 DTS changes adding the "pipeline" clock must land before this patch, otherwise the boot hangs and memory corruption this clock caused are reintroduced.

This series should be merged together in one tree? Which tree? I can provide an Acked-by if it should go through the mmc tree.

Quoted 7 lines
Quoted 2 lines

Brian

It's definitely best to keep the series together in one tree to avoid boot regressions,
but I think the clk tree is the better fit since the core changes revolve around clock logic.
Could you accept it ?

No. This applies on top of another change already queued in the amlogic clock tree. It can't go through the MMC tree at the moment.

This clock is not critical in mainline right now, so
1) I could merge this and it and in practice there would be no regression. The problem you had would still be there until the MMC change lands

2) Or you can wait for the MMC stuff to land and re-submit this in the next cycle.

Your choice. IMO, (1) is fine.

Quoted 3 lines

thanks
lucas

Signature · 1 line
Jerome
#14 lore raw

Re: [PATCH v2 4/4] clk: meson: t7: don't mark sys_ampipe_nand as critical

Quoted 48 lines · Jerome Brunet
Quoted 26 lines · Lucas Tanure
Quoted 25 lines · Brian Masney

Hi Lucas,

Quoted 10 lines · Lucas Tanure

sys_ampipe_nand clocks the pipeline stage inserted in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric. It does have identifiable consumers - the three MMC controllers - so marking it critical was the wrong tool: the clock should be referenced from the consumer nodes and claimed by the mmc driver instead.

Drop the CLK_IS_CRITICAL flag and update the comment accordingly. sys_am2axi0..2 remain critical as they clock the AXI DMA bus itself and have no single identifiable consumer.

Quoted 7 lines
Assisted-by Claude:claude-fable-5

---
This patch depends on the MMC controllers actually referencing the clock:
the dt-bindings, mmc driver and t7 DTS changes adding the "pipeline" clock must land before this patch, otherwise the boot hangs and memory corruption this clock caused are reintroduced.

This series should be merged together in one tree? Which tree? I can provide an Acked-by if it should go through the mmc tree.

Quoted 7 lines
Quoted 2 lines

Brian

It's definitely best to keep the series together in one tree to avoid boot regressions,
but I think the clk tree is the better fit since the core changes revolve around clock logic.
Could you accept it ?

No. This applies on top of another change already queued in the amlogic clock tree. It can't go through the MMC tree at the moment.

This clock is not critical in mainline right now, so
1) I could merge this and it and in practice there would be no regression. The problem you had would still be there until the MMC change lands

2) Or you can wait for the MMC stuff to land and re-submit this in the next cycle.

Quoted 8 lines

Your choice. IMO, (1) is fine.

Quoted 3 lines

thanks
lucas

--
Jerome

Hi Jerome,

Sorry for the late reply. The MMC side is in next now, so the clock has a real consumer.

Can you take this patch dropping the sys_ampipe_nand part or should I re-submit a new version dropping sys_ampipe_nand change and only marking sys_am2axi0/1/2 as critical?

Thanks
Lucas

#15 lore raw
In reply to Lucas Tanure
Quoted 34 lines · Lucas Tanure

The previous series for the intermittent boot hangs on the VIM4 marked sys_ampipe_nand as critical. But as Chuan Liu from Amlogic explained, sys_ampipe_nand clocks a pipeline stage that the hardware design inserts in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric to help timing closure.

So the clock has real consumers: reference it from the three MMC controller nodes and drop CLK_IS_CRITICAL instead.

The series crosses three trees; patch 4 (clk) must only land after patches 1-3, otherwise the DMA hangs fixed by 43e1705ecab9 come back.

Changes since v1 [3]:
- Dropped the Fixes: tag; this series is an improvement and should not be picked up by stable (Jerome Brunet)
- Moved the patch 4 dependency note below the --- so it is not kept for posterity (Jerome Brunet)
- Dropped the e-mail address from the Assisted-by trailer, see Documentation/process/coding-assistants.rst (Jerome Brunet)
- Fixed the space-indented error path added to meson_mmc_probe() in patch 2, it did not pass checkpatch
- Dropped the CLK_PIPELINE() macro from patch 2; has_pipeline_clk is a capability flag, not an SD_EMMC_CLOCK register field

Thanks,
Lucas

Lucas Tanure (4):
dt-bindings: mmc: amlogic,meson-gx-mmc: document the T7 pipeline clock
mmc: meson-gx: enable the bus pipeline clock on T7
arm64: dts: amlogic: t7: add the pipeline clock to the MMC controllers
clk: meson: t7: don't mark sys_ampipe_nand as critical

Quoted 9 lines
 .../bindings/mmc/amlogic,meson-gx-mmc.yaml    | 29 ++++++++++++++++++-
 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   | 15 ++++++----
 drivers/clk/meson/t7-peripherals.c            | 10 +++----
 drivers/mmc/host/meson-gx-mmc.c               | 20 +++++++++++++
 4 files changed, 62 insertions(+), 12 deletions(-)

--
2.55.0

Patch 1 and patch2 applied for next, thanks!

Kind regards
Uffe

#16 lore raw
Quoted 41 lines · Ulf Hansson
Quoted 40 lines · Lucas Tanure

The previous series for the intermittent boot hangs on the VIM4 marked sys_ampipe_nand as critical. But as Chuan Liu from Amlogic explained, sys_ampipe_nand clocks a pipeline stage that the hardware design inserts in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric to help timing closure.

So the clock has real consumers: reference it from the three MMC controller nodes and drop CLK_IS_CRITICAL instead.

The series crosses three trees; patch 4 (clk) must only land after patches 1-3, otherwise the DMA hangs fixed by 43e1705ecab9 come back.

Changes since v1 [3]:
- Dropped the Fixes: tag; this series is an improvement and should not be picked up by stable (Jerome Brunet)
- Moved the patch 4 dependency note below the --- so it is not kept for posterity (Jerome Brunet)
- Dropped the e-mail address from the Assisted-by trailer, see Documentation/process/coding-assistants.rst (Jerome Brunet)
- Fixed the space-indented error path added to meson_mmc_probe() in patch 2, it did not pass checkpatch
- Dropped the CLK_PIPELINE() macro from patch 2; has_pipeline_clk is a capability flag, not an SD_EMMC_CLOCK register field

Thanks,
Lucas

Lucas Tanure (4):
dt-bindings: mmc: amlogic,meson-gx-mmc: document the T7 pipeline clock
mmc: meson-gx: enable the bus pipeline clock on T7
arm64: dts: amlogic: t7: add the pipeline clock to the MMC controllers
clk: meson: t7: don't mark sys_ampipe_nand as critical

  .../bindings/mmc/amlogic,meson-gx-mmc.yaml    | 29 ++++++++++++++++++-
  arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   | 15 ++++++----
  drivers/clk/meson/t7-peripherals.c            | 10 +++----
  drivers/mmc/host/meson-gx-mmc.c               | 20 +++++++++++++
  4 files changed, 62 insertions(+), 12 deletions(-)
Quoted 8 lines
Quoted 3 lines

--
2.55.0

Patch 1 and patch2 applied for next, thanks!

Kind regards
Uffe

Hi Neil,

Any chance you could queue patch 3 for this cycle? Patch 2 is already in next, and until the DTS lands the MMC probe fails on T7 with "missing pipeline clock".

Thanks
Lucas

maintainer
#17 lore raw
Quoted 48 lines · Lucas Tanure
Quoted 47 lines · Ulf Hansson
Quoted 34 lines · Lucas Tanure

The previous series for the intermittent boot hangs on the VIM4 marked sys_ampipe_nand as critical. But as Chuan Liu from Amlogic explained, sys_ampipe_nand clocks a pipeline stage that the hardware design inserts in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric to help timing closure.

So the clock has real consumers: reference it from the three MMC controller nodes and drop CLK_IS_CRITICAL instead.

The series crosses three trees; patch 4 (clk) must only land after patches 1-3, otherwise the DMA hangs fixed by 43e1705ecab9 come back.

Changes since v1 [3]:
  - Dropped the Fixes: tag; this series is an improvement and should not be picked up by stable (Jerome Brunet)
  - Moved the patch 4 dependency note below the --- so it is not kept for posterity (Jerome Brunet)
  - Dropped the e-mail address from the Assisted-by trailer, see Documentation/process/coding-assistants.rst (Jerome Brunet)
  - Fixed the space-indented error path added to meson_mmc_probe() in patch 2, it did not pass checkpatch
  - Dropped the CLK_PIPELINE() macro from patch 2; has_pipeline_clk is a capability flag, not an SD_EMMC_CLOCK register field

Thanks,
Lucas

Lucas Tanure (4):
   dt-bindings: mmc: amlogic,meson-gx-mmc: document the T7 pipeline clock
   mmc: meson-gx: enable the bus pipeline clock on T7
   arm64: dts: amlogic: t7: add the pipeline clock to the MMC controllers
   clk: meson: t7: don't mark sys_ampipe_nand as critical

Quoted 9 lines

  .../bindings/mmc/amlogic,meson-gx-mmc.yaml    | 29 ++++++++++++++++++- arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   | 15 ++++++---- drivers/clk/meson/t7-peripherals.c            | 10 +++---- drivers/mmc/host/meson-gx-mmc.c               | 20 +++++++++++++

  4 files changed, 62 insertions(+), 12 deletions(-)
Signature · 1 line
2.55.0

Patch 1 and patch2 applied for next, thanks!

Quoted 7 lines
Quoted 2 lines

Kind regards
Uffe

Hi Neil,

Any chance you could queue patch 3 for this cycle? Patch 2 is already in next, and until the DTS lands the MMC probe fails on T7 with "missing pipeline clock".

Done !

Thanks,
Neil

Quoted 3 lines

Thanks
Lucas

maintainer Applied
#18 lore raw

Re: (subset) [PATCH v2 0/4] amlogic: t7: give the MMC bus pipeline clock real consumers

In reply to Lucas Tanure

Hi,

Quoted 10 lines · Lucas Tanure

The previous series for the intermittent boot hangs on the VIM4 marked sys_ampipe_nand as critical. But as Chuan Liu from Amlogic explained, sys_ampipe_nand clocks a pipeline stage that the hardware design inserts in the bus path between the SD/eMMC controllers and the NIC_MATRIX fabric to help timing closure.

So the clock has real consumers: reference it from the three MMC controller nodes and drop CLK_IS_CRITICAL instead.

[...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v7.4/arm64-dt)

[3/4] arm64: dts: amlogic: t7: add the pipeline clock to the MMC controllers

      https://git.kernel.org/amlogic/c/065957517880dc7053e0723cc9532b6e78c8855c

These changes has been applied on the intermediate git tree [1].

The v7.4/arm64-dt branch will then be sent via a formal Pull Request to the Linux SoC maintainers for inclusion in their intermediate git branches in order to be sent to Linus during the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate kernel and as soon they appear on the Linux master branch they will be backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3], people are encouraged testing these pre-release kernels and report issues on the relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

Signature · 1 line
Neil
maintainer Applied
#19 lore raw

Re: (subset) [PATCH v2 0/4] amlogic: t7: give the MMC bus pipeline clock real consumers

In reply to Lucas Tanure

Applied to [email protected]:BayLibre/clk-meson.git (clk-meson-next), thanks!

[4/4] clk: meson: t7: don't mark sys_ampipe_nand as critical

      commit: 363f97a1ce635b86be7fd263d56a040fbd87bdbb

Best regards,
--
Jerome