Commit graph

563489 commits

Author SHA1 Message Date
Subhash Jadavani
eea9974ddf scsi: ufs-msm: enable power management
Until now due to issues with UFS host controller (especially with version
1.1.0) and UFS device, UFS power management was not enabled but now as UFS
link hibernate and UFS device sleep functionalities are stable, we are
enabling the level 3 power management which puts UFS link in hibernate and
UFS device in sleep state during suspend.

Change-Id: I0376bb3bfa47f4fa13527f496258862f10ffe07a
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:43 -07:00
Subhash Jadavani
6f2397a1ad scsi: ufs-msm: avoid full UFS initialization on system resume
As part of UFS power management, UFS link would be put in hibernate and
UFS device would be put in SLEEP mode as part of runtime/system suspend
callback. But when system goes into suspend with VDD minimization, UFS
PHY states are being reset which means UFS link hibernate exit command on
system resume would fail. There are 2 ways to workaround this issue, one
is to reinitialize the entire UFS link on system resume but it has very
high latency of ~150ms whereas other acceptable workaround is to save
the UFS PHY state information before system goes into suspend and restore
this state information during system resume but before executing the
hibernate exit command. This change implements the 2nd workaround.

Change-Id: I061871321b9c0e6386188355858217dcedd4f20a
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts, dropped changes to
ufshcd.c & unipro.h]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:42 -07:00
Subhash Jadavani
5b0bdd634a scsi: ufs: increase the query request timeout
Some of the query requests like reading the fDeviceInit flag
and reading the ref_clk attribute could take more than current
timeout value of 30ms and hence we might see error messages
printed in kernel logs even though next retries are going to
succeed. Hence its better to increase the query request timeout
to 100ms which seems good enough for all query requests to be
completed.

Change-Id: I57ed50e25131677ee6cab6b63ccacf7020f2b501
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:41 -07:00
Subhash Jadavani
26c2a47e5c scsi: ufs-msm: inform PHY about analog rails power down
UFS PHY analog rails (VDDA_PHY_0P9 & VDDA_PLL_1P8) can be power collapsed
while the UFS link is in hibern8 state but PHY needs to be informed about
the power collapse by writing 0 to its power down control register. If PHY
is not informed about it, hibern8 exit might fail. This fixes this problem.

Change-Id: If897681569ca0073f2075acf8a9014da8d762827
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:40 -07:00
Yaniv Gardi
601d661911 scsi: ufs-msm: enable quirk to fix gear change to HS
With the G3 UFS devices, changing gear into HS is failing.
The quirk solves the problem of changing gear into HS by enabling
the attribute that specifies whether or not the inbound Link supports
unterminated line in HS mode.
This change enables the quirk.

Change-Id: I2a2fcb9dd0233e4dee7cc2443b6a60808e62da7c
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:39 -07:00
Dolev Raviv
c2e17b8952 scsi: ufs: fix multiple ufs spec violation
When a command to a W-LU is timed out via scsi, error handling
will treat it as any other LU and send commands such as
START_STOP with wrong format or task abort. Those commands are
illegal for W-LU according to the UFS spec.
To solve it, when an error is recognized those steps are skipped
and the last step, reset and restore process, is initiated.

Change-Id: I7ff2a8d3c816adf5e1bf3762c0a6c342be7e83ea
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
2016-03-22 10:56:39 -07:00
Yaniv Gardi
626cfcfb32 scsi: ufs-msm: change default working mode in HS to rate A
So far, we used to work in the maximum HS (High Speed) rate available
by the UFS device (and supported by the controller) which is rate B.
This change changes the default working rate from rate B to rate A,
in order to gain more stability.

Change-Id: I797485b9699c5dab2a294b524f27c8e327b1e62d
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:38 -07:00
Yaniv Gardi
68e23b443a scsi: ufs-msm: add PHY calibration values for UFS controller 1.1.1
The PHY should be calibrated with set of values based on the UFS
controller revision.
In this patch the UFS controller revision is read, and based on it,
it is decided which set of values to use in order to calibrate the PHY.

Change-Id: I369f9332df95364ee9e2ed83c8ce1bf5a28565c0
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:37 -07:00
Yaniv Gardi
241e1f8a50 scsi: ufs: disable LCC configuration in the UFS device
LCC configuration that is needed for optical connections, is not needed
when working with UFS devices. As this values is already disabled
in the host, it should also be disabled in the device.

Change-Id: I81a6ac7310ff9dbf2d6c571431e62beab107fdf2
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:36 -07:00
Subhash Jadavani
accd4ac14f scsi: ufs-msm: enable UFSHCD_BROKEN_LCC
LCC (Line Control Command) are being used for communication between
UFS host and UFS device. But UFS host controller on our MSM have the issue
with issuing the LCC commands to UFS device and hence disable LCC from
host side.

Change-Id: I155b6a4a1adb77c40c5b5e642b3a034ee24659f3
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:35 -07:00
Subhash Jadavani
47df7e7a36 scsi: ufs: provide the quirk to disable the LCC
LCC (Line Control Command) are being used for communication between
UFS host and UFS device. But some hosts might have the issue with
issuing the LCC commands to UFS device and in this case LCC could be
explicitly disabled from the host side.

Change-Id: I7b4d4a46d8d4e70bde088a5652decc7ba86a5617
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:34 -07:00
Subhash Jadavani
b99beadf1c scsi: ufs-msm: don't enable interrupt aggregation
Current versions of UFS host controllers on our MSMs have interrupt
aggregation logic broken. Interrupt aggregation may not work if both
threshold count and timeout is enabled. Hence disable interrupt
aggregation by enabling UFSHCD_QUIRK_BROKEN_INTR_AGGR quirk until
its fixed in the newer UFS host controller revisions.

Change-Id: I063c6d577c370bfcf5648b4b0df9292c30984c63
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:33 -07:00
Noag
90c7800a6d scsi: ufs: read ref clk and icc level during init only
In order to minimize resume latency, pre-fetch
icc levels and reference clock during initialization
and avoid reading them each link startup
during resume.

Change-Id: Iab705068e46114eb3caa00c6e1b88a7862385d08
Signed-off-by: Noag <noag@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:32 -07:00
Sahitya Tummala
57e694f677 scsi: ufs-msm: Add hba->vops->clk_scale_notify()
Add hba->vops->clk_scale_notify() to get notified about clock
scaling and thus to configure phy timers and to update the
bus bandwidth vote accordingly.

Change-Id: I2f0cae8e787d0b4e764dc210db035add880428ce
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2016-03-22 10:56:32 -07:00
Sahitya Tummala
af960ab154 scsi: ufs: Add support for clock scaling using devfreq framework
The clocks for UFS device will be managed by generic DVFS (Dynamic
Voltage and Frequency Scaling) framework within kernel. This devfreq
framework works with different governors to scale the clocks. By default,
UFS devices uses simple_ondemand governor which scales the clocks up if
the load is more than upthreshold and scales down if the load is less than
downthreshold.

Change-Id: I1c3944a5b1771b967c1df3e441a75fd584d6e2a5
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
[gbroner@codeaurora.org: fix usage of devfreq governor data]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts, dropped most of the
changes as they are already present on baseline]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:31 -07:00
Dolev Raviv
0c8a317ea9 scsi: ufs: add queue fullness statistics
Add more statistics to allow tracking of tags occupancy
upon sending a new request. The statistics is kept separately
for 4 types of requests: read, write, urgent and flush.
All will consist only of data requests (eg. read, write, urgent).
This statistic is an enhancement of current tag statistic and
uses same infrastructure.

Change-Id: If5cea4aec4e94081d568a3661584b31665becfc6
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:30 -07:00
Yaniv Gardi
8045d7daab scsi: ufs-msm: fix a wrong condition when checking array size
This change fixes a wrong condition that results a false error message

Change-Id: Iacb9224eaa908c0eec612fe3570b38ada3f90b37
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:29 -07:00
Raviv Shvili
b270f7f8cf scsi: ufs: fix crash upon reading host_regs debugfs entry
While reading host_regs debugfs entry, UFS controller
might be in low power mode. While in UFS runtime suspend mode the host
controller is being unclocked.
Reading the unclocked host controller registers, may cause a system crash.
In order to avoid that, UFS runtime suspend should be
held and released when done.

CRs-fixed: 594618
Change-Id: I4b850806352b59192340bc5b0bb480b4dd6553f1
Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:28 -07:00
Subhash Jadavani
c61706e065 scsi: ufs-msm: enable workarounds for APQ8084 v1.1
Some of the workarounds (like skipping the suspend and giving 1ms delay
before every UIC DME commands) are still needed to enable the booting
from UFS device on APQ8084 v1.1 as well. This patch enables those
workarounds.

Change-Id: I6023403130e3ff87f918e1ab7eaf5a145935bfab
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:27 -07:00
Noag
19c6b388dd scsi: ufs: remove redundant "Illegal ufs-IOCTL" log for BLKROSET command
This patch prevents the "ufshcd_ioctl: Illegal ufs-IOCTL cmd 4701" log
message from being printed during boot time.
4701(BLKROSET) is not supported but not an Illegal command to UFS.

CRs-fixed: 580449

Change-Id: I20d54b23c09bd8b72b671b979103424e2050e15f
Signed-off-by: Noa Rubens <noag@codeaurora.org>
2016-03-22 10:56:26 -07:00
Sahitya Tummala
e022634159 scsi: ufs-msm: Enable clock gating
Enable relevant PHY clocks to be turned off as part of ufshcd
clock gating. Also, enable clock gating by setting necessary
capabilities.

The clock gating delay is currently set to 150ms by default. It can
be changed if required via sysfs -
echo xx > /sys/bus/platform/devices/msm_ufs.1/clkgate_delay_ms

Change-Id: I41c0b4c560711540cc0630e752d7843fca3fb26c
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2016-03-22 10:56:25 -07:00
Sahitya Tummala
7686ac5a4a scsi: ufs: Add support for clock gating
The UFS controller clocks can be gated after certain period of
inactivity, which is typically less than runtime suspend timeout.
In addition to clocks the link will also be put into Hibern8 mode
to save more power.

The clock gating can be turned on by enabling the capability
UFSHCD_CAP_CLK_GATING. To enable entering into Hibern8 mode as part of
clock gating, set the capability UFSHCD_CAP_HIBERN8_WITH_CLK_GATING.

The tracing events for clock gating can be enabled through debugfs as:
echo 1 > /sys/kernel/debug/tracing/events/ufs/ufshcd_clk_gating/enable
cat /sys/kernel/debug/tracing/trace_pipe

Change-Id: I3e5e7e78130941ad7109fc05a46d7c3720245a1a
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflicts]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts, dropped most of the
changes as they are already present on baseline]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:25 -07:00
Sahitya Tummala
b55d16cd6b scsi: ufs-msm: Fix hba variant host op init and setup_clocks
Handle the case where vops->setup_clocks is called before vops->init()
from ufshcd driver.

Change-Id: I4754b658c1f37db6418560321f5dfe7a4650692b
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
2016-03-22 10:56:24 -07:00
Yaniv Gardi
c6aef9984d scsi: ufs: save and print current power info in the driver
There is no way to know the current working power info of the
driver, so in this patch, we save the power parameters, and we
print them to console.
This printing is necessary, since in case of crash, we can use those
logs to debug and investigate.

Change-Id: If0dc7a695c9b14a369e033e4c31787dcc2254ac3
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:23 -07:00
Yaniv Gardi
0a33bca1b1 scsi: ufs-msm: add clock frequency table for Rate B
The UFS driver is now supporting working in HS (High Speed), Rate B.
Hence, we need to add a static table of clock frequency for rate B gears.

Also, this change fixes array access to index -1, in certain corner
cases, and report illegal values that are returned from
msm_ufs_cfg_timers() routine

Change-Id: Id05321c4fd3ebcc509c6b53f3722c3acfb48cad3
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: fixed compilation errors]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:21 -07:00
Yaniv Gardi
f2a2f3edbe scsi: ufs-msm: enable quirk for broken mode of TX 2 lanes
The default working mode should be TX 2 lanes, but
as this mode is not stable on the current controller, this quirk is
required so the unique mode will be TX 1 lane.

Change-Id: Iac8ed83207d66b8bd6a50cf1983f89df85525904
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:20 -07:00
Yaniv Gardi
6efcad99dc scsi: ufs: add a quirk for broken mode of TX 2 lanes
The default working mode should be TX 2 lanes, but
as this mode is not stable on the current controller, this quirk is
required so the unique mode will be TX 1 lane.

Change-Id: Id2dc9e2a1b481007a894f0828d15d8f8ad61215c
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:19 -07:00
Yaniv Gardi
f2bbc92cb7 scsi: ufs-msm: change default working mode to rate B
Working throughput in UFS is affected by Gear, Number of lanes, and Mode
(PWM: Slow / SlowAuto,
 or
 HS: Fast /FastAuto).
When working in HS, throughput is affected by additional parameter -
Rate (A / B).
Here, we change the default working rate in HS to Rate B.

Change-Id: I35f63d5fc90ad1be19d886dda0bdcd4e54fe9c4c
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:19 -07:00
Subhash Jadavani
461a7044f1 scsi: ufs-msm: switch off PHY PLL power rail during hibern8
If UniPro link is in Hibern8 state, low noise analog power rail for PLL
can be switched off along with main PHY analog power.

Change-Id: I20b113e5f004c824c330f72dc7649dac961bfe3e
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
2016-03-22 10:56:18 -07:00
Sujit Reddy Thumma
8cdca82049 scsi: ufs: Override auto suspend tunables for ufs
Override auto suspend tunables for UFS device LUNs during
initialization so as to efficiently manage background operations
and the power consumption.

Change-Id: Id7ff9e8a5c83b7503a329e71936af3234a22895b
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
[gbroner@codeaurora.org: fix minor merge conflicts]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
2016-03-22 10:56:17 -07:00
Yaniv Gardi
5443a50d5c scsi: ufs-msm: phy configuration to support rate B
This change adds phy configuration to support working in rate B
in case vendor power-mode preferences are pre-defined to work in
rate B.
Note: This change doesn't configure the default working rate
to be rate B, but only adds the support to do so.

Change-Id: Iec896917f9c76dcc3b5383c211871c7edf215b44
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:16 -07:00
Yaniv Gardi
06a49c67f7 scsi: ufs: dump device descriptor info via debugfs
This change adds a debugfs capability to dump Device Descriptor
information, parsed and detailed. It helps developer to get
important information about the UFS device it handles.

Change-Id: Ia149e4c82e33755b235eb6afe52541c8b23a0708
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:15 -07:00
Yaniv Gardi
277e3a5096 scsi: ufs: update device descriptor maximum size
According to JESD220B - UFS v2.0, the maximum size of device descriptor
has changed from 0x1F to 0x40. This patch updates the maximum size of
this descriptor.

Change-Id: I5f5de516a2d86e1f4409e44e1b2db62a624207b9
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:14 -07:00
Sujit Reddy Thumma
591026c930 scsi: ufs-msm: avoid powering off the device during system suspend
Powering off the device during system suspend cause regressions
and device may go bad. This is mainly because of specification
violation of not holding RST_n line LOW during power up. Since
RST_n line cannot be controlled from software, avoid powering off
the device in first place.

Change-Id: I5cdb3b3b1685222d69717f079dc9fc43c97b01bf
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
2016-03-22 10:56:13 -07:00
Sujit Reddy Thumma
ada4c78516 scsi: ufs: fix NULL pointer dereference when aborting command
If there is a race between command completion and the scsi timeout,
the scsi timeout ignores the command completion and proceed with
aborting the command. Since the command completion happen in
interrupt context, it would be prioritized and ufshcd might free
resources before abort initiated by scsi is completed. Hence, if the
abort routine refers to the command info saved in lrbp it would cause
NULL pointer dereference. Fix this by using the command info provided
by scsi layer in the ufshcd_abort() argument.

Change-Id: Ie915880b1c239ef9080cfb5cb74f19329b3a82d4
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
2016-03-22 10:56:12 -07:00
Yaniv Gardi
953a9f7f36 scsi: ufs-msm: disable quirk that adds delay after power more change
As new PHY configuration attributes changed and more delays added to
DME commands, we can now remove this quirk and remains same stability
as before.

Change-Id: I8f0d2c045ca2f68e58913f4e9a1ce41ef4d77878
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:11 -07:00
Lee Susman
59580a44b3 scsi: ufs: add retries to dme_peer get and set attribute
The dme_peer get/set attribute commands are prone to errors, therefore
we add three retries for the UIC command sending.
Error code returned from ufshcd_send_uic_cmd() is checked, and unless
it was successful or the retries have finished, another command will be
sent.

Change-Id: I63727228079cde897b4ed22ce0e87a8ca4814871
Signed-off-by: Lee Susman <lsusman@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
2016-03-22 10:56:10 -07:00
Sujit Reddy Thumma
ff109f0fc3 scsi: ufs-msm: Fix turning off tx/rx lane synchronization clocks
The UFS PHY outputs tx/rx lane synchronization clocks which are
input to host controller via branch gating logic in GCC. These
clocks are enabled only when the PHY is powered on and Tx/Rx bursts
are active. Gating these clocks at runtime might lead to insufficient
clocks for the controller to close the tx/rx bursts. This further
lead to data transfer getting stuck after clocks are ungated.

Fix this by controlling the explicit enable/disable of these clocks
only when PHY state is changed. There will be no power impact of
leaving the clocks enabled at runtime because PHY dynamically manages
the gating and the clocks are really enabled only when tx/rx bursts
are active.

CRs-Fixed: 576719
Change-Id: Ib74bff641063eab36c7fd3e5fb7829c46a11aee0
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflicts - apq8084.dtsi file
location has been previously changed and is already up to date]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
2016-03-22 10:56:10 -07:00
Yaniv Gardi
743464f0ed scsi: ufs: add wrapper for retrying sending query attribute
Sometimes queries from the device might return a failure so it is
recommended to retry sending the query, before giving up.
This change adds a wrapper to retry sending a query attribute,
in cases where we need to wait longer, before we continue,
or before reporting a failure.

Change-Id: I350a818f6a11c4f32310ca19c4c6f664381ba88d
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:09 -07:00
Lee Susman
c9c15f80e8 scsi: ufs: fix debugfs tag stats resetting
When attempting to clear ufs tag stats, memset 0 is called with size
of multiples of unsigned int.
This is wrong since each cell in the stats array is of type (u64).
Fix the memset to sizeof(*tag_stats).

Change-Id: Iaeb70616a2160ee9cba4605e7251dc45868d1951
Signed-off-by: Lee Susman <lsusman@codeaurora.org>
2016-03-22 10:56:08 -07:00
Yaniv Gardi
f97ac66e17 scsi: ufs-msm: remove command queue quirk
So far the command queue for the whole UFS device was depend on the
UFSHCD_QUIRK_BROKEN_DEVICE_Q_CMND quirk due to stability issues.
Now, that we gained stability, with new UFS devices FW, we can
remove the UFSHCD_QUIRK_BROKEN_DEVICE_Q_CMND quirk

Change-Id: I7aef145e226e5b207d0146f58b5cd9c87ed5bb91
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:07 -07:00
Dolev Raviv
d706844272 scsi: ufs: handle errors from PHY_ADAPTER_ERROR register
The PHY_ADAPTER_ERROR status register indicates PHY lane errors
reported by the M-PHY layer. In some occasions the controller
can recover from such errors. When the error is not recoverable,
a stuck DB error will occur. Since the stuck DB error is spotted
separately, no action other than clearing the register is necessary.

Change-Id: I4b9e8ab15018fe74da34264eac71f8110e94928a
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
2016-03-22 10:56:06 -07:00
Raviv Shvili
84458d005c scsi: ufs: Add new file ufs-msm.h
At the current implementation all the enums structs and defintions
defined at the ufs-msm.c. In order to share those definitions with
other files, we expose them at ufs-msm.h

Change-Id: I12fe3b9a51c86b5bf6584c2de65de40749ef5693
Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
2016-03-22 10:56:05 -07:00
Yaniv Gardi
4a0b4e04d2 scsi: ufs-msm: change the vendor preferable power mode
As working with new UFS devices, and new version of FW,
we were able to work in a higher gear, and to maintain stability.
In this change the preferable values of the vendor power modes are
set to be HS-G2.
Also, a few minor indentation fixes are added.

Change-Id: I34d4836894b9d48085bbe2aa31a6f2d92661fb3d
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:04 -07:00
Sujit Reddy Thumma
9539c166fa scsi: ufs: add trace support for ufs power management
Add ftrace support for profiling ufs power management latencies.
Usage:
	echo 1 > /sys/kernel/debug/tracing/events/ufs/enable
	cat /sys/kernel/debug/tracing/trace_pipe

Change-Id: If5c063179cc69a500d4902eb00b4ca3dc16e27f0
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:03 -07:00
Dolev Raviv
ee20bf627d scsi: ufs: print scsi interpretation for aborted task
Adds the scsi interpretation of the aborted command,
in addition to the transfer dump. This change improves
crashes debugging.

Change-Id: I1b983042d90b8d0434260bb78e09807dd933a03a
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
2016-03-22 10:56:03 -07:00
Yaniv Gardi
4dad760a4d scsi: ufs: fix a bug in a UTRD info dump
The bug was a wrong parameter passed to print_hex_dump() function.

Change-Id: I962e08b8c1c8c546f0bc625da3bff292965da8a5
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:02 -07:00
Sujit Reddy Thumma
b0c53c13e9 scsi: ufs-msm: Add bus bandwidth voting support
The UFS host controller on MSM chipsets transfer data over
System NoC to the DDR memory. Add bus bandwidth voting support
based on the speed modes the host communicates with the device
so as to provide optimum throughput while transferring data over
the bus.

Change-Id: I1b407975984985fa108aa9373e2eab08b9027df4
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflicts - apq8084.dtsi file
location has been previously changed and is already up to date]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts and also fixed
compilation error]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:56:01 -07:00
Yaniv Gardi
894fa0c22d scsi: ufs-msm: add support for rx and tx to work in different num of lanes
Uni-pro lane management provides flexibility for tx/rx to work with
different number of lanes.
This change supports different number of lanes for TX and for RX.
The configured number of lanes for TX will be now the minimum between
the device capability and the vendor preferences.
Same logic applies when configuring RX number of lanes.

Change-Id: I9387a4489d910f89a0741c6349084051d7d94549
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:56:00 -07:00
Yaniv Gardi
cb6bbbdc02 scsi: ufs: add index details to query error messages
When sending query to the device, the index  of the failure
is additional useful information that should be printed out as it
might specify the logical unit (LU) where the error occurred.

Change-Id: I15dd74545842bde7bbfb5bda56c20b5a28d54e75
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:55:59 -07:00