scsi: ufs: add caps info for platform init
authorhgchu <hg.chu@samsung.com>
Fri, 12 Jan 2018 01:57:00 +0000 (10:57 +0900)
committerJaeHun Jung <jh0801.jung@samsung.com>
Tue, 8 May 2018 08:20:16 +0000 (17:20 +0900)
Change-Id: I70fccbd21232c6e41fad7841a4c21c951a3b7546
Signed-off-by: hgchu <hg.chu@samsung.com>
drivers/scsi/ufs/ufshcd-pltfrm.c

index 713570e17b8478985b9e511b199bac2f79227e5f..26d187090cfd3c4dbcc8a8c56466281f812c4c93 100644 (file)
@@ -249,6 +249,25 @@ static int ufshcd_parse_pm_lvl_policy(struct ufs_hba *hba)
 
        return 0;
 }
+static int ufshcd_parse_caps_info(struct ufs_hba *hba)
+{
+       struct device *dev = hba->dev;
+       struct device_node *np = dev->of_node;
+
+       if (of_find_property(np, "ufs-cap-clk-gating", NULL))
+               hba->caps |= UFSHCD_CAP_CLK_GATING;
+       if (of_find_property(np, "ufs-cap-hibern8-with-clk-gating", NULL))
+               hba->caps |= UFSHCD_CAP_HIBERN8_WITH_CLK_GATING;
+       if (of_find_property(np, "ufs-cap-clk-scaling", NULL))
+               hba->caps |= UFSHCD_CAP_CLK_SCALING;
+       if (of_find_property(np, "ufs-cap-auto-bkops-suspend", NULL))
+               hba->caps |= UFSHCD_CAP_AUTO_BKOPS_SUSPEND;
+       if (of_find_property(np, "ufs-cap-fake-clk-gating", NULL))
+               hba->caps |= UFSHCD_CAP_FAKE_CLK_GATING;
+
+       return 0;
+}
+
 #ifdef CONFIG_PM
 /**
  * ufshcd_pltfrm_suspend - suspend power management function
@@ -369,6 +388,7 @@ int ufshcd_pltfrm_init(struct platform_device *pdev,
        }
 
        ufshcd_parse_pm_lvl_policy(hba);
+       ufshcd_parse_caps_info(hba);
        pm_runtime_set_active(&pdev->dev);
        pm_runtime_enable(&pdev->dev);