diff options
| author | Sujit Reddy Thumma <sthumma@codeaurora.org> | 2013-08-31 19:46:03 +0530 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 10:55:23 -0700 |
| commit | 2a239fdc64cc45bad8b63fa1a47db829ed889278 (patch) | |
| tree | f1b61bb4ea328282413102d7fded54f2414e7b69 | |
| parent | dee78049a306e34d2e0985e1b8d86ee36e1c3eb2 (diff) | |
scsi: ufs: program number of TX lanes to drive in MSM UFS PHY
After link startup the phy adapter (PA) layer in Uni-Pro
automatically detects the number of available lanes for
communication with the device. Since it is choice of s/w
to use all the available lanes or a partial of them, it is
necessary to communicate to MSM PHY about the lanes not being
used so that PHY can stop driving them.
Change-Id: I6f005e67a4c0a35dcba0ff186de5817af1b0439d
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
| -rw-r--r-- | drivers/scsi/ufs/ufs-msm.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/scsi/ufs/ufs-msm.c b/drivers/scsi/ufs/ufs-msm.c index 623f16b55742..84ad6400b313 100644 --- a/drivers/scsi/ufs/ufs-msm.c +++ b/drivers/scsi/ufs/ufs-msm.c @@ -21,7 +21,9 @@ #include <linux/iopoll.h> #include <linux/platform_device.h> #include "ufshcd.h" +#include "unipro.h" +#define MAX_U32 (~(u32)0) #define MPHY_TX_FSM_STATE 0x41 #define TX_FSM_HIBERN8 0x1 #define HBRN8_POLL_TOUT_MS 100 @@ -1065,6 +1067,28 @@ static void msm_ufs_phy_calibrate(struct msm_ufs_phy *phy) mb(); } +static int msm_ufs_enable_tx_lanes(struct ufs_hba *hba) +{ + int err; + u32 tx_lanes; + u32 val; + struct msm_ufs_phy *phy = hba->priv; + + err = ufshcd_dme_get(hba, + UIC_ARG_MIB(PA_CONNECTEDTXDATALANES), &tx_lanes); + if (err) { + dev_err(hba->dev, "%s: couldn't read PA_CONNECTEDTXDATALANES %d\n", + __func__, err); + goto out; + } + + val = ~(MAX_U32 << tx_lanes); + writel_relaxed(val, phy->mmio + UFS_PHY_TX_LANE_ENABLE); + mb(); +out: + return err; +} + static int msm_ufs_check_hibern8(struct ufs_hba *hba) { int err; @@ -1254,6 +1278,8 @@ static int msm_ufs_link_startup_notify(struct ufs_hba *hba, bool status) switch (status) { case PRE_CHANGE: msm_ufs_cfg_timers(hba); + case POST_CHANGE: + msm_ufs_enable_tx_lanes(hba); default: break; } |
