Re: [PATCH V2] PCI/portdrv: do not disable device on reboot/shutdown

2018-05-25 Thread okaya

On 2018-05-25 15:10, Bjorn Helgaas wrote:

On Fri, May 25, 2018 at 09:30:59AM -0400, Sinan Kaya wrote:

On 5/24/2018 2:35 PM, Bjorn Helgaas wrote:
> That sounds like a reasonable idea, and it is definitely another can
> of worms.  I looked briefly at some of the .shutdown() cases:

should we throw it into 4.18 and see what happens?


It wouldn't solve this particular problem because hpsa *does* have a
.shutdown() method.  The problem is that it doesn't work -- it's
supposed to stop DMA and interrupts but it apparently doesn't.

I think we need to fix hpsa first.



Absolutely, the othet patch is a parallel issue.


Re: [PATCH V2] PCI/portdrv: do not disable device on reboot/shutdown

2018-05-25 Thread Bjorn Helgaas
On Fri, May 25, 2018 at 09:30:59AM -0400, Sinan Kaya wrote:
> On 5/24/2018 2:35 PM, Bjorn Helgaas wrote:
> > That sounds like a reasonable idea, and it is definitely another can
> > of worms.  I looked briefly at some of the .shutdown() cases:
> 
> should we throw it into 4.18 and see what happens?

It wouldn't solve this particular problem because hpsa *does* have a
.shutdown() method.  The problem is that it doesn't work -- it's
supposed to stop DMA and interrupts but it apparently doesn't.

I think we need to fix hpsa first.


Re: [PATCH 3/6] block: Create scsi_sense.h for SCSI and ATAPI

2018-05-25 Thread Christoph Hellwig
On Thu, May 24, 2018 at 10:06:59AM -0700, Kees Cook wrote:
> On Thu, May 24, 2018 at 1:00 AM, Christoph Hellwig  wrote:
> > On Wed, May 23, 2018 at 03:14:19PM -0600, Jens Axboe wrote:
> >> Ugh, so that would necessitate a change there too. As I said before,
> >> I don't really care where it lives. I know the SCSI folks seem bothered
> >> by moving it, but in reality, it's not like this stuff will likely ever
> >> really change. Of the two choices (select entire SCSI stack, or just move
> >> this little bit), I know what I would consider the saner option...
> >
> > Oh well.  How about something like this respin of Kees' series?
> >
> > http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/sense-cleanup
> 
> Does the CONFIG_PCMCIA in drivers/scsi/Makefile now get exposed in
> weird config cases?

That just includes drivers/scsi/pcmcia/Makefile, which only
has three conditional modules in it, so it should be fine.

> Otherwise, yeah, looks good to me. Thanks!

Can you pick up my tweaks and ressend?


RE: [PATCH RFC 0/3] Add ufs provisioning support in driver

2018-05-25 Thread sayali
Hi Stanislav,

Thank you for the comments.

Please check my answers below:
1. New descriptors structures are redefinition of the descriptors info (see
definitions of  device_desc_param, unit_desc_param, etc in
drivers/scsi/ufs/ufs.h)
[Sayali] I checked enum device_desc_param, unit_desc_param in ufs.h. These
enum's are actually defining parameter offsets (not values) for device/unit
descriptors.
What we want is to assign/get certain value for each configurable parameter
and then write it to Configuration descriptor.
The new descriptors structures and its members added in my patches are meant
for Configuration descriptor (which is combination of configurable
device/unit desc parameters)
New structs added:
ufs_unit_desc ==> correspond to Table 14-12 - Unit Descriptor configurable
parameters (from specs)
ufs_config_descr ==>  correspond to Table 14-10 - Configuration Descr.
Header and Device Descr. Conf. parameters (INDEX = 00h)

These structs are required and will contain the actual values (parsed via
sysfs buffer) of configurable parameters of device/unit descriptors.

2. You didn't took into consideration the recently added UFS sysfs
infostructure.
[Sayali] Do you mean below commits ?
commit d829fc8a1058851f1058b4a29ea02da125c1684a  (scsi: ufs: sysfs: unit
descriptor)
commit 45bced87e79316ecd868aee8f187284025792c5f  (scsi: ufs: sysfs: device
descriptor)
As per my understanding, these are read only interface to show unit/device
descriptors/parameters via sysfs.
There is no sysfs api to write configurable parameters of unit/device desc.
Please correct me if I am missing something here.

3. The idea of passing the binary buffer as a string is a bit flawed and the
parser doesn't provide any protection against bad data (e.g just send the
string "100").
[Sayali] Read only interface is already present upstream to get descriptor
data from device (as you pointed above)
In similar lines, I thought of using sysfs write interface to provision UFS
device.

In my current implementation and testing , the buffer (being passed via
sysfs) is obtained using a python script.
The script provides sanitized buffer after parsing vendor specific
provisioning data/file. 
Still I agree I should check and add more protection against bad data
handling in my code. Will update this is my next patch set.

Regards,
Sayali

-Original Message-
From: Stanislav Nijnikov [mailto:stanislav.nijni...@wdc.com] 
Sent: Thursday, May 24, 2018 5:56 PM
To: Sayali Lokhande ; subha...@codeaurora.org;
c...@codeaurora.org; vivek.gau...@codeaurora.org; rna...@codeaurora.org;
vinholika...@gmail.com; j...@linux.vnet.ibm.com; martin.peter...@oracle.com;
asuto...@codeaurora.org
Cc: linux-scsi@vger.kernel.org
Subject: RE: [PATCH RFC 0/3] Add ufs provisioning support in driver

Hi Sayali,
I have several notes about the patches:
1. New descriptors structures are redefinition of the descriptors info (see
definitions of  device_desc_param, unit_desc_param, etc in
drivers/scsi/ufs/ufs.h) 2. You didn't took into consideration the recently
added UFS sysfs infostructure.
3. The idea of passing the binary buffer as a string is a bit flawed and the
parser doesn't provide any protection against bad data (e.g just send the
string "100").

Regards
Stanislav

> -Original Message-
> From: linux-scsi-ow...@vger.kernel.org 
>  On Behalf Of Sayali Lokhande
> Sent: Tuesday, May 22, 2018 7:22 AM
> To: subha...@codeaurora.org; c...@codeaurora.org; 
> vivek.gau...@codeaurora.org; rna...@codeaurora.org; 
> vinholika...@gmail.com; j...@linux.vnet.ibm.com; 
> martin.peter...@oracle.com; asuto...@codeaurora.org
> Cc: linux-scsi@vger.kernel.org; Sayali Lokhande 
> 
> Subject: [PATCH RFC 0/3] Add ufs provisioning support in driver
> 
> This change adds a new API ufshcd_do_config_device() to write 
> configuration descriptor with the provisioning data.
> Sysfs support is added in driver to trigger ufs provisioning at 
> runtime. Provisioning data is parsed from vendor specific provisioning 
> file. This parsed data is passed as a buffer via sysfs to provision 
> ufs device.
> 
> Sayali Lokhande (2):
>   scsi: ufs: Add ufs provisioning support
>   scsi: ufs: Add sysfs support for ufs provision
> 
> Subhash Jadavani (1):
>   scsi: ufs: set the device reference clock setting
> 
>  .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  |   8 +
>  drivers/scsi/ufs/ufs.h |  39 +++
>  drivers/scsi/ufs/ufshcd-pltfrm.c   |  20 ++
>  drivers/scsi/ufs/ufshcd.c  | 383
+
>  drivers/scsi/ufs/ufshcd.h  |   9 +
>  5 files changed, 459 insertions(+)
> 
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
> Forum, a Linux Foundation Collaborative Project




Re: [PATCH V2] PCI/portdrv: do not disable device on reboot/shutdown

2018-05-25 Thread Sinan Kaya
On 5/24/2018 2:35 PM, Bjorn Helgaas wrote:
> That sounds like a reasonable idea, and it is definitely another can
> of worms.  I looked briefly at some of the .shutdown() cases:

should we throw it into 4.18 and see what happens?

-- 
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm 
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux 
Foundation Collaborative Project.


RE: [PATCH RFC 1/3] scsi: ufs: set the device reference clock setting

2018-05-25 Thread sayali
Hi Rob,

For UFS provisioning, all we need is ref_clk to be set to 19.2MHz before
actual descriptor write happens.
So I can actually avoid parsing it via DT and use REF_CLK_FREQ_19_2_MHZ from
enum ref_clk_freq (which is already added in my current implementation).

Thanks,
Sayali
-Original Message-
From: Rob Herring [mailto:r...@kernel.org] 
Sent: Thursday, May 24, 2018 12:19 AM
To: Sayali Lokhande 
Cc: subha...@codeaurora.org; c...@codeaurora.org;
vivek.gau...@codeaurora.org; rna...@codeaurora.org; vinholika...@gmail.com;
j...@linux.vnet.ibm.com; martin.peter...@oracle.com;
asuto...@codeaurora.org; linux-scsi@vger.kernel.org; Mark Rutland
; Mathieu Malaterre ; open list:OPEN
FIRMWARE AND FLATTENED DEVICE TREE BINDINGS ;
open list 
Subject: Re: [PATCH RFC 1/3] scsi: ufs: set the device reference clock
setting

On Tue, May 22, 2018 at 09:51:38AM +0530, Sayali Lokhande wrote:
> From: Subhash Jadavani 
> 
> UFS host supplies the reference clock to UFS device and UFS device 
> specification allows host to provide one of the 4 frequencies (19.2 
> MHz,
> 26 MHz, 38.4 MHz, 52 MHz) for reference clock. Host should set the 
> device reference clock frequency setting in the device based on what 
> frequency it is supplying to UFS device.
> 
> Signed-off-by: Subhash Jadavani 
> [c...@codeaurora.org: Resolved trivial merge conflicts]
> Signed-off-by: Can Guo 
> Signed-off-by: Sayali Lokhande 
> ---
>  .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  |  8 +++
>  drivers/scsi/ufs/ufs.h |  9 
>  drivers/scsi/ufs/ufshcd-pltfrm.c   | 20 
>  drivers/scsi/ufs/ufshcd.c  | 60
++
>  drivers/scsi/ufs/ufshcd.h  |  2 +
>  5 files changed, 99 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt 
> b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
> index c39dfef..ac94220 100644
> --- a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
> +++ b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
> @@ -41,6 +41,12 @@ Optional properties:
>  -lanes-per-direction : number of lanes available per direction - either 1
or 2.
> Note that it is assume same number of lanes is
used both
> directions at once. If not specified, default is 2
lanes per direction.
> +- dev-ref-clk-freq   : Specify the device reference clock frequency, must
be one of the following:
> +   0: 19.2 MHz
> +   1: 26 MHz
> +   2: 38.4 MHz
> +   3: 52 MHz
> +   Defaults to 26 MHz if not specified.

You already have "ref_clk", can't you just read its frequency?

Rob



Re: [PATCH v2 1/1] qed: Add firmware 8.37.2.0

2018-05-25 Thread Josh Boyer
On Mon, May 21, 2018 at 10:25 AM Rahul Verma  wrote:

> This patch add a new qed firmware with fixes and added
> support for new features.
> -Fix aRFS for tunneled traffic without inner IP.
> -Fix chip configuration which may fail under heavy traffic conditions.
> -Fix iSCSI recovery flow.
> -Support receiving any-VNI in VXLAN and GENEVE RX classification.
> -Support additional RoCE statistics for error cases.
> -Support RoCE T10DIF.

> v1->v2:
> Added signoff for Ariel Elior.

> Signed-off-by: Rahul Verma 
> Signed-off-by: Ariel Elior 
> ---
>   WHENCE  |   1 +
>   qed/qed_init_values_zipped-8.37.2.0.bin | Bin 0 -> 867472 bytes
>   2 files changed, 1 insertion(+)
>   create mode 100755 qed/qed_init_values_zipped-8.37.2.0.bin

Applied and pushed out.

josh


[PATCH v10 1/5] scsi: ufs: add Hisilicon ufs driver code

2018-05-25 Thread Li Wei
add Hisilicon ufs driver code.

Signed-off-by: Li Wei 
Signed-off-by: Geng Jianfeng 
Signed-off-by: Zang Leigang 
Signed-off-by: Yu Jianfeng 
---
 drivers/scsi/ufs/Kconfig|   9 +
 drivers/scsi/ufs/Makefile   |   1 +
 drivers/scsi/ufs/ufs-hisi.c | 619 
 drivers/scsi/ufs/ufs-hisi.h | 115 
 4 files changed, 744 insertions(+)
 create mode 100644 drivers/scsi/ufs/ufs-hisi.c
 create mode 100644 drivers/scsi/ufs/ufs-hisi.h

diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig
index e27b4d4e6ae2..e09fe6ab3572 100644
--- a/drivers/scsi/ufs/Kconfig
+++ b/drivers/scsi/ufs/Kconfig
@@ -100,3 +100,12 @@ config SCSI_UFS_QCOM
 
  Select this if you have UFS controller on QCOM chipset.
  If unsure, say N.
+
+config SCSI_UFS_HISI
+   tristate "Hisilicon specific hooks to UFS controller platform driver"
+   depends on (ARCH_HISI || COMPILE_TEST) && SCSI_UFSHCD_PLATFORM
+   ---help---
+ This selects the Hisilicon specific additions to UFSHCD platform 
driver.
+
+ Select this if you have UFS controller on Hisilicon chipset.
+ If unsure, say N.
diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile
index 918f5791202d..2c50f03d8c4a 100644
--- a/drivers/scsi/ufs/Makefile
+++ b/drivers/scsi/ufs/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o
 ufshcd-core-objs := ufshcd.o ufs-sysfs.o
 obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o
 obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o
+obj-$(CONFIG_SCSI_UFS_HISI) += ufs-hisi.o
diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c
new file mode 100644
index ..524861cd0ffd
--- /dev/null
+++ b/drivers/scsi/ufs/ufs-hisi.c
@@ -0,0 +1,619 @@
+/*
+ * HiSilicon Hi UFS Driver
+ *
+ * Copyright (c) 2016-2017 Linaro Ltd.
+ * Copyright (c) 2016-2017 HiSilicon Technologies Co., Ltd.
+ * 
+ * Released under the GPLv2 only.
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ufshcd.h"
+#include "ufshcd-pltfrm.h"
+#include "unipro.h"
+#include "ufs-hisi.h"
+#include "ufshci.h"
+
+static int ufs_hisi_check_hibern8(struct ufs_hba *hba)
+{
+   int err = 0;
+   u32 tx_fsm_val_0 = 0;
+   u32 tx_fsm_val_1 = 0;
+   unsigned long timeout = jiffies + msecs_to_jiffies(HBRN8_POLL_TOUT_MS);
+
+   do {
+   err = ufshcd_dme_get(hba, UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE, 0),
+ &tx_fsm_val_0);
+   err |= ufshcd_dme_get(hba,
+   UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE, 1), &tx_fsm_val_1);
+   if (err || (tx_fsm_val_0 == TX_FSM_HIBERN8 &&
+   tx_fsm_val_1 == TX_FSM_HIBERN8))
+   break;
+
+   /* sleep for max. 200us */
+   usleep_range(100, 200);
+   } while (time_before(jiffies, timeout));
+
+   /*
+* we might have scheduled out for long during polling so
+* check the state again.
+*/
+   if (time_after(jiffies, timeout)) {
+   err = ufshcd_dme_get(hba, UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE, 0),
+&tx_fsm_val_0);
+   err |= ufshcd_dme_get(hba,
+UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE, 1), &tx_fsm_val_1);
+   }
+
+   if (err) {
+   dev_err(hba->dev, "%s: unable to get TX_FSM_STATE, err %d\n",
+   __func__, err);
+   } else if (tx_fsm_val_0 != TX_FSM_HIBERN8 ||
+tx_fsm_val_1 != TX_FSM_HIBERN8) {
+   err = -1;
+   dev_err(hba->dev, "%s: invalid TX_FSM_STATE, lane0 = %d, lane1 
= %d\n",
+   __func__, tx_fsm_val_0, tx_fsm_val_1);
+   }
+
+   return err;
+}
+
+static void ufs_hi3660_clk_init(struct ufs_hba *hba)
+{
+   struct ufs_hisi_host *host = ufshcd_get_variant(hba);
+
+   ufs_sys_ctrl_clr_bits(host, BIT_SYSCTRL_REF_CLOCK_EN, PHY_CLK_CTRL);
+   if (ufs_sys_ctrl_readl(host, PHY_CLK_CTRL) & BIT_SYSCTRL_REF_CLOCK_EN)
+   mdelay(1);
+   /* use abb clk */
+   ufs_sys_ctrl_clr_bits(host, BIT_UFS_REFCLK_SRC_SEl, UFS_SYSCTRL);
+   ufs_sys_ctrl_clr_bits(host, BIT_UFS_REFCLK_ISO_EN, PHY_ISO_EN);
+   /* open mphy ref clk */
+   ufs_sys_ctrl_set_bits(host, BIT_SYSCTRL_REF_CLOCK_EN, PHY_CLK_CTRL);
+}
+
+static void ufs_hi3660_soc_init(struct ufs_hba *hba)
+{
+   struct ufs_hisi_host *host = ufshcd_get_variant(hba);
+   u32 reg;
+
+   if (!IS_ERR(host->rst))
+   reset_control_assert(host->rst);
+
+   /* HC_PSW powerup */
+   ufs_sys_ctrl_set_bits(host, BIT_UFS_PSW_MTCMOS_EN, PSW_POWER_CTRL);
+   udelay(10);
+   /* notify PWR ready */
+   ufs_sys_ctrl_set_bits(host, BIT_SYSCTRL_PWR_READY, HC_LP_CTRL);
+   ufs_sys_ctrl_writel(host, MASK_UFS_DEVICE_RESET | 0,
+   UFS_DEVICE_RESET_CTRL);
+
+   reg = u

[PATCH v10 5/5] arm64: defconfig: enable f2fs and squashfs

2018-05-25 Thread Li Wei
Partitions in HiKey960 are formatted as f2fs and squashfs.
f2fs is for userdata; squashfs is for system. Both partitions are required
by Android.

Signed-off-by: Li Wei 
Signed-off-by: Zhangfei Gao 
Signed-off-by: Guodong Xu 
---
 arch/arm64/configs/defconfig | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index d42b1ecaf490..e8036cddb272 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -613,6 +613,7 @@ CONFIG_ACPI_APEI_MEMORY_FAILURE=y
 CONFIG_ACPI_APEI_EINJ=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
+CONFIG_F2FS_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
 CONFIG_BTRFS_FS=m
 CONFIG_BTRFS_FS_POSIX_ACL=y
@@ -628,6 +629,13 @@ CONFIG_HUGETLBFS=y
 CONFIG_CONFIGFS_FS=y
 CONFIG_EFIVAR_FS=y
 CONFIG_SQUASHFS=y
+CONFIG_SQUASHFS_FILE_DIRECT=y
+CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y
+CONFIG_SQUASHFS_XATTR=y
+CONFIG_SQUASHFS_LZ4=y
+CONFIG_SQUASHFS_LZO=y
+CONFIG_SQUASHFS_XZ=y
+CONFIG_SQUASHFS_4K_DEVBLK_SIZE=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V4=y
 CONFIG_NFS_V4_1=y
-- 
2.15.0



[PATCH v10 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

2018-05-25 Thread Li Wei
add ufs node document for Hisilicon.

Signed-off-by: Li Wei 
---
 Documentation/devicetree/bindings/ufs/ufs-hisi.txt | 41 ++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  | 10 --
 2 files changed, 48 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-hisi.txt

diff --git a/Documentation/devicetree/bindings/ufs/ufs-hisi.txt 
b/Documentation/devicetree/bindings/ufs/ufs-hisi.txt
new file mode 100644
index ..a48c44817367
--- /dev/null
+++ b/Documentation/devicetree/bindings/ufs/ufs-hisi.txt
@@ -0,0 +1,41 @@
+* Hisilicon Universal Flash Storage (UFS) Host Controller
+
+UFS nodes are defined to describe on-chip UFS hardware macro.
+Each UFS Host Controller should have its own node.
+
+Required properties:
+- compatible: compatible list, contains one of the following -
+   "hisilicon,hi3660-ufs", "jedec,ufs-1.1" 
for hisi ufs
+   host controller present on Hi36xx 
chipset.
+- reg   : should contain UFS register address space & UFS SYS CTRL 
register address,
+- interrupt-parent  : interrupt device
+- interrupts: interrupt number
+- clocks   : List of phandle and clock specifier pairs
+- clock-names   : List of clock input name strings sorted in the same
+   order as the clocks property. 
"ref_clk", "phy_clk" is optional
+- freq-table-hz : Array of  operating frequencies stored in the 
same
+  order as the clocks property. If this property is not
+  defined or a value in the array is "0" then it is assumed
+  that the frequency is set by the parent clock or a
+  fixed rate clock source.
+- resets: describe reset node register
+- reset-names   : reset node register, the "rst" corresponds to reset the 
whole UFS IP.
+
+Example:
+
+   ufs: ufs@ff3b {
+   compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+   /* 0: HCI standard */
+   /* 1: UFS SYS CTRL */
+   reg = <0x0 0xff3b 0x0 0x1000>,
+   <0x0 0xff3b1000 0x0 0x1000>;
+   interrupt-parent = <&gic>;
+   interrupts = ;
+   clocks = <&crg_ctrl HI3660_CLK_GATE_UFSIO_REF>,
+   <&crg_ctrl HI3660_CLK_GATE_UFSPHY_CFG>;
+   clock-names = "ref_clk", "phy_clk";
+   freq-table-hz = <0 0>, <0 0>;
+   /* offset: 0x84; bit: 12  */
+   resets = <&crg_rst 0x84 12>;
+   reset-names = "rst";
+   };
diff --git a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt 
b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
index c39dfef76a18..2df00524bd21 100644
--- a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
+++ b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
@@ -41,6 +41,8 @@ Optional properties:
 -lanes-per-direction   : number of lanes available per direction - either 1 or 
2.
  Note that it is assume same number of lanes is used 
both
  directions at once. If not specified, default is 2 
lanes per direction.
+- resets: reset node register
+- reset-names   : describe reset node register, the "rst" corresponds to 
reset the whole UFS IP.
 
 Note: If above properties are not defined it can be assumed that the supply
 regulators or clocks are always on.
@@ -61,9 +63,11 @@ Example:
vccq-max-microamp = 20;
vccq2-max-microamp = 20;
 
-   clocks = <&core 0>, <&ref 0>, <&iface 0>;
-   clock-names = "core_clk", "ref_clk", "iface_clk";
-   freq-table-hz = <1 2>, <0 0>, <0 0>;
+   clocks = <&core 0>, <&ref 0>, <&phy 0>, <&iface 0>;
+   clock-names = "core_clk", "ref_clk", "phy_clk", "iface_clk";
+   freq-table-hz = <1 2>, <0 0>, <0 0>, <0 0>;
+   resets = <&reset 0 1>;
+   reset-names = "rst";
phys = <&ufsphy1>;
phy-names = "ufsphy";
};
-- 
2.15.0



[PATCH v10 0/5] scsi: ufs: add ufs driver code for Hisilicon Hi3660 SoC

2018-05-25 Thread Li Wei
This patchset adds driver support for UFS for Hi3660 SoC. It is verified on 
HiKey960 board.

Li Wei (5):
  scsi: ufs: add Hisilicon ufs driver code
  dt-bindings: scsi: ufs: add document for hisi-ufs
  arm64: dts: add ufs dts node
  arm64: defconfig: enable configs for Hisilicon ufs
  arm64: defconfig: enable f2fs and squashfs

 Documentation/devicetree/bindings/ufs/ufs-hisi.txt |  41 ++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  |  10 +-
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi  |  18 +
 arch/arm64/configs/defconfig   |  11 +
 drivers/scsi/ufs/Kconfig   |   9 +
 drivers/scsi/ufs/Makefile  |   1 +
 drivers/scsi/ufs/ufs-hisi.c| 619 +
 drivers/scsi/ufs/ufs-hisi.h| 115 
 8 files changed, 821 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-hisi.txt
 create mode 100644 drivers/scsi/ufs/ufs-hisi.c
 create mode 100644 drivers/scsi/ufs/ufs-hisi.h

Major changes in v10:
 - solve review comments from Rob Herring.
   *Modify the "reset-names" describe in ufs-hisi.txt binding file.
   *List clocks in ufs-hisi.txt binding file.
   *remove the "arst" and keep only "rst" in the binging files.
   *remove the "arst" member from both dts and c code. 
Major changes in v9:
 - solve review comments from Rob Herring.
   *remove freq-table-hz in ufs-hisi.txt binding file.
   *Move the rst to the ufshcd_pltfm.txt common binding file.
   *Modify the member "assert" of UFS host structure to "arst".
Major changes in v8:
 - solve review comments from zhangfei.
   *Add Version history.
 - solve review comments from Rob Herring.
   *remove freq-table-hz.
 -  solve review comments from Riku Voipio.
   *Add MODULE_DEVICE_TABLE for ufs driver.
-- 
Major changes in v7:
 - solve review comments from Philippe Ombredanne.
   *use the new SPDX license ids instead of the GNU General Public License.
-- 
2.15.0



[PATCH v10 3/5] arm64: dts: add ufs dts node

2018-05-25 Thread Li Wei
arm64: dts: add ufs node for Hisilicon.

Signed-off-by: Li Wei 
---
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi 
b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index ec3eb8e33a3a..04438621c6c3 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -892,6 +892,24 @@
reset-gpios = <&gpio11 1 0 >;
};
 
+   /* UFS */
+   ufs: ufs@ff3b {
+   compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+   /* 0: HCI standard */
+   /* 1: UFS SYS CTRL */
+   reg = <0x0 0xff3b 0x0 0x1000>,
+   <0x0 0xff3b1000 0x0 0x1000>;
+   interrupt-parent = <&gic>;
+   interrupts = ;
+   clocks = <&crg_ctrl HI3660_CLK_GATE_UFSIO_REF>,
+   <&crg_ctrl HI3660_CLK_GATE_UFSPHY_CFG>;
+   clock-names = "ref_clk", "phy_clk";
+   freq-table-hz = <0 0>, <0 0>;
+   /* offset: 0x84; bit: 12 */
+   resets = <&crg_rst 0x84 12>;
+   reset-names = "rst";
+   };
+
/* SD */
dwmmc1: dwmmc1@ff37f000 {
#address-cells = <1>;
-- 
2.15.0



[PATCH v10 4/5] arm64: defconfig: enable configs for Hisilicon ufs

2018-05-25 Thread Li Wei
This enable configs for Hisilicon Hi UFS driver.

Signed-off-by: Li Wei 
Signed-off-by: Zhangfei Gao 
Signed-off-by: Guodong Xu 
---
 arch/arm64/configs/defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index ecf613761e78..d42b1ecaf490 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -187,6 +187,9 @@ CONFIG_BLK_DEV_SD=y
 CONFIG_SCSI_SAS_ATA=y
 CONFIG_SCSI_HISI_SAS=y
 CONFIG_SCSI_HISI_SAS_PCI=y
+CONFIG_SCSI_UFSHCD=y
+CONFIG_SCSI_UFSHCD_PLATFORM=y
+CONFIG_SCSI_UFS_HISI=y
 CONFIG_ATA=y
 CONFIG_SATA_AHCI=y
 CONFIG_SATA_AHCI_PLATFORM=y
-- 
2.15.0



Re: [PATCH 5/6] lpfc: Fix port initialization failure.

2018-05-25 Thread Hannes Reinecke
On Thu, 24 May 2018 21:09:01 -0700
James Smart  wrote:

> The driver exits port setup after failing the
> lpfc_sli4_get_parameters command (messages 0356, 2541, & 1412).
> 
> The older CNA adapters do not support the MBX command. In the past
> the code was allowed to fail and continue on with initialization.
> However a nvme change moved a closing bracket and now makes all
> failures terminal.
> 
> Revise the logic so that terminal failure only occurs if the command
> failed on the newer adapters. Additionally, if parameters are set
> that require information from the command and the command failed,
> the parameters are erroneous and port set up should fail even on
> the older adapters.
> 
> Signed-off-by: Dick Kennedy 
> Signed-off-by: James Smart 
> ---
>  drivers/scsi/lpfc/lpfc_init.c | 21 ++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes



Re: [PATCH 3/6] lpfc: Fix crash in blk_mq layer when executing modprobe -r lpfc

2018-05-25 Thread Hannes Reinecke
On Thu, 24 May 2018 21:08:59 -0700
James Smart  wrote:

> modprobe -r lpfc produces the following:
> 
> Call Trace:
>  __blk_mq_run_hw_queue+0xa2/0xb0
>  __blk_mq_delay_run_hw_queue+0x9d/0xb0
>  ? blk_mq_hctx_has_pending+0x32/0x80
>  blk_mq_run_hw_queue+0x50/0xd0
>  blk_mq_sched_insert_request+0x110/0x1b0
>  blk_execute_rq_nowait+0x76/0x180
>  nvme_keep_alive_work+0x8a/0xd0 [nvme_core]
>  process_one_work+0x17f/0x440
>  worker_thread+0x126/0x3c0
>  ? manage_workers.isra.24+0x2a0/0x2a0
>  kthread+0xd1/0xe0
>  ? insert_kthread_work+0x40/0x40
>  ret_from_fork_nospec_begin+0x21/0x21
>  ? insert_kthread_work+0x40/0x40
> 
> However, rmmod lpfc would run correctly.
> 
> When an nvme remoteport is unregistered with the host nvme
> transport, it needs to set the remoteport->dev_loss_tmo value 0
> to indicate an immediate termination of device loss and prevent
> any further keep alives to that rport.  The driver was never
> setting dev_loss_tmo causing the nvme transport to continue to
> send the keep alive.
> 
> Signed-off-by: Dick Kennedy 
> Signed-off-by: James Smart 
> ---
>  drivers/scsi/lpfc/lpfc_nvme.c | 9 +
>  1 file changed, 9 insertions(+)
> 

Reviewed-by: Hannes Reinecke 

Cheers,

Hannes



Re: [PATCH 4/6] lpfc: Fix 16gb hbas failing cq create.

2018-05-25 Thread Hannes Reinecke
On Thu, 24 May 2018 21:09:00 -0700
James Smart  wrote:

> The lancer G5 chip family fails the CQ create with 16k page size.
> The hardware incorrectly reports it supports large page sizes
> when it is actually limited to 4k pages.
> 
> A prior patch resolved this for the A0 chip revision only.
> This patch excludes all revisions of the G5 asic from using
> large page sizes. As knowing the actual chip revision is
> unnecessary, the now unused definitions are removed
> 
> Signed-off-by: Dick Kennedy 
> Signed-off-by: James Smart 
> ---
>  drivers/scsi/lpfc/lpfc_hw4.h  | 11 ---
>  drivers/scsi/lpfc/lpfc_init.c |  9 +
>  drivers/scsi/lpfc/lpfc_sli4.h |  1 -
>  3 files changed, 1 insertion(+), 20 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes



Re: [PATCH 6/6] lpfc: update driver version to 12.0.0.4

2018-05-25 Thread Hannes Reinecke
On Thu, 24 May 2018 21:09:02 -0700
James Smart  wrote:

> Update the driver version to 12.0.0.4
> 
> Signed-off-by: Dick Kennedy 
> Signed-off-by: James Smart 
> ---
>  drivers/scsi/lpfc/lpfc_version.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_version.h
> b/drivers/scsi/lpfc/lpfc_version.h index 9fca71d7c297..18c23afcf46b
> 100644 --- a/drivers/scsi/lpfc/lpfc_version.h
> +++ b/drivers/scsi/lpfc/lpfc_version.h
> @@ -20,7 +20,7 @@
>   * included with this package. *
>   ***/
>  
> -#define LPFC_DRIVER_VERSION "12.0.0.3"
> +#define LPFC_DRIVER_VERSION "12.0.0.4"
>  #define LPFC_DRIVER_NAME "lpfc"
>  
>  /* Used for SLI 2/3 */

Reviewed-by: Hannes Reinecke 

Cheers,

Hannes



Re: [PATCH 2/6] lpfc: correct oversubscription of nvme io requests for an adapter

2018-05-25 Thread Hannes Reinecke
On Thu, 24 May 2018 21:08:58 -0700
James Smart  wrote:

> Under large configurations, the driver would start to log
> message 6065 - NVME out of buffers (exchanges).
> 
> The driver is using the ndlp cmd_qdepth value when determining
> the max outstanding ios for an adapter. This value, by default,
> is set to 65536, which exceeds the maximum exchange counts
> supported on an adapter. The ndlp cmd_qdepth has no relevance
> and outstanding io count should be capped at the max exchange
> count with IO requests beyond that level getting bounced back
> with an EBUSY status so that they are retried by the block layer.
> 
> Signed-off-by: Dick Kennedy 
> Signed-off-by: James Smart 
> ---
>  drivers/scsi/lpfc/lpfc_attr.c  |  7 +++
>  drivers/scsi/lpfc/lpfc_nportdisc.c |  6 ++
>  drivers/scsi/lpfc/lpfc_nvme.c  | 23 +++
>  3 files changed, 32 insertions(+), 4 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes



Re: [PATCH 1/6] lpfc: Fix MDS diagnostics failure (Rx < Tx)

2018-05-25 Thread Hannes Reinecke
On Thu, 24 May 2018 21:08:57 -0700
James Smart  wrote:

> MDS diagnostics fail because of frame count mismatch.
> 
> Unavailability of SGL is the trigger for this issue. If ELS SGL
> is not available to process MDS frame, IOCB is put in FCP txq
> but not attempted to post afterwards. So, driver stops processing
> incoming frames as it runs out of IOCB.  lpfc_drain_txq attempts
> to submit IOCBS that are queued in ELS txq but MDS frames are
> posted to FCP WQ.
> 
> Attempt to submit IOCBs that are present in FCP txq when MDS
> loopback is running.
> 
> Signed-off-by: Dick Kennedy 
> Signed-off-by: James Smart 
> ---
>  drivers/scsi/lpfc/lpfc_hbadisc.c |  3 +--
>  drivers/scsi/lpfc/lpfc_sli.c | 19 ---
>  2 files changed, 17 insertions(+), 5 deletions(-)
> 

Reviewed-by: Hannes Reinecke 

Cheers,

Hannes