phy: qcom-ufs: Add support to set phy mode
authorVivek Gautam <vivek.gautam@codeaurora.org>
Thu, 12 Oct 2017 06:19:34 +0000 (11:49 +0530)
committerKishon Vijay Abraham I <kishon@ti.com>
Mon, 23 Oct 2017 05:49:27 +0000 (11:19 +0530)
Adding support to set desired UFS phy mode that can be set
from the host controller.

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/qualcomm/phy-qcom-ufs-i.h
drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c
drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c

index 13b02b7de30b3f0e82d47ffbaa5824bf212a6f15..94326ed107c3f6edc72423505469101556788ae8 100644 (file)
@@ -115,6 +115,8 @@ struct ufs_qcom_phy {
        int cached_regs_table_size;
        bool is_powered_on;
        struct ufs_qcom_phy_specific_ops *phy_spec_ops;
+
+       enum phy_mode mode;
 };
 
 /**
index 12a1b498dc4b07850120dc03c8eca3bd9c7dcf46..af65785230b559ba4e5a38adc2fe5d690992b59e 100644 (file)
@@ -52,6 +52,19 @@ static int ufs_qcom_phy_qmp_14nm_exit(struct phy *generic_phy)
        return 0;
 }
 
+static
+int ufs_qcom_phy_qmp_14nm_set_mode(struct phy *generic_phy, enum phy_mode mode)
+{
+       struct ufs_qcom_phy *phy_common = get_ufs_qcom_phy(generic_phy);
+
+       phy_common->mode = PHY_MODE_INVALID;
+
+       if (mode > 0)
+               phy_common->mode = mode;
+
+       return 0;
+}
+
 static
 void ufs_qcom_phy_qmp_14nm_power_control(struct ufs_qcom_phy *phy, bool val)
 {
@@ -102,6 +115,7 @@ static const struct phy_ops ufs_qcom_phy_qmp_14nm_phy_ops = {
        .exit           = ufs_qcom_phy_qmp_14nm_exit,
        .power_on       = ufs_qcom_phy_power_on,
        .power_off      = ufs_qcom_phy_power_off,
+       .set_mode       = ufs_qcom_phy_qmp_14nm_set_mode,
        .owner          = THIS_MODULE,
 };
 
index 4f68acb58b7361e2f158cbb463907452b31f1485..5c18c41dbdb4e569dd13b719aeaa59ad732e3e03 100644 (file)
@@ -71,6 +71,19 @@ static int ufs_qcom_phy_qmp_20nm_exit(struct phy *generic_phy)
        return 0;
 }
 
+static
+int ufs_qcom_phy_qmp_20nm_set_mode(struct phy *generic_phy, enum phy_mode mode)
+{
+       struct ufs_qcom_phy *phy_common = get_ufs_qcom_phy(generic_phy);
+
+       phy_common->mode = PHY_MODE_INVALID;
+
+       if (mode > 0)
+               phy_common->mode = mode;
+
+       return 0;
+}
+
 static
 void ufs_qcom_phy_qmp_20nm_power_control(struct ufs_qcom_phy *phy, bool val)
 {
@@ -160,6 +173,7 @@ static const struct phy_ops ufs_qcom_phy_qmp_20nm_phy_ops = {
        .exit           = ufs_qcom_phy_qmp_20nm_exit,
        .power_on       = ufs_qcom_phy_power_on,
        .power_off      = ufs_qcom_phy_power_off,
+       .set_mode       = ufs_qcom_phy_qmp_20nm_set_mode,
        .owner          = THIS_MODULE,
 };