summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaniv Gardi <ygardi@codeaurora.org>2015-02-03 15:47:08 +0200
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 10:58:45 -0700
commitfac1cf559def03c510727353ec0b427eca44ff18 (patch)
treeecec2ebe4e9234899486451c1c27415aae071fdb
parentda7f098c895d1f612f308b25d38acadb492a058a (diff)
phy: qcom-ufs: move decision of rate B calibration to ufs driver
Until now, the decision if phy calibration is according to rate A or rate B values, was done in the phy driver. It made the phy dependent on the ufs unipro which is unnecessary binding. This change moves the decision into the ufs driver, and pass it through a function parameter to the calibration routine in the phy driver. Change-Id: I7a51d84142c31da57ba5de6ec98526e5c7d1b544 Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> [venkatg@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
-rw-r--r--drivers/phy/phy-qcom-ufs-qmp-20nm.c6
-rw-r--r--drivers/phy/phy-qcom-ufs.c8
-rw-r--r--drivers/scsi/ufs/ufs-qcom.c6
3 files changed, 12 insertions, 8 deletions
diff --git a/drivers/phy/phy-qcom-ufs-qmp-20nm.c b/drivers/phy/phy-qcom-ufs-qmp-20nm.c
index 65612c5187d3..c948f206282b 100644
--- a/drivers/phy/phy-qcom-ufs-qmp-20nm.c
+++ b/drivers/phy/phy-qcom-ufs-qmp-20nm.c
@@ -17,11 +17,11 @@
#define UFS_PHY_NAME "ufs_phy_qmp_20nm"
static
-int ufs_qcom_phy_qmp_20nm_phy_calibrate(struct ufs_qcom_phy *ufs_qcom_phy)
+int ufs_qcom_phy_qmp_20nm_phy_calibrate(struct ufs_qcom_phy *ufs_qcom_phy,
+ bool is_rate_B)
{
struct ufs_qcom_phy_calibration *tbl_A, *tbl_B;
int tbl_size_A, tbl_size_B;
- int rate = UFS_QCOM_LIMIT_HS_RATE;
int err;
tbl_size_A = ARRAY_SIZE(phy_cal_table_rate_A);
@@ -31,7 +31,7 @@ int ufs_qcom_phy_qmp_20nm_phy_calibrate(struct ufs_qcom_phy *ufs_qcom_phy)
tbl_B = phy_cal_table_rate_B;
err = ufs_qcom_phy_calibrate(ufs_qcom_phy, tbl_A, tbl_size_A,
- tbl_B, tbl_size_B, rate);
+ tbl_B, tbl_size_B, is_rate_B);
if (err)
dev_err(ufs_qcom_phy->dev, "%s: ufs_qcom_phy_calibrate() failed %d\n",
diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
index 8e93bf22fe68..a8a45dd09036 100644
--- a/drivers/phy/phy-qcom-ufs.c
+++ b/drivers/phy/phy-qcom-ufs.c
@@ -33,7 +33,7 @@ int ufs_qcom_phy_calibrate(struct ufs_qcom_phy *ufs_qcom_phy,
struct ufs_qcom_phy_calibration *tbl_A,
int tbl_size_A,
struct ufs_qcom_phy_calibration *tbl_B,
- int tbl_size_B, int rate)
+ int tbl_size_B, bool is_rate_B)
{
int i;
int ret = 0;
@@ -54,7 +54,7 @@ int ufs_qcom_phy_calibrate(struct ufs_qcom_phy *ufs_qcom_phy,
* with registers of rate B table.
* table.
*/
- if (rate == PA_HS_MODE_B) {
+ if (is_rate_B) {
if (!tbl_B) {
dev_err(ufs_qcom_phy->dev, "%s: tbl_B is NULL",
__func__);
@@ -543,7 +543,7 @@ void ufs_qcom_phy_save_controller_version(struct phy *generic_phy,
ufs_qcom_phy->host_ctrl_rev_step = step;
}
-int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy)
+int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B)
{
struct ufs_qcom_phy *ufs_qcom_phy = get_ufs_qcom_phy(generic_phy);
int ret = 0;
@@ -554,7 +554,7 @@ int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy)
ret = -ENOTSUPP;
} else {
ret = ufs_qcom_phy->phy_spec_ops->
- calibrate_phy(ufs_qcom_phy);
+ calibrate_phy(ufs_qcom_phy, is_rate_B);
if (ret)
dev_err(ufs_qcom_phy->dev, "%s: calibrate_phy() failed %d\n",
__func__, ret);
diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 1f812c000302..c9d6cdf415c3 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -26,6 +26,7 @@
#include <linux/phy/phy.h>
#include <linux/scsi/ufs/ufshcd.h>
+#include <linux/scsi/ufs/unipro.h>
#include <linux/scsi/ufs/ufs-qcom.h>
#include <linux/phy/phy-qcom-ufs.h>
#include "ufshcd.h"
@@ -288,13 +289,16 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
struct ufs_qcom_host *host = hba->priv;
struct phy *phy = host->generic_phy;
int ret = 0;
+ bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B)
+ ? true : false;
/* Assert PHY reset and apply PHY calibration values */
ufs_qcom_assert_reset(hba);
/* provide 1ms delay to let the reset pulse propagate */
usleep_range(1000, 1100);
- ret = ufs_qcom_phy_calibrate_phy(phy);
+ ret = ufs_qcom_phy_calibrate_phy(phy, is_rate_B);
+
if (ret) {
dev_err(hba->dev, "%s: ufs_qcom_phy_calibrate_phy() failed, ret = %d\n",
__func__, ret);