]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ufs: add device_reset callback
authorNeil Armstrong <neil.armstrong@linaro.org>
Tue, 10 Sep 2024 09:50:10 +0000 (11:50 +0200)
committerNeil Armstrong <neil.armstrong@linaro.org>
Mon, 14 Oct 2024 06:56:03 +0000 (08:56 +0200)
Add device_reset op to permit resetting the UFS device if
the UFS controller drivers supports the operation.

Tested-by: Julius Lehmann <lehmanju@devpi.de>
Tested-by: Caleb Connolly <caleb.connolly@linaro.org> #rb3gen2
Link: https://lore.kernel.org/r/20240910-topic-ufs-qcom-controller-v1-1-54c0d2231b10@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
drivers/ufs/ufs.c
drivers/ufs/ufs.h

index e34e458622408af6ae49e5734102e07b43ebfb51..de8ba011d57f7bf181b2205c97ffd6d303269dee 100644 (file)
@@ -125,6 +125,11 @@ static void ufshcd_print_pwr_info(struct ufs_hba *hba)
                hba->pwr_info.hs_rate);
 }
 
+static void ufshcd_device_reset(struct ufs_hba *hba)
+{
+       ufshcd_vops_device_reset(hba);
+}
+
 /**
  * ufshcd_ready_for_uic_cmd - Check if controller is ready
  *                            to accept UIC commands
@@ -1997,6 +2002,9 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops)
 
        mb();
 
+       /* Reset the attached device */
+       ufshcd_device_reset(hba);
+
        err = ufshcd_hba_enable(hba);
        if (err) {
                dev_err(hba->dev, "Host controller enable failed\n");
index c1c6d15db4a69c33c48a0201eecd841d4c449865..8221812f6da140d7f9d61b64ace2ea70254e001a 100644 (file)
@@ -701,6 +701,7 @@ struct ufs_hba_ops {
        int (*link_startup_notify)(struct ufs_hba *hba,
                                   enum ufs_notify_change_status);
        int (*phy_initialization)(struct ufs_hba *hba);
+       int (*device_reset)(struct ufs_hba *hba);
 };
 
 enum ufshcd_quirks {
@@ -920,6 +921,14 @@ static inline int ufshcd_ops_link_startup_notify(struct ufs_hba *hba,
        return 0;
 }
 
+static inline int ufshcd_vops_device_reset(struct ufs_hba *hba)
+{
+       if (hba->ops && hba->ops->device_reset)
+               return hba->ops->device_reset(hba);
+
+       return 0;
+}
+
 /* Controller UFSHCI version */
 enum {
        UFSHCI_VERSION_10 = 0x00010000, /* 1.0 */