]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
ufs: rockchip: Make use of controller resets
authorAlexey Charkov <alchark@flipper.net>
Mon, 16 Mar 2026 16:50:45 +0000 (20:50 +0400)
committerNeil Armstrong <neil.armstrong@linaro.org>
Wed, 22 Apr 2026 08:03:54 +0000 (10:03 +0200)
Assert Rockchip UFS controller resets during initialization and HCE
enable, as it is done by the Linux driver.

This is required to make some UFS chips, such as Foresee FEUDNN064G-C2G0,
work properly.

Note that the resets were already requested in the probe function, just
not used.

Signed-off-by: Alexey Charkov <alchark@flipper.net>
Link: https://patch.msgid.link/20260316-rockchip-ufs-reset-v1-1-808eb017459a@flipper.net
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
drivers/ufs/ufs-rockchip.c

index a13236c7f7610c3eee1f6195edb47e0544a80a4e..dc4b9b5c86daedeb470cdb31682edff5b71faa1b 100644 (file)
 #include "unipro.h"
 #include "ufs-rockchip.h"
 
+static void ufs_rockchip_controller_reset(struct ufs_rockchip_host *host)
+{
+       reset_assert_bulk(&host->rsts);
+       udelay(1);
+       reset_deassert_bulk(&host->rsts);
+}
+
 static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba,
                                          enum ufs_notify_change_status status)
 {
        int err = 0;
 
-       if (status != POST_CHANGE)
+       if (status != POST_CHANGE) {
+               ufs_rockchip_controller_reset(dev_get_priv(hba->dev));
                return 0;
+       }
 
        ufshcd_dme_reset(hba);
        ufshcd_dme_enable(hba);
@@ -150,6 +159,8 @@ static int ufs_rockchip_common_init(struct ufs_hba *hba)
                return err;
        }
 
+       ufs_rockchip_controller_reset(host);
+
        err = gpio_request_by_name(dev, "reset-gpios", 0, &host->device_reset,
                                   GPIOD_IS_OUT | GPIOD_ACTIVE_LOW);
        if (err) {