aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorYaniv Gardi <ygardi@codeaurora.org>2015-03-31 10:37:13 -0400
committerJames Bottomley <JBottomley@Odin.com>2015-04-10 11:52:58 -0400
commitbfdbe8ba21291c024afcec95b7bd515b5bf69689 (patch)
tree6193eececc213269af26b7f66135f95e4ac8375b /drivers/scsi
parenta776e39416cc4580b5a1688c3e44258888955996 (diff)
ufs-qcom: save controller revision info in internal structure
Sometimes, specific information about the UFS controller revision is required in order to determine certain operations or execute controller dependent quirks. In order to avoid reading the controller revision multiple times, we simply read it once and save this information in internal structure. Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> Reviewed-by: Gilad Broner <gbroner@codeaurora.org> Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ufs/ufs-qcom.c14
-rw-r--r--drivers/scsi/ufs/ufs-qcom.h8
2 files changed, 15 insertions, 7 deletions
diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 9217af9bf734..d7cb8435b697 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -214,8 +214,6 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
214 struct ufs_qcom_host *host = hba->priv; 214 struct ufs_qcom_host *host = hba->priv;
215 struct phy *phy = host->generic_phy; 215 struct phy *phy = host->generic_phy;
216 int ret = 0; 216 int ret = 0;
217 u8 major;
218 u16 minor, step;
219 bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B) 217 bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B)
220 ? true : false; 218 ? true : false;
221 219
@@ -224,8 +222,6 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
224 /* provide 1ms delay to let the reset pulse propagate */ 222 /* provide 1ms delay to let the reset pulse propagate */
225 usleep_range(1000, 1100); 223 usleep_range(1000, 1100);
226 224
227 ufs_qcom_get_controller_revision(hba, &major, &minor, &step);
228 ufs_qcom_phy_save_controller_version(phy, major, minor, step);
229 ret = ufs_qcom_phy_calibrate_phy(phy, is_rate_B); 225 ret = ufs_qcom_phy_calibrate_phy(phy, is_rate_B);
230 if (ret) { 226 if (ret) {
231 dev_err(hba->dev, "%s: ufs_qcom_phy_calibrate_phy() failed, ret = %d\n", 227 dev_err(hba->dev, "%s: ufs_qcom_phy_calibrate_phy() failed, ret = %d\n",
@@ -698,10 +694,7 @@ out:
698 */ 694 */
699static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) 695static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)
700{ 696{
701 u8 major;
702 u16 minor, step;
703 697
704 ufs_qcom_get_controller_revision(hba, &major, &minor, &step);
705 698
706 /* 699 /*
707 * TBD 700 * TBD
@@ -929,6 +922,13 @@ static int ufs_qcom_init(struct ufs_hba *hba)
929 if (err) 922 if (err)
930 goto out_host_free; 923 goto out_host_free;
931 924
925 ufs_qcom_get_controller_revision(hba, &host->hw_ver.major,
926 &host->hw_ver.minor, &host->hw_ver.step);
927
928 /* update phy revision information before calling phy_init() */
929 ufs_qcom_phy_save_controller_version(host->generic_phy,
930 host->hw_ver.major, host->hw_ver.minor, host->hw_ver.step);
931
932 phy_init(host->generic_phy); 932 phy_init(host->generic_phy);
933 err = phy_power_on(host->generic_phy); 933 err = phy_power_on(host->generic_phy);
934 if (err) 934 if (err)
diff --git a/drivers/scsi/ufs/ufs-qcom.h b/drivers/scsi/ufs/ufs-qcom.h
index 9a6febd007df..903739668228 100644
--- a/drivers/scsi/ufs/ufs-qcom.h
+++ b/drivers/scsi/ufs/ufs-qcom.h
@@ -151,6 +151,12 @@ struct ufs_qcom_bus_vote {
151 struct device_attribute max_bus_bw; 151 struct device_attribute max_bus_bw;
152}; 152};
153 153
154/* Host controller hardware version: major.minor.step */
155struct ufs_hw_version {
156 u16 step;
157 u16 minor;
158 u8 major;
159};
154struct ufs_qcom_host { 160struct ufs_qcom_host {
155 struct phy *generic_phy; 161 struct phy *generic_phy;
156 struct ufs_hba *hba; 162 struct ufs_hba *hba;
@@ -161,6 +167,8 @@ struct ufs_qcom_host {
161 struct clk *rx_l1_sync_clk; 167 struct clk *rx_l1_sync_clk;
162 struct clk *tx_l1_sync_clk; 168 struct clk *tx_l1_sync_clk;
163 bool is_lane_clks_enabled; 169 bool is_lane_clks_enabled;
170
171 struct ufs_hw_version hw_ver;
164}; 172};
165 173
166#define ufs_qcom_is_link_off(hba) ufshcd_is_link_off(hba) 174#define ufs_qcom_is_link_off(hba) ufshcd_is_link_off(hba)