OSDN Git Service

sagit-ice-cold/kernel_xiaomi_msm8998.git
8 years agoscsi: ufs: Add sysfs node to dynamically control hibern8 on idle
Subhash Jadavani [Thu, 9 Oct 2014 09:54:41 +0000 (02:54 -0700)]
scsi: ufs: Add sysfs node to dynamically control hibern8 on idle

Provide an option to enable/disable hibern8 on idle functionality during
runtime. Write 1 or 0 to "hibern8_on_idle_enable" sysfs node to
enable/disable hibern8 on idle functionality.

Change-Id: Id4b6253c3c53ed71575c05596abbd4dd99821eff
[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>
8 years agoscsi: ufs: add support for hibern8 on idle
Subhash Jadavani [Thu, 9 Oct 2014 02:08:10 +0000 (19:08 -0700)]
scsi: ufs: add support for hibern8 on idle

In order to save power we should put the UFS link into hibern8 as soon as
UFS link is idle and power measurement of active usecases (like audio/video
playback/recording) show that putting UFS link in hibern8 @ 10ms of idle
(if not earlier) would save significant power.

Our current available solution is to do hibern8 with clock gating @idle
timeout of 150ms. As clock gating has huge latencies (7ms each in enter and
exit), we cannot bring down the idle timeout to <=10ms without degrading
UFS throughput. Hence this change has added support to enter into hibern8
with another idle timer.

Change-Id: I5a31f18fc21015d4a68236da9fd94f3f016e1d44
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: update bus vector name used for slow-auto mode
Noa Rubens [Tue, 7 Oct 2014 16:52:57 +0000 (19:52 +0300)]
scsi: ufs: update bus vector name used for slow-auto mode

Set the bus vector name used for slow-auto mode to be "MIN".
For each power mode a specific bus vector name should be selected
from UFS DTS node. Slow-auto mode was missing this specification.

Change-Id: I48de8e70823b75ed3bb4eefe7828f841f2e775eb
Signed-off-by: Noa Rubens <noag@codeaurora.org>
8 years agoscsi: ufs: fix exception event handling
Maya Erez [Thu, 2 Oct 2014 10:50:42 +0000 (13:50 +0300)]
scsi: ufs: fix exception event handling

The device can set the exception event bit in one of the response UPIU,
for example to notify the need for urgent BKOPs operation.
In such a case the host driver calls ufshcd_exception_event_handler to
handle this notification.
When trying to check the exception event status (for finding the cause for
the exception event), the device may be busy with additional SCSI commands
handling and may not respond within the 100ms timeout.

To prevent that, we need to block SCSI commands during handling of
exception events and allow retransmissions of the query requests,
in case of timeout.

CRs-Fixed: 725525
Change-Id: I67a55ad5f891a018f1dfff319233f875789805a1
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
8 years agoscsi: ufs: reduce UFS dump prints for error case
Gilad Broner [Wed, 1 Oct 2014 11:18:35 +0000 (14:18 +0300)]
scsi: ufs: reduce UFS dump prints for error case

When UFS controller reports an error a dump is printed to
aid debugging. In certain cases the print outs is too excesive
and not all the information is really needed. In addition, printing
is done from interrupt context so long prints might cause the target
to crash.
This change reduces the amount of data printed out and moves part of
the printing to the worker thread context.

Change-Id: If3e13000b8165479f2dac4d0c8e513eaa9a3e3c2
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
8 years agoscsi: ufs: tune UniPro parameters to optimize hibern8 exit time
Subhash Jadavani [Fri, 26 Sep 2014 00:55:26 +0000 (17:55 -0700)]
scsi: ufs: tune UniPro parameters to optimize hibern8 exit time

Optimal values of local UniPro parameters like PA_Hibern8Time &
PA_TActivate can help reduce the hibern8 exit latency. If both host and
device supports UniPro ver1.6 or later, these parameters will be
automatically tuned during link startup itself. But if either host or
device doesn't support UniPro ver 1.6 or later, we have to manually tune
them. But to keep manual tuning logic simple, we will only do manual
tuning if local unipro version doesn't support ver1.6 or later.

Change-Id: I533afe9b62a35602e4e766d76912db7ac9a480b6
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agoscsi: ufs: move dme peer quirk handling to ufshcd_dme_get_attr()
Subhash Jadavani [Thu, 25 Sep 2014 21:23:18 +0000 (14:23 -0700)]
scsi: ufs: move dme peer quirk handling to ufshcd_dme_get_attr()

Some UFS host controllers may only allow accessing the peer DME attribute
in AUTO mode (FAST AUTO or SLOW AUTO) hence we had added a quirk for
switching to AUTO power mode before accessing the peer DME attribute.
But this quirk handling was only done in UFS driver's debugfs handling
hence this patch moves it to main driver ufshcd.c so that this quirk
handling is applied to all the peer DME accesses.

As we are doing this, this patch fixes 2 more related problem:
1. Current quirk was only handling the switch from FAST to FAST AUTO hence
this change adds the handling for SLOW to SLOW AUTO mode change as well.
2. ufsdbg_dme_read() helper function was always reading the local DME
attribute hence this change fix the same.

Change-Id: I475375fb57cd27cdafe1573c14d09dc7f9a2791b
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agoscsi: ufs_quirks: fix card model string copy
Subhash Jadavani [Thu, 25 Sep 2014 00:15:17 +0000 (17:15 -0700)]
scsi: ufs_quirks: fix card model string copy

Product name string (referred as "model" string in driver) starts from
offset 02h in Product Name String Descriptor but currently we copy the
product name from 00h offset of the descriptor which is incorrect.
This change fixes the above problem by copying the product name from
the right offset of the Product Name String Descriptor.

Change-Id: I0ab2ecc19c7383d9782ba57af6441175d2ecda46
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: fix failure to read the string descriptor
Subhash Jadavani [Thu, 25 Sep 2014 00:11:50 +0000 (17:11 -0700)]
scsi: ufs: fix failure to read the string descriptor

While reading variable size descriptors (like string descriptor), some UFS
devices may report the "LENGTH" (field in "Transaction Specific fields" of
Query Response UPIU) same as what was requested in Query Request UPIU
instead of reporting the actual size of the variable size descriptor.
Although it's safe to ignore the "LENGTH" field for variable size
descriptors as we can always derive the length of the descriptor from
the descriptor header fields. Hence this change impose the length match
check only for fixed size descriptors (for which we always request the
correct size as part of Query Request UPIU).

Change-Id: I6be74b3e139b876275c265524cb6ee8489f3737c
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs-qcom: enable host controller hardware clock gating
Subhash Jadavani [Sun, 21 Sep 2014 07:00:27 +0000 (00:00 -0700)]
scsi: ufs-qcom: enable host controller hardware clock gating

The UTP controller has a number of internal clock gating cells (CGCs).
Internal hardware sub-modules within the UTP controller control the CGCs.
Hardware CGCs disable the clock to inactivate UTP sub-modules not involved
in a specific operation, UTP controller CGCs are by default disabled and
this change enables them (after every UFS link startup) to save some power
leakage.

Change-Id: I47bba62436c5913eb6755e59c36a11fea2e9468f
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs-qcom: add support for new UFS controller revisions
Subhash Jadavani [Fri, 19 Sep 2014 23:46:31 +0000 (16:46 -0700)]
scsi: ufs-qcom: add support for new UFS controller revisions

MSM8994v2 will have UFS controller revision 1.3.0 (major.minor.step)
hence update the quirks check for this revision as well.

Here is the list of UFS revisions (for quick reference):
8084 : 1.1.1
8994v1 : 1.2.0
8994v2 : 1.3.0
Future revisions: x.y.z where x >= 2

Change-Id: Iabc4b9117cda9d685e5a4fbaa9cc1f1bd40a5a60
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: debugfs: add option to read peer DME attribute
Subhash Jadavani [Sat, 13 Sep 2014 19:17:59 +0000 (12:17 -0700)]
scsi: ufs: debugfs: add option to read peer DME attribute

This patch adds the debugfs capability to read the DME attribute of
peer UniPro/M-PHY. This should help for debugging.

Change-Id: I26d3675bdda8b9fdf0f9aa6b81a1ffafbd828fd0
[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>
8 years agoscsi: ufs: fix bug when changing power mode via debugfs
Yaniv Gardi [Fri, 12 Sep 2014 07:28:43 +0000 (10:28 +0300)]
scsi: ufs: fix bug when changing power mode via debugfs

So far when required to change UFS power mode via debugfs the final power
parameters to which the UFS device is configured were determined based on
comparison between the new required power (gear, lane, mode) and qcom
pre-defined power preferences, and the minimum between them was the
configured power which is incorrect.
This change fixes this issue so what is done is a comparison between
the new required power and the device maximum supported power
parameters. If the new required power parameters exceed the device
maximum supported power, then the UFS power mode is not changed.

This change also contains a few cosmetic changes that simplify
code that is related to the above power change.

Change-Id: If08d3ce50af2dc17a6f68583dd1e7973aeb3c33a
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: resolved 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>
8 years agoscsi: ufs: add option to change default UFS power management level
Subhash Jadavani [Thu, 11 Sep 2014 01:25:33 +0000 (18:25 -0700)]
scsi: ufs: add option to change default UFS power management level

UFS device and link can be put in multiple different low power modes hence
UFS driver supports multiple different low power modes. By default UFS
driver selects the default (optimal) low power mode (which gives moderate
power savings and have relatively less enter and exit latencies) but
we might have to tune this default power mode for different chipset
platforms to meet the low power requirements/goals. Hence this patch
adds option to change default UFS low power mode (level).

Change-Id: I45aaae9f46beb3b5d38bcc6dcbd728e79677276c
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agoscsi: ufs-qcom: enable hibern8 during clock gating
Subhash Jadavani [Wed, 10 Sep 2014 01:15:37 +0000 (18:15 -0700)]
scsi: ufs-qcom: enable hibern8 during clock gating

By default UFS link operates in FAST mode which would keep the link active
until host puts the link in hibern8. Power consumption during link active
state is huge hence it's recommended to put the link in hibern8 as soon
as possible. Clock gating mechanism kicks in after pre-defined idle timeout
(150ms at this time) shorter than the runtime suspend timeout hence it
would be idle to put the UFS link in hibern8 along with clock gating.
Note that this aggressive power management approach doesn't affect the
normal storage benchmark performance numbers as clock gating idle timeout
has been choosen to not affect storage performance benchmarks.

Change-Id: I5b88a7ea2d918750a3cc9150511e25caa1e57284
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: debugfs: add option to read local DME attribute
Subhash Jadavani [Sat, 6 Sep 2014 01:13:41 +0000 (18:13 -0700)]
scsi: ufs: debugfs: add option to read local DME attribute

This patch adds the debugfs capability to read the DME attribute of
local UniPro/M-PHY. This should help for debugging.

Change-Id: I2dea471f6bcf591a69206e127d3c9e3febbbc68f
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: remove unwanted checks from hibern8 sequence
Subhash Jadavani [Sat, 6 Sep 2014 01:12:09 +0000 (18:12 -0700)]
scsi: ufs: remove unwanted checks from hibern8 sequence

We are unnecessarily checking for the request/task doorbell status
during hibern8 enter/exit path but it's very important to have the
minimal latencies for hibern8 enter/exit in order to achieve agressive
power management strategies for UFS. So these unecessary checks are moved
out of this hot path.

Change-Id: Ibaeddca7bd516d71eb03b02a1fc1a86f05038f08
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agophy: relocate and rename phy ufs files
Yaniv Gardi [Wed, 3 Sep 2014 12:31:52 +0000 (15:31 +0300)]
phy: relocate and rename phy ufs files

This change contains:
1. Relocating the phy ufs files to reside under the phy driver since
this is the location of any file that implements the APIs presented in
the generic phy framework
2. Renaming ufs-msm-phy*.* files to be phy-qcom-ufs*.* files.
Since UFS is not used strictly in a specific set of targets but rather
its code is applicable to MSM, APQ, IPQ etc, any mentioning of "msm" in
the file name should be changed to "qcom".
Also, prefix of "phy-" is the naming convention of platform driver files
that reside in the phy driver.
3. As a result of the relocation of files into the phy driver,
a new path is created (include/linux/scsi/ufs) and there we expose ufs
header files that are being used also from the drivers/scsi/ufs
and from drivers/phy as well.

Change-Id: Ie5cb47718911ff711d9401a389f56fa508fcddf3
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflicts]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[venkatg@codeaurora.org: resolved merge conflicts by keeping
upstream version]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agoARM: dts: msm: rename attributes to more generic names
Yaniv Gardi [Tue, 2 Sep 2014 12:54:37 +0000 (15:54 +0300)]
ARM: dts: msm: rename attributes to more generic names

In this change the "compatible" attribute in dts files of ufsphy node
and the "phy-names" attribute in ufs node are changed to a more generic
name.
This is done for apq8084 and for msm8994 targets.

Change-Id: I46176459e9bc877456489e4728b86eecb2c16261
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts & dropped changes to
apq8084.dtsi & msm8994.dtsi]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agodefconfig: change SCSI_UFS_MSM to SCSI_UFS_QCOM
Yaniv Gardi [Mon, 1 Sep 2014 14:40:41 +0000 (17:40 +0300)]
defconfig: change SCSI_UFS_MSM to SCSI_UFS_QCOM

Since UFS is not used strictly in a specific set of targets but rather
its code is applicable to MSM, APQ, IPQ etc, "SCSI_UFS_MSM" should be
changed to "SCSI_UFS_QCOM".

Change-Id: I8851907f86055bb5012cb4a00f81511529ba4e03
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflicts]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts, dropped changes to
apq8084_defconfig & msm8994_defconfig files]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agoscsi: ufs-msm: rename all entities from "msm" to "qcom"
Yaniv Gardi [Mon, 1 Sep 2014 14:31:46 +0000 (17:31 +0300)]
scsi: ufs-msm: rename all entities from "msm" to "qcom"

Since UFS is not used strictly in a specific set of targets but rather
its code is applicable to MSM, APQ, IPQ etc, everywhere where
there is a use of "msm" should be replaced with "qcom".

Change-Id: Ib96259bab6de506a40876c1c121a12bb75b655c1
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: resolved 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>
8 years agoscsi: ufs-msm: Add support for the new scm_call2 API
Vikram Mulukutla [Sat, 23 Aug 2014 02:26:33 +0000 (19:26 -0700)]
scsi: ufs-msm: Add support for the new scm_call2 API

The scm library has added support for a new secure world
interface that is more aligned to the ARMv8 SMC calling
convention. Use the new API while maintaining backward
compatibility.

Change-Id: I19b523edb7a849f50916dbbd426c92cc4c459799
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
8 years agoscsi: ufs-msm: remove redundant dependencies in header files
Yaniv Gardi [Sun, 24 Aug 2014 13:09:38 +0000 (16:09 +0300)]
scsi: ufs-msm: remove redundant dependencies in header files

In this change we simply remove dependencies in header files as they are
not required.

Change-Id: I73298a603f205fc102e9a39711263a10ace489e9
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
8 years agoscsi: ufs-msm: remove global variable that is not in use
Yaniv Gardi [Thu, 21 Aug 2014 11:51:54 +0000 (14:51 +0300)]
scsi: ufs-msm: remove global variable that is not in use

In this change a global variable which is never referenced is being
removed.

Change-Id: I2eda5157cf5e77e61d776d450cb036ca51027a08
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
8 years agoscsi: ufs-msm: request UFS register space access after power collapse
Subhash Jadavani [Tue, 19 Aug 2014 01:34:36 +0000 (18:34 -0700)]
scsi: ufs-msm: request UFS register space access after power collapse

Following UFS core power collapse, all the TZ programmed xPU protection
settings would be lost and default protection settings won't allow access
to even UFS host controller register address space from non-secure world.
Hence we have to explicitly call into TZ to open up atleast UFS host
controller & UFS PHY register address space access to non-secure world.

Change-Id: Ic05c88e418484a10ad0d651fe2295916117c085e
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflicts]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[subhashj@codeaurora.org: resolved 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>
8 years agoscsi: ufs: null terminate buffer that is sent to strlcpy
Yaniv Gardi [Tue, 19 Aug 2014 21:12:01 +0000 (00:12 +0300)]
scsi: ufs: null terminate buffer that is sent to strlcpy

strlcpy() must get null-terminated buffer as a second argument because
inside strlcpy(), strlen() is invoked on that argument, and unterminated
buffer will result incorrect value.
In this case, str_desc_buf is a buffer that might return from
ufshcd_read_string_desc() when it is no longer null-terminated.
Therefor we must null-terminate it before sending it to strlcpy().

This change also fixes the type of the vendor variable that is read
from the device descriptor. According to UFS device specification this
field is 2 bytes wide. Its name is also changed to be compatible
with UFS device specification.

Change-Id: I3b1ba0311846881a1f3f1c984cc6f9d7109821b3
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
8 years agoscsi: ufs: fix deadlock when attempting hibern8 during clock gating
Subhash Jadavani [Fri, 15 Aug 2014 00:54:02 +0000 (17:54 -0700)]
scsi: ufs: fix deadlock when attempting hibern8 during clock gating

If UFSHCD_CAP_HIBERN8_WITH_CLK_GATING capability is enabled then UFS
driver should put the link in hibern8 along with gating of UFS related
clocks but we are hitting the deadlock in this case. UFS gating work
calls the ufshcd_uic_hibern8_enter() which would call the helper function
ufshcd_uic_pwr_ctrl(). ufshcd_uic_pwr_ctrl() calls ufshcd_hold() to make
sure that clocks are ungated which means clock ungate work would end up
waiting for the gate work to finish which causes the deadlock (as gate
work is waiting for ufshcd_uic_pwer_ctrl() to finish).

Fix this issue by letting the callers of ufshcd_uic_pwr_ctrl() to decide
if they really need to vote for the UFS clocks or not.

Change-Id: I5b9d1a1c75bbc5a7097e6cc71cd9ec6885cd271a
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: avoid spurious UFS host controller interrupts
Subhash Jadavani [Fri, 15 Aug 2014 00:56:47 +0000 (17:56 -0700)]
scsi: ufs: avoid spurious UFS host controller interrupts

When control reaches to Linux UFS driver during UFS boot mode, UFS host
controller interrupt status/enable registers may have left over settings.
In order to avoid any spurious interrupts due to these left overs, it's
important to clear these interrupt status/enable registers before enabling
UFS interrupt handling.

CRs-Fixed: 709250
Change-Id: Ibb554ca6e1bd2f69663a741f15948f80c52ce75c
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: fix suspend/resume tracing message
Subhash Jadavani [Wed, 6 Aug 2014 21:10:25 +0000 (14:10 -0700)]
scsi: ufs: fix suspend/resume tracing message

Tracing message for suspend/resume events is wrongly printing the device
state as link state and link state as device state. This change fixes the
same and while we are here, fix the device and link state string to be more
readable.

Change-Id: Ifc878b84345bf4f7be56102d4972cbac039b78ed
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs-msm: remove unnecessary callbacks of generic PHY framework
Yaniv Gardi [Wed, 6 Aug 2014 15:11:52 +0000 (18:11 +0300)]
scsi: ufs-msm: remove unnecessary callbacks of generic PHY framework

In this change unnecessary callbacks of the generic PHY framework
are removed and instead we call the required operations directly in
the driver.
The callbacks that were removed are:
phy_suspend(), phy_resume() and advertise_quirks()

In addition, one specific callback of the generic PHY is added:
restore_configuration() as complementary callback of save_configuration().

Change-Id: Iaf2be3ebff7a9978adae50c3f2617714106c40ac
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
8 years agoscsi: ufs: fix a possible kernel info leak to userspace
Yaniv Gardi [Thu, 31 Jul 2014 21:54:26 +0000 (00:54 +0300)]
scsi: ufs: fix a possible kernel info leak to userspace

This change fixes a possible info leak from kernel into userspace, since
two buffers were allocated with kmalloc() and never set their memory
region to 0.
Now, they are being allocated with kzalloc that fixes this issue

Change-Id: I23012ae8d3611c561511775362c3014b9a8be522
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
8 years agoscsi: ufs: fix bugs related to null pointer access and array size
Yaniv Gardi [Wed, 30 Jul 2014 16:36:34 +0000 (19:36 +0300)]
scsi: ufs: fix bugs related to null pointer access and array size

In this change there are a few fixes of possible NULL pointer access
and possible access to index that exceeds array boundaries.

Change-Id: I4a2dbc417d53931e012925978cd52e3397356ec2
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: enable ufs driver to support generic PHY framework
Yaniv Gardi [Mon, 28 Jul 2014 20:06:11 +0000 (23:06 +0300)]
scsi: ufs: enable ufs driver to support generic PHY framework

In this change, ufs driver is using the generic PHY framework,
by calling the API "devm_phy_get" that returns handle to a generic
PHY driver.

In this change "__maybe_unused" flag of a few callbacks is removed
since those callbacks are now hooked to generic PHY driver APIs that
were added.

This change also includes the required DT changes as in this case,
the driver changes derived from the DT changes and therefor must
be placed within the same change.

Change-Id: I10e15e25d050bedca55a058b79240360564aebcd
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflict]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agoscsi: ufs-msm: disable using generic PHY framework
Yaniv Gardi [Mon, 28 Jul 2014 19:25:34 +0000 (22:25 +0300)]
scsi: ufs-msm: disable using generic PHY framework

This change disables the use of the generic PHY framework API and
callbacks.
This change is only temporary and eventually UFS will use the
updated generic PHY framework API.

The reason for temporary disabling the use of the generic PHY framework,
is due to generic PHY changes in the upstream that are required to be
merged and would result into many conflicts.

In this change, calling to devm_phy_get_by_index() is removed.
Following, the API itself will be removed from the generic PHY framework,
and changes from the upstream will be cherry-picked.

Also, hooking resume, suspend and advertise_quirks is temporary removed
to avoid compilation errors.
After merging all generic PHY framework changes from the upstream,
the UFS driver will call the updated API in order to get its correct
generic PHY and will hook the local implementation of resume, suspend
and advertise_quirks into the correct hooks.

Change-Id: I2bf1007ecf079bc82f472a17538a17dc452ea447
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
8 years agoscsi: ufs-msm: probe UFS only if it is the boot device
Subhash Jadavani [Tue, 25 Feb 2014 08:55:10 +0000 (00:55 -0800)]
scsi: ufs-msm: probe UFS only if it is the boot device

Boot device can be either UFS or eMMC which means if eMMC is the boot
device, probing UFS device is not desirable as it's not going to be
used after probing. Kernel command line parameter "android.bootdevice"
tells the kernel about the boot device so look at this boot device
parameter to know whether to probe UFS device or not.

Change-Id: I053b9611088263cd8de64085754c00d082aec3ed
[subhashj@codeaurora.org: resolved merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs-msm-phy: fix false error message
Yaniv Gardi [Mon, 21 Jul 2014 22:26:10 +0000 (01:26 +0300)]
scsi: ufs-msm-phy: fix false error message

This change fixes error message that falsely was printed out
unconditionally.
A fix condition is now added.

Change-Id: I8d70d7f27c7dc122ecda64bea1a51f0044047e5b
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
8 years agoscsi: ufs-msm-phy-qmp-20nm: fix hibern8 exit failure
Subhash Jadavani [Fri, 18 Jul 2014 18:39:16 +0000 (11:39 -0700)]
scsi: ufs-msm-phy-qmp-20nm: fix hibern8 exit failure

If UFS link is put into Hibern8 and if UFS PHY analog hardware is power
collapsed (by clearing UFS_PHY_POWER_DOWN_CONTROL), Hibern8 exit might fail
even after powering on UFS PHY analog hardware. This change provides
workaround to solve above issue by doing custom PHY settings just before
PHY analog power collapse.

Change-Id: I63d43329798c5475e07511248ac35450b8fe208d
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: remove code duplication from ufs specific phy
Yaniv Gardi [Wed, 16 Jul 2014 20:46:05 +0000 (23:46 +0300)]
scsi: ufs: remove code duplication from ufs specific phy

In this change, code that is duplicated in specific ufs msm PHYs
modules is removed, and helper functions that contain the common
code are added to ufs-msm-phy.c.

Change-Id: I30ca8b4d4b452450a155671da94f03d7b965160a
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: fixed compilation errors]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs-msm: re-factoring the ufs phy to support various phys
Yaniv Gardi [Wed, 16 Jul 2014 22:41:59 +0000 (01:41 +0300)]
scsi: ufs-msm: re-factoring the ufs phy to support various phys

This re-factor is required in order to provide a robust way to support
multiple ufs phys. It also creates a better separation between
ufs-msm block, ufs-msm-phy block and the specific phy blocks.
In this change a generic phy handle is created, using the phy driver
framework.
Two ufs phys are currently supported: 28nm and 20nm
This change also includes the required DT changes as in this case,
the driver changes and the DT changes must be placed within the same
change.

Change-Id: I3aa7ed942ed7b54f3a29c9b9dbdeff1861079066
Signed-off-by: Noa Rubens <noag@codeaurora.org>
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflicts in apq8084 and msm8994
device tree files]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts, dropped changes to
msm8994.dtsi and fixed compilation errors]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agodrivers: msm: Fix a handful of compiler warnings
Stepan Moskovchenko [Sat, 14 Jun 2014 02:12:25 +0000 (19:12 -0700)]
drivers: msm: Fix a handful of compiler warnings

Compiling the kernel with the -O2 GCC flag reveals a number
of warnings relating to potentially uninitialized variables
and other edge cases.

Change-Id: I3758dbe1af276d79f55188b9f2db850c730acb80
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
[gbroner@codeaurora.org: drop changes to all file besides
ufs-msm.c and ufshcd.c]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
8 years agoscsi: ufs: add quirks for a new UFS host controller version
Yaniv Gardi [Tue, 10 Jun 2014 01:03:46 +0000 (18:03 -0700)]
scsi: ufs: add quirks for a new UFS host controller version

This change adds a new set of UFS host controllers quirks as there
is a new version of UFS controllers.

Change-Id: Ie0f96f7fbc8928d29cd760c14258d8497a979a99
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
8 years agoscsi: ufs: fix deadlock during runtime resume
Subhash Jadavani [Sat, 10 May 2014 00:44:00 +0000 (17:44 -0700)]
scsi: ufs: fix deadlock during runtime resume

Commit e21cdd59b6fbaeaf3ab0043fc49287f554fa8696 (scsi: ufs: Change power
mode at run-time via debug-fs) has introduced bug where
pm_runtime_get_sync() might get called in UFS driver's runtime resume
callback context which will cause the deadlock as pm_runtime_get_sync()
waits for the runtime resume callback to finish.

This change fixes the above bug by moving pm_runtime_get_sync() call out
of runtime resume callback context.

Change-Id: I1efa68510eb2545fc043dfa4d8bfe6f6c36ef6a8
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: provide sysfs attribute to select the PM level
Subhash Jadavani [Thu, 1 May 2014 01:23:07 +0000 (18:23 -0700)]
scsi: ufs: provide sysfs attribute to select the PM level

This patch provides the sysfs attribute to choose the power management
level for UFS runtime and system suspend.

Change-Id: I5beedadff1ac3a1ac1f8d36ab88fc3b2ecb75e88
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs-msm: disable the sigdet before power collapsing PHY
Subhash Jadavani [Thu, 1 May 2014 00:37:18 +0000 (17:37 -0700)]
scsi: ufs-msm: disable the sigdet before power collapsing PHY

If UFS PHY power down is deasserted and power is restored to analog
circuits, the rx_sigdet can glitch. If the glitch is wide enough,
it can trigger the PHY digital logic to think it saw a DIF-N and
cause it to exit Hibern8. Disabling the rx_sigdet during power-up
will mask the glitch.

Change-Id: I20d93d2f5b479bb9e1d9626cfb9939d280b172a5
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: Change power mode at run-time via debug-fs
Gilad Broner [Tue, 4 Mar 2014 15:40:54 +0000 (17:40 +0200)]
scsi: ufs: Change power mode at run-time via debug-fs

Add 'power_mode' entry to UFS debug-fs to allow query of current
power mode status and changing the power mode by writing to the
entry a string in the format 'GGLLMM' where:
G - selected gear
L - number of lanes
M - power mode
    (1=fast mode, 2=slow mode, 4=fast-auto mode, 5=slow-auto mode)
First letter is for RX, second is for TX.

Change-Id: Ia48cb2719bb11e66bca923c5f4647a33cbd6c43e
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflicts]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[subhashj@codeaurora.org: resolved merge conflicts and compilation error]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agoscsi: ufs: Add sysfs node to dynamically control clock scaling
Sahitya Tummala [Thu, 27 Mar 2014 10:21:56 +0000 (15:51 +0530)]
scsi: ufs: Add sysfs node to dynamically control clock scaling

Provide an option to enable/disable clock scaling during runtime.
Write 1/0 to "clkscale_enable" sysfs node to enable/disable clock
scaling.

Change-Id: I67a6cd317d3dca97a992e240c970719f85067cd8
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: add debug counters for recoverable errors during runtime
Yaniv Gardi [Tue, 15 Apr 2014 19:50:44 +0000 (22:50 +0300)]
scsi: ufs: add debug counters for recoverable errors during runtime

There is no way to know how many times various UFS errors happened
while system is running if we have successfully recovered from those
errors. Those failures should be counted and inspected as they might be
anomaly behavior of the driver and can impact performance.
This change adds support to capture these failures statistics like how
many times we have seen errors, and which type of errors.

To reset the counters:
echo 1 > /sys/kernel/debug/ufs/err_stats

To print them out:
cat /sys/kernel/debug/ufs/err_stats

Note: There is no need to enable them as they are never disabled.
This error counters are something that we always would like to have.

Change-Id: I559c729b998f79c6bdda2da54c0f0ec7531696d7
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: cleanup unused quirks
Subhash Jadavani [Sun, 6 Apr 2014 07:46:44 +0000 (10:46 +0300)]
scsi: ufs: cleanup unused quirks

We had added many host and device quirks support non commercial UFS device
and UFS controller. As these quirks are not required in commercially
available UFS devices and UFS controller, we should offload driver from
maintaining these unused quirks.

Change-Id: If721d71b41e19e6c68af49403a0043bf40266ffa
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflict]
Signed-off-by: Gilad Broner <gbroner@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>
8 years agoscsi: ufs: Add sysfs node to dynamically control clock gating
Sahitya Tummala [Fri, 28 Mar 2014 04:12:09 +0000 (09:42 +0530)]
scsi: ufs: Add sysfs node to dynamically control clock gating

Provide an option to enable/disable clock gating during runtime.
Write 1 or 0 to "clkgate_enable" sysfs node to enable/disable
clock gating.

Change-Id: I69a20e66cf91bb889ac3942eb2d20d5adc289d03
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: seperate device and host quirks
Raviv Shvili [Tue, 1 Apr 2014 19:20:15 +0000 (22:20 +0300)]
scsi: ufs: seperate device and host quirks

Currently we use the host quirks mechanism in order to
handle both device and host controller quirks.
In order to support many UFS devices we should separate
handling the device quirks from the host controller's.

Change-Id: I6c23be42ff78689f9aad4d5c0c9f0a678bfb5c14
Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agoscsi: ufs: add read string descriptor api
Raviv Shvili [Sun, 30 Mar 2014 10:36:05 +0000 (13:36 +0300)]
scsi: ufs: add read string descriptor api

The string descriptor may consist of up to 126 UNICODE characters.
The number of UNICODE characters is calculated
by (descriptor's length - 2)/2.
In addition the api allows to get the result in an ascii format.

Change-Id: If43453bf5f9a826900c0acc064e8def275c0f7d1
Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
8 years agoscsi: ufs: add descriptor read support
Raviv Shvili [Thu, 20 Mar 2014 19:33:04 +0000 (21:33 +0200)]
scsi: ufs: add descriptor read support

Allow reading descriptors with length which is different
than the descriptors max size.

Change-Id: Ia0685ae147883f33466865d2348d71473e0d5173
Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
8 years agoscsi: ufs: add additional tracing messages
Subhash Jadavani [Thu, 20 Mar 2014 22:52:09 +0000 (15:52 -0700)]
scsi: ufs: add additional tracing messages

This patch adds following tracing messages:
 - Add support to trace the automatic background operations enable/disable
   events.
 - Add addition logs to trace the UFS device and UFS link state during
   suspend/resume and initialization.

Change-Id: I732b255296042442e50278c2700c52bd166e1d8b
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs-msm: remove UFSHCD_BROKEN_LCC_PROCESSING_ON_DEVICE quirk
Subhash Jadavani [Thu, 20 Mar 2014 19:46:14 +0000 (12:46 -0700)]
scsi: ufs-msm: remove UFSHCD_BROKEN_LCC_PROCESSING_ON_DEVICE quirk

New commercial UFS devices don't have the issues with LCC processing
but UFS host controller might still have the issue with LCC processing
hence keep the UFSHCD_BROKEN_LCC_PROCESSING_ON_HOST quirk enabled but
disable the UFSHCD_BROKEN_LCC_PROCESSING_ON_DEVICE quirk.

Change-Id: Ib3d563553878eec39c677f38af1545f470e8ee9b
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs: split broken LCC quirk
Subhash Jadavani [Thu, 20 Mar 2014 19:41:53 +0000 (12:41 -0700)]
scsi: ufs: split broken LCC quirk

Currently when UFSHCD_BROKEN_LCC quirk is defined, LCC is getting
disabled on both host and device side but there could be a need
where we don't want to disable the LCC on both side hence this change
splits the quirk in 2 parts one for host and one for device.

Change-Id: I906a24a428665e3ee67a4c2ec3fc31f47e5c7e3c
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
8 years agoscsi: ufs-msm: allow background operations during runtime suspend
Subhash Jadavani [Thu, 20 Mar 2014 22:42:42 +0000 (15:42 -0700)]
scsi: ufs-msm: allow background operations during runtime suspend

Allow the card to perform background operations during runtime suspend.

Change-Id: Ie93b4ad795f7afb05addb551f73fca853ecd4769
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoRevert "scsi: ufs: try read capacity (10) first"
Dolev Raviv [Thu, 20 Mar 2014 09:21:56 +0000 (11:21 +0200)]
Revert "scsi: ufs: try read capacity (10) first"

This reverts commit 7d76a33cac7040f3e05c1a49fc312e53dc3b2f1c.
Read capacity (16) is used, in addition to reading capacity, for
reading unmap command parameters. In UFS spec since v2.0 read
capacity (16) command is mandatory for embedded devices.

If read capacity (16) is not supported by the device then it simply
rejects the scsi command with ILLEGAL_REQUEST in sense key. The sd
driver then retries with read capacity (10), thus keeping backward
compatibility.

Change-Id: Iaa2acdfab0d7f0f6e1ef20e370195a3b64068216
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
8 years agoscsi: ufshcd: fix one of the argument type for ufshcd_query_descriptor
Subhash Jadavani [Sat, 1 Mar 2014 09:18:22 +0000 (01:18 -0800)]
scsi: ufshcd: fix one of the argument type for ufshcd_query_descriptor

ufshcd_query_descriptor() function should take the descriptor id as one of
its argument but type of this argument is incorrect, hence fix it here.

Change-Id: If83b551b2bc4da644d03a0ae37b2e83dc7909b43
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[gbroner@codeaurora.org: fix merge conflicts and add missing
function signatures]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufs-msm: probe UFS only if it is the boot device
Subhash Jadavani [Tue, 25 Feb 2014 08:55:10 +0000 (00:55 -0800)]
scsi: ufs-msm: probe UFS only if it is the boot device

Boot device can be either UFS or eMMC which means if eMMC is the boot
device, probing UFS device is not desirable as it's not going to be
used after probing. Kernel command line parameter "android.bootdevice"
tells the kernel about the boot device so look at this boot device
parameter to know whether to probe UFS device or not.

Change-Id: I053b9611088263cd8de64085754c00d082aec3ed
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
8 years agoscsi: ufshcd: release resources if probe fails
Subhash Jadavani [Wed, 26 Feb 2014 05:43:07 +0000 (21:43 -0800)]
scsi: ufshcd: release resources if probe fails

If ufshcd pltfrm/pci driver's probe fails for some reason then ensure that
scsi host is released to avoid memory leak but managed memory allocations
(via devm_* calls) need not to be freed explicitly on probe failure as
memory allocated with these functions is automatically freed on driver
detach.

Change-Id: Ic88c3e1d29a6b03e9a79201d3790f26bc4ccae61
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[gbroner@codeaurora.org: fix minor merge conflicts]
Signed-off-by: Gilad Broner <gbroner@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>
8 years agoscsi: ufs-msm: enable power management
Subhash Jadavani [Fri, 14 Feb 2014 01:39:28 +0000 (17:39 -0800)]
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>
8 years agoscsi: ufs-msm: avoid full UFS initialization on system resume
Subhash Jadavani [Thu, 13 Feb 2014 19:50:37 +0000 (11:50 -0800)]
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>
8 years agoscsi: ufs: increase the query request timeout
Subhash Jadavani [Thu, 23 Jan 2014 01:54:12 +0000 (17:54 -0800)]
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>
8 years agoscsi: ufs-msm: inform PHY about analog rails power down
Subhash Jadavani [Fri, 10 Jan 2014 22:23:52 +0000 (14:23 -0800)]
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>
8 years agoscsi: ufs-msm: enable quirk to fix gear change to HS
Yaniv Gardi [Wed, 12 Feb 2014 05:44:43 +0000 (21:44 -0800)]
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>
8 years agoscsi: ufs: fix multiple ufs spec violation
Dolev Raviv [Wed, 12 Feb 2014 08:25:13 +0000 (10:25 +0200)]
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>
8 years agoscsi: ufs-msm: change default working mode in HS to rate A
Yaniv Gardi [Wed, 12 Feb 2014 01:13:33 +0000 (17:13 -0800)]
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>
8 years agoscsi: ufs-msm: add PHY calibration values for UFS controller 1.1.1
Yaniv Gardi [Wed, 15 Jan 2014 21:34:34 +0000 (23:34 +0200)]
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>
8 years agoscsi: ufs: disable LCC configuration in the UFS device
Yaniv Gardi [Wed, 15 Jan 2014 21:57:53 +0000 (23:57 +0200)]
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>
8 years agoscsi: ufs-msm: enable UFSHCD_BROKEN_LCC
Subhash Jadavani [Fri, 10 Jan 2014 22:12:48 +0000 (14:12 -0800)]
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>
8 years agoscsi: ufs: provide the quirk to disable the LCC
Subhash Jadavani [Fri, 10 Jan 2014 22:07:26 +0000 (14:07 -0800)]
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>
8 years agoscsi: ufs-msm: don't enable interrupt aggregation
Subhash Jadavani [Fri, 10 Jan 2014 19:14:16 +0000 (11:14 -0800)]
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>
8 years agoscsi: ufs: read ref clk and icc level during init only
Noag [Wed, 15 Jan 2014 08:52:53 +0000 (10:52 +0200)]
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>
8 years agoscsi: ufs-msm: Add hba->vops->clk_scale_notify()
Sahitya Tummala [Mon, 13 Jan 2014 09:54:18 +0000 (15:24 +0530)]
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>
8 years agoscsi: ufs: Add support for clock scaling using devfreq framework
Sahitya Tummala [Thu, 2 Jan 2014 07:57:14 +0000 (13:27 +0530)]
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>
8 years agoscsi: ufs: add queue fullness statistics
Dolev Raviv [Sun, 12 Jan 2014 11:51:23 +0000 (13:51 +0200)]
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>
8 years agoscsi: ufs-msm: fix a wrong condition when checking array size
Yaniv Gardi [Thu, 9 Jan 2014 11:18:55 +0000 (13:18 +0200)]
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>
8 years agoscsi: ufs: fix crash upon reading host_regs debugfs entry
Raviv Shvili [Thu, 9 Jan 2014 08:22:16 +0000 (10:22 +0200)]
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>
8 years agoscsi: ufs-msm: enable workarounds for APQ8084 v1.1
Subhash Jadavani [Fri, 3 Jan 2014 19:08:35 +0000 (11:08 -0800)]
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>
8 years agoscsi: ufs: remove redundant "Illegal ufs-IOCTL" log for BLKROSET command
Noag [Mon, 30 Dec 2013 08:58:58 +0000 (10:58 +0200)]
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>
8 years agoscsi: ufs-msm: Enable clock gating
Sahitya Tummala [Tue, 17 Dec 2013 06:17:32 +0000 (11:47 +0530)]
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>
8 years agoscsi: ufs: Add support for clock gating
Sahitya Tummala [Tue, 17 Dec 2013 06:16:13 +0000 (11:46 +0530)]
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>
8 years agoscsi: ufs-msm: Fix hba variant host op init and setup_clocks
Sahitya Tummala [Wed, 18 Dec 2013 08:19:27 +0000 (13:49 +0530)]
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>
8 years agoscsi: ufs: save and print current power info in the driver
Yaniv Gardi [Sun, 22 Dec 2013 19:07:09 +0000 (21:07 +0200)]
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>
8 years agoscsi: ufs-msm: add clock frequency table for Rate B
Yaniv Gardi [Thu, 26 Dec 2013 08:57:31 +0000 (10:57 +0200)]
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>
8 years agoscsi: ufs-msm: enable quirk for broken mode of TX 2 lanes
Yaniv Gardi [Wed, 25 Dec 2013 09:57:28 +0000 (11:57 +0200)]
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>
8 years agoscsi: ufs: add a quirk for broken mode of TX 2 lanes
Yaniv Gardi [Wed, 25 Dec 2013 09:51:59 +0000 (11:51 +0200)]
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>
8 years agoscsi: ufs-msm: change default working mode to rate B
Yaniv Gardi [Sun, 8 Dec 2013 13:56:38 +0000 (15:56 +0200)]
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>
8 years agoscsi: ufs-msm: switch off PHY PLL power rail during hibern8
Subhash Jadavani [Fri, 4 Oct 2013 10:53:14 +0000 (16:23 +0530)]
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>
8 years agoscsi: ufs: Override auto suspend tunables for ufs
Sujit Reddy Thumma [Fri, 6 Dec 2013 14:35:55 +0000 (20:05 +0530)]
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>
8 years agoscsi: ufs-msm: phy configuration to support rate B
Yaniv Gardi [Sun, 8 Dec 2013 14:37:56 +0000 (16:37 +0200)]
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>
8 years agoscsi: ufs: dump device descriptor info via debugfs
Yaniv Gardi [Sun, 8 Dec 2013 11:58:56 +0000 (13:58 +0200)]
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>
8 years agoscsi: ufs: update device descriptor maximum size
Yaniv Gardi [Fri, 6 Dec 2013 01:37:25 +0000 (03:37 +0200)]
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>
8 years agoscsi: ufs-msm: avoid powering off the device during system suspend
Sujit Reddy Thumma [Tue, 26 Nov 2013 06:58:31 +0000 (12:28 +0530)]
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>
8 years agoscsi: ufs: fix NULL pointer dereference when aborting command
Sujit Reddy Thumma [Fri, 22 Nov 2013 04:09:34 +0000 (09:39 +0530)]
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>
8 years agoscsi: ufs-msm: disable quirk that adds delay after power more change
Yaniv Gardi [Sun, 24 Nov 2013 18:45:24 +0000 (20:45 +0200)]
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>
8 years agoscsi: ufs: add retries to dme_peer get and set attribute
Lee Susman [Sun, 24 Nov 2013 13:39:01 +0000 (15:39 +0200)]
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>
8 years agoscsi: ufs-msm: Fix turning off tx/rx lane synchronization clocks
Sujit Reddy Thumma [Wed, 20 Nov 2013 14:41:40 +0000 (20:11 +0530)]
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>
8 years agoscsi: ufs: add wrapper for retrying sending query attribute
Yaniv Gardi [Wed, 20 Nov 2013 20:55:45 +0000 (22:55 +0200)]
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>
8 years agoscsi: ufs: fix debugfs tag stats resetting
Lee Susman [Tue, 19 Nov 2013 08:49:56 +0000 (10:49 +0200)]
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>