Skip to contentSkip to conversation

scsi: ufs: add ufs driver code for Hisilicon Hi3660 SoC

PATCH Superseded Li Wei 2 participants 11 messages Apr 17, 2018 – May 17, 2018

Subsystems (4)

v9 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

Li Wei

author
#0 lore raw

v9 cover scsi: ufs: add ufs driver code for Hisilicon Hi3660 SoC

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 |  29 +
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt      |  10 +-
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi          |  20 +
 arch/arm64/configs/defconfig                       |  11 +
 drivers/scsi/ufs/Kconfig                           |   9 +
 drivers/scsi/ufs/Makefile                          |   1 +
 drivers/scsi/ufs/ufs-hisi.c                        | 621 +++++++++++++++++++++
 drivers/scsi/ufs/ufs-hisi.h                        | 114 ++++
 8 files changed, 812 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 v9:
- solve review comments from Rob Herring.
*remove clocks/clock-names/freq-table-hz from 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.

Signature · 5 lines
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
author
#1 lore raw

PATCH v9 1/5 scsi: ufs: add Hisilicon ufs driver code

add Hisilicon ufs driver code.

---
 drivers/scsi/ufs/Kconfig    |   9 +
 drivers/scsi/ufs/Makefile   |   1 +
 drivers/scsi/ufs/ufs-hisi.c | 621 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/scsi/ufs/ufs-hisi.h | 114 ++++++++
 4 files changed, 745 insertions(+)
 create mode 100644 drivers/scsi/ufs/ufs-hisi.c
 create mode 100644 drivers/scsi/ufs/ufs-hisi.h
drivers/scsi/ufs/Kconfig +9 -0
index e27b4d4e6ae2..10c3e60d86a5 100644
@@ -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.
drivers/scsi/ufs/Makefile +1 -0
index 918f5791202d..2c50f03d8c4a 100644
@@ -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
drivers/scsi/ufs/ufs-hisi.c new file +621 -0

621 lines not on this page · raw message

drivers/scsi/ufs/ufs-hisi.h new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
2.15.0
author
#2 lore raw

PATCH v9 2/5 dt-bindings: scsi: ufs: add document for hisi-ufs

In reply to Li Wei

add ufs node document for Hisilicon.

---
 Documentation/devicetree/bindings/ufs/ufs-hisi.txt | 29 ++++++++++++++++++++++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt      | 10 +++++---
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-hisi.txt
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +29 -0
new file mode 100644
index 000000000000..d49ab7d8f31d
@@ -0,0 +1,29 @@
+* 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
+- resets            : reset node register, the "arst" corresponds to reset the APB/AXI bus.
+- reset-names       : describe reset node register
+
+Example:
+
+	ufs: ufs at ff3b0000 {
+		compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+		/* 0: HCI standard */
+		/* 1: UFS SYS CTRL */
+		reg = <0x0 0xff3b0000 0x0 0x1000>,
+			<0x0 0xff3b1000 0x0 0x1000>;
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>;
+		/* offset: 0x84; bit: 7  */
+		resets = <&crg_rst 0x84 7>;
+		reset-names = "arst";
+	};
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +7 -3
index c39dfef76a18..adcfb79f63f5 100644
@@ -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, the "rst" corresponds to reset the whole UFS IP.
+- reset-names       : describe reset node register
 
 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 = 200000;
 		vccq2-max-microamp = 200000;
 
-		clocks = <&core 0>, <&ref 0>, <&iface 0>;
-		clock-names = "core_clk", "ref_clk", "iface_clk";
-		freq-table-hz = <100000000 200000000>, <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 = <100000000 200000000>, <0 0>, <0 0>, <0 0>;
+		resets = <&reset 0 1>;
+		reset-names = "rst";
 		phys = <&ufsphy1>;
 		phy-names = "ufsphy";
 	};
Signature · 1 line
2.15.0
maintainer
#3 lore raw

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

Quoted 18 lines · Li Wei

add ufs node document for Hisilicon.

---
 Documentation/devicetree/bindings/ufs/ufs-hisi.txt | 29 ++++++++++++++++++++++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt      | 10 +++++---
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-hisi.txt
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +3 -0
new file mode 100644
index 000000000000..d49ab7d8f31d
@@ -0,0 +1,29 @@
+* Hisilicon Universal Flash Storage (UFS) Host Controller
+
+UFS nodes are defined to describe on-chip UFS hardware macro.

Documentation/devicetree/bindings/ufs/ufs-hisi.txt line 13

Quoted 10 lines
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +10 -0
+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
+- resets            : reset node register, the "arst" corresponds to reset the APB/AXI bus.

arst belongs in reset-names.

Documentation/devicetree/bindings/ufs/ufs-hisi.txt line 14

Quoted 1 line
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +1 -0
+- reset-names       : describe reset node register

What happened to clocks? You still have to list which ones apply even if documented in the common binding.

Quoted 20 lines
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +15 -0
+
+Example:
+
+	ufs: ufs at ff3b0000 {
+		compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+		/* 0: HCI standard */
+		/* 1: UFS SYS CTRL */
+		reg = <0x0 0xff3b0000 0x0 0x1000>,
+			<0x0 0xff3b1000 0x0 0x1000>;
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>;
+		/* offset: 0x84; bit: 7  */
+		resets = <&crg_rst 0x84 7>;
+		reset-names = "arst";
+	};
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +0 -0
index c39dfef76a18..adcfb79f63f5 100644

Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt Optional properties: · line 45

Quoted 5 lines
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +2 -0
@@ -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, the "rst" corresponds to reset the whole UFS IP.
+- reset-names       : describe reset node register

Does your controller have 1 or 2 resets? There's no point in adding this here if it doesn't apply to your controller.

Quoted 20 lines
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +5 -3
 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 = 200000;
 		vccq2-max-microamp = 200000;
 
-		clocks = <&core 0>, <&ref 0>, <&iface 0>;
-		clock-names = "core_clk", "ref_clk", "iface_clk";
-		freq-table-hz = <100000000 200000000>, <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 = <100000000 200000000>, <0 0>, <0 0>, <0 0>;
+		resets = <&reset 0 1>;
+		reset-names = "rst";
 		phys = <&ufsphy1>;
 		phy-names = "ufsphy";
 	};
Signature · 1 line
2.15.0
author
#4 lore raw

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

Hi, Rob

Thanks for your patience.

Hi, Arnd

Quoted 1 line

From Rob's suggestion, we have to list the properties node in ufs-hisi.txt bingings even if documented in the common binding.

-----????-----
???: Rob Herring [mailto:robh at kernel.org]
????: 2018?4?24? 20:58
???: liwei (CM)
??: mark.rutland at arm.com; catalin.marinas at arm.com; will.deacon at arm.com; vinholikatti at gmail.com; jejb at linux.vnet.ibm.com; martin.petersen at oracle.com; khilman at baylibre.com; arnd at arndb.de; gregory.clement at free-electrons.com; thomas.petazzoni at free-electrons.com; yamada.masahiro at socionext.com; riku.voipio at linaro.org; treding at nvidia.com; krzk at kernel.org; devicetree at vger.kernel.org; linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-scsi at vger.kernel.org; zangleigang; Gengjianfeng; guodong.xu at linaro.org ??: Re: [PATCH v9 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

Quoted 18 lines · Li Wei

add ufs node document for Hisilicon.

---
 Documentation/devicetree/bindings/ufs/ufs-hisi.txt | 29 ++++++++++++++++++++++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt      | 10 +++++---
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-hisi.txt
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +3 -0
new file mode 100644
index 000000000000..d49ab7d8f31d
@@ -0,0 +1,29 @@
+* Hisilicon Universal Flash Storage (UFS) Host Controller
+
+UFS nodes are defined to describe on-chip UFS hardware macro.

Documentation/devicetree/bindings/ufs/ufs-hisi.txt line 13

Quoted 10 lines
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +10 -0
+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
+- resets            : reset node register, the "arst" corresponds to reset the APB/AXI bus.

arst belongs in reset-names.

OK, I will fix it in next patch;

Documentation/devicetree/bindings/ufs/ufs-hisi.txt line 14

Quoted 1 line
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +1 -0
+- reset-names       : describe reset node register

What happened to clocks? You still have to list which ones apply even if documented in the common binding.

OK, I will fix it in next patch;

Quoted 20 lines
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +15 -0
+
+Example:
+
+	ufs: ufs at ff3b0000 {
+		compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+		/* 0: HCI standard */
+		/* 1: UFS SYS CTRL */
+		reg = <0x0 0xff3b0000 0x0 0x1000>,
+			<0x0 0xff3b1000 0x0 0x1000>;
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>;
+		/* offset: 0x84; bit: 7  */
+		resets = <&crg_rst 0x84 7>;
+		reset-names = "arst";
+	};
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +0 -0
index c39dfef76a18..adcfb79f63f5 100644

Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt Optional properties: · line 45

Quoted 5 lines
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +2 -0
@@ -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, the "rst" corresponds to reset the whole UFS IP.
+- reset-names       : describe reset node register

Does your controller have 1 or 2 resets? There's no point in adding this here if it doesn't apply to your controller.

There are 2 reset in our soc init, the "rst" corresponds to reset the whole UFS IP, and " arst " only reset the APB/AXI bus. Discussed with our soc colleagues that "arst" is assert by default and needs to deassert,but it done in bootloader,so will remove 'arst' in next patch.

About the 'reset' property?it seems that Arnd Bergmann has different suggestion?he suggested that add 'rst' to ufshcd-pltfrm because it seems common. But it looks like only our soc init needs it. What's your opinion? Does it still needs add to common bindings?

Quoted 20 lines
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +5 -3
 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 = 200000;
 		vccq2-max-microamp = 200000;
 
-		clocks = <&core 0>, <&ref 0>, <&iface 0>;
-		clock-names = "core_clk", "ref_clk", "iface_clk";
-		freq-table-hz = <100000000 200000000>, <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 = <100000000 200000000>, <0 0>, <0 0>, <0 0>;
+		resets = <&reset 0 1>;
+		reset-names = "rst";
 		phys = <&ufsphy1>;
 		phy-names = "ufsphy";
 	};
Signature · 1 line
2.15.0
maintainer
#5 lore raw

Re: 答复: [PATCH v9 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

Quoted 85 lines · liwei (CM)

Hi, Rob

Thanks for your patience.

Hi, Arnd

From Rob's suggestion, we have to list the properties node in ufs-hisi.txt bingings even if documented in the common binding.

-----邮件原件-----
发件人: Rob Herring [mailto:[email protected]]
发送时间: 2018年4月24日 20:58
收件人: liwei (CM)
抄送: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; zangleigang; Gengjianfeng; [email protected] 主题: Re: [PATCH v9 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

Quoted 18 lines · Li Wei

add ufs node document for Hisilicon.

---
 Documentation/devicetree/bindings/ufs/ufs-hisi.txt | 29 ++++++++++++++++++++++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt      | 10 +++++---
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-hisi.txt
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +3 -0
new file mode 100644
index 000000000000..d49ab7d8f31d
@@ -0,0 +1,29 @@
+* Hisilicon Universal Flash Storage (UFS) Host Controller
+
+UFS nodes are defined to describe on-chip UFS hardware macro.

Documentation/devicetree/bindings/ufs/ufs-hisi.txt line 13

Quoted 10 lines
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +10 -0
+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
+- resets            : reset node register, the "arst" corresponds to reset the APB/AXI bus.

arst belongs in reset-names.

OK, I will fix it in next patch;

Documentation/devicetree/bindings/ufs/ufs-hisi.txt line 14

Quoted 1 line
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +1 -0
+- reset-names       : describe reset node register

What happened to clocks? You still have to list which ones apply even if documented in the common binding.

OK, I will fix it in next patch;

Quoted 20 lines
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +15 -0
+
+Example:
+
+     ufs: ufs@ff3b0000 {
+             compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+             /* 0: HCI standard */
+             /* 1: UFS SYS CTRL */
+             reg = <0x0 0xff3b0000 0x0 0x1000>,
+                     <0x0 0xff3b1000 0x0 0x1000>;
+             interrupt-parent = <&gic>;
+             interrupts = <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>;
+             /* offset: 0x84; bit: 7  */
+             resets = <&crg_rst 0x84 7>;
+             reset-names = "arst";
+     };
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +0 -0
index c39dfef76a18..adcfb79f63f5 100644

Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt Optional properties: · line 45

Quoted 5 lines
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +2 -0
@@ -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, the "rst" corresponds to reset the whole UFS IP.
+- reset-names       : describe reset node register

Does your controller have 1 or 2 resets? There's no point in adding this here if it doesn't apply to your controller.

Quoted 5 lines

There are 2 reset in our soc init, the "rst" corresponds to reset the whole UFS IP, and " arst " only reset the APB/AXI bus. Discussed with our soc colleagues that "arst" is assert by default and needs to deassert,but it done in bootloader,so will remove 'arst' in next patch.

About the 'reset' property,it seems that Arnd Bergmann has different suggestion,he suggested that add 'rst' to ufshcd-pltfrm because it seems common. But it looks like only our soc init needs it. What's your opinion? Does it still needs add to common bindings?

For a single reset, then I'm fine with it being in the common bindings. If there are multiple then it should be in the specific bindings as the reset names are likely different.

Rob

author
#6 lore raw

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

Hi, Rob

-----????-----
???: Rob Herring [mailto:robh at kernel.org]
????: 2018?5?16? 21:16
???: liwei (CM)
??: mark.rutland at arm.com; catalin.marinas at arm.com; will.deacon at arm.com; vinholikatti at gmail.com; jejb at linux.vnet.ibm.com; martin.petersen at oracle.com; khilman at baylibre.com; arnd at arndb.de; gregory.clement at free-electrons.com; thomas.petazzoni at free-electrons.com; yamada.masahiro at socionext.com; riku.voipio at linaro.org; treding at nvidia.com; krzk at kernel.org; devicetree at vger.kernel.org; linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-scsi at vger.kernel.org; zangleigang; Gengjianfeng; guodong.xu at linaro.org ??: Re: ??: [PATCH v9 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

Quoted 85 lines · liwei (CM)

Hi, Rob

Thanks for your patience.

Hi, Arnd

From Rob's suggestion, we have to list the properties node in ufs-hisi.txt bingings even if documented in the common binding.

-----????-----
???: Rob Herring [mailto:robh at kernel.org]
????: 2018?4?24? 20:58
???: liwei (CM)
??: mark.rutland at arm.com; catalin.marinas at arm.com; will.deacon at arm.com; vinholikatti at gmail.com; jejb at linux.vnet.ibm.com; martin.petersen at oracle.com; khilman at baylibre.com; arnd at arndb.de; gregory.clement at free-electrons.com; thomas.petazzoni at free-electrons.com; yamada.masahiro at socionext.com; riku.voipio at linaro.org; treding at nvidia.com; krzk at kernel.org; devicetree at vger.kernel.org; linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-scsi at vger.kernel.org; zangleigang; Gengjianfeng; guodong.xu at linaro.org ??: Re: [PATCH v9 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

Quoted 18 lines · Li Wei

add ufs node document for Hisilicon.

---
 Documentation/devicetree/bindings/ufs/ufs-hisi.txt | 29 ++++++++++++++++++++++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt      | 10 +++++---
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-hisi.txt
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +3 -0
new file mode 100644
index 000000000000..d49ab7d8f31d
@@ -0,0 +1,29 @@
+* Hisilicon Universal Flash Storage (UFS) Host Controller
+
+UFS nodes are defined to describe on-chip UFS hardware macro.

Documentation/devicetree/bindings/ufs/ufs-hisi.txt line 13

Quoted 10 lines
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +10 -0
+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
+- resets            : reset node register, the "arst" corresponds to reset the APB/AXI bus.

arst belongs in reset-names.

OK, I will fix it in next patch;

Documentation/devicetree/bindings/ufs/ufs-hisi.txt line 14

Quoted 1 line
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +1 -0
+- reset-names       : describe reset node register

What happened to clocks? You still have to list which ones apply even if documented in the common binding.

OK, I will fix it in next patch;

Quoted 20 lines
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +15 -0
+
+Example:
+
+     ufs: ufs at ff3b0000 {
+             compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+             /* 0: HCI standard */
+             /* 1: UFS SYS CTRL */
+             reg = <0x0 0xff3b0000 0x0 0x1000>,
+                     <0x0 0xff3b1000 0x0 0x1000>;
+             interrupt-parent = <&gic>;
+             interrupts = <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>;
+             /* offset: 0x84; bit: 7  */
+             resets = <&crg_rst 0x84 7>;
+             reset-names = "arst";
+     };
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +0 -0
index c39dfef76a18..adcfb79f63f5 100644

Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt Optional properties: · line 45

Quoted 5 lines
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +2 -0
@@ -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, the "rst" corresponds to reset the whole UFS IP.
+- reset-names       : describe reset node register

Does your controller have 1 or 2 resets? There's no point in adding this here if it doesn't apply to your controller.

Quoted 5 lines

There are 2 reset in our soc init, the "rst" corresponds to reset the whole UFS IP, and " arst " only reset the APB/AXI bus. Discussed with our soc colleagues that "arst" is assert by default and needs to deassert,but it done in bootloader,so will remove 'arst' in next patch.

About the 'reset' property?it seems that Arnd Bergmann has different suggestion?he suggested that add 'rst' to ufshcd-pltfrm because it seems common. But it looks like only our soc init needs it. What's your opinion? Does it still needs add to common bindings?

For a single reset, then I'm fine with it being in the common bindings. If there are multiple then it should be in the specific bindings as the reset names are likely different.

OK, I will remove the 'arst' and keep only 'rst' in tne common bingings.

Rob

author
#7 lore raw

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

In reply to Rob Herring

Hi, Rob & Arnd

Sorry to bother you, do you have any other questions or comments? If not, we will continue to issue patch v10.

Look forward to your reply, thank you!

-----????-----
???: liwei (CM)
????: 2018?4?24? 21:54
???: 'Rob Herring'
??: mark.rutland at arm.com; catalin.marinas at arm.com; will.deacon at arm.com; vinholikatti at gmail.com; jejb at linux.vnet.ibm.com; martin.petersen at oracle.com; khilman at baylibre.com; arnd at arndb.de; gregory.clement at free-electrons.com; thomas.petazzoni at free-electrons.com; yamada.masahiro at socionext.com; riku.voipio at linaro.org; treding at nvidia.com; krzk at kernel.org; devicetree at vger.kernel.org; linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-scsi at vger.kernel.org; zangleigang; Gengjianfeng; guodong.xu at linaro.org ??: ??: [PATCH v9 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

Hi, Rob

Thanks for your patience.

Hi, Arnd

Quoted 1 line

From Rob's suggestion, we have to list the properties node in ufs-hisi.txt bingings even if documented in the common binding.

-----????-----
???: Rob Herring [mailto:robh at kernel.org]
????: 2018?4?24? 20:58
???: liwei (CM)
??: mark.rutland at arm.com; catalin.marinas at arm.com; will.deacon at arm.com; vinholikatti at gmail.com; jejb at linux.vnet.ibm.com; martin.petersen at oracle.com; khilman at baylibre.com; arnd at arndb.de; gregory.clement at free-electrons.com; thomas.petazzoni at free-electrons.com; yamada.masahiro at socionext.com; riku.voipio at linaro.org; treding at nvidia.com; krzk at kernel.org; devicetree at vger.kernel.org; linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-scsi at vger.kernel.org; zangleigang; Gengjianfeng; guodong.xu at linaro.org ??: Re: [PATCH v9 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

Quoted 18 lines · Li Wei

add ufs node document for Hisilicon.

---
 Documentation/devicetree/bindings/ufs/ufs-hisi.txt | 29 ++++++++++++++++++++++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt      | 10 +++++---
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-hisi.txt
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +3 -0
new file mode 100644
index 000000000000..d49ab7d8f31d
@@ -0,0 +1,29 @@
+* Hisilicon Universal Flash Storage (UFS) Host Controller
+
+UFS nodes are defined to describe on-chip UFS hardware macro.

Documentation/devicetree/bindings/ufs/ufs-hisi.txt line 13

Quoted 10 lines
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +10 -0
+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
+- resets            : reset node register, the "arst" corresponds to reset the APB/AXI bus.

arst belongs in reset-names.

OK, I will fix it in next patch;

Documentation/devicetree/bindings/ufs/ufs-hisi.txt line 14

Quoted 1 line
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +1 -0
+- reset-names       : describe reset node register

What happened to clocks? You still have to list which ones apply even if documented in the common binding.

OK, I will fix it in next patch;

Quoted 20 lines
Documentation/devicetree/bindings/ufs/ufs-hisi.txt new file +15 -0
+
+Example:
+
+	ufs: ufs at ff3b0000 {
+		compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+		/* 0: HCI standard */
+		/* 1: UFS SYS CTRL */
+		reg = <0x0 0xff3b0000 0x0 0x1000>,
+			<0x0 0xff3b1000 0x0 0x1000>;
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>;
+		/* offset: 0x84; bit: 7  */
+		resets = <&crg_rst 0x84 7>;
+		reset-names = "arst";
+	};
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +0 -0
index c39dfef76a18..adcfb79f63f5 100644

Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt Optional properties: · line 45

Quoted 5 lines
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +2 -0
@@ -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, the "rst" corresponds to reset the whole UFS IP.
+- reset-names       : describe reset node register

Does your controller have 1 or 2 resets? There's no point in adding this here if it doesn't apply to your controller.

There are 2 reset in our soc init, the "rst" corresponds to reset the whole UFS IP, and " arst " only reset the APB/AXI bus. Discussed with our soc colleagues that "arst" is assert by default and needs to deassert,but it done in bootloader,so will remove 'arst' in next patch.

About the 'reset' property?it seems that Arnd Bergmann has different suggestion?he suggested that add 'rst' to ufshcd-pltfrm because it seems common. But it looks like only our soc init needs it. What's your opinion? Does it still needs add to common bindings?

Quoted 20 lines
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +5 -3
 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 = 200000;
 		vccq2-max-microamp = 200000;
 
-		clocks = <&core 0>, <&ref 0>, <&iface 0>;
-		clock-names = "core_clk", "ref_clk", "iface_clk";
-		freq-table-hz = <100000000 200000000>, <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 = <100000000 200000000>, <0 0>, <0 0>, <0 0>;
+		resets = <&reset 0 1>;
+		reset-names = "rst";
 		phys = <&ufsphy1>;
 		phy-names = "ufsphy";
 	};
Signature · 1 line
2.15.0
author
#8 lore raw

PATCH v9 3/5 arm64: dts: add ufs dts node

In reply to Li Wei

arm64: dts: add ufs node for Hisilicon.

---
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +20 -0
index ec3eb8e33a3a..e9013d40a613 100644
@@ -892,6 +892,26 @@
 			reset-gpios = <&gpio11 1 0 >;
 		};
 
+		/* UFS */
+		ufs: ufs at ff3b0000 {
+			compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+			/* 0: HCI standard */
+			/* 1: UFS SYS CTRL */
+			reg = <0x0 0xff3b0000 0x0 0x1000>,
+				<0x0 0xff3b1000 0x0 0x1000>;
+			interrupt-parent = <&gic>;
+			interrupts = <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>;
+			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 */
+			/* offset: 0x84; bit: 7  */
+			resets = <&crg_rst 0x84 12>,
+				<&crg_rst 0x84 7>;
+			reset-names = "rst", "arst";
+		};
+
 		/* SD */
 		dwmmc1: dwmmc1 at ff37f000 {
 			#address-cells = <1>;
Signature · 1 line
2.15.0
author
#9 lore raw

PATCH v9 4/5 arm64: defconfig: enable configs for Hisilicon ufs

In reply to Li Wei

This enable configs for Hisilicon Hixxxx UFS driver.

---
 arch/arm64/configs/defconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/configs/defconfig +3 -0
index ecf613761e78..d42b1ecaf490 100644
@@ -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
Signature · 1 line
2.15.0
author
#10 lore raw

PATCH v9 5/5 arm64: defconfig: enable f2fs and squashfs

In reply to 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.

---
 arch/arm64/configs/defconfig | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/configs/defconfig +8 -0
index d42b1ecaf490..e8036cddb272 100644
@@ -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
Signature · 1 line
2.15.0