arm64: dts: rockchip: Explicitly request UFS reset pin on RK3576
Subsystems (3)
PATCH v2 1/1 arm64: dts: rockchip: Explicitly request UFS reset pin on RK3576
Rockchip RK3576 UFS controller uses a dedicated pin to reset the connected UFS device, which can operate either in a hardware controlled mode or as a GPIO pin.
Power-on default is GPIO mode, but the boot ROM reconfigures it to a hardware controlled mode if it uses UFS to load the next boot stage.
Given that existing bindings (and rk3576.dtsi) expect a GPIO-controlled device reset, request the required pin config explicitly.
This doesn't appear to affect Linux, but it does affect U-boot:
Before:
=> md.l 0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ... >
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE, FASTAUTO_MODE], rate = 2 => md.l 0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
After:
=> md.l 0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ...>
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE, FASTAUTO_MODE], rate = 2 => md.l 0x2604b3982604b398: 00000010 00000000 00000000 00000000 ................
(0x2604b398 is the respective pin mux register, with its BIT0 driving the mode of UFS_RST: unset = GPIO, set = hardware controlled UFS_RST)
This helps ensure that GPIO-driven device reset actually fires when the system requests it, not when whatever black box magic inside the UFSHC decides to reset the flash chip.
---
This has originally surfaced during the review of UFS patches for U-boot at [1], where it was found that the UFS reset line is not requested to be configured as GPIO but used as such. This leads in some cases to the UFS driver appearing to control device resets, while in fact it is the internal controller logic that drives the reset line (perhaps in unexpected ways).
Thanks Quentin Schulz for spotting this issue.
[1] https://lore.kernel.org/u-boot/[email protected]/
---
Changes in v2:
- Change default pin pull to pull-down in line with the SoC power-on default
- Link to v1: https://lore.kernel.org/r/[email protected]
--- arch/arm64/boot/dts/rockchip/rk3576-pinctrl.dtsi | 7 +++++++ arch/arm64/boot/dts/rockchip/rk3576.dtsi | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3576-pinctrl.dtsi +7 -0
@@ -5228,6 +5228,13 @@ ufs_rst: ufs-rst { /* ufs_rstn */ <4 RK_PD0 1 &pcfg_pull_none>; }; + + /omit-if-no-ref/ + ufs_rst_gpio: ufs-rst-gpio { + rockchip,pins = + /* ufs_rstn */ + <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_down>; + }; }; ufs_testdata0 {
arch/arm64/boot/dts/rockchip/rk3576.dtsi +1 -1
@@ -1865,7 +1865,7 @@ ufshc: ufshc@2a2d0000 { assigned-clock-parents = <&cru CLK_REF_MPHY_26M>; interrupts = <GIC_SPI 361 IRQ_TYPE_LEVEL_HIGH>; power-domains = <&power RK3576_PD_USB>; - pinctrl-0 = <&ufs_refclk>; + pinctrl-0 = <&ufs_refclk &ufs_rst_gpio>; pinctrl-names = "default"; resets = <&cru SRST_A_UFS_BIU>, <&cru SRST_A_UFS_SYS>, <&cru SRST_A_UFS>, <&cru SRST_P_UFS_GRF>;
---
base-commit: 46fe65a2c28ecf5df1a7475aba1f08ccf4c0ac1b
change-id: 20260119-ufs-rst-ffbc0ec88e07
Best regards,
Signature · 1 line
Alexey Charkov <[email protected]>
Hi Alexey,
Quoted 30 lines · Alexey Charkov
Rockchip RK3576 UFS controller uses a dedicated pin to reset the connected UFS device, which can operate either in a hardware controlled mode or as a GPIO pin.
Power-on default is GPIO mode, but the boot ROM reconfigures it to a hardware controlled mode if it uses UFS to load the next boot stage.
Given that existing bindings (and
rk3576.dtsi) expect a GPIO-controlled device reset, request the required pin config explicitly.This doesn't appear to affect Linux, but it does affect U-boot:
Before:
=> md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ... >
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE,FASTAUTO_MODE], rate = 2 => md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................After:
=> md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ...>
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE,FASTAUTO_MODE], rate = 2 => md.l0x2604b3982604b398: 00000010 00000000 00000000 00000000 ................
Quoted 7 lines
(
0x2604b398is the respective pin mux register, with its BIT0 driving the mode ofUFS_RST: unset = GPIO, set = hardware controlledUFS_RST)This helps ensure that GPIO-driven device reset actually fires when the system requests it, not when whatever black box magic inside the UFSHC decides to reset the flash chip.
Would have liked a mention on why pull-down in the commit log.
In any case,
Thanks!
Quentin
Quoted 37 lines · Quentin Schulz
Hi Alexey,
Quoted 33 lines · Alexey Charkov
Rockchip RK3576 UFS controller uses a dedicated pin to reset the connected UFS device, which can operate either in a hardware controlled mode or as a GPIO pin.
Power-on default is GPIO mode, but the boot ROM reconfigures it to a hardware controlled mode if it uses UFS to load the next boot stage.
Given that existing bindings (and
rk3576.dtsi) expect a GPIO-controlled device reset, request the required pin config explicitly.This doesn't appear to affect Linux, but it does affect U-boot:
Before:
=> md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ... >
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE,FASTAUTO_MODE], rate = 2 => md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................After:
=> md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ...>
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE,FASTAUTO_MODE], rate = 2 => md.l0x2604b3982604b398: 00000010 00000000 00000000 00000000 ................(
0x2604b398is the respective pin mux register, with its BIT0 driving the mode ofUFS_RST: unset = GPIO, set = hardware controlledUFS_RST)
Quoted 6 lines
Quoted 4 lines
This helps ensure that GPIO-driven device reset actually fires when the system requests it, not when whatever black box magic inside the UFSHC decides to reset the flash chip.
Would have liked a mention on why pull-down in the commit log.
Indeed. Heiko, if you're going to apply this to your tree, would you mind amending the commit description with something like the following?
The pin is requested with pull-down enabled, which is in line with the SoC power-on default and helps ensure that the attached UFS chip stays in reset until the driver takes over the control of the respective GPIO line.
Quoted 3 lines
In any case,
Reviewed-by Quentin Schulz <[email protected]>
Thanks a lot!
Best regards,
Alexey
Heiko Stübner
maintainerAm Dienstag, 20. Januar 2026, 14:14:48 Mitteleuropäische Normalzeit schrieb Alexey Charkov:
Quoted 45 lines · Quentin Schulz
Quoted 37 lines
Hi Alexey,
Quoted 33 lines · Alexey Charkov
Rockchip RK3576 UFS controller uses a dedicated pin to reset the connected UFS device, which can operate either in a hardware controlled mode or as a GPIO pin.
Power-on default is GPIO mode, but the boot ROM reconfigures it to a hardware controlled mode if it uses UFS to load the next boot stage.
Given that existing bindings (and
rk3576.dtsi) expect a GPIO-controlled device reset, request the required pin config explicitly.This doesn't appear to affect Linux, but it does affect U-boot:
Before:
=> md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ... >
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE,FASTAUTO_MODE], rate = 2 => md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................After:
=> md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ...>
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE,FASTAUTO_MODE], rate = 2 => md.l0x2604b3982604b398: 00000010 00000000 00000000 00000000 ................(
0x2604b398is the respective pin mux register, with its BIT0 driving the mode ofUFS_RST: unset = GPIO, set = hardware controlledUFS_RST)Quoted 6 lines
Quoted 4 lines
This helps ensure that GPIO-driven device reset actually fires when the system requests it, not when whatever black box magic inside the UFSHC decides to reset the flash chip.
Would have liked a mention on why pull-down in the commit log.
Quoted 8 lines
Indeed. Heiko, if you're going to apply this to your tree, would you mind amending the commit description with something like the following?
The pin is requested with pull-down enabled, which is in line with the SoC power-on default and helps ensure that the attached UFS chip stays in reset until the driver takes over the control of the respective GPIO line.
Will do :-)
Heiko
Quoted 9 lines
Quoted 3 lines
In any case,
Reviewed-by Quentin Schulz <[email protected]>Thanks a lot!
Best regards,
Alexey
Rob Herring
maintainerQuoted 56 lines · Alexey Charkov
Rockchip RK3576 UFS controller uses a dedicated pin to reset the connected UFS device, which can operate either in a hardware controlled mode or as a GPIO pin.
Power-on default is GPIO mode, but the boot ROM reconfigures it to a hardware controlled mode if it uses UFS to load the next boot stage.
Given that existing bindings (and
rk3576.dtsi) expect a GPIO-controlled device reset, request the required pin config explicitly.This doesn't appear to affect Linux, but it does affect U-boot:
Before:
=> md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ... >
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE,FASTAUTO_MODE], rate = 2 => md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................After:
=> md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ...>
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE,FASTAUTO_MODE], rate = 2 => md.l0x2604b3982604b398: 00000010 00000000 00000000 00000000 ................(
0x2604b398is the respective pin mux register, with its BIT0 driving the mode ofUFS_RST: unset = GPIO, set = hardware controlledUFS_RST)This helps ensure that GPIO-driven device reset actually fires when the system requests it, not when whatever black box magic inside the UFSHC decides to reset the flash chip.
Fixes c75e5e010fef ("scsi: arm64: dts: rockchip: Add UFS support for RK3576 SoC")Reported-by Quentin Schulz <[email protected]>Signed-off-by Alexey Charkov <[email protected]>---
This has originally surfaced during the review of UFS patches for U-boot at [1], where it was found that the UFS reset line is not requested to be configured as GPIO but used as such. This leads in some cases to the UFS driver appearing to control device resets, while in fact it is the internal controller logic that drives the reset line (perhaps in unexpected ways).Thanks Quentin Schulz for spotting this issue.
[1] https://lore.kernel.org/u-boot/[email protected]/
---
Changes in v2:
- Change default pin pull to pull-down in line with the SoC power-on default
- Link to v1: https://lore.kernel.org/r/[email protected]
Quoted 5 lines
--- arch/arm64/boot/dts/rockchip/rk3576-pinctrl.dtsi | 7 +++++++ arch/arm64/boot/dts/rockchip/rk3576.dtsi | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)
My bot found new DTB warnings on the .dts files added or changed in this series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:
pip3 install dtschema --upgrade
This patch series was applied (using b4) to base:
Base: 46fe65a2c28ecf5df1a7475aba1f08ccf4c0ac1b (use --merge-base to override)
If this is not the correct base, please add 'base-commit' tag (or use b4 which does this automatically)
New warnings running 'make CHECK_DTBS=y for arch/arm64/boot/dts/rockchip/' for [email protected]:
arch/arm64/boot/dts/rockchip/rk3576-luckfox-omni3576.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 113} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-100ask-dshanpi-a1.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 130} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-nanopi-r76s.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 116} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-roc-pc.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 117} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 133} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-rock-4d.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 122} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-evb1-v10.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 134} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-armsom-sige5.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 130} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-evb1-v10-pcie1.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 134} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-armsom-sige5-v1.2-wifibt.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 130} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yaml
Quoted 101 lines · Rob Herring
Quoted 56 lines · Alexey Charkov
Rockchip RK3576 UFS controller uses a dedicated pin to reset the connected UFS device, which can operate either in a hardware controlled mode or as a GPIO pin.
Power-on default is GPIO mode, but the boot ROM reconfigures it to a hardware controlled mode if it uses UFS to load the next boot stage.
Given that existing bindings (and
rk3576.dtsi) expect a GPIO-controlled device reset, request the required pin config explicitly.This doesn't appear to affect Linux, but it does affect U-boot:
Before:
=> md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ... >
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE,FASTAUTO_MODE], rate = 2 => md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................After:
=> md.l0x2604b3982604b398: 00000011 00000000 00000000 00000000 ................
< ... snip ...>
=> ufs init
ufshcd-rockchip ufshc@2a2d0000: [RX, TX]: gear=[3, 3], lane[2, 2], pwr[FASTAUTO_MODE,FASTAUTO_MODE], rate = 2 => md.l0x2604b3982604b398: 00000010 00000000 00000000 00000000 ................(
0x2604b398is the respective pin mux register, with its BIT0 driving the mode ofUFS_RST: unset = GPIO, set = hardware controlledUFS_RST)This helps ensure that GPIO-driven device reset actually fires when the system requests it, not when whatever black box magic inside the UFSHC decides to reset the flash chip.
Fixes c75e5e010fef ("scsi: arm64: dts: rockchip: Add UFS support for RK3576 SoC")Reported-by Quentin Schulz <[email protected]>Signed-off-by Alexey Charkov <[email protected]>---
This has originally surfaced during the review of UFS patches for U-boot at [1], where it was found that the UFS reset line is not requested to be configured as GPIO but used as such. This leads in some cases to the UFS driver appearing to control device resets, while in fact it is the internal controller logic that drives the reset line (perhaps in unexpected ways).Thanks Quentin Schulz for spotting this issue.
[1] https://lore.kernel.org/u-boot/[email protected]/
---
Changes in v2:
- Change default pin pull to pull-down in line with the SoC power-on default
- Link to v1: https://lore.kernel.org/r/[email protected]Quoted 5 lines
--- arch/arm64/boot/dts/rockchip/rk3576-pinctrl.dtsi | 7 +++++++ arch/arm64/boot/dts/rockchip/rk3576.dtsi | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)My bot found new DTB warnings on the .dts files added or changed in this series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:
pip3 install dtschema --upgradeThis patch series was applied (using b4) to base:
Base:46fe65a2c28ecf5df1a7475aba1f08ccf4c0ac1b(use --merge-base to override)If this is not the correct base, please add 'base-commit' tag (or use b4 which does this automatically)
New warnings running 'make CHECK_DTBS=y for
arch/arm64/boot/dts/rockchip/' for [email protected]:
arch/arm64/boot/dts/rockchip/rk3576-luckfox-omni3576.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 113} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-100ask-dshanpi-a1.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 130} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-nanopi-r76s.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 116} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-roc-pc.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 117} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 133} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-rock-4d.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 122} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yaml
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3576-evb1-v10.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 134} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-armsom-sige5.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 130} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-evb1-v10-pcie1.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 134} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yamlarch/arm64/boot/dts/rockchip/rk3576-armsom-sige5-v1.2-wifibt.dtb: ufs: ufs-rst-gpio: {'rockchip,pins': [[4, 24, 0, 29]], 'phandle': 130} is not of type 'array'
from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yaml
Thank you bot. This wildcard for *-gpio is driving me crazy. And yes, looks like I forgot to test against the schema - sorry for that. Will resend a slightly adjusted version shortly (s/ufs-rst-gpio/ufs-rstgpio/ to avoid incorrectly matching against the GPIO schema)
Best regards,
Alexey