rockchip: rk3328: Fix Synchronous Abort on usb start
Subsystems (3)
PATCH 1/1 rockchip: rk3328: Fix Synchronous Abort on usb start
Remove incorrect assigned-clock-parents in rk3328-u-boot.dtsi. This incorrect parent has become a problem since recent commit with parent clock enablement.
Currently assigned-clock-parents is not a CLK node, but rk3328-usb2phy. It looks like a mistake in dts made a long time ago (~8 years ago).
=> usb start
starting USB...
Bus usb@ff580000: "Synchronous Abort" handler, esr 0x96000210, far 0x4
Linux dts source reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c60c0373a5e85d8bd0bb026cd5440576249d2299
---
arch/arm/dts/rk3328-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/dts/rk3328-u-boot.dtsi +4 -0
@@ -150,6 +150,10 @@ bootph-all; }; +&u2phy { + /delete-property/ assigned-clock-parents; +}; + #ifdef CONFIG_ROCKCHIP_SPI_IMAGE &binman { simple-bin-spi {
Signature · 4 lines
2.43.0 base-commit: df2ed552f0b05591090369a7fe7ddc92439dea5c branch: fix-rk3328-usb2phy-clock
Hi Alex,
Quoted 6 lines · Alex Shumsky
Remove incorrect assigned-clock-parents in
rk3328-u-boot.dtsi. This incorrect parent has become a problem since recent commit with parent clock enablement.Currently assigned-clock-parents is not a CLK node, but rk3328-usb2phy. It looks like a mistake in dts made a long time ago (~8 years ago).
No, this is very much correct, u2phy is a clk provider as can be seen by the use of the '#clock-cells' prop so being able to use it as a parent clk is allowed and the device tree is correct.
Quoted 20 lines
=> usb start
starting USB...
Bus usb@ff580000: "Synchronous Abort" handler, esr0x96000210, far0x4Linux dts source reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c60c0373a5e85d8bd0bb026cd5440576249d2299Fixes ac30d90f3367 ("clk: Ensure the parent clocks are enabled while reparenting")Signed-off-by Alex Shumsky <[email protected]>---
arch/arm/dts/rk3328-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/dts/rk3328-u-boot.dtsi +0
-0
arch/arm/dts/rk3328-u-boot.dtsi line 155
Quoted 6 lines
arch/arm/dts/rk3328-u-boot.dtsi +3
-0@@ -150,6 +150,10 @@ bootph-all; }; +&u2phy { + /delete-property/ assigned-clock-parents; +};
We should fix the driver code and not modify the device tree to fit the code.
The u2phy ofnode is tied to multiple uclass drivers so is it possible that the parent clock lookup from commit ac30d90f3367 ("clk: Ensure the parent clocks are enabled while reparenting") is not getting the UCLASS_CLK driver?
Regards,
Jonas
Quoted 4 lines
arch/arm/dts/rk3328-u-boot.dtsi +1
-0+ #ifdef CONFIG_ROCKCHIP_SPI_IMAGE &binman { simple-bin-spi {
Quoted 7 lines · Jonas Karlman
Hi Alex,
Quoted 4 lines · Alex Shumsky
Remove incorrect assigned-clock-parents in
rk3328-u-boot.dtsi. This incorrect parent has become a problem since recent commit with parent clock enablement.
Quoted 11 lines
Quoted 2 lines
Currently assigned-clock-parents is not a CLK node, but rk3328-usb2phy. It looks like a mistake in dts made a long time ago (~8 years ago).
No, this is very much correct, u2phy is a clk provider as can be seen by the use of the '#clock-cells' prop so being able to use it as a parent clk is allowed and the device tree is correct.
Quoted 4 lines
=> usb start
starting USB...
Bus usb@ff580000: "Synchronous Abort" handler, esr0x96000210, far0x4
I have now tried to re-create this issue using latest master branch on a rk3328 board, however I was only able to re-create a different issue.
On what board and U-Boot version/commit are you seeing this issue?
The issue I faced was due to only enable usb20_otg and not u2phy_otg, something that could be fixed with following diff:
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +1 -1
@@ -538,7 +538,7 @@ U_BOOT_DRIVER(rockchip_usb2phy_clock) = {U_BOOT_DRIVER (rockchip_usb2phy) = { .name ="rockchip_usb2phy" , - .id =UCLASS_PHY , + .id =UCLASS_NOP , .of_match = rockchip_usb2phy_ids, .probe = rockchip_usb2phy_probe, .bind = rockchip_usb2phy_bind,
Regards,
Jonas
Quoted 39 lines
Quoted 16 lines
Linux dts source reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c60c0373a5e85d8bd0bb026cd5440576249d2299Fixes ac30d90f3367 ("clk: Ensure the parent clocks are enabled while reparenting")Signed-off-by Alex Shumsky <[email protected]>---
arch/arm/dts/rk3328-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/dts/rk3328-u-boot.dtsi +0
-0arch/arm/dts/rk3328-u-boot.dtsi line 155
Quoted 6 lines
arch/arm/dts/rk3328-u-boot.dtsi +3
-0@@ -150,6 +150,10 @@ bootph-all; }; +&u2phy { + /delete-property/ assigned-clock-parents; +};We should fix the driver code and not modify the device tree to fit the code.
The u2phy ofnode is tied to multiple uclass drivers so is it possible that the parent clock lookup from commit
ac30d90f3367("clk: Ensure the parent clocks are enabled while reparenting") is not getting theUCLASS_CLKdriver?Regards,
JonasQuoted 4 lines
arch/arm/dts/rk3328-u-boot.dtsi +1
-0+ #ifdef CONFIG_ROCKCHIP_SPI_IMAGE &binman { simple-bin-spi {
Oops, I forgot Reply-All and some messages missed list. Sorry about that.
Jonas and I have found NULL pointer dereference in rockchip_usb2phy_clkout_ctl:
https://github.com/u-boot/u-boot/blob/df2ed552f0b05591090369a7fe7ddc92439dea5c/drivers/phy/rockchip/phy-rockchip-inno-usb2.c#L177
Here rockchip_usb2phy_clkout_ctl tries to read from dev_get_priv(parent)->phy_cfg
but it is NULL because rockchip_usb2phy_probe is not yet called.
Johnas, I have dug the problem a little further and found something interesting. We have circular dependency between rockchip-inno-usb2 clock/phy initialisation here. The rockchip-inno-usb2 phy node also acts as a parent clock for itself. Parent clocks now are enabled as part of the probe process before dev->probe call, but this particular clock depends on phy. Here is relevant code:
https://github.com/u-boot/u-boot/blob/df2ed552f0b05591090369a7fe7ddc92439dea5c/drivers/core/device.c#L572
Quick and dirty solution would be to just ignore rockchip_usb2phy_clk_enable when the phy node is not yet probed. USB works fine with this check added, exactly as before the recent parent clock enablement commit that introduced this issue:ac30d90f3367 ("clk: Ensure the parent clocks are enabled while reparenting").
Clean solution would probably be to break dependency cycle, but I'm not proficient enough with uboot codebase to propose such solution. I've tried to move some of rockchip_usb2phy_probe initialisation code to rockchip_usb2phy_of_to_plat to make it run before clock initialisation. But I have failed on priv->reg_base = syscon_get_regmap(dev_get_parent(dev)) which needs a parent node to be probed (I unsure is it OK to probe parent from of_to_plat).
If we settle on a quick fix, I propose to add to rockchip_usb2phy_clk_enable something like (Johnas, please let me know if it have some flaw over your patch):
struct rockchip_usb2phy *parent_priv = dev_get_priv(dev_get_parent(clk->dev));
if (!parent_priv->phy_cfg) {
return 0;}
Quoted 86 lines · Jonas Karlman
Quoted 7 lines · Jonas Karlman
Hi Alex,
Quoted 4 lines · Alex Shumsky
Remove incorrect assigned-clock-parents in
rk3328-u-boot.dtsi. This incorrect parent has become a problem since recent commit with parent clock enablement.Quoted 11 lines
Quoted 2 lines
Currently assigned-clock-parents is not a CLK node, but rk3328-usb2phy. It looks like a mistake in dts made a long time ago (~8 years ago).
No, this is very much correct, u2phy is a clk provider as can be seen by the use of the '#clock-cells' prop so being able to use it as a parent clk is allowed and the device tree is correct.
Quoted 4 lines
=> usb start
starting USB...
Bus usb@ff580000: "Synchronous Abort" handler, esr0x96000210, far0x4I have now tried to re-create this issue using latest master branch on a rk3328 board, however I was only able to re-create a different issue.
On what board and U-Boot version/commit are you seeing this issue?
The issue I faced was due to only enable
usb20_otgand notu2phy_otg, something that could be fixed with following diff:drivers/phy/rockchip/phy-rockchip-inno-usb2.c +1
-1@@ -538,7 +538,7 @@ U_BOOT_DRIVER(rockchip_usb2phy_clock) = {U_BOOT_DRIVER (rockchip_usb2phy) = { .name ="rockchip_usb2phy" , - .id =UCLASS_PHY , + .id =UCLASS_NOP , .of_match = rockchip_usb2phy_ids, .probe = rockchip_usb2phy_probe, .bind = rockchip_usb2phy_bind,Regards,
JonasQuoted 39 lines
Quoted 16 lines
Linux dts source reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c60c0373a5e85d8bd0bb026cd5440576249d2299Fixes ac30d90f3367 ("clk: Ensure the parent clocks are enabled while reparenting")Signed-off-by Alex Shumsky <[email protected]>---
arch/arm/dts/rk3328-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/dts/rk3328-u-boot.dtsi +0
-0arch/arm/dts/rk3328-u-boot.dtsi line 155
Quoted 6 lines
arch/arm/dts/rk3328-u-boot.dtsi +3
-0@@ -150,6 +150,10 @@ bootph-all; }; +&u2phy { + /delete-property/ assigned-clock-parents; +};We should fix the driver code and not modify the device tree to fit the code.
The u2phy ofnode is tied to multiple uclass drivers so is it possible that the parent clock lookup from commit
ac30d90f3367("clk: Ensure the parent clocks are enabled while reparenting") is not getting theUCLASS_CLKdriver?Regards,
JonasQuoted 4 lines
arch/arm/dts/rk3328-u-boot.dtsi +1
-0+ #ifdef CONFIG_ROCKCHIP_SPI_IMAGE &binman { simple-bin-spi {
Quoted 31 lines · Alex Shumsky
Oops, I forgot Reply-All and some messages missed list. Sorry about that.
Jonas and I have found NULL pointer dereference in
rockchip_usb2phy_clkout_ctl:
https://github.com/u-boot/u-boot/blob/df2ed552f0b05591090369a7fe7ddc92439dea5c/drivers/phy/rockchip/phy-rockchip-inno-usb2.c#L177Here
rockchip_usb2phy_clkout_ctltries to read fromdev_get_priv(parent)->phy_cfg
but it is NULL becauserockchip_usb2phy_probeis not yet called.Johnas, I have dug the problem a little further and found something interesting. We have circular dependency between rockchip-inno-usb2 clock/phy initialisation here. The rockchip-inno-usb2 phy node also acts as a parent clock for itself. Parent clocks now are enabled as part of the probe process before
dev->probecall, but this particular clock depends on phy. Here is relevant code:
https://github.com/u-boot/u-boot/blob/df2ed552f0b05591090369a7fe7ddc92439dea5c/drivers/core/device.c#L572Quick and dirty solution would be to just ignore
rockchip_usb2phy_clk_enablewhen the phy node is not yet probed. USB works fine with this check added, exactly as before the recent parent clock enablement commit that introduced this issue:ac30d90f3367("clk: Ensure the parent clocks are enabled while reparenting").Clean solution would probably be to break dependency cycle, but I'm not proficient enough with uboot codebase to propose such solution. I've tried to move some of
rockchip_usb2phy_probeinitialisation code torockchip_usb2phy_of_to_platto make it run before clock initialisation. But I have failed onpriv->reg_base = syscon_get_regmap(dev_get_parent(dev))which needs a parent node to be probed (I unsure is it OK to probe parent fromof_to_plat).
Quoted 9 lines
If we settle on a quick fix, I propose to add to
rockchip_usb2phy_clk_enablesomething like (Johnas, please let me know if it have some flaw over your patch):
structrockchip_usb2phy*parent_priv= dev_get_priv(dev_get_parent(clk->dev));if (!parent_priv->phy_cfg) { return 0;}
Kindly ping Jonas and Kever.
How can we proceed with this issue to apply fix before the 2025.07 release? Do some of my ideas from the previous message make sense to you?
Quoted 88 lines · Jonas Karlman
Quoted 86 lines · Jonas Karlman
Quoted 7 lines
Hi Alex,
Quoted 4 lines · Alex Shumsky
Remove incorrect assigned-clock-parents in
rk3328-u-boot.dtsi. This incorrect parent has become a problem since recent commit with parent clock enablement.Quoted 11 lines
Quoted 2 lines
Currently assigned-clock-parents is not a CLK node, but rk3328-usb2phy. It looks like a mistake in dts made a long time ago (~8 years ago).
No, this is very much correct, u2phy is a clk provider as can be seen by the use of the '#clock-cells' prop so being able to use it as a parent clk is allowed and the device tree is correct.
Quoted 4 lines
=> usb start
starting USB...
Bus usb@ff580000: "Synchronous Abort" handler, esr0x96000210, far0x4I have now tried to re-create this issue using latest master branch on a rk3328 board, however I was only able to re-create a different issue.
On what board and U-Boot version/commit are you seeing this issue?
The issue I faced was due to only enable
usb20_otgand notu2phy_otg, something that could be fixed with following diff:drivers/phy/rockchip/phy-rockchip-inno-usb2.c +1
-1@@ -538,7 +538,7 @@ U_BOOT_DRIVER(rockchip_usb2phy_clock) = {U_BOOT_DRIVER (rockchip_usb2phy) = { .name ="rockchip_usb2phy" , - .id =UCLASS_PHY , + .id =UCLASS_NOP , .of_match = rockchip_usb2phy_ids, .probe = rockchip_usb2phy_probe, .bind = rockchip_usb2phy_bind,Regards,
JonasQuoted 39 lines
Quoted 16 lines
Linux dts source reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c60c0373a5e85d8bd0bb026cd5440576249d2299Fixes ac30d90f3367 ("clk: Ensure the parent clocks are enabled while reparenting")Signed-off-by Alex Shumsky <[email protected]>---
arch/arm/dts/rk3328-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/dts/rk3328-u-boot.dtsi +0
-0arch/arm/dts/rk3328-u-boot.dtsi line 155
Quoted 6 lines
arch/arm/dts/rk3328-u-boot.dtsi +3
-0@@ -150,6 +150,10 @@ bootph-all; }; +&u2phy { + /delete-property/ assigned-clock-parents; +};We should fix the driver code and not modify the device tree to fit the code.
The u2phy ofnode is tied to multiple uclass drivers so is it possible that the parent clock lookup from commit
ac30d90f3367("clk: Ensure the parent clocks are enabled while reparenting") is not getting theUCLASS_CLKdriver?Regards,
JonasQuoted 4 lines
arch/arm/dts/rk3328-u-boot.dtsi +1
-0+ #ifdef CONFIG_ROCKCHIP_SPI_IMAGE &binman { simple-bin-spi {
Hi Alex,
Quoted 42 lines · Alex Shumsky
Quoted 31 lines · Alex Shumsky
Oops, I forgot Reply-All and some messages missed list. Sorry about that.
Jonas and I have found NULL pointer dereference in
rockchip_usb2phy_clkout_ctl:
https://github.com/u-boot/u-boot/blob/df2ed552f0b05591090369a7fe7ddc92439dea5c/drivers/phy/rockchip/phy-rockchip-inno-usb2.c#L177Here
rockchip_usb2phy_clkout_ctltries to read fromdev_get_priv(parent)->phy_cfg
but it is NULL becauserockchip_usb2phy_probeis not yet called.Johnas, I have dug the problem a little further and found something interesting. We have circular dependency between rockchip-inno-usb2 clock/phy initialisation here. The rockchip-inno-usb2 phy node also acts as a parent clock for itself. Parent clocks now are enabled as part of the probe process before
dev->probecall, but this particular clock depends on phy. Here is relevant code:
https://github.com/u-boot/u-boot/blob/df2ed552f0b05591090369a7fe7ddc92439dea5c/drivers/core/device.c#L572Quick and dirty solution would be to just ignore
rockchip_usb2phy_clk_enablewhen the phy node is not yet probed. USB works fine with this check added, exactly as before the recent parent clock enablement commit that introduced this issue:ac30d90f3367("clk: Ensure the parent clocks are enabled while reparenting").Clean solution would probably be to break dependency cycle, but I'm not proficient enough with uboot codebase to propose such solution. I've tried to move some of
rockchip_usb2phy_probeinitialisation code torockchip_usb2phy_of_to_platto make it run before clock initialisation. But I have failed onpriv->reg_base = syscon_get_regmap(dev_get_parent(dev))which needs a parent node to be probed (I unsure is it OK to probe parent fromof_to_plat).Quoted 9 lines
If we settle on a quick fix, I propose to add to
rockchip_usb2phy_clk_enablesomething like (Johnas, please let me know if it have some flaw over your patch):
structrockchip_usb2phy*parent_priv= dev_get_priv(dev_get_parent(clk->dev));if (!parent_priv->phy_cfg) { return 0;}
Quoted 3 lines
Kindly ping Jonas and Kever.
How can we proceed with this issue to apply fix before the 2025.07 release? Do some of my ideas from the previous message make sense to you?
rockchip_usb2phy_clkout_ctl() was introduced this cycle, so I would personally prefer a proper fix and having this new function incorporate a proper NULL check, similar to what I sent you some time ago.
If possible, please send a similar patch and include a fixes-tag for 229218373c22 ("phy: rockchip-inno-usb2: Add support for clkout_ctl_phy").
Regards,
Jonas
Quoted 90 lines
Quoted 90 lines · Jonas Karlman
Quoted 86 lines · Jonas Karlman
Quoted 7 lines
Hi Alex,
Quoted 4 lines · Alex Shumsky
Remove incorrect assigned-clock-parents in
rk3328-u-boot.dtsi. This incorrect parent has become a problem since recent commit with parent clock enablement.Quoted 11 lines
Quoted 2 lines
Currently assigned-clock-parents is not a CLK node, but rk3328-usb2phy. It looks like a mistake in dts made a long time ago (~8 years ago).
No, this is very much correct, u2phy is a clk provider as can be seen by the use of the '#clock-cells' prop so being able to use it as a parent clk is allowed and the device tree is correct.
Quoted 4 lines
=> usb start
starting USB...
Bus usb@ff580000: "Synchronous Abort" handler, esr0x96000210, far0x4I have now tried to re-create this issue using latest master branch on a rk3328 board, however I was only able to re-create a different issue.
On what board and U-Boot version/commit are you seeing this issue?
The issue I faced was due to only enable
usb20_otgand notu2phy_otg, something that could be fixed with following diff:drivers/phy/rockchip/phy-rockchip-inno-usb2.c +1
-1@@ -538,7 +538,7 @@ U_BOOT_DRIVER(rockchip_usb2phy_clock) = {U_BOOT_DRIVER (rockchip_usb2phy) = { .name ="rockchip_usb2phy" , - .id =UCLASS_PHY , + .id =UCLASS_NOP , .of_match = rockchip_usb2phy_ids, .probe = rockchip_usb2phy_probe, .bind = rockchip_usb2phy_bind,Regards,
JonasQuoted 39 lines
Quoted 16 lines
Linux dts source reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c60c0373a5e85d8bd0bb026cd5440576249d2299Fixes ac30d90f3367 ("clk: Ensure the parent clocks are enabled while reparenting")Signed-off-by Alex Shumsky <[email protected]>---
arch/arm/dts/rk3328-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/dts/rk3328-u-boot.dtsi +0
-0arch/arm/dts/rk3328-u-boot.dtsi line 155
Quoted 6 lines
arch/arm/dts/rk3328-u-boot.dtsi +3
-0@@ -150,6 +150,10 @@ bootph-all; }; +&u2phy { + /delete-property/ assigned-clock-parents; +};We should fix the driver code and not modify the device tree to fit the code.
The u2phy ofnode is tied to multiple uclass drivers so is it possible that the parent clock lookup from commit
ac30d90f3367("clk: Ensure the parent clocks are enabled while reparenting") is not getting theUCLASS_CLKdriver?Regards,
JonasQuoted 4 lines
arch/arm/dts/rk3328-u-boot.dtsi +1
-0+ #ifdef CONFIG_ROCKCHIP_SPI_IMAGE &binman { simple-bin-spi {