Skip to contentSkip to conversation

Fix aspeed-video driver load failure

PATCH New Haiyue Wang 2 participants 4 messages Jun 5

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

v4 cover Fix aspeed-video driver load failure

v4:
- No code change, re-send with cover letter for more than one patch
v3: https://lore.kernel.org/all/[email protected]/
- Drop 'Fixes:' tag in header file patch.
v2: https://lore.kernel.org/all/[email protected]/
- Fix checkpatch.pl warning, and send dt-bindings as single patch as the submitting-patches guide.
v1: https://lore.kernel.org/all/[email protected]/

Haiyue Wang (2):
dt-bindings: clock: ast2600: Add reset definition for video
ARM: dts: aspeed: add 'resets' to video node

 arch/arm/boot/dts/aspeed/aspeed-g4.dtsi   | 1 +
 arch/arm/boot/dts/aspeed/aspeed-g5.dtsi   | 1 +
 arch/arm/boot/dts/aspeed/aspeed-g6.dtsi   | 1 +
 include/dt-bindings/clock/ast2600-clock.h | 1 +
 4 files changed, 4 insertions(+)
Signature · 1 line
2.54.0
#1 lore raw

PATCH v4 1/2 dt-bindings: clock: ast2600: Add reset definition for video

Add ASPEED_RESET_VIDEO reset definition to the ast2600-clock binding header. It is required for proper reset control of the video on the AST2600 SoC for aspeed-video driver.

---
 include/dt-bindings/clock/ast2600-clock.h | 1 +
 1 file changed, 1 insertion(+)
include/dt-bindings/clock/ast2600-clock.h +1 -0
index f60fff261130..7b9b80c38a8b 100644
@@ -124,6 +124,7 @@
 #define ASPEED_RESET_PCIE_RC_OEN	18
 #define ASPEED_RESET_MAC2		12
 #define ASPEED_RESET_MAC1		11
+#define ASPEED_RESET_VIDEO		6
 #define ASPEED_RESET_PCI_DP		5
 #define ASPEED_RESET_HACE		4
 #define ASPEED_RESET_AHB		1
Signature · 1 line
2.54.0
#2 lore raw

Re: [PATCH v4 1/2] dt-bindings: clock: ast2600: Add reset definition for video

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] ASPEED_RESET_VIDEO is added as a standalone reset, but it is already part of a clock gate + reset…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ASPEED_RESET_VIDEO is added as a standalone reset, but it is already part of a clock gate + reset pair, leading to uncoordinated dual-management of the reset line. --

commit 7d99e8d0bb05e6a9bb226ee4b2b7bc8d561ba78f
Author: Haiyue Wang <[email protected]>

dt-bindings: clock: ast2600: Add reset definition for video

Add ASPEED_RESET_VIDEO reset definition to the ast2600-clock binding header. It is required for proper reset control of the video on the AST2600 SoC for aspeed-video driver.

Quoted 3 lines
include/dt-bindings/clock/ast2600-clock.h +0 -0

[ ... ]

include/dt-bindings/clock/ast2600-clock.h line 127

Quoted 5 lines
include/dt-bindings/clock/ast2600-clock.h +1 -0
@@ -124,6 +124,7 @@
 #define ASPEED_RESET_PCIE_RC_OEN	18
 #define ASPEED_RESET_MAC2		12
 #define ASPEED_RESET_MAC1		11
+#define ASPEED_RESET_VIDEO		6

[Severity: High]
Does this introduce uncoordinated dual-management of the reset line?

The bindings header explicitly states earlier in the file to "Only list resets here that are not part of a clock gate + reset pair".

Looking at drivers/clk/aspeed/clk-ast2600.c, ASPEED_CLK_GATE_ECLK is already configured to manage reset bit 6 during eclk state transitions:

drivers/clk/aspeed/clk-ast2600.c:aspeed_g6_gates[] = {
    ...
    [ASPEED_CLK_GATE_ECLK] = {  1,  6, "eclk-gate", "eclk",  0 },
    ...
};

The clock framework directly toggles this exact reset bit via regmap during clk_enable(). Simultaneously, the aspeed-video driver requests this reset via devm_reset_control_get(), which assumes exclusive control.

Will this result in two different subsystems independently manipulating the same hardware reset bit and bypassing synchronization mechanisms?

Quoted 3 lines
include/dt-bindings/clock/ast2600-clock.h +0 -0
 #define ASPEED_RESET_PCI_DP		5
 #define ASPEED_RESET_HACE		4
 #define ASPEED_RESET_AHB		1
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH v4 2/2 ARM: dts: aspeed: add 'resets' to video node

In reply to Haiyue Wang

The aspeed video (be compatible for ast2400, ast2500, ast2600) now needs the reset DTS handle specified, otherwise it will fail to load:

[    4.809494] aspeed-video 1e700000.video: irq 57
[    4.809977] aspeed-video 1e700000.video: Unable to get reset
[    4.810341] aspeed-video 1e700000.video: probe with driver aspeed-video failed with error -2
Fixes e83f8dd668ea ("media: aspeed: Fix dram hang at res-change")
---
 arch/arm/boot/dts/aspeed/aspeed-g4.dtsi | 1 +
 arch/arm/boot/dts/aspeed/aspeed-g5.dtsi | 1 +
 arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 1 +
 3 files changed, 3 insertions(+)
arch/arm/boot/dts/aspeed/aspeed-g4.dtsi +1 -0
index c3d4d916c69b..1547e28d77e2 100644
@@ -242,6 +242,7 @@ video: video@1e700000 {
 					 <&syscon ASPEED_CLK_GATE_ECLK>;
 				clock-names = "vclk", "eclk";
 				interrupts = <7>;
+				resets = <&syscon ASPEED_RESET_VIDEO>;
 				status = "disabled";
 			};
 
arch/arm/boot/dts/aspeed/aspeed-g5.dtsi +1 -0
index 39500bdb4747..793570ca2518 100644
@@ -296,6 +296,7 @@ video: video@1e700000 {
 					 <&syscon ASPEED_CLK_GATE_ECLK>;
 				clock-names = "vclk", "eclk";
 				interrupts = <7>;
+				resets = <&syscon ASPEED_RESET_VIDEO>;
 				status = "disabled";
 			};
 
arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +1 -0
index 189bc3bbb47c..3adf48987a17 100644
@@ -428,6 +428,7 @@ video: video@1e700000 {
 					 <&syscon ASPEED_CLK_GATE_ECLK>;
 				clock-names = "vclk", "eclk";
 				interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+				resets = <&syscon ASPEED_RESET_VIDEO>;
 				status = "disabled";
 			};
 
Signature · 1 line
2.54.0