From 427b10e68e236ec9ed0b01c29e14e01f2ffe4906 Mon Sep 17 00:00:00 2001 From: Can Guo Date: Tue, 20 Aug 2019 00:58:46 -0700 Subject: [PATCH] phy: qcom-ufs: separate out 2 lanes configuration Some platforms have 2 UFS PHY instances, one instance supports 2-lane while other instance supports only 1-lane. This change separates out the 2nd lane configuration from 1-lane configuration so that we can apply the 2nd lane configuration only if needed. Change-Id: Idcf8aaa8ed7a9662c0f4186e5a28d2405f8fd5fc Signed-off-by: Subhash Jadavani [cang@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Can Guo --- drivers/phy/qualcomm/phy-qcom-ufs-i.h | 4 ++++ drivers/phy/qualcomm/phy-qcom-ufs.c | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-ufs-i.h b/drivers/phy/qualcomm/phy-qcom-ufs-i.h index 5e0c9fc7282c..84e3aa525a4a 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs-i.h +++ b/drivers/phy/qualcomm/phy-qcom-ufs-i.h @@ -72,6 +72,10 @@ struct ufs_qcom_phy { struct ufs_qcom_phy_vreg vdda_pll; struct ufs_qcom_phy_vreg vdda_phy; struct ufs_qcom_phy_vreg vddp_ref_clk; + + /* Number of lanes available (1 or 2) for Rx/Tx */ + u32 lanes_per_direction; + unsigned int quirks; /* diff --git a/drivers/phy/qualcomm/phy-qcom-ufs.c b/drivers/phy/qualcomm/phy-qcom-ufs.c index e1dde9740069..6c7f17ef6ece 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-ufs.c @@ -13,6 +13,8 @@ #define VDDP_REF_CLK_MIN_UV 1200000 #define VDDP_REF_CLK_MAX_UV 1200000 +#define UFS_PHY_DEFAULT_LANES_PER_DIRECTION 1 + int ufs_qcom_phy_calibrate(struct ufs_qcom_phy *ufs_qcom_phy, struct ufs_qcom_phy_calibration *tbl_A, int tbl_size_A, @@ -123,6 +125,11 @@ struct phy *ufs_qcom_phy_generic_probe(struct platform_device *pdev, goto out; } + if (of_property_read_u32(dev->of_node, "lanes-per-direction", + &common_cfg->lanes_per_direction)) + common_cfg->lanes_per_direction = + UFS_PHY_DEFAULT_LANES_PER_DIRECTION; + /* * UFS PHY power management is managed by its parent (UFS host * controller) hence set the no runtime PM callbacks flag