]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
arm64: dts: rockchip: Explicitly request UFS reset pin on RK3576
authorAlexey Charkov <alchark@gmail.com>
Wed, 21 Jan 2026 07:42:13 +0000 (11:42 +0400)
committerHeiko Stuebner <heiko@sntech.de>
Thu, 22 Jan 2026 17:59:56 +0000 (18:59 +0100)
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.

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.

This doesn't appear to affect Linux, but it does affect U-boot:

Before:
=> md.l 0x2604b398
2604b39800000011 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 0x2604b398
2604b39800000011 00000000 00000000 00000000  ................

After:
=> md.l 0x2604b398
2604b39800000011 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 0x2604b398
2604b39800000010 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.

Cc: stable@vger.kernel.org
Fixes: c75e5e010fef ("scsi: arm64: dts: rockchip: Add UFS support for RK3576 SoC")
Reported-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Alexey Charkov <alchark@gmail.com>
Link: https://patch.msgid.link/20260121-ufs-rst-v3-1-35839bcb4ca7@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
arch/arm64/boot/dts/rockchip/rk3576-pinctrl.dtsi
arch/arm64/boot/dts/rockchip/rk3576.dtsi

index 0b0851a7e4ea9ef2ff6d226277ca1d51ffc1e9f8..98c9f8013158cafdce43af7178fc7bed8b1f80da 100644 (file)
                                /* ufs_rstn */
                                <4 RK_PD0 1 &pcfg_pull_none>;
                };
+
+               /omit-if-no-ref/
+               ufs_rstgpio: ufs-rstgpio {
+                       rockchip,pins =
+                               /* ufs_rstn */
+                               <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_down>;
+               };
        };
 
        ufs_testdata0 {
index 7286d968e2b0626e001a6a746cba850dacd30b7c..4d7743dde66416be1c84b7af4d95393732398d78 100644 (file)
                        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_rstgpio>;
                        pinctrl-names = "default";
                        resets = <&cru SRST_A_UFS_BIU>, <&cru SRST_A_UFS_SYS>,
                                 <&cru SRST_A_UFS>, <&cru SRST_P_UFS_GRF>;