Commit graph

563364 commits

Author SHA1 Message Date
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
Yaniv Gardi
23a7de785f scsi: ufs: phy configuration to support HS-G2
This change is required according to HW team, in order to support
UFS device working with HS-G2

Change-Id: Id76a36870103d93b9f602911412e999cce64cec1
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:55:58 -07:00
Yaniv Gardi
014e61878a scsi: ufs: read the device bRefClkFreq attribute
Device reference clock is a crucial parameter, as
it would fail to work in HS, if its value is different than 19.2 MHz.
This is why we should read its value upon start-up and notify
its value as a debug message.
We don't want to "blindly" configure this attribute as well, as this is
a one-time-programmable parameter and should be considered carefully
before setting it.

Change-Id: Ia2cc0f18fae1189949c30b5b2a65b763c1c46fb1
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:55:57 -07:00
Sujit Reddy Thumma
956d591558 scsi: ufs: Inject errors to verify error handling
Use fault-injection framework to simulate error conditions
in the controller and verify error handling mechanisms
implemented in UFS host controller driver.

This is used only during development and hence
guarded by CONFIG_UFS_FAULT_INJECTION debug config option.

Change-Id: Ia63c276c5e56d677a92332b42b670300ad82af7a
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
2016-03-22 10:55:56 -07:00
Yaniv Gardi
29a67c2689 scsi: ufs: undo disabling LCC configuration in UFS device
So far we have disabled the LCC configuration in device and also in the
controller.
However, in some UFS devices, disabling the LCC configuration might fail
so we can remove this command. It was presented at first, just that the
controller and device will be configured identically (both with
TX_LCC_ENABLE disabled), but it shouldn't have any impact on the UFS
device behavior when removing this configuration command from the device.

Change-Id: I87342a63c75d28a91f0d1ab8edd819d13b3a21a1
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:55:56 -07:00
Raviv Shvili
2069520a4c scsi :ufs: verify hba controller hce reg value
Sometimes due to hw issues it takes some time to the
host controller register to update. In order to verify the register
has updated, a polling is done until its value is set.

In addition the functions ufshcd_hba_stop() and
ufshcd_wait_for_register() was updated with an additional input
parameter, indicating the timeout between reads will
be done by sleeping or spinning the cpu.

Change-Id: Id79d92a4a0bc05d385eb47c027fe19a765f71851
Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts, dropped the changes
in drivers/scsi/ufs/ufshcd-pci.c]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:55:55 -07:00
Dolev Raviv
7e9e854fc3 scsi: ufs: add queries retry mechanism
Some of the queries might fail during init. To avoid
system failure, we add retry mechanism to issue queries
several times.

Change-Id: Ibab1d1dbfbaab763baad63c24218289b61da7b28
Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
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:55:54 -07:00
Yaniv Gardi
96e008c24e scsi: ufs: enable the quirk to add delay before dme commands
Before each dme command (get, set), delay is required for
stability purposes.
This change enables that quirk.

Change-Id: I8ef88f08562de444cb81e767c4d8aeb35b6bb0ea
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:55:53 -07:00
Yaniv Gardi
9da665ff6d scsi: ufs: add quirk for delay before dme commands
add delay before each dme command (get, set), as this delay is
required for stability purposes.

Change-Id: I5aca4c25f251c41c6764269366a8ca7235ffafc1
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
2016-03-22 10:55:52 -07:00
Yaniv Gardi
e6aa6d8e5a scsi: ufs: disable LCC configuration
LCC configuration that is needed for optical connections, is not needed
when working with UFS devices. This values can be disable in all tx
connected lanes and in both: unipro and the device

Change-Id: I3c94600dad0aaade87eb976b6296a284d10aff93
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:55:51 -07:00
Dolev Raviv
1458023d1e scsi: ufs: fix spelling in variable
A variable named ioct_data should have named ioctl_data. This change is
important for synchronizing the original change with mailing list version.

Change-Id: I224989d3caf2ee0faad6b99cd6774983438c5464
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:55:49 -07:00
Yaniv Gardi
a4d13e95d6 scsi: ufs: replace debugfs mutex with spinlock
Using a mutex is problematic if the code can run in interrupt context.
In this patch we replace the ufs debugfs synchronization mechanism
from mutex to spinlock, which doesn't go to sleep.

Change-Id: I4e258898ed0ddf5b84d955fabd4354c2d2891c3d
Signed-off-by: Lee Susman <lsusman@codeaurora.org>
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:55:46 -07:00
Sujit Reddy Thumma
3ae96f80aa scsi: ufs: Enable quirk to ignore sending WRITE_SAME command
WRITE_SAME command is not supported by UFS. Enable a quirk for
the upper level drivers to not send WRITE SAME command.

Change-Id: If3108134ceefbcb9c8585c1b489b4124ffa6b1ad
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:55:45 -07:00
Sujit Reddy Thumma
5a390083a3 scsi: ufs-msm: override HS rate series with vendor specifics
High Speed rate series might always be set to rate "A" if the
vendor doesn't specify any rate during pre-power change notify.

Change-Id: Ied7ce3eba98ffbece97ec06eb6cab8df1d104f52
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
2016-03-22 10:55:44 -07:00
Dolev Raviv
58cf7d3fea scsi: ufs: add ioctl interface for query request
This patch exposes the ioctl interface for UFS driver via SCSI device
ioctl interface. As of now UFS driver would provide the ioctl for query
interface to connected UFS device.

Change-Id: I7a5cea8de925dc0ecb6643774321e2c3690c504e
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
[gbroner@codeaurora.org: dropping changes to the following files:
 include/uapi/scsi/Kbuild
 include/uapi/scsi/ufs/Kbuild
 include/uapi/scsi/ufs/ioctl.h
 include/uapi/scsi/ufs/ufs.h
which are already included in previous change titled:
'uapi: scsi: ufs: add ioctl interface for query request']
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts and compilation
errors]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:55:44 -07:00
Dolev Raviv
3154337ccd uapi: scsi: ufs: add ioctl interface for query request
This patch exposes the ioctl interface for UFS
driver via SCSI device ioctl interface. As of
now UFS driver would provide the ioctl for query
interface to connected UFS device.

Change-Id: Ib8301a69550408bfcb5fc85bb9c0498450c8cc31
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:55:43 -07:00
Yaniv Gardi
2a0ccca3dc scsi: ufs: fix a compilation warning
Assign a value to 'ret' in order to prevent a compilation warning of:
'ret' may be used uninitialized in this function.

Change-Id: Id10d0e5e8204d233cf4906bc33709d3c012d964f
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:55:42 -07:00
Yaniv Gardi
145d4bd6af scsi: ufs: change the default preferences of vendor pwr change to HS
In this change the default preferences of the UFS vendor
are set to work in HS-G1- 1 Lane, as the enviroment became stable.

Change-Id: I340190d5c6cf4f848f9def7eba8831fb299adadb
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:55:41 -07:00
Yaniv Gardi
f158530df0 scsi: ufs-msm: avoid code duplication when setting timer register
since two different routines implement almost the same logic of
scanning the ufs clocks, getting the rate of "core_clk" and
setting a vendor timer register with a calculated value,
we should use only one routine to do that in order to minimize
potential errors

Change-Id: I22728295074acfbe4d421996ea9eaa1f29cb3a32
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:55:40 -07:00
Yaniv Gardi
b0a7b2b5df scsi: ufs-msm: add vendor specific support for power change callback
Sometimes, the device shall report its maximum power and speed
capabilities, but we might not wish to configure it to use those
maximum capabilities.

In this change we implement the vendor specific callback that should
determines what parameters we should use in power change.
It takes into account the maximum capabilities of the device, and
also the pre-defined vendor preferences.
According to both set of parameters, it calculates the maximum power
and speed that are still acceptable by both: the vendor preferences
and the devices capabilities.

Change-Id: I3ef468d3882f3ed9d49a99aa285af4a1f58063a0
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:55:39 -07:00
Yaniv Gardi
2d716ea062 scsi: ufs-msm: fix fall-through in switch case
fix fall through in msm_ufs_link_startup_notify() during PRE_CHANGE,
since we would like msm_ufs_enable_tx_lanes(hba) to happen only in
POST_CHANGE

Change-Id: I91b1134ef7060ee8b8189335d0ef7b5a4f546534
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:55:38 -07:00
Sujit Reddy Thumma
bf14b36ec0 scsi: ufs-msm: fix issue with setting the ref_clk enable flag
Fix missing update of ref_clk enable reference count when the
clocks are enabled and also enable shutting down the phy and
device during system suspend.

Change-Id: I7772cd87e0d0528ab5dbe6ea9f09e6d02c86f96c
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
2016-03-22 10:55:37 -07:00
Yaniv Gardi
f8ef801c9e scsi: ufs: expose driver run time data and hci regs via debugfs
This change adds a few more options to a user to get a complete
status and statistics regarding the UFS driver, via debugfs
This information includes:
1. UFS Host Controller registers (cat /sys/kernel/debug/ufs/host_regs)
2. hba values (cat /sys/kernel/debug/ufs/show_hba)

Change-Id: Iac60de81a56ed42de72c3a7946a0d2bb5fab2903
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2016-03-22 10:55:37 -07:00
Dolev Raviv
24a05915b2 scsi: ufs: dump debug info during failures
Inserts driver dumps for UFS Host Controller registers, Transfer Requests
and Task Management Requests.
The dumps will occur on driver initialization failure, ufshcd_abort() and
on error handling path.

Change-Id: Ie8683e22a619cdae20680b15930e546e84f8aa73
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:55:36 -07:00
Subhash Jadavani
f5e347b925 scsi: ufs-msm: add power management support
This patch adds the vendor specific UFS power management support for MSM
platform.

If UFS link hibernate operation is broken in HW, make sure that link
remains active and device in sleep state during the runtime suspend.
During system suspend, keep both link and device in power off state.

If UFS link hibernate operation is working properly in HW, keep the link
in hibernate state and device in sleep state during both runtime and
system suspend.

Change-Id: Ibc5be00eb9d5fd72ed116b887d835a12ed97ae78
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2016-03-22 10:55:35 -07:00
Yaniv Gardi
e8e3beb4a8 scsi: ufs: Allowing power mode change
Due to M-PHY issues, moving from HS to any other mode or gear or
even Hibern8 causes some un-predicted behavior of the device.
This patch fixes this issues.

Change-Id: I4540e30703aa1212099b2316e158b09e311c7420
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:55:34 -07:00