All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v9 0/4]   add PCIe driver for Kirin PCIe
@ 2017-05-31  7:01 ` Xiaowei Song
  0 siblings, 0 replies; 32+ messages in thread
From: Xiaowei Song @ 2017-05-31  7:01 UTC (permalink / raw)
  To: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon
  Cc: chenyao11, puck.chen, songxiaowei, guodong.xu, wangbinghui,
	suzhuangluan, linux-pci, devicetree, linux-kernel

Before Version Patches
======================
patch V8
http://www.spinics.net/lists/linux-pci/msg61715.html
patch V7
https://www.spinics.net/lists/linux-pci/msg61664.html
patch V6
https://www.spinics.net/lists/linux-pci/msg61610.html

patch V4
https://www.spinics.net/lists/linux-pci/msg61406.html

patch V3
https://www.spinics.net/lists/linux-pci/msg61399.html

Changes between V8 and V7
=========================
1. Fix the indent issues in Documentation, dtsi file and macro defination.
2. Replace pdev->dev with dev in kirin_pcie_get_resource and 
   kirin_pcie_get_clk functions.
3. Put variables "pci" and "kirin_pcie" to be initialized at first
   in kirin_pcie_wr_own_config, kirin_pcie_read_dbi and other functions.
4. Add space before blankets in "Low power mode(L1 ".
5. Short the Makefile sentence to lower than 80 characters
   and delete reduntant words.
6. Use word 'located' instead of the wrong one 'lacated'.
7. Fix the problem of return value type.

Changes between V8 and V7
=========================
1. Replace 'reset-gpios' of 'reset-gpio' in Documentation.

Changes between V7 and V6
=========================
1. add enumeration log Based on Hikey960 Board with these patches.
2. fix issues as fellows:
   (1) delete reduntant blankets in macro defination,
   (2) add blank line in  kirin_pcie_clk_ctrl function.
   (3) Fix compitable property in DT with the SoC name,
       for example "hisilicon,kirin960-pcie".

Changes between V6 and V4
=========================
1. seperate Document from .dtsi patch.
2. fix issues according to review comments
   from Bjorn Helgaas and Rob Herring: annotation stype, DT node,
   patch post method and so on.

Enumeration log
===============
These test logs come from patches running on Hikey960 Board
(1) Connect with Atheros Communications WIFI
	OF: PCI: host bridge /soc/kirin_pcie_rc@f4000000 ranges:
	OF: PCI:   MEM 0xf6000000..0xf7ffffff -> 0x00000000
	kirin-pcie f4000000.kirin_pcie_rc: PCI host bridge to bus 0000:00
	pci_bus 0000:00: root bus resource [bus 00-01]
	pci_bus 0000:00: root bus resource [mem 0xf6000000-0xf7ffffff] (bus address [0x00000000-0x01ffffff])
	pci 0000:00:00.0: [19e5:3660] type 01 class 0x060400
	pci 0000:00:00.0: reg 0x10: [mem 0xf6000000-0xf6ffffff]
	pci 0000:00:00.0: supports D1 D2
	pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot
	pci 0000:01:00.0: [168c:002a] type 00 class 0x028000
	pci 0000:01:00.0: reg 0x10: [mem 0xf6000000-0xf600ffff 64bit]
	pci 0000:01:00.0: supports D1
	pci 0000:01:00.0: PME# supported from D0 D1 D3hot
	pci 0000:01:00.0: disabling ASPM on pre-1.1 PCIe device.  You can enable it with 'pcie_aspm=force'
	pci 0000:00:00.0: BAR 0: assigned [mem 0xf6000000-0xf6ffffff]
	pci 0000:00:00.0: BAR 14: assigned [mem 0xf7000000-0xf70fffff]
	pci 0000:01:00.0: BAR 0: assigned [mem 0xf7000000-0xf700ffff 64bit]
	pci 0000:00:00.0: PCI bridge to [bus 01]
	pci 0000:00:00.0:   bridge window [mem 0xf7000000-0xf70fffff]
	pcieport 0000:00:00.0: Signaling PME with IRQ 276
	pcieport 0000:00:00.0: AER enabled with IRQ 276	

(2) Connect with Sandisk SSD
	OF: PCI: host bridge /soc/kirin_pcie_rc@f4000000 ranges:
	OF: PCI:   MEM 0xf6000000..0xf7ffffff -> 0x00000000
	kirin-pcie f4000000.kirin_pcie_rc: PCI host bridge to bus 0000:00
	pci_bus 0000:00: root bus resource [bus 00-01]
	pci_bus 0000:00: root bus resource [mem 0xf6000000-0xf7ffffff] (bus address [0x00000000-0x01ffffff])
	pci 0000:00:00.0: [19e5:3660] type 01 class 0x060400
	pci 0000:00:00.0: reg 0x10: [mem 0xf6000000-0xf6ffffff]
	pci 0000:00:00.0: supports D1 D2
	pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot
	pci 0000:01:00.0: [1b4b:1093] type 00 class 0x010802
	pci 0000:01:00.0: reg 0x10: [mem 0xf6000000-0xf6003fff 64bit]
	pci 0000:01:00.0: reg 0x30: [mem 0xf6000000-0xf600ffff pref]
	pci 0000:00:00.0: BAR 0: assigned [mem 0xf6000000-0xf6ffffff]
	pci 0000:00:00.0: BAR 14: assigned [mem 0xf7000000-0xf70fffff]
	pci 0000:00:00.0: BAR 15: assigned [mem 0xf7100000-0xf71fffff pref]
	pci 0000:01:00.0: BAR 6: assigned [mem 0xf7100000-0xf710ffff pref]
	pci 0000:01:00.0: BAR 0: assigned [mem 0xf7000000-0xf7003fff 64bit]
	pci 0000:00:00.0: PCI bridge to [bus 01]
	pci 0000:00:00.0:   bridge window [mem 0xf7000000-0xf70fffff]
	pci 0000:00:00.0:   bridge window [mem 0xf7100000-0xf71fffff pref]
	pcieport 0000:00:00.0: Signaling PME with IRQ 276
	pcieport 0000:00:00.0: AER enabled with IRQ 276

Patches list
============
Xiaowei Song (4):
  PCI: hisi: Add DT binding for PCIe of Kirin SoC series
  arm64: dts: hisi: add kirin pcie node
  PCI: dwc: kirin: add PCIe Driver for HiSilicon Kirin SoC
  ARM64: defconfig: Enable  Kirin PCIe

 .../devicetree/bindings/pci/kirin-pcie.txt         |  50 ++
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi          |  31 ++
 arch/arm64/configs/defconfig                       |   1 +
 drivers/pci/dwc/Kconfig                            |  10 +
 drivers/pci/dwc/Makefile                           |   1 +
 drivers/pci/dwc/pcie-kirin.c                       | 514 +++++++++++++++++++++
 6 files changed, 607 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/kirin-pcie.txt
 create mode 100644 drivers/pci/dwc/pcie-kirin.c

-- 
2.11.GIT

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH v9 0/4]   add PCIe driver for Kirin PCIe
@ 2017-05-31  7:01 ` Xiaowei Song
  0 siblings, 0 replies; 32+ messages in thread
From: Xiaowei Song @ 2017-05-31  7:01 UTC (permalink / raw)
  To: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon
  Cc: chenyao11, puck.chen, songxiaowei, guodong.xu, wangbinghui,
	suzhuangluan, linux-pci, devicetree, linux-kernel

Before Version Patches
======================
patch V8
http://www.spinics.net/lists/linux-pci/msg61715.html
patch V7
https://www.spinics.net/lists/linux-pci/msg61664.html
patch V6
https://www.spinics.net/lists/linux-pci/msg61610.html

patch V4
https://www.spinics.net/lists/linux-pci/msg61406.html

patch V3
https://www.spinics.net/lists/linux-pci/msg61399.html

Changes between V8 and V7
=========================
1. Fix the indent issues in Documentation, dtsi file and macro defination.
2. Replace pdev->dev with dev in kirin_pcie_get_resource and 
   kirin_pcie_get_clk functions.
3. Put variables "pci" and "kirin_pcie" to be initialized at first
   in kirin_pcie_wr_own_config, kirin_pcie_read_dbi and other functions.
4. Add space before blankets in "Low power mode(L1 ".
5. Short the Makefile sentence to lower than 80 characters
   and delete reduntant words.
6. Use word 'located' instead of the wrong one 'lacated'.
7. Fix the problem of return value type.

Changes between V8 and V7
=========================
1. Replace 'reset-gpios' of 'reset-gpio' in Documentation.

Changes between V7 and V6
=========================
1. add enumeration log Based on Hikey960 Board with these patches.
2. fix issues as fellows:
   (1) delete reduntant blankets in macro defination,
   (2) add blank line in  kirin_pcie_clk_ctrl function.
   (3) Fix compitable property in DT with the SoC name,
       for example "hisilicon,kirin960-pcie".

Changes between V6 and V4
=========================
1. seperate Document from .dtsi patch.
2. fix issues according to review comments
   from Bjorn Helgaas and Rob Herring: annotation stype, DT node,
   patch post method and so on.

Enumeration log
===============
These test logs come from patches running on Hikey960 Board
(1) Connect with Atheros Communications WIFI
	OF: PCI: host bridge /soc/kirin_pcie_rc@f4000000 ranges:
	OF: PCI:   MEM 0xf6000000..0xf7ffffff -> 0x00000000
	kirin-pcie f4000000.kirin_pcie_rc: PCI host bridge to bus 0000:00
	pci_bus 0000:00: root bus resource [bus 00-01]
	pci_bus 0000:00: root bus resource [mem 0xf6000000-0xf7ffffff] (bus address [0x00000000-0x01ffffff])
	pci 0000:00:00.0: [19e5:3660] type 01 class 0x060400
	pci 0000:00:00.0: reg 0x10: [mem 0xf6000000-0xf6ffffff]
	pci 0000:00:00.0: supports D1 D2
	pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot
	pci 0000:01:00.0: [168c:002a] type 00 class 0x028000
	pci 0000:01:00.0: reg 0x10: [mem 0xf6000000-0xf600ffff 64bit]
	pci 0000:01:00.0: supports D1
	pci 0000:01:00.0: PME# supported from D0 D1 D3hot
	pci 0000:01:00.0: disabling ASPM on pre-1.1 PCIe device.  You can enable it with 'pcie_aspm=force'
	pci 0000:00:00.0: BAR 0: assigned [mem 0xf6000000-0xf6ffffff]
	pci 0000:00:00.0: BAR 14: assigned [mem 0xf7000000-0xf70fffff]
	pci 0000:01:00.0: BAR 0: assigned [mem 0xf7000000-0xf700ffff 64bit]
	pci 0000:00:00.0: PCI bridge to [bus 01]
	pci 0000:00:00.0:   bridge window [mem 0xf7000000-0xf70fffff]
	pcieport 0000:00:00.0: Signaling PME with IRQ 276
	pcieport 0000:00:00.0: AER enabled with IRQ 276	

(2) Connect with Sandisk SSD
	OF: PCI: host bridge /soc/kirin_pcie_rc@f4000000 ranges:
	OF: PCI:   MEM 0xf6000000..0xf7ffffff -> 0x00000000
	kirin-pcie f4000000.kirin_pcie_rc: PCI host bridge to bus 0000:00
	pci_bus 0000:00: root bus resource [bus 00-01]
	pci_bus 0000:00: root bus resource [mem 0xf6000000-0xf7ffffff] (bus address [0x00000000-0x01ffffff])
	pci 0000:00:00.0: [19e5:3660] type 01 class 0x060400
	pci 0000:00:00.0: reg 0x10: [mem 0xf6000000-0xf6ffffff]
	pci 0000:00:00.0: supports D1 D2
	pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot
	pci 0000:01:00.0: [1b4b:1093] type 00 class 0x010802
	pci 0000:01:00.0: reg 0x10: [mem 0xf6000000-0xf6003fff 64bit]
	pci 0000:01:00.0: reg 0x30: [mem 0xf6000000-0xf600ffff pref]
	pci 0000:00:00.0: BAR 0: assigned [mem 0xf6000000-0xf6ffffff]
	pci 0000:00:00.0: BAR 14: assigned [mem 0xf7000000-0xf70fffff]
	pci 0000:00:00.0: BAR 15: assigned [mem 0xf7100000-0xf71fffff pref]
	pci 0000:01:00.0: BAR 6: assigned [mem 0xf7100000-0xf710ffff pref]
	pci 0000:01:00.0: BAR 0: assigned [mem 0xf7000000-0xf7003fff 64bit]
	pci 0000:00:00.0: PCI bridge to [bus 01]
	pci 0000:00:00.0:   bridge window [mem 0xf7000000-0xf70fffff]
	pci 0000:00:00.0:   bridge window [mem 0xf7100000-0xf71fffff pref]
	pcieport 0000:00:00.0: Signaling PME with IRQ 276
	pcieport 0000:00:00.0: AER enabled with IRQ 276

Patches list
============
Xiaowei Song (4):
  PCI: hisi: Add DT binding for PCIe of Kirin SoC series
  arm64: dts: hisi: add kirin pcie node
  PCI: dwc: kirin: add PCIe Driver for HiSilicon Kirin SoC
  ARM64: defconfig: Enable  Kirin PCIe

 .../devicetree/bindings/pci/kirin-pcie.txt         |  50 ++
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi          |  31 ++
 arch/arm64/configs/defconfig                       |   1 +
 drivers/pci/dwc/Kconfig                            |  10 +
 drivers/pci/dwc/Makefile                           |   1 +
 drivers/pci/dwc/pcie-kirin.c                       | 514 +++++++++++++++++++++
 6 files changed, 607 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/kirin-pcie.txt
 create mode 100644 drivers/pci/dwc/pcie-kirin.c

-- 
2.11.GIT

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH v9 1/4] PCI: hisi: Add DT binding for PCIe of Kirin SoC series
  2017-05-31  7:01 ` Xiaowei Song
@ 2017-05-31  7:01   ` Xiaowei Song
  -1 siblings, 0 replies; 32+ messages in thread
From: Xiaowei Song @ 2017-05-31  7:01 UTC (permalink / raw)
  To: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon
  Cc: chenyao11, puck.chen, songxiaowei, guodong.xu, wangbinghui,
	suzhuangluan, linux-pci, devicetree, linux-kernel

Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
---
 .../devicetree/bindings/pci/kirin-pcie.txt         | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/kirin-pcie.txt

diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
new file mode 100644
index 000000000000..68ffa0fbcd73
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
@@ -0,0 +1,50 @@
+HiSilicon Kirin SoCs PCIe host DT description
+
+Kirin PCIe host controller is based on Designware PCI core.
+It shares common functions with PCIe Designware core driver
+and inherits common properties defined in
+Documentation/devicetree/bindings/pci/designware-pci.txt.
+
+Additional properties are described here:
+
+Required properties
+- compatible:
+	"hisilicon,kirin960-pcie" for PCIe of Kirin960 SoC
+- reg: Should contain rc_dbi, apb, phy, config registers location and length.
+- reg-names: Must include the following entries:
+  "dbi": controller configuration registers;
+  "apb": apb Ctrl register defined by Kirin;
+  "phy": apb PHY register defined by Kirin;
+  "config": PCIe configuration space registers.
+- reset-gpios: The gpio to generate PCIe perst assert and deassert signal.
+
+Optional properties:
+
+Example based on kirin960:
+
+	pcie@f4000000 {
+		compatible = "hisilicon,kirin-pcie";
+		reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
+		      <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
+		reg-names = "dbi","apb","phy", "config";
+		bus-range = <0x0  0x1>;
+		#address-cells = <3>;
+		#size-cells = <2>;
+		device_type = "pci";
+		ranges = <0x02000000 0x0 0x00000000 0x0 0xf5000000 0x0 0x2000000>;
+		num-lanes = <1>;
+		#interrupt-cells = <1>;
+		interrupt-map-mask = <0xf800 0 0 7>;
+		interrupt-map = <0x0 0 0 1 &gic 0 0 0  282 4>,
+				<0x0 0 0 2 &gic 0 0 0  283 4>,
+				<0x0 0 0 3 &gic 0 0 0  284 4>,
+				<0x0 0 0 4 &gic 0 0 0  285 4>;
+		clocks = <&crg_ctrl HI3660_PCIEPHY_REF>,
+			 <&crg_ctrl HI3660_CLK_GATE_PCIEAUX>,
+			 <&crg_ctrl HI3660_PCLK_GATE_PCIE_PHY>,
+			 <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
+			 <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
+		clock-names = "pcie_phy_ref", "pcie_aux",
+			      "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
+		reset-gpios = <&gpio11 1 0 >;
+	};
-- 
2.11.GIT

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v9 1/4] PCI: hisi: Add DT binding for PCIe of Kirin SoC series
@ 2017-05-31  7:01   ` Xiaowei Song
  0 siblings, 0 replies; 32+ messages in thread
From: Xiaowei Song @ 2017-05-31  7:01 UTC (permalink / raw)
  To: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon
  Cc: chenyao11, puck.chen, songxiaowei, guodong.xu, wangbinghui,
	suzhuangluan, linux-pci, devicetree, linux-kernel

Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
---
 .../devicetree/bindings/pci/kirin-pcie.txt         | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/kirin-pcie.txt

diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
new file mode 100644
index 000000000000..68ffa0fbcd73
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
@@ -0,0 +1,50 @@
+HiSilicon Kirin SoCs PCIe host DT description
+
+Kirin PCIe host controller is based on Designware PCI core.
+It shares common functions with PCIe Designware core driver
+and inherits common properties defined in
+Documentation/devicetree/bindings/pci/designware-pci.txt.
+
+Additional properties are described here:
+
+Required properties
+- compatible:
+	"hisilicon,kirin960-pcie" for PCIe of Kirin960 SoC
+- reg: Should contain rc_dbi, apb, phy, config registers location and length.
+- reg-names: Must include the following entries:
+  "dbi": controller configuration registers;
+  "apb": apb Ctrl register defined by Kirin;
+  "phy": apb PHY register defined by Kirin;
+  "config": PCIe configuration space registers.
+- reset-gpios: The gpio to generate PCIe perst assert and deassert signal.
+
+Optional properties:
+
+Example based on kirin960:
+
+	pcie@f4000000 {
+		compatible = "hisilicon,kirin-pcie";
+		reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
+		      <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
+		reg-names = "dbi","apb","phy", "config";
+		bus-range = <0x0  0x1>;
+		#address-cells = <3>;
+		#size-cells = <2>;
+		device_type = "pci";
+		ranges = <0x02000000 0x0 0x00000000 0x0 0xf5000000 0x0 0x2000000>;
+		num-lanes = <1>;
+		#interrupt-cells = <1>;
+		interrupt-map-mask = <0xf800 0 0 7>;
+		interrupt-map = <0x0 0 0 1 &gic 0 0 0  282 4>,
+				<0x0 0 0 2 &gic 0 0 0  283 4>,
+				<0x0 0 0 3 &gic 0 0 0  284 4>,
+				<0x0 0 0 4 &gic 0 0 0  285 4>;
+		clocks = <&crg_ctrl HI3660_PCIEPHY_REF>,
+			 <&crg_ctrl HI3660_CLK_GATE_PCIEAUX>,
+			 <&crg_ctrl HI3660_PCLK_GATE_PCIE_PHY>,
+			 <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
+			 <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
+		clock-names = "pcie_phy_ref", "pcie_aux",
+			      "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
+		reset-gpios = <&gpio11 1 0 >;
+	};
-- 
2.11.GIT

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
  2017-05-31  7:01 ` Xiaowei Song
@ 2017-05-31  7:01   ` Xiaowei Song
  -1 siblings, 0 replies; 32+ messages in thread
From: Xiaowei Song @ 2017-05-31  7:01 UTC (permalink / raw)
  To: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon
  Cc: chenyao11, puck.chen, songxiaowei, guodong.xu, wangbinghui,
	suzhuangluan, linux-pci, devicetree, linux-kernel

Add PCIe node for hi3660, and add binding documentation.

Cc: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
---
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index 3983086bd67b..e8feb2fb4d53 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -156,5 +156,36 @@
 			clock-names = "uartclk", "apb_pclk";
 			status = "disabled";
 		};
+
+		pcie@f4000000 {
+			compatible = "hisilicon,kirin960-pcie";
+			reg = <0x0 0xf4000000 0x0 0x1000>,
+			      <0x0 0xff3fe000 0x0 0x1000>,
+			      <0x0 0xf3f20000 0x0 0x40000>,
+			      <0x0 0xF5000000 0x0 0x2000>;
+			reg-names = "dbi", "apb", "phy", "config";
+			bus-range = <0x0  0x1>;
+			#address-cells = <3>;
+			#size-cells = <2>;
+			device_type = "pci";
+			ranges = <0x02000000 0x0 0x00000000 0x0
+				  0xf6000000 0x0 0x2000000>;
+			num-lanes = <1>;
+			#interrupt-cells = <1>;
+			interrupt-map-mask = <0xf800 0 0 7>;
+			interrupt-map = <0x0 0 0 1 &gic 0 0 0 282 4>,
+					<0x0 0 0 2 &gic 0 0 0  283 4>,
+					<0x0 0 0 3 &gic 0 0 0  284 4>,
+					<0x0 0 0 4 &gic 0 0 0  285 4>;
+			clocks = <&crg_ctrl HI3660_PCIEPHY_REF>,
+				 <&crg_ctrl HI3660_CLK_GATE_PCIEAUX>,
+				 <&crg_ctrl HI3660_PCLK_GATE_PCIE_PHY>,
+				 <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
+				 <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
+			clock-names = "pcie_phy_ref", "pcie_aux",
+				      "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
+			reset-gpios = <&gpio11 1 0 >;
+			status = "ok";
+		};
 	};
 };
-- 
2.11.GIT

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-05-31  7:01   ` Xiaowei Song
  0 siblings, 0 replies; 32+ messages in thread
From: Xiaowei Song @ 2017-05-31  7:01 UTC (permalink / raw)
  To: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon
  Cc: chenyao11, puck.chen, songxiaowei, guodong.xu, wangbinghui,
	suzhuangluan, linux-pci, devicetree, linux-kernel

Add PCIe node for hi3660, and add binding documentation.

Cc: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
---
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index 3983086bd67b..e8feb2fb4d53 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -156,5 +156,36 @@
 			clock-names = "uartclk", "apb_pclk";
 			status = "disabled";
 		};
+
+		pcie@f4000000 {
+			compatible = "hisilicon,kirin960-pcie";
+			reg = <0x0 0xf4000000 0x0 0x1000>,
+			      <0x0 0xff3fe000 0x0 0x1000>,
+			      <0x0 0xf3f20000 0x0 0x40000>,
+			      <0x0 0xF5000000 0x0 0x2000>;
+			reg-names = "dbi", "apb", "phy", "config";
+			bus-range = <0x0  0x1>;
+			#address-cells = <3>;
+			#size-cells = <2>;
+			device_type = "pci";
+			ranges = <0x02000000 0x0 0x00000000 0x0
+				  0xf6000000 0x0 0x2000000>;
+			num-lanes = <1>;
+			#interrupt-cells = <1>;
+			interrupt-map-mask = <0xf800 0 0 7>;
+			interrupt-map = <0x0 0 0 1 &gic 0 0 0 282 4>,
+					<0x0 0 0 2 &gic 0 0 0  283 4>,
+					<0x0 0 0 3 &gic 0 0 0  284 4>,
+					<0x0 0 0 4 &gic 0 0 0  285 4>;
+			clocks = <&crg_ctrl HI3660_PCIEPHY_REF>,
+				 <&crg_ctrl HI3660_CLK_GATE_PCIEAUX>,
+				 <&crg_ctrl HI3660_PCLK_GATE_PCIE_PHY>,
+				 <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
+				 <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
+			clock-names = "pcie_phy_ref", "pcie_aux",
+				      "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
+			reset-gpios = <&gpio11 1 0 >;
+			status = "ok";
+		};
 	};
 };
-- 
2.11.GIT

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v9 3/4] PCI: dwc: kirin: add PCIe Driver for HiSilicon Kirin SoC
  2017-05-31  7:01 ` Xiaowei Song
@ 2017-05-31  7:01   ` Xiaowei Song
  -1 siblings, 0 replies; 32+ messages in thread
From: Xiaowei Song @ 2017-05-31  7:01 UTC (permalink / raw)
  To: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon
  Cc: chenyao11, puck.chen, songxiaowei, guodong.xu, wangbinghui,
	suzhuangluan, linux-pci, devicetree, linux-kernel

Hisilicon PCIe Driver shares the common functions for PCIe dw-host

The poweron functions is developed on hi3660 SoC,
while Others Functions are common for Kirin series SoCs.

Low power mode (L1 sub-state and Suspend/Resume), hotplug
and MSI feature are not supported currently.

Cc: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
---
 drivers/pci/dwc/Kconfig      |  10 +
 drivers/pci/dwc/Makefile     |   1 +
 drivers/pci/dwc/pcie-kirin.c | 514 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 525 insertions(+)
 create mode 100644 drivers/pci/dwc/pcie-kirin.c

diff --git a/drivers/pci/dwc/Kconfig b/drivers/pci/dwc/Kconfig
index d2d2ba5b8a68..afecfb2b6ff4 100644
--- a/drivers/pci/dwc/Kconfig
+++ b/drivers/pci/dwc/Kconfig
@@ -130,4 +130,14 @@ config PCIE_ARTPEC6
 	  Say Y here to enable PCIe controller support on Axis ARTPEC-6
 	  SoCs.  This PCIe controller uses the DesignWare core.
 
+config PCIE_KIRIN
+	depends on OF && ARM64
+	bool "HiSilicon Kirin series SoCs PCIe controllers"
+	depends on PCI
+	select PCIEPORTBUS
+	select PCIE_DW_HOST
+	help
+	  Say Y here if you want PCIe controller support
+	  on HiSilicon Kirin series SoCs.
+
 endmenu
diff --git a/drivers/pci/dwc/Makefile b/drivers/pci/dwc/Makefile
index a2df13c28798..4bd69bacd4ab 100644
--- a/drivers/pci/dwc/Makefile
+++ b/drivers/pci/dwc/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o
 obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o
 obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
 obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o
+obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o
 
 # The following drivers are for devices that use the generic ACPI
 # pci_root.c driver but don't support standard ECAM config access.
diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
new file mode 100644
index 000000000000..f63e6548efae
--- /dev/null
+++ b/drivers/pci/dwc/pcie-kirin.c
@@ -0,0 +1,514 @@
+/*
+ * PCIe host controller driver for Kirin Phone SoCs
+ *
+ * Copyright (C) 2017 Hilisicon Electronics Co., Ltd.
+ *		http://www.huawei.com
+ *
+ * Author: Xiaowei Song <songxiaowei@huawei.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <asm/compiler.h>
+#include <linux/compiler.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/syscon.h>
+#include <linux/of_address.h>
+#include <linux/of_gpio.h>
+#include <linux/of_pci.h>
+#include <linux/pci.h>
+#include <linux/pci_regs.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/resource.h>
+#include <linux/types.h>
+#include "pcie-designware.h"
+
+#define to_kirin_pcie(x) dev_get_drvdata((x)->dev)
+
+#define REF_CLK_FREQ			100000000
+
+/* PCIe ELBI registers */
+#define SOC_PCIECTRL_CTRL0_ADDR	0x000
+#define SOC_PCIECTRL_CTRL1_ADDR	0x004
+#define SOC_PCIEPHY_CTRL2_ADDR		0x008
+#define SOC_PCIEPHY_CTRL3_ADDR		0x00c
+#define PCIE_ELBI_SLV_DBI_ENABLE	(0x1 << 21)
+
+/* info located in APB */
+#define PCIE_APP_LTSSM_ENABLE		0x01c
+#define PCIE_APB_PHY_CTRL0		0x0
+#define PCIE_APB_PHY_CTRL1		0x4
+#define PCIE_APB_PHY_STATUS0		0x400
+#define PCIE_LINKUP_ENABLE		(0x8020)
+#define PCIE_LTSSM_ENABLE_BIT		(0x1 << 11)
+#define PIPE_CLK_STABLE		(0x1 << 19)
+#define PIPE_CLK_MAX_TRY_TIMES		10
+#define PHY_REF_PAD_BIT		(0x1 << 8)
+#define PHY_PWR_DOWN_BIT		(0x1 << 22)
+#define PHY_RST_ACK_BIT		(0x1 << 16)
+
+/* info located in sysctrl */
+#define SCTRL_PCIE_CMOS_OFFSET		0x60
+#define SCTRL_PCIE_CMOS_BIT		0x10
+#define SCTRL_PCIE_ISO_OFFSET		0x44
+#define SCTRL_PCIE_ISO_BIT		0x30
+#define SCTRL_PCIE_HPCLK_OFFSET	0x190
+#define SCTRL_PCIE_HPCLK_BIT		0x184000
+#define SCTRL_PCIE_OE_OFFSET		0x14a
+#define PCIE_DEBOUNCE_PARAM		0xF0F400
+#define PCIE_OE_BYPASS			(0x3 << 28)
+
+/* peri_crg ctrl */
+#define CRGCTRL_PCIE_ASSERT_OFFSET	0x88
+#define CRGCTRL_PCIE_ASSERT_BIT	0x8c000000
+
+/* Time for delay */
+#define REF_2_PERST_MIN		20000
+#define REF_2_PERST_MAX		25000
+#define PERST_2_ACCESS_MIN		10000
+#define PERST_2_ACCESS_MAX		12000
+#define LINK_WAIT_MIN			900
+#define LINK_WAIT_MAX			1000
+#define PIPE_CLK_WAIT_MIN		550
+#define PIPE_CLK_WAIT_MAX		600
+
+struct kirin_pcie {
+	struct dw_pcie		*pci;
+	void __iomem		*apb_base;
+	void __iomem		*phy_base;
+	struct regmap		*crgctrl;
+	struct regmap 		*sysctrl;
+	struct clk		*apb_sys_clk;
+	struct clk		*apb_phy_clk;
+	struct clk		*phy_ref_clk;
+	struct clk		*pcie_aclk;
+	struct clk		*pcie_aux_clk;
+	int			gpio_id_reset;
+};
+
+/* Registers in PCIeCTRL */
+static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,
+		u32 val, u32 reg)
+{
+	writel(val, kirin_pcie->apb_base + reg);
+}
+
+static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32 reg)
+{
+	return readl(kirin_pcie->apb_base + reg);
+}
+
+/* Registers in PCIePHY */
+static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,
+		u32 val, u32 reg)
+{
+	writel(val, kirin_pcie->phy_base + reg);
+}
+
+static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32 reg)
+{
+	return readl(kirin_pcie->phy_base + reg);
+}
+
+static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
+		struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+
+	kirin_pcie->phy_ref_clk = devm_clk_get(dev, "pcie_phy_ref");
+	if (IS_ERR(kirin_pcie->phy_ref_clk))
+		return PTR_ERR(kirin_pcie->phy_ref_clk);
+
+	kirin_pcie->pcie_aux_clk = devm_clk_get(dev, "pcie_aux");
+	if (IS_ERR(kirin_pcie->pcie_aux_clk))
+		return PTR_ERR(kirin_pcie->pcie_aux_clk);
+
+	kirin_pcie->apb_phy_clk = devm_clk_get(dev, "pcie_apb_phy");
+	if (IS_ERR(kirin_pcie->apb_phy_clk))
+		return PTR_ERR(kirin_pcie->apb_phy_clk);
+
+	kirin_pcie->apb_sys_clk = devm_clk_get(dev, "pcie_apb_sys");
+	if (IS_ERR(kirin_pcie->apb_sys_clk))
+		return PTR_ERR(kirin_pcie->apb_sys_clk);
+
+	kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
+	if (IS_ERR(kirin_pcie->pcie_aclk))
+		return PTR_ERR(kirin_pcie->pcie_aclk);
+
+	return 0;
+}
+
+static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
+		struct platform_device *pdev)
+{
+	struct resource *apb;
+	struct resource *phy;
+	struct resource *dbi;
+	struct device *dev = &pdev->dev;
+
+	apb = platform_get_resource_byname(pdev, IORESOURCE_MEM, "apb");
+	kirin_pcie->apb_base = devm_ioremap_resource(dev, apb);
+	if (IS_ERR(kirin_pcie->apb_base))
+		return PTR_ERR(kirin_pcie->apb_base);
+
+	phy = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy");
+	kirin_pcie->phy_base = devm_ioremap_resource(dev, phy);
+	if (IS_ERR(kirin_pcie->phy_base))
+		return PTR_ERR(kirin_pcie->phy_base);
+
+	dbi = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
+	kirin_pcie->pci->dbi_base = devm_ioremap_resource(dev, dbi);
+	if (IS_ERR(kirin_pcie->pci->dbi_base))
+		return PTR_ERR(kirin_pcie->pci->dbi_base);
+
+	kirin_pcie->crgctrl =
+		syscon_regmap_lookup_by_compatible("hisilicon,hi3660-crgctrl");
+	if (IS_ERR(kirin_pcie->crgctrl))
+		return PTR_ERR(kirin_pcie->crgctrl);
+
+	kirin_pcie->sysctrl =
+		syscon_regmap_lookup_by_compatible("hisilicon,hi3660-sctrl");
+	if (IS_ERR(kirin_pcie->sysctrl))
+		return PTR_ERR(kirin_pcie->sysctrl);
+
+	return 0;
+}
+
+static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
+{
+	u32 reg_val;
+	u32 time = PIPE_CLK_MAX_TRY_TIMES;
+
+	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
+	reg_val &= ~PHY_REF_PAD_BIT;
+	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL1);
+
+	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL0);
+	reg_val &= ~PHY_PWR_DOWN_BIT;
+	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL0);
+	udelay(10);
+
+	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
+	reg_val &= ~PHY_RST_ACK_BIT;
+	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL1);
+
+	usleep_range(PIPE_CLK_WAIT_MIN, PIPE_CLK_WAIT_MAX);
+	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_STATUS0);
+	if (reg_val & PIPE_CLK_STABLE) {
+		dev_err(kirin_pcie->pci->dev, "PIPE clk is not stable\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static void kirin_pcie_oe_enable(struct kirin_pcie *kirin_pcie)
+{
+	u32 val;
+
+	regmap_read(kirin_pcie->sysctrl, SCTRL_PCIE_OE_OFFSET, &val);
+	val |= PCIE_DEBOUNCE_PARAM;
+	val &= ~PCIE_OE_BYPASS;
+	regmap_write(kirin_pcie->sysctrl, SCTRL_PCIE_OE_OFFSET, val);
+}
+
+static int kirin_pcie_clk_ctrl(struct kirin_pcie *kirin_pcie, bool enable)
+{
+	int ret = 0;
+
+	if (!enable)
+		goto close_clk;
+
+	ret = clk_set_rate(kirin_pcie->phy_ref_clk, REF_CLK_FREQ);
+	if (ret)
+		return ret;
+
+	ret = clk_prepare_enable(kirin_pcie->phy_ref_clk);
+	if (ret)
+		return ret;
+
+	ret = clk_prepare_enable(kirin_pcie->apb_sys_clk);
+	if (ret)
+		goto apb_sys_fail;
+
+	ret = clk_prepare_enable(kirin_pcie->apb_phy_clk);
+	if (ret)
+		goto apb_phy_fail;
+
+	ret = clk_prepare_enable(kirin_pcie->pcie_aclk);
+	if (ret)
+		goto aclk_fail;
+
+	ret = clk_prepare_enable(kirin_pcie->pcie_aux_clk);
+	if (ret)
+		goto aux_clk_fail;
+
+	return 0;
+
+close_clk:
+	clk_disable_unprepare(kirin_pcie->pcie_aux_clk);
+aux_clk_fail:
+	clk_disable_unprepare(kirin_pcie->pcie_aclk);
+aclk_fail:
+	clk_disable_unprepare(kirin_pcie->apb_phy_clk);
+apb_phy_fail:
+	clk_disable_unprepare(kirin_pcie->apb_sys_clk);
+apb_sys_fail:
+	clk_disable_unprepare(kirin_pcie->phy_ref_clk);
+
+	return ret;
+}
+
+static int kirin_pcie_power_on(struct kirin_pcie *kirin_pcie)
+{
+	int ret;
+
+	/* Power supply for Host */
+	regmap_write(kirin_pcie->sysctrl,
+		SCTRL_PCIE_CMOS_OFFSET, SCTRL_PCIE_CMOS_BIT);
+	udelay(100);
+	kirin_pcie_oe_enable(kirin_pcie);
+
+	ret = kirin_pcie_clk_ctrl(kirin_pcie, true);
+	if (ret)
+		return ret;
+
+	/* ISO disable, PCIeCtrl, PHY assert and clk gate clear */
+	regmap_write(kirin_pcie->sysctrl,
+		SCTRL_PCIE_ISO_OFFSET, SCTRL_PCIE_ISO_BIT);
+	regmap_write(kirin_pcie->crgctrl,
+		CRGCTRL_PCIE_ASSERT_OFFSET, CRGCTRL_PCIE_ASSERT_BIT);
+	regmap_write(kirin_pcie->sysctrl,
+		SCTRL_PCIE_HPCLK_OFFSET, SCTRL_PCIE_HPCLK_BIT);
+
+	ret = kirin_pcie_phy_init(kirin_pcie);
+	if (ret)
+		goto close_clk;
+
+	/* perst assert Endpoint */
+	if (!gpio_request(kirin_pcie->gpio_id_reset, "pcie_perst")) {
+		usleep_range(REF_2_PERST_MIN, REF_2_PERST_MAX);
+		ret = gpio_direction_output(kirin_pcie->gpio_id_reset, 1);
+		if (ret)
+			goto close_clk;
+		usleep_range(PERST_2_ACCESS_MIN, PERST_2_ACCESS_MAX);
+
+		return 0;
+	}
+
+close_clk:
+	kirin_pcie_clk_ctrl(kirin_pcie, false);
+	return ret;
+}
+
+static void kirin_pcie_sideband_dbi_w_mode(struct kirin_pcie *kirin_pcie,
+		bool on)
+{
+	u32 val;
+
+	val = kirin_apb_ctrl_readl(kirin_pcie, SOC_PCIECTRL_CTRL0_ADDR);
+	if (on)
+		val = val | PCIE_ELBI_SLV_DBI_ENABLE;
+	else
+		val = val & ~PCIE_ELBI_SLV_DBI_ENABLE;
+
+	kirin_apb_ctrl_writel(kirin_pcie, val, SOC_PCIECTRL_CTRL0_ADDR);
+}
+
+static void kirin_pcie_sideband_dbi_r_mode(struct kirin_pcie *kirin_pcie,
+		bool on)
+{
+	u32 val;
+
+	val = kirin_apb_ctrl_readl(kirin_pcie, SOC_PCIECTRL_CTRL1_ADDR);
+	if (on)
+		val = val | PCIE_ELBI_SLV_DBI_ENABLE;
+	else
+		val = val & ~PCIE_ELBI_SLV_DBI_ENABLE;
+
+	kirin_apb_ctrl_writel(kirin_pcie, val, SOC_PCIECTRL_CTRL1_ADDR);
+}
+
+static int kirin_pcie_rd_own_conf(struct pcie_port *pp,
+		int where, int size, u32 *val)
+{
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+	int ret;
+
+	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, true);
+	ret = dw_pcie_read(pci->dbi_base + where, size, val);
+	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, false);
+
+	return ret;
+}
+
+static int kirin_pcie_wr_own_conf(struct pcie_port *pp,
+		int where, int size, u32 val)
+{
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+	int ret;
+
+	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, true);
+	ret = dw_pcie_write(pci->dbi_base + where, size, val);
+	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, false);
+
+	return ret;
+}
+
+static u32 kirin_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base,
+		u32 reg, size_t size)
+{
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+	u32 ret;
+
+	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, true);
+	dw_pcie_read(base + reg, size, &ret);
+	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, false);
+
+	return ret;
+}
+
+static void kirin_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base,
+		u32 reg, size_t size, u32 val)
+{
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+
+	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, true);
+	dw_pcie_write(base + reg, size, val);
+	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, false);
+}
+
+static int kirin_pcie_link_up(struct dw_pcie *pci)
+{
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+	u32 val = kirin_apb_ctrl_readl(kirin_pcie, PCIE_APB_PHY_STATUS0);
+
+	if ((val & PCIE_LINKUP_ENABLE) == PCIE_LINKUP_ENABLE)
+		return 1;
+
+	return 0;
+}
+
+static int kirin_pcie_establish_link(struct pcie_port *pp)
+{
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+	int count = 0;
+
+	if (kirin_pcie_link_up(pci))
+		return 0;
+
+	dw_pcie_setup_rc(pp);
+
+	/* assert LTSSM enable */
+	kirin_apb_ctrl_writel(kirin_pcie, PCIE_LTSSM_ENABLE_BIT,
+		PCIE_APP_LTSSM_ENABLE);
+
+	/* check if the link is up or not */
+	while (!kirin_pcie_link_up(pci)) {
+		usleep_range(LINK_WAIT_MIN, LINK_WAIT_MAX);
+		count++;
+		if (count == 1000) {
+			dev_err(pci->dev, "Link Fail\n");
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
+static void kirin_pcie_host_init(struct pcie_port *pp)
+{
+	kirin_pcie_establish_link(pp);
+}
+
+static struct dw_pcie_ops kirin_dw_pcie_ops = {
+	.read_dbi = kirin_pcie_read_dbi,
+	.write_dbi = kirin_pcie_write_dbi,
+	.link_up = kirin_pcie_link_up,
+};
+
+static struct dw_pcie_host_ops kirin_pcie_host_ops = {
+	.rd_own_conf = kirin_pcie_rd_own_conf,
+	.wr_own_conf = kirin_pcie_wr_own_conf,
+	.host_init = kirin_pcie_host_init,
+};
+
+static int __init kirin_add_pcie_port(struct dw_pcie *pci,
+			struct platform_device *pdev)
+{
+	pci->pp.ops = &kirin_pcie_host_ops;
+
+	return dw_pcie_host_init(&pci->pp);
+}
+
+static int kirin_pcie_probe(struct platform_device *pdev)
+{
+	struct kirin_pcie *kirin_pcie;
+	struct dw_pcie *pci;
+	struct device *dev = &pdev->dev;
+	int ret;
+
+	if (!dev->of_node) {
+		dev_err(&pdev->dev, "NULL node\n");
+		return -EINVAL;
+	}
+
+	kirin_pcie = devm_kzalloc(dev, sizeof(struct kirin_pcie), GFP_KERNEL);
+	if (!kirin_pcie)
+		return -ENOMEM;
+
+	pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
+	if (!pci)
+		return -ENOMEM;
+
+	pci->dev = dev;
+	pci->ops = &kirin_dw_pcie_ops;
+	kirin_pcie->pci = pci;
+
+	ret = kirin_pcie_get_clk(kirin_pcie, pdev);
+	if (ret)
+		return ret;
+
+	ret = kirin_pcie_get_resource(kirin_pcie, pdev);
+	if (ret)
+		return ret;
+
+	kirin_pcie->gpio_id_reset = of_get_named_gpio(dev->of_node,
+			"reset-gpio", 0);
+	if (kirin_pcie->gpio_id_reset < 0)
+		return -ENODEV;
+
+	ret = kirin_pcie_power_on(kirin_pcie);
+	if (ret)
+		return ret;
+
+	platform_set_drvdata(pdev, kirin_pcie);
+
+	return kirin_add_pcie_port(pci, pdev);
+}
+
+static const struct of_device_id kirin_pcie_match[] = {
+	{ .compatible = "hisilicon,kirin960-pcie" },
+	{},
+};
+
+struct platform_driver kirin_pcie_driver = {
+	.probe			= kirin_pcie_probe,
+	.driver			= {
+		.name			= "kirin-pcie",
+		.of_match_table = kirin_pcie_match,
+		.suppress_bind_attrs = true,
+	},
+};
+
+builtin_platform_driver(kirin_pcie_driver);
-- 
2.11.GIT

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v9 3/4] PCI: dwc: kirin: add PCIe Driver for HiSilicon Kirin SoC
@ 2017-05-31  7:01   ` Xiaowei Song
  0 siblings, 0 replies; 32+ messages in thread
From: Xiaowei Song @ 2017-05-31  7:01 UTC (permalink / raw)
  To: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon
  Cc: chenyao11, puck.chen, songxiaowei, guodong.xu, wangbinghui,
	suzhuangluan, linux-pci, devicetree, linux-kernel

Hisilicon PCIe Driver shares the common functions for PCIe dw-host

The poweron functions is developed on hi3660 SoC,
while Others Functions are common for Kirin series SoCs.

Low power mode (L1 sub-state and Suspend/Resume), hotplug
and MSI feature are not supported currently.

Cc: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
---
 drivers/pci/dwc/Kconfig      |  10 +
 drivers/pci/dwc/Makefile     |   1 +
 drivers/pci/dwc/pcie-kirin.c | 514 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 525 insertions(+)
 create mode 100644 drivers/pci/dwc/pcie-kirin.c

diff --git a/drivers/pci/dwc/Kconfig b/drivers/pci/dwc/Kconfig
index d2d2ba5b8a68..afecfb2b6ff4 100644
--- a/drivers/pci/dwc/Kconfig
+++ b/drivers/pci/dwc/Kconfig
@@ -130,4 +130,14 @@ config PCIE_ARTPEC6
 	  Say Y here to enable PCIe controller support on Axis ARTPEC-6
 	  SoCs.  This PCIe controller uses the DesignWare core.
 
+config PCIE_KIRIN
+	depends on OF && ARM64
+	bool "HiSilicon Kirin series SoCs PCIe controllers"
+	depends on PCI
+	select PCIEPORTBUS
+	select PCIE_DW_HOST
+	help
+	  Say Y here if you want PCIe controller support
+	  on HiSilicon Kirin series SoCs.
+
 endmenu
diff --git a/drivers/pci/dwc/Makefile b/drivers/pci/dwc/Makefile
index a2df13c28798..4bd69bacd4ab 100644
--- a/drivers/pci/dwc/Makefile
+++ b/drivers/pci/dwc/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o
 obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o
 obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
 obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o
+obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o
 
 # The following drivers are for devices that use the generic ACPI
 # pci_root.c driver but don't support standard ECAM config access.
diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
new file mode 100644
index 000000000000..f63e6548efae
--- /dev/null
+++ b/drivers/pci/dwc/pcie-kirin.c
@@ -0,0 +1,514 @@
+/*
+ * PCIe host controller driver for Kirin Phone SoCs
+ *
+ * Copyright (C) 2017 Hilisicon Electronics Co., Ltd.
+ *		http://www.huawei.com
+ *
+ * Author: Xiaowei Song <songxiaowei@huawei.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <asm/compiler.h>
+#include <linux/compiler.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/syscon.h>
+#include <linux/of_address.h>
+#include <linux/of_gpio.h>
+#include <linux/of_pci.h>
+#include <linux/pci.h>
+#include <linux/pci_regs.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/resource.h>
+#include <linux/types.h>
+#include "pcie-designware.h"
+
+#define to_kirin_pcie(x) dev_get_drvdata((x)->dev)
+
+#define REF_CLK_FREQ			100000000
+
+/* PCIe ELBI registers */
+#define SOC_PCIECTRL_CTRL0_ADDR	0x000
+#define SOC_PCIECTRL_CTRL1_ADDR	0x004
+#define SOC_PCIEPHY_CTRL2_ADDR		0x008
+#define SOC_PCIEPHY_CTRL3_ADDR		0x00c
+#define PCIE_ELBI_SLV_DBI_ENABLE	(0x1 << 21)
+
+/* info located in APB */
+#define PCIE_APP_LTSSM_ENABLE		0x01c
+#define PCIE_APB_PHY_CTRL0		0x0
+#define PCIE_APB_PHY_CTRL1		0x4
+#define PCIE_APB_PHY_STATUS0		0x400
+#define PCIE_LINKUP_ENABLE		(0x8020)
+#define PCIE_LTSSM_ENABLE_BIT		(0x1 << 11)
+#define PIPE_CLK_STABLE		(0x1 << 19)
+#define PIPE_CLK_MAX_TRY_TIMES		10
+#define PHY_REF_PAD_BIT		(0x1 << 8)
+#define PHY_PWR_DOWN_BIT		(0x1 << 22)
+#define PHY_RST_ACK_BIT		(0x1 << 16)
+
+/* info located in sysctrl */
+#define SCTRL_PCIE_CMOS_OFFSET		0x60
+#define SCTRL_PCIE_CMOS_BIT		0x10
+#define SCTRL_PCIE_ISO_OFFSET		0x44
+#define SCTRL_PCIE_ISO_BIT		0x30
+#define SCTRL_PCIE_HPCLK_OFFSET	0x190
+#define SCTRL_PCIE_HPCLK_BIT		0x184000
+#define SCTRL_PCIE_OE_OFFSET		0x14a
+#define PCIE_DEBOUNCE_PARAM		0xF0F400
+#define PCIE_OE_BYPASS			(0x3 << 28)
+
+/* peri_crg ctrl */
+#define CRGCTRL_PCIE_ASSERT_OFFSET	0x88
+#define CRGCTRL_PCIE_ASSERT_BIT	0x8c000000
+
+/* Time for delay */
+#define REF_2_PERST_MIN		20000
+#define REF_2_PERST_MAX		25000
+#define PERST_2_ACCESS_MIN		10000
+#define PERST_2_ACCESS_MAX		12000
+#define LINK_WAIT_MIN			900
+#define LINK_WAIT_MAX			1000
+#define PIPE_CLK_WAIT_MIN		550
+#define PIPE_CLK_WAIT_MAX		600
+
+struct kirin_pcie {
+	struct dw_pcie		*pci;
+	void __iomem		*apb_base;
+	void __iomem		*phy_base;
+	struct regmap		*crgctrl;
+	struct regmap 		*sysctrl;
+	struct clk		*apb_sys_clk;
+	struct clk		*apb_phy_clk;
+	struct clk		*phy_ref_clk;
+	struct clk		*pcie_aclk;
+	struct clk		*pcie_aux_clk;
+	int			gpio_id_reset;
+};
+
+/* Registers in PCIeCTRL */
+static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,
+		u32 val, u32 reg)
+{
+	writel(val, kirin_pcie->apb_base + reg);
+}
+
+static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32 reg)
+{
+	return readl(kirin_pcie->apb_base + reg);
+}
+
+/* Registers in PCIePHY */
+static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,
+		u32 val, u32 reg)
+{
+	writel(val, kirin_pcie->phy_base + reg);
+}
+
+static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32 reg)
+{
+	return readl(kirin_pcie->phy_base + reg);
+}
+
+static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
+		struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+
+	kirin_pcie->phy_ref_clk = devm_clk_get(dev, "pcie_phy_ref");
+	if (IS_ERR(kirin_pcie->phy_ref_clk))
+		return PTR_ERR(kirin_pcie->phy_ref_clk);
+
+	kirin_pcie->pcie_aux_clk = devm_clk_get(dev, "pcie_aux");
+	if (IS_ERR(kirin_pcie->pcie_aux_clk))
+		return PTR_ERR(kirin_pcie->pcie_aux_clk);
+
+	kirin_pcie->apb_phy_clk = devm_clk_get(dev, "pcie_apb_phy");
+	if (IS_ERR(kirin_pcie->apb_phy_clk))
+		return PTR_ERR(kirin_pcie->apb_phy_clk);
+
+	kirin_pcie->apb_sys_clk = devm_clk_get(dev, "pcie_apb_sys");
+	if (IS_ERR(kirin_pcie->apb_sys_clk))
+		return PTR_ERR(kirin_pcie->apb_sys_clk);
+
+	kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
+	if (IS_ERR(kirin_pcie->pcie_aclk))
+		return PTR_ERR(kirin_pcie->pcie_aclk);
+
+	return 0;
+}
+
+static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
+		struct platform_device *pdev)
+{
+	struct resource *apb;
+	struct resource *phy;
+	struct resource *dbi;
+	struct device *dev = &pdev->dev;
+
+	apb = platform_get_resource_byname(pdev, IORESOURCE_MEM, "apb");
+	kirin_pcie->apb_base = devm_ioremap_resource(dev, apb);
+	if (IS_ERR(kirin_pcie->apb_base))
+		return PTR_ERR(kirin_pcie->apb_base);
+
+	phy = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy");
+	kirin_pcie->phy_base = devm_ioremap_resource(dev, phy);
+	if (IS_ERR(kirin_pcie->phy_base))
+		return PTR_ERR(kirin_pcie->phy_base);
+
+	dbi = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
+	kirin_pcie->pci->dbi_base = devm_ioremap_resource(dev, dbi);
+	if (IS_ERR(kirin_pcie->pci->dbi_base))
+		return PTR_ERR(kirin_pcie->pci->dbi_base);
+
+	kirin_pcie->crgctrl =
+		syscon_regmap_lookup_by_compatible("hisilicon,hi3660-crgctrl");
+	if (IS_ERR(kirin_pcie->crgctrl))
+		return PTR_ERR(kirin_pcie->crgctrl);
+
+	kirin_pcie->sysctrl =
+		syscon_regmap_lookup_by_compatible("hisilicon,hi3660-sctrl");
+	if (IS_ERR(kirin_pcie->sysctrl))
+		return PTR_ERR(kirin_pcie->sysctrl);
+
+	return 0;
+}
+
+static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
+{
+	u32 reg_val;
+	u32 time = PIPE_CLK_MAX_TRY_TIMES;
+
+	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
+	reg_val &= ~PHY_REF_PAD_BIT;
+	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL1);
+
+	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL0);
+	reg_val &= ~PHY_PWR_DOWN_BIT;
+	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL0);
+	udelay(10);
+
+	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
+	reg_val &= ~PHY_RST_ACK_BIT;
+	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL1);
+
+	usleep_range(PIPE_CLK_WAIT_MIN, PIPE_CLK_WAIT_MAX);
+	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_STATUS0);
+	if (reg_val & PIPE_CLK_STABLE) {
+		dev_err(kirin_pcie->pci->dev, "PIPE clk is not stable\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static void kirin_pcie_oe_enable(struct kirin_pcie *kirin_pcie)
+{
+	u32 val;
+
+	regmap_read(kirin_pcie->sysctrl, SCTRL_PCIE_OE_OFFSET, &val);
+	val |= PCIE_DEBOUNCE_PARAM;
+	val &= ~PCIE_OE_BYPASS;
+	regmap_write(kirin_pcie->sysctrl, SCTRL_PCIE_OE_OFFSET, val);
+}
+
+static int kirin_pcie_clk_ctrl(struct kirin_pcie *kirin_pcie, bool enable)
+{
+	int ret = 0;
+
+	if (!enable)
+		goto close_clk;
+
+	ret = clk_set_rate(kirin_pcie->phy_ref_clk, REF_CLK_FREQ);
+	if (ret)
+		return ret;
+
+	ret = clk_prepare_enable(kirin_pcie->phy_ref_clk);
+	if (ret)
+		return ret;
+
+	ret = clk_prepare_enable(kirin_pcie->apb_sys_clk);
+	if (ret)
+		goto apb_sys_fail;
+
+	ret = clk_prepare_enable(kirin_pcie->apb_phy_clk);
+	if (ret)
+		goto apb_phy_fail;
+
+	ret = clk_prepare_enable(kirin_pcie->pcie_aclk);
+	if (ret)
+		goto aclk_fail;
+
+	ret = clk_prepare_enable(kirin_pcie->pcie_aux_clk);
+	if (ret)
+		goto aux_clk_fail;
+
+	return 0;
+
+close_clk:
+	clk_disable_unprepare(kirin_pcie->pcie_aux_clk);
+aux_clk_fail:
+	clk_disable_unprepare(kirin_pcie->pcie_aclk);
+aclk_fail:
+	clk_disable_unprepare(kirin_pcie->apb_phy_clk);
+apb_phy_fail:
+	clk_disable_unprepare(kirin_pcie->apb_sys_clk);
+apb_sys_fail:
+	clk_disable_unprepare(kirin_pcie->phy_ref_clk);
+
+	return ret;
+}
+
+static int kirin_pcie_power_on(struct kirin_pcie *kirin_pcie)
+{
+	int ret;
+
+	/* Power supply for Host */
+	regmap_write(kirin_pcie->sysctrl,
+		SCTRL_PCIE_CMOS_OFFSET, SCTRL_PCIE_CMOS_BIT);
+	udelay(100);
+	kirin_pcie_oe_enable(kirin_pcie);
+
+	ret = kirin_pcie_clk_ctrl(kirin_pcie, true);
+	if (ret)
+		return ret;
+
+	/* ISO disable, PCIeCtrl, PHY assert and clk gate clear */
+	regmap_write(kirin_pcie->sysctrl,
+		SCTRL_PCIE_ISO_OFFSET, SCTRL_PCIE_ISO_BIT);
+	regmap_write(kirin_pcie->crgctrl,
+		CRGCTRL_PCIE_ASSERT_OFFSET, CRGCTRL_PCIE_ASSERT_BIT);
+	regmap_write(kirin_pcie->sysctrl,
+		SCTRL_PCIE_HPCLK_OFFSET, SCTRL_PCIE_HPCLK_BIT);
+
+	ret = kirin_pcie_phy_init(kirin_pcie);
+	if (ret)
+		goto close_clk;
+
+	/* perst assert Endpoint */
+	if (!gpio_request(kirin_pcie->gpio_id_reset, "pcie_perst")) {
+		usleep_range(REF_2_PERST_MIN, REF_2_PERST_MAX);
+		ret = gpio_direction_output(kirin_pcie->gpio_id_reset, 1);
+		if (ret)
+			goto close_clk;
+		usleep_range(PERST_2_ACCESS_MIN, PERST_2_ACCESS_MAX);
+
+		return 0;
+	}
+
+close_clk:
+	kirin_pcie_clk_ctrl(kirin_pcie, false);
+	return ret;
+}
+
+static void kirin_pcie_sideband_dbi_w_mode(struct kirin_pcie *kirin_pcie,
+		bool on)
+{
+	u32 val;
+
+	val = kirin_apb_ctrl_readl(kirin_pcie, SOC_PCIECTRL_CTRL0_ADDR);
+	if (on)
+		val = val | PCIE_ELBI_SLV_DBI_ENABLE;
+	else
+		val = val & ~PCIE_ELBI_SLV_DBI_ENABLE;
+
+	kirin_apb_ctrl_writel(kirin_pcie, val, SOC_PCIECTRL_CTRL0_ADDR);
+}
+
+static void kirin_pcie_sideband_dbi_r_mode(struct kirin_pcie *kirin_pcie,
+		bool on)
+{
+	u32 val;
+
+	val = kirin_apb_ctrl_readl(kirin_pcie, SOC_PCIECTRL_CTRL1_ADDR);
+	if (on)
+		val = val | PCIE_ELBI_SLV_DBI_ENABLE;
+	else
+		val = val & ~PCIE_ELBI_SLV_DBI_ENABLE;
+
+	kirin_apb_ctrl_writel(kirin_pcie, val, SOC_PCIECTRL_CTRL1_ADDR);
+}
+
+static int kirin_pcie_rd_own_conf(struct pcie_port *pp,
+		int where, int size, u32 *val)
+{
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+	int ret;
+
+	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, true);
+	ret = dw_pcie_read(pci->dbi_base + where, size, val);
+	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, false);
+
+	return ret;
+}
+
+static int kirin_pcie_wr_own_conf(struct pcie_port *pp,
+		int where, int size, u32 val)
+{
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+	int ret;
+
+	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, true);
+	ret = dw_pcie_write(pci->dbi_base + where, size, val);
+	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, false);
+
+	return ret;
+}
+
+static u32 kirin_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base,
+		u32 reg, size_t size)
+{
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+	u32 ret;
+
+	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, true);
+	dw_pcie_read(base + reg, size, &ret);
+	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, false);
+
+	return ret;
+}
+
+static void kirin_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base,
+		u32 reg, size_t size, u32 val)
+{
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+
+	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, true);
+	dw_pcie_write(base + reg, size, val);
+	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, false);
+}
+
+static int kirin_pcie_link_up(struct dw_pcie *pci)
+{
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+	u32 val = kirin_apb_ctrl_readl(kirin_pcie, PCIE_APB_PHY_STATUS0);
+
+	if ((val & PCIE_LINKUP_ENABLE) == PCIE_LINKUP_ENABLE)
+		return 1;
+
+	return 0;
+}
+
+static int kirin_pcie_establish_link(struct pcie_port *pp)
+{
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
+	int count = 0;
+
+	if (kirin_pcie_link_up(pci))
+		return 0;
+
+	dw_pcie_setup_rc(pp);
+
+	/* assert LTSSM enable */
+	kirin_apb_ctrl_writel(kirin_pcie, PCIE_LTSSM_ENABLE_BIT,
+		PCIE_APP_LTSSM_ENABLE);
+
+	/* check if the link is up or not */
+	while (!kirin_pcie_link_up(pci)) {
+		usleep_range(LINK_WAIT_MIN, LINK_WAIT_MAX);
+		count++;
+		if (count == 1000) {
+			dev_err(pci->dev, "Link Fail\n");
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
+static void kirin_pcie_host_init(struct pcie_port *pp)
+{
+	kirin_pcie_establish_link(pp);
+}
+
+static struct dw_pcie_ops kirin_dw_pcie_ops = {
+	.read_dbi = kirin_pcie_read_dbi,
+	.write_dbi = kirin_pcie_write_dbi,
+	.link_up = kirin_pcie_link_up,
+};
+
+static struct dw_pcie_host_ops kirin_pcie_host_ops = {
+	.rd_own_conf = kirin_pcie_rd_own_conf,
+	.wr_own_conf = kirin_pcie_wr_own_conf,
+	.host_init = kirin_pcie_host_init,
+};
+
+static int __init kirin_add_pcie_port(struct dw_pcie *pci,
+			struct platform_device *pdev)
+{
+	pci->pp.ops = &kirin_pcie_host_ops;
+
+	return dw_pcie_host_init(&pci->pp);
+}
+
+static int kirin_pcie_probe(struct platform_device *pdev)
+{
+	struct kirin_pcie *kirin_pcie;
+	struct dw_pcie *pci;
+	struct device *dev = &pdev->dev;
+	int ret;
+
+	if (!dev->of_node) {
+		dev_err(&pdev->dev, "NULL node\n");
+		return -EINVAL;
+	}
+
+	kirin_pcie = devm_kzalloc(dev, sizeof(struct kirin_pcie), GFP_KERNEL);
+	if (!kirin_pcie)
+		return -ENOMEM;
+
+	pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
+	if (!pci)
+		return -ENOMEM;
+
+	pci->dev = dev;
+	pci->ops = &kirin_dw_pcie_ops;
+	kirin_pcie->pci = pci;
+
+	ret = kirin_pcie_get_clk(kirin_pcie, pdev);
+	if (ret)
+		return ret;
+
+	ret = kirin_pcie_get_resource(kirin_pcie, pdev);
+	if (ret)
+		return ret;
+
+	kirin_pcie->gpio_id_reset = of_get_named_gpio(dev->of_node,
+			"reset-gpio", 0);
+	if (kirin_pcie->gpio_id_reset < 0)
+		return -ENODEV;
+
+	ret = kirin_pcie_power_on(kirin_pcie);
+	if (ret)
+		return ret;
+
+	platform_set_drvdata(pdev, kirin_pcie);
+
+	return kirin_add_pcie_port(pci, pdev);
+}
+
+static const struct of_device_id kirin_pcie_match[] = {
+	{ .compatible = "hisilicon,kirin960-pcie" },
+	{},
+};
+
+struct platform_driver kirin_pcie_driver = {
+	.probe			= kirin_pcie_probe,
+	.driver			= {
+		.name			= "kirin-pcie",
+		.of_match_table = kirin_pcie_match,
+		.suppress_bind_attrs = true,
+	},
+};
+
+builtin_platform_driver(kirin_pcie_driver);
-- 
2.11.GIT

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v9 4/4] ARM64: defconfig: Enable  Kirin PCIe
  2017-05-31  7:01 ` Xiaowei Song
@ 2017-05-31  7:01   ` Xiaowei Song
  -1 siblings, 0 replies; 32+ messages in thread
From: Xiaowei Song @ 2017-05-31  7:01 UTC (permalink / raw)
  To: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon
  Cc: chenyao11, puck.chen, songxiaowei, guodong.xu, wangbinghui,
	suzhuangluan, linux-pci, devicetree, linux-kernel

Cc: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 7c48028ec64a..d56d8f1062ab 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -71,6 +71,7 @@ CONFIG_PCI_XGENE=y
 CONFIG_PCI_LAYERSCAPE=y
 CONFIG_PCI_HISI=y
 CONFIG_PCIE_QCOM=y
+CONFIG_PCIE_KIRIN=y
 CONFIG_PCIE_ARMADA_8K=y
 CONFIG_ARM64_VA_BITS_48=y
 CONFIG_SCHED_MC=y
-- 
2.11.GIT

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v9 4/4] ARM64: defconfig: Enable  Kirin PCIe
@ 2017-05-31  7:01   ` Xiaowei Song
  0 siblings, 0 replies; 32+ messages in thread
From: Xiaowei Song @ 2017-05-31  7:01 UTC (permalink / raw)
  To: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon
  Cc: chenyao11, puck.chen, songxiaowei, guodong.xu, wangbinghui,
	suzhuangluan, linux-pci, devicetree, linux-kernel

Cc: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 7c48028ec64a..d56d8f1062ab 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -71,6 +71,7 @@ CONFIG_PCI_XGENE=y
 CONFIG_PCI_LAYERSCAPE=y
 CONFIG_PCI_HISI=y
 CONFIG_PCIE_QCOM=y
+CONFIG_PCIE_KIRIN=y
 CONFIG_PCIE_ARMADA_8K=y
 CONFIG_ARM64_VA_BITS_48=y
 CONFIG_SCHED_MC=y
-- 
2.11.GIT

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 3/4] PCI: dwc: kirin: add PCIe Driver for HiSilicon Kirin SoC
  2017-05-31  7:01   ` Xiaowei Song
@ 2017-05-31 17:00     ` Jingoo Han
  -1 siblings, 0 replies; 32+ messages in thread
From: Jingoo Han @ 2017-05-31 17:00 UTC (permalink / raw)
  To: 'Xiaowei Song', bhelgaas
  Cc: kishon, arnd, tn, keith.busch, niklas.cassel, dhdang,
	liudongdong3, gabriele.paoloni, robh+dt, mark.rutland,
	catalin.marinas, will.deacon, chenyao11, puck.chen, guodong.xu,
	wangbinghui, suzhuangluan, linux-pci, devicetree, linux-kernel

On Wednesday, May 31, 2017 3:01 AM, Xiaowei Song wrote:
> 
> Hisilicon PCIe Driver shares the common functions for PCIe dw-host
> 
> The poweron functions is developed on hi3660 SoC,
> while Others Functions are common for Kirin series SoCs.
> 
> Low power mode (L1 sub-state and Suspend/Resume), hotplug
> and MSI feature are not supported currently.
> 
> Cc: Guodong Xu <guodong.xu@linaro.org>
> Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>

Reviewed-by: Jingoo Han <jingoohan1@gmail.com>

Best regards,
Jingoo Han

> ---
>  drivers/pci/dwc/Kconfig      |  10 +
>  drivers/pci/dwc/Makefile     |   1 +
>  drivers/pci/dwc/pcie-kirin.c | 514
> +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 525 insertions(+)
>  create mode 100644 drivers/pci/dwc/pcie-kirin.c
> 
> diff --git a/drivers/pci/dwc/Kconfig b/drivers/pci/dwc/Kconfig
> index d2d2ba5b8a68..afecfb2b6ff4 100644
> --- a/drivers/pci/dwc/Kconfig
> +++ b/drivers/pci/dwc/Kconfig
> @@ -130,4 +130,14 @@ config PCIE_ARTPEC6
>  	  Say Y here to enable PCIe controller support on Axis ARTPEC-6
>  	  SoCs.  This PCIe controller uses the DesignWare core.
> 
> +config PCIE_KIRIN
> +	depends on OF && ARM64
> +	bool "HiSilicon Kirin series SoCs PCIe controllers"
> +	depends on PCI
> +	select PCIEPORTBUS
> +	select PCIE_DW_HOST
> +	help
> +	  Say Y here if you want PCIe controller support
> +	  on HiSilicon Kirin series SoCs.
> +
>  endmenu
> diff --git a/drivers/pci/dwc/Makefile b/drivers/pci/dwc/Makefile
> index a2df13c28798..4bd69bacd4ab 100644
> --- a/drivers/pci/dwc/Makefile
> +++ b/drivers/pci/dwc/Makefile
> @@ -10,6 +10,7 @@ obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o
>  obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o
>  obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
>  obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o
> +obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o
> 
>  # The following drivers are for devices that use the generic ACPI
>  # pci_root.c driver but don't support standard ECAM config access.
> diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
> new file mode 100644
> index 000000000000..f63e6548efae
> --- /dev/null
> +++ b/drivers/pci/dwc/pcie-kirin.c
> @@ -0,0 +1,514 @@
> +/*
> + * PCIe host controller driver for Kirin Phone SoCs
> + *
> + * Copyright (C) 2017 Hilisicon Electronics Co., Ltd.
> + *		http://www.huawei.com
> + *
> + * Author: Xiaowei Song <songxiaowei@huawei.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <asm/compiler.h>
> +#include <linux/compiler.h>
> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/gpio.h>
> +#include <linux/interrupt.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/of_address.h>
> +#include <linux/of_gpio.h>
> +#include <linux/of_pci.h>
> +#include <linux/pci.h>
> +#include <linux/pci_regs.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/resource.h>
> +#include <linux/types.h>
> +#include "pcie-designware.h"
> +
> +#define to_kirin_pcie(x) dev_get_drvdata((x)->dev)
> +
> +#define REF_CLK_FREQ			100000000
> +
> +/* PCIe ELBI registers */
> +#define SOC_PCIECTRL_CTRL0_ADDR	0x000
> +#define SOC_PCIECTRL_CTRL1_ADDR	0x004
> +#define SOC_PCIEPHY_CTRL2_ADDR		0x008
> +#define SOC_PCIEPHY_CTRL3_ADDR		0x00c
> +#define PCIE_ELBI_SLV_DBI_ENABLE	(0x1 << 21)
> +
> +/* info located in APB */
> +#define PCIE_APP_LTSSM_ENABLE		0x01c
> +#define PCIE_APB_PHY_CTRL0		0x0
> +#define PCIE_APB_PHY_CTRL1		0x4
> +#define PCIE_APB_PHY_STATUS0		0x400
> +#define PCIE_LINKUP_ENABLE		(0x8020)
> +#define PCIE_LTSSM_ENABLE_BIT		(0x1 << 11)
> +#define PIPE_CLK_STABLE		(0x1 << 19)
> +#define PIPE_CLK_MAX_TRY_TIMES		10
> +#define PHY_REF_PAD_BIT		(0x1 << 8)
> +#define PHY_PWR_DOWN_BIT		(0x1 << 22)
> +#define PHY_RST_ACK_BIT		(0x1 << 16)
> +
> +/* info located in sysctrl */
> +#define SCTRL_PCIE_CMOS_OFFSET		0x60
> +#define SCTRL_PCIE_CMOS_BIT		0x10
> +#define SCTRL_PCIE_ISO_OFFSET		0x44
> +#define SCTRL_PCIE_ISO_BIT		0x30
> +#define SCTRL_PCIE_HPCLK_OFFSET	0x190
> +#define SCTRL_PCIE_HPCLK_BIT		0x184000
> +#define SCTRL_PCIE_OE_OFFSET		0x14a
> +#define PCIE_DEBOUNCE_PARAM		0xF0F400
> +#define PCIE_OE_BYPASS			(0x3 << 28)
> +
> +/* peri_crg ctrl */
> +#define CRGCTRL_PCIE_ASSERT_OFFSET	0x88
> +#define CRGCTRL_PCIE_ASSERT_BIT	0x8c000000
> +
> +/* Time for delay */
> +#define REF_2_PERST_MIN		20000
> +#define REF_2_PERST_MAX		25000
> +#define PERST_2_ACCESS_MIN		10000
> +#define PERST_2_ACCESS_MAX		12000
> +#define LINK_WAIT_MIN			900
> +#define LINK_WAIT_MAX			1000
> +#define PIPE_CLK_WAIT_MIN		550
> +#define PIPE_CLK_WAIT_MAX		600
> +
> +struct kirin_pcie {
> +	struct dw_pcie		*pci;
> +	void __iomem		*apb_base;
> +	void __iomem		*phy_base;
> +	struct regmap		*crgctrl;
> +	struct regmap 		*sysctrl;
> +	struct clk		*apb_sys_clk;
> +	struct clk		*apb_phy_clk;
> +	struct clk		*phy_ref_clk;
> +	struct clk		*pcie_aclk;
> +	struct clk		*pcie_aux_clk;
> +	int			gpio_id_reset;
> +};
> +
> +/* Registers in PCIeCTRL */
> +static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,
> +		u32 val, u32 reg)
> +{
> +	writel(val, kirin_pcie->apb_base + reg);
> +}
> +
> +static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32
> reg)
> +{
> +	return readl(kirin_pcie->apb_base + reg);
> +}
> +
> +/* Registers in PCIePHY */
> +static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,
> +		u32 val, u32 reg)
> +{
> +	writel(val, kirin_pcie->phy_base + reg);
> +}
> +
> +static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32
> reg)
> +{
> +	return readl(kirin_pcie->phy_base + reg);
> +}
> +
> +static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
> +		struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +
> +	kirin_pcie->phy_ref_clk = devm_clk_get(dev, "pcie_phy_ref");
> +	if (IS_ERR(kirin_pcie->phy_ref_clk))
> +		return PTR_ERR(kirin_pcie->phy_ref_clk);
> +
> +	kirin_pcie->pcie_aux_clk = devm_clk_get(dev, "pcie_aux");
> +	if (IS_ERR(kirin_pcie->pcie_aux_clk))
> +		return PTR_ERR(kirin_pcie->pcie_aux_clk);
> +
> +	kirin_pcie->apb_phy_clk = devm_clk_get(dev, "pcie_apb_phy");
> +	if (IS_ERR(kirin_pcie->apb_phy_clk))
> +		return PTR_ERR(kirin_pcie->apb_phy_clk);
> +
> +	kirin_pcie->apb_sys_clk = devm_clk_get(dev, "pcie_apb_sys");
> +	if (IS_ERR(kirin_pcie->apb_sys_clk))
> +		return PTR_ERR(kirin_pcie->apb_sys_clk);
> +
> +	kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
> +	if (IS_ERR(kirin_pcie->pcie_aclk))
> +		return PTR_ERR(kirin_pcie->pcie_aclk);
> +
> +	return 0;
> +}
> +
> +static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
> +		struct platform_device *pdev)
> +{
> +	struct resource *apb;
> +	struct resource *phy;
> +	struct resource *dbi;
> +	struct device *dev = &pdev->dev;
> +
> +	apb = platform_get_resource_byname(pdev, IORESOURCE_MEM, "apb");
> +	kirin_pcie->apb_base = devm_ioremap_resource(dev, apb);
> +	if (IS_ERR(kirin_pcie->apb_base))
> +		return PTR_ERR(kirin_pcie->apb_base);
> +
> +	phy = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy");
> +	kirin_pcie->phy_base = devm_ioremap_resource(dev, phy);
> +	if (IS_ERR(kirin_pcie->phy_base))
> +		return PTR_ERR(kirin_pcie->phy_base);
> +
> +	dbi = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
> +	kirin_pcie->pci->dbi_base = devm_ioremap_resource(dev, dbi);
> +	if (IS_ERR(kirin_pcie->pci->dbi_base))
> +		return PTR_ERR(kirin_pcie->pci->dbi_base);
> +
> +	kirin_pcie->crgctrl =
> +		syscon_regmap_lookup_by_compatible("hisilicon,hi3660-
> crgctrl");
> +	if (IS_ERR(kirin_pcie->crgctrl))
> +		return PTR_ERR(kirin_pcie->crgctrl);
> +
> +	kirin_pcie->sysctrl =
> +
syscon_regmap_lookup_by_compatible("hisilicon,hi3660-sctrl");
> +	if (IS_ERR(kirin_pcie->sysctrl))
> +		return PTR_ERR(kirin_pcie->sysctrl);
> +
> +	return 0;
> +}
> +
> +static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
> +{
> +	u32 reg_val;
> +	u32 time = PIPE_CLK_MAX_TRY_TIMES;
> +
> +	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
> +	reg_val &= ~PHY_REF_PAD_BIT;
> +	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL1);
> +
> +	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL0);
> +	reg_val &= ~PHY_PWR_DOWN_BIT;
> +	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL0);
> +	udelay(10);
> +
> +	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
> +	reg_val &= ~PHY_RST_ACK_BIT;
> +	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL1);
> +
> +	usleep_range(PIPE_CLK_WAIT_MIN, PIPE_CLK_WAIT_MAX);
> +	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_STATUS0);
> +	if (reg_val & PIPE_CLK_STABLE) {
> +		dev_err(kirin_pcie->pci->dev, "PIPE clk is not stable\n");
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
> +static void kirin_pcie_oe_enable(struct kirin_pcie *kirin_pcie)
> +{
> +	u32 val;
> +
> +	regmap_read(kirin_pcie->sysctrl, SCTRL_PCIE_OE_OFFSET, &val);
> +	val |= PCIE_DEBOUNCE_PARAM;
> +	val &= ~PCIE_OE_BYPASS;
> +	regmap_write(kirin_pcie->sysctrl, SCTRL_PCIE_OE_OFFSET, val);
> +}
> +
> +static int kirin_pcie_clk_ctrl(struct kirin_pcie *kirin_pcie, bool
enable)
> +{
> +	int ret = 0;
> +
> +	if (!enable)
> +		goto close_clk;
> +
> +	ret = clk_set_rate(kirin_pcie->phy_ref_clk, REF_CLK_FREQ);
> +	if (ret)
> +		return ret;
> +
> +	ret = clk_prepare_enable(kirin_pcie->phy_ref_clk);
> +	if (ret)
> +		return ret;
> +
> +	ret = clk_prepare_enable(kirin_pcie->apb_sys_clk);
> +	if (ret)
> +		goto apb_sys_fail;
> +
> +	ret = clk_prepare_enable(kirin_pcie->apb_phy_clk);
> +	if (ret)
> +		goto apb_phy_fail;
> +
> +	ret = clk_prepare_enable(kirin_pcie->pcie_aclk);
> +	if (ret)
> +		goto aclk_fail;
> +
> +	ret = clk_prepare_enable(kirin_pcie->pcie_aux_clk);
> +	if (ret)
> +		goto aux_clk_fail;
> +
> +	return 0;
> +
> +close_clk:
> +	clk_disable_unprepare(kirin_pcie->pcie_aux_clk);
> +aux_clk_fail:
> +	clk_disable_unprepare(kirin_pcie->pcie_aclk);
> +aclk_fail:
> +	clk_disable_unprepare(kirin_pcie->apb_phy_clk);
> +apb_phy_fail:
> +	clk_disable_unprepare(kirin_pcie->apb_sys_clk);
> +apb_sys_fail:
> +	clk_disable_unprepare(kirin_pcie->phy_ref_clk);
> +
> +	return ret;
> +}
> +
> +static int kirin_pcie_power_on(struct kirin_pcie *kirin_pcie)
> +{
> +	int ret;
> +
> +	/* Power supply for Host */
> +	regmap_write(kirin_pcie->sysctrl,
> +		SCTRL_PCIE_CMOS_OFFSET, SCTRL_PCIE_CMOS_BIT);
> +	udelay(100);
> +	kirin_pcie_oe_enable(kirin_pcie);
> +
> +	ret = kirin_pcie_clk_ctrl(kirin_pcie, true);
> +	if (ret)
> +		return ret;
> +
> +	/* ISO disable, PCIeCtrl, PHY assert and clk gate clear */
> +	regmap_write(kirin_pcie->sysctrl,
> +		SCTRL_PCIE_ISO_OFFSET, SCTRL_PCIE_ISO_BIT);
> +	regmap_write(kirin_pcie->crgctrl,
> +		CRGCTRL_PCIE_ASSERT_OFFSET, CRGCTRL_PCIE_ASSERT_BIT);
> +	regmap_write(kirin_pcie->sysctrl,
> +		SCTRL_PCIE_HPCLK_OFFSET, SCTRL_PCIE_HPCLK_BIT);
> +
> +	ret = kirin_pcie_phy_init(kirin_pcie);
> +	if (ret)
> +		goto close_clk;
> +
> +	/* perst assert Endpoint */
> +	if (!gpio_request(kirin_pcie->gpio_id_reset, "pcie_perst")) {
> +		usleep_range(REF_2_PERST_MIN, REF_2_PERST_MAX);
> +		ret = gpio_direction_output(kirin_pcie->gpio_id_reset, 1);
> +		if (ret)
> +			goto close_clk;
> +		usleep_range(PERST_2_ACCESS_MIN, PERST_2_ACCESS_MAX);
> +
> +		return 0;
> +	}
> +
> +close_clk:
> +	kirin_pcie_clk_ctrl(kirin_pcie, false);
> +	return ret;
> +}
> +
> +static void kirin_pcie_sideband_dbi_w_mode(struct kirin_pcie *kirin_pcie,
> +		bool on)
> +{
> +	u32 val;
> +
> +	val = kirin_apb_ctrl_readl(kirin_pcie, SOC_PCIECTRL_CTRL0_ADDR);
> +	if (on)
> +		val = val | PCIE_ELBI_SLV_DBI_ENABLE;
> +	else
> +		val = val & ~PCIE_ELBI_SLV_DBI_ENABLE;
> +
> +	kirin_apb_ctrl_writel(kirin_pcie, val, SOC_PCIECTRL_CTRL0_ADDR);
> +}
> +
> +static void kirin_pcie_sideband_dbi_r_mode(struct kirin_pcie *kirin_pcie,
> +		bool on)
> +{
> +	u32 val;
> +
> +	val = kirin_apb_ctrl_readl(kirin_pcie, SOC_PCIECTRL_CTRL1_ADDR);
> +	if (on)
> +		val = val | PCIE_ELBI_SLV_DBI_ENABLE;
> +	else
> +		val = val & ~PCIE_ELBI_SLV_DBI_ENABLE;
> +
> +	kirin_apb_ctrl_writel(kirin_pcie, val, SOC_PCIECTRL_CTRL1_ADDR);
> +}
> +
> +static int kirin_pcie_rd_own_conf(struct pcie_port *pp,
> +		int where, int size, u32 *val)
> +{
> +	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +	int ret;
> +
> +	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, true);
> +	ret = dw_pcie_read(pci->dbi_base + where, size, val);
> +	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, false);
> +
> +	return ret;
> +}
> +
> +static int kirin_pcie_wr_own_conf(struct pcie_port *pp,
> +		int where, int size, u32 val)
> +{
> +	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +	int ret;
> +
> +	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, true);
> +	ret = dw_pcie_write(pci->dbi_base + where, size, val);
> +	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, false);
> +
> +	return ret;
> +}
> +
> +static u32 kirin_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base,
> +		u32 reg, size_t size)
> +{
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +	u32 ret;
> +
> +	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, true);
> +	dw_pcie_read(base + reg, size, &ret);
> +	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, false);
> +
> +	return ret;
> +}
> +
> +static void kirin_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base,
> +		u32 reg, size_t size, u32 val)
> +{
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +
> +	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, true);
> +	dw_pcie_write(base + reg, size, val);
> +	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, false);
> +}
> +
> +static int kirin_pcie_link_up(struct dw_pcie *pci)
> +{
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +	u32 val = kirin_apb_ctrl_readl(kirin_pcie, PCIE_APB_PHY_STATUS0);
> +
> +	if ((val & PCIE_LINKUP_ENABLE) == PCIE_LINKUP_ENABLE)
> +		return 1;
> +
> +	return 0;
> +}
> +
> +static int kirin_pcie_establish_link(struct pcie_port *pp)
> +{
> +	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +	int count = 0;
> +
> +	if (kirin_pcie_link_up(pci))
> +		return 0;
> +
> +	dw_pcie_setup_rc(pp);
> +
> +	/* assert LTSSM enable */
> +	kirin_apb_ctrl_writel(kirin_pcie, PCIE_LTSSM_ENABLE_BIT,
> +		PCIE_APP_LTSSM_ENABLE);
> +
> +	/* check if the link is up or not */
> +	while (!kirin_pcie_link_up(pci)) {
> +		usleep_range(LINK_WAIT_MIN, LINK_WAIT_MAX);
> +		count++;
> +		if (count == 1000) {
> +			dev_err(pci->dev, "Link Fail\n");
> +			return -EINVAL;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static void kirin_pcie_host_init(struct pcie_port *pp)
> +{
> +	kirin_pcie_establish_link(pp);
> +}
> +
> +static struct dw_pcie_ops kirin_dw_pcie_ops = {
> +	.read_dbi = kirin_pcie_read_dbi,
> +	.write_dbi = kirin_pcie_write_dbi,
> +	.link_up = kirin_pcie_link_up,
> +};
> +
> +static struct dw_pcie_host_ops kirin_pcie_host_ops = {
> +	.rd_own_conf = kirin_pcie_rd_own_conf,
> +	.wr_own_conf = kirin_pcie_wr_own_conf,
> +	.host_init = kirin_pcie_host_init,
> +};
> +
> +static int __init kirin_add_pcie_port(struct dw_pcie *pci,
> +			struct platform_device *pdev)
> +{
> +	pci->pp.ops = &kirin_pcie_host_ops;
> +
> +	return dw_pcie_host_init(&pci->pp);
> +}
> +
> +static int kirin_pcie_probe(struct platform_device *pdev)
> +{
> +	struct kirin_pcie *kirin_pcie;
> +	struct dw_pcie *pci;
> +	struct device *dev = &pdev->dev;
> +	int ret;
> +
> +	if (!dev->of_node) {
> +		dev_err(&pdev->dev, "NULL node\n");
> +		return -EINVAL;
> +	}
> +
> +	kirin_pcie = devm_kzalloc(dev, sizeof(struct kirin_pcie),
> GFP_KERNEL);
> +	if (!kirin_pcie)
> +		return -ENOMEM;
> +
> +	pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
> +	if (!pci)
> +		return -ENOMEM;
> +
> +	pci->dev = dev;
> +	pci->ops = &kirin_dw_pcie_ops;
> +	kirin_pcie->pci = pci;
> +
> +	ret = kirin_pcie_get_clk(kirin_pcie, pdev);
> +	if (ret)
> +		return ret;
> +
> +	ret = kirin_pcie_get_resource(kirin_pcie, pdev);
> +	if (ret)
> +		return ret;
> +
> +	kirin_pcie->gpio_id_reset = of_get_named_gpio(dev->of_node,
> +			"reset-gpio", 0);
> +	if (kirin_pcie->gpio_id_reset < 0)
> +		return -ENODEV;
> +
> +	ret = kirin_pcie_power_on(kirin_pcie);
> +	if (ret)
> +		return ret;
> +
> +	platform_set_drvdata(pdev, kirin_pcie);
> +
> +	return kirin_add_pcie_port(pci, pdev);
> +}
> +
> +static const struct of_device_id kirin_pcie_match[] = {
> +	{ .compatible = "hisilicon,kirin960-pcie" },
> +	{},
> +};
> +
> +struct platform_driver kirin_pcie_driver = {
> +	.probe			= kirin_pcie_probe,
> +	.driver			= {
> +		.name			= "kirin-pcie",
> +		.of_match_table = kirin_pcie_match,
> +		.suppress_bind_attrs = true,
> +	},
> +};
> +
> +builtin_platform_driver(kirin_pcie_driver);
> --
> 2.11.GIT

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 3/4] PCI: dwc: kirin: add PCIe Driver for HiSilicon Kirin SoC
@ 2017-05-31 17:00     ` Jingoo Han
  0 siblings, 0 replies; 32+ messages in thread
From: Jingoo Han @ 2017-05-31 17:00 UTC (permalink / raw)
  To: 'Xiaowei Song', bhelgaas
  Cc: kishon, arnd, tn, keith.busch, niklas.cassel, dhdang,
	liudongdong3, gabriele.paoloni, robh+dt, mark.rutland,
	catalin.marinas, will.deacon, chenyao11, puck.chen, guodong.xu,
	wangbinghui, suzhuangluan, linux-pci, devicetree, linux-kernel

On Wednesday, May 31, 2017 3:01 AM, Xiaowei Song wrote:
> 
> Hisilicon PCIe Driver shares the common functions for PCIe dw-host
> 
> The poweron functions is developed on hi3660 SoC,
> while Others Functions are common for Kirin series SoCs.
> 
> Low power mode (L1 sub-state and Suspend/Resume), hotplug
> and MSI feature are not supported currently.
> 
> Cc: Guodong Xu <guodong.xu@linaro.org>
> Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>

Reviewed-by: Jingoo Han <jingoohan1@gmail.com>

Best regards,
Jingoo Han

> ---
>  drivers/pci/dwc/Kconfig      |  10 +
>  drivers/pci/dwc/Makefile     |   1 +
>  drivers/pci/dwc/pcie-kirin.c | 514
> +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 525 insertions(+)
>  create mode 100644 drivers/pci/dwc/pcie-kirin.c
> 
> diff --git a/drivers/pci/dwc/Kconfig b/drivers/pci/dwc/Kconfig
> index d2d2ba5b8a68..afecfb2b6ff4 100644
> --- a/drivers/pci/dwc/Kconfig
> +++ b/drivers/pci/dwc/Kconfig
> @@ -130,4 +130,14 @@ config PCIE_ARTPEC6
>  	  Say Y here to enable PCIe controller support on Axis ARTPEC-6
>  	  SoCs.  This PCIe controller uses the DesignWare core.
> 
> +config PCIE_KIRIN
> +	depends on OF && ARM64
> +	bool "HiSilicon Kirin series SoCs PCIe controllers"
> +	depends on PCI
> +	select PCIEPORTBUS
> +	select PCIE_DW_HOST
> +	help
> +	  Say Y here if you want PCIe controller support
> +	  on HiSilicon Kirin series SoCs.
> +
>  endmenu
> diff --git a/drivers/pci/dwc/Makefile b/drivers/pci/dwc/Makefile
> index a2df13c28798..4bd69bacd4ab 100644
> --- a/drivers/pci/dwc/Makefile
> +++ b/drivers/pci/dwc/Makefile
> @@ -10,6 +10,7 @@ obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o
>  obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o
>  obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
>  obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o
> +obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o
> 
>  # The following drivers are for devices that use the generic ACPI
>  # pci_root.c driver but don't support standard ECAM config access.
> diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
> new file mode 100644
> index 000000000000..f63e6548efae
> --- /dev/null
> +++ b/drivers/pci/dwc/pcie-kirin.c
> @@ -0,0 +1,514 @@
> +/*
> + * PCIe host controller driver for Kirin Phone SoCs
> + *
> + * Copyright (C) 2017 Hilisicon Electronics Co., Ltd.
> + *		http://www.huawei.com
> + *
> + * Author: Xiaowei Song <songxiaowei@huawei.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <asm/compiler.h>
> +#include <linux/compiler.h>
> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/gpio.h>
> +#include <linux/interrupt.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/of_address.h>
> +#include <linux/of_gpio.h>
> +#include <linux/of_pci.h>
> +#include <linux/pci.h>
> +#include <linux/pci_regs.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/resource.h>
> +#include <linux/types.h>
> +#include "pcie-designware.h"
> +
> +#define to_kirin_pcie(x) dev_get_drvdata((x)->dev)
> +
> +#define REF_CLK_FREQ			100000000
> +
> +/* PCIe ELBI registers */
> +#define SOC_PCIECTRL_CTRL0_ADDR	0x000
> +#define SOC_PCIECTRL_CTRL1_ADDR	0x004
> +#define SOC_PCIEPHY_CTRL2_ADDR		0x008
> +#define SOC_PCIEPHY_CTRL3_ADDR		0x00c
> +#define PCIE_ELBI_SLV_DBI_ENABLE	(0x1 << 21)
> +
> +/* info located in APB */
> +#define PCIE_APP_LTSSM_ENABLE		0x01c
> +#define PCIE_APB_PHY_CTRL0		0x0
> +#define PCIE_APB_PHY_CTRL1		0x4
> +#define PCIE_APB_PHY_STATUS0		0x400
> +#define PCIE_LINKUP_ENABLE		(0x8020)
> +#define PCIE_LTSSM_ENABLE_BIT		(0x1 << 11)
> +#define PIPE_CLK_STABLE		(0x1 << 19)
> +#define PIPE_CLK_MAX_TRY_TIMES		10
> +#define PHY_REF_PAD_BIT		(0x1 << 8)
> +#define PHY_PWR_DOWN_BIT		(0x1 << 22)
> +#define PHY_RST_ACK_BIT		(0x1 << 16)
> +
> +/* info located in sysctrl */
> +#define SCTRL_PCIE_CMOS_OFFSET		0x60
> +#define SCTRL_PCIE_CMOS_BIT		0x10
> +#define SCTRL_PCIE_ISO_OFFSET		0x44
> +#define SCTRL_PCIE_ISO_BIT		0x30
> +#define SCTRL_PCIE_HPCLK_OFFSET	0x190
> +#define SCTRL_PCIE_HPCLK_BIT		0x184000
> +#define SCTRL_PCIE_OE_OFFSET		0x14a
> +#define PCIE_DEBOUNCE_PARAM		0xF0F400
> +#define PCIE_OE_BYPASS			(0x3 << 28)
> +
> +/* peri_crg ctrl */
> +#define CRGCTRL_PCIE_ASSERT_OFFSET	0x88
> +#define CRGCTRL_PCIE_ASSERT_BIT	0x8c000000
> +
> +/* Time for delay */
> +#define REF_2_PERST_MIN		20000
> +#define REF_2_PERST_MAX		25000
> +#define PERST_2_ACCESS_MIN		10000
> +#define PERST_2_ACCESS_MAX		12000
> +#define LINK_WAIT_MIN			900
> +#define LINK_WAIT_MAX			1000
> +#define PIPE_CLK_WAIT_MIN		550
> +#define PIPE_CLK_WAIT_MAX		600
> +
> +struct kirin_pcie {
> +	struct dw_pcie		*pci;
> +	void __iomem		*apb_base;
> +	void __iomem		*phy_base;
> +	struct regmap		*crgctrl;
> +	struct regmap 		*sysctrl;
> +	struct clk		*apb_sys_clk;
> +	struct clk		*apb_phy_clk;
> +	struct clk		*phy_ref_clk;
> +	struct clk		*pcie_aclk;
> +	struct clk		*pcie_aux_clk;
> +	int			gpio_id_reset;
> +};
> +
> +/* Registers in PCIeCTRL */
> +static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,
> +		u32 val, u32 reg)
> +{
> +	writel(val, kirin_pcie->apb_base + reg);
> +}
> +
> +static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32
> reg)
> +{
> +	return readl(kirin_pcie->apb_base + reg);
> +}
> +
> +/* Registers in PCIePHY */
> +static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,
> +		u32 val, u32 reg)
> +{
> +	writel(val, kirin_pcie->phy_base + reg);
> +}
> +
> +static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32
> reg)
> +{
> +	return readl(kirin_pcie->phy_base + reg);
> +}
> +
> +static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
> +		struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +
> +	kirin_pcie->phy_ref_clk = devm_clk_get(dev, "pcie_phy_ref");
> +	if (IS_ERR(kirin_pcie->phy_ref_clk))
> +		return PTR_ERR(kirin_pcie->phy_ref_clk);
> +
> +	kirin_pcie->pcie_aux_clk = devm_clk_get(dev, "pcie_aux");
> +	if (IS_ERR(kirin_pcie->pcie_aux_clk))
> +		return PTR_ERR(kirin_pcie->pcie_aux_clk);
> +
> +	kirin_pcie->apb_phy_clk = devm_clk_get(dev, "pcie_apb_phy");
> +	if (IS_ERR(kirin_pcie->apb_phy_clk))
> +		return PTR_ERR(kirin_pcie->apb_phy_clk);
> +
> +	kirin_pcie->apb_sys_clk = devm_clk_get(dev, "pcie_apb_sys");
> +	if (IS_ERR(kirin_pcie->apb_sys_clk))
> +		return PTR_ERR(kirin_pcie->apb_sys_clk);
> +
> +	kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
> +	if (IS_ERR(kirin_pcie->pcie_aclk))
> +		return PTR_ERR(kirin_pcie->pcie_aclk);
> +
> +	return 0;
> +}
> +
> +static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
> +		struct platform_device *pdev)
> +{
> +	struct resource *apb;
> +	struct resource *phy;
> +	struct resource *dbi;
> +	struct device *dev = &pdev->dev;
> +
> +	apb = platform_get_resource_byname(pdev, IORESOURCE_MEM, "apb");
> +	kirin_pcie->apb_base = devm_ioremap_resource(dev, apb);
> +	if (IS_ERR(kirin_pcie->apb_base))
> +		return PTR_ERR(kirin_pcie->apb_base);
> +
> +	phy = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy");
> +	kirin_pcie->phy_base = devm_ioremap_resource(dev, phy);
> +	if (IS_ERR(kirin_pcie->phy_base))
> +		return PTR_ERR(kirin_pcie->phy_base);
> +
> +	dbi = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
> +	kirin_pcie->pci->dbi_base = devm_ioremap_resource(dev, dbi);
> +	if (IS_ERR(kirin_pcie->pci->dbi_base))
> +		return PTR_ERR(kirin_pcie->pci->dbi_base);
> +
> +	kirin_pcie->crgctrl =
> +		syscon_regmap_lookup_by_compatible("hisilicon,hi3660-
> crgctrl");
> +	if (IS_ERR(kirin_pcie->crgctrl))
> +		return PTR_ERR(kirin_pcie->crgctrl);
> +
> +	kirin_pcie->sysctrl =
> +
syscon_regmap_lookup_by_compatible("hisilicon,hi3660-sctrl");
> +	if (IS_ERR(kirin_pcie->sysctrl))
> +		return PTR_ERR(kirin_pcie->sysctrl);
> +
> +	return 0;
> +}
> +
> +static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
> +{
> +	u32 reg_val;
> +	u32 time = PIPE_CLK_MAX_TRY_TIMES;
> +
> +	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
> +	reg_val &= ~PHY_REF_PAD_BIT;
> +	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL1);
> +
> +	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL0);
> +	reg_val &= ~PHY_PWR_DOWN_BIT;
> +	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL0);
> +	udelay(10);
> +
> +	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
> +	reg_val &= ~PHY_RST_ACK_BIT;
> +	kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL1);
> +
> +	usleep_range(PIPE_CLK_WAIT_MIN, PIPE_CLK_WAIT_MAX);
> +	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_STATUS0);
> +	if (reg_val & PIPE_CLK_STABLE) {
> +		dev_err(kirin_pcie->pci->dev, "PIPE clk is not stable\n");
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
> +static void kirin_pcie_oe_enable(struct kirin_pcie *kirin_pcie)
> +{
> +	u32 val;
> +
> +	regmap_read(kirin_pcie->sysctrl, SCTRL_PCIE_OE_OFFSET, &val);
> +	val |= PCIE_DEBOUNCE_PARAM;
> +	val &= ~PCIE_OE_BYPASS;
> +	regmap_write(kirin_pcie->sysctrl, SCTRL_PCIE_OE_OFFSET, val);
> +}
> +
> +static int kirin_pcie_clk_ctrl(struct kirin_pcie *kirin_pcie, bool
enable)
> +{
> +	int ret = 0;
> +
> +	if (!enable)
> +		goto close_clk;
> +
> +	ret = clk_set_rate(kirin_pcie->phy_ref_clk, REF_CLK_FREQ);
> +	if (ret)
> +		return ret;
> +
> +	ret = clk_prepare_enable(kirin_pcie->phy_ref_clk);
> +	if (ret)
> +		return ret;
> +
> +	ret = clk_prepare_enable(kirin_pcie->apb_sys_clk);
> +	if (ret)
> +		goto apb_sys_fail;
> +
> +	ret = clk_prepare_enable(kirin_pcie->apb_phy_clk);
> +	if (ret)
> +		goto apb_phy_fail;
> +
> +	ret = clk_prepare_enable(kirin_pcie->pcie_aclk);
> +	if (ret)
> +		goto aclk_fail;
> +
> +	ret = clk_prepare_enable(kirin_pcie->pcie_aux_clk);
> +	if (ret)
> +		goto aux_clk_fail;
> +
> +	return 0;
> +
> +close_clk:
> +	clk_disable_unprepare(kirin_pcie->pcie_aux_clk);
> +aux_clk_fail:
> +	clk_disable_unprepare(kirin_pcie->pcie_aclk);
> +aclk_fail:
> +	clk_disable_unprepare(kirin_pcie->apb_phy_clk);
> +apb_phy_fail:
> +	clk_disable_unprepare(kirin_pcie->apb_sys_clk);
> +apb_sys_fail:
> +	clk_disable_unprepare(kirin_pcie->phy_ref_clk);
> +
> +	return ret;
> +}
> +
> +static int kirin_pcie_power_on(struct kirin_pcie *kirin_pcie)
> +{
> +	int ret;
> +
> +	/* Power supply for Host */
> +	regmap_write(kirin_pcie->sysctrl,
> +		SCTRL_PCIE_CMOS_OFFSET, SCTRL_PCIE_CMOS_BIT);
> +	udelay(100);
> +	kirin_pcie_oe_enable(kirin_pcie);
> +
> +	ret = kirin_pcie_clk_ctrl(kirin_pcie, true);
> +	if (ret)
> +		return ret;
> +
> +	/* ISO disable, PCIeCtrl, PHY assert and clk gate clear */
> +	regmap_write(kirin_pcie->sysctrl,
> +		SCTRL_PCIE_ISO_OFFSET, SCTRL_PCIE_ISO_BIT);
> +	regmap_write(kirin_pcie->crgctrl,
> +		CRGCTRL_PCIE_ASSERT_OFFSET, CRGCTRL_PCIE_ASSERT_BIT);
> +	regmap_write(kirin_pcie->sysctrl,
> +		SCTRL_PCIE_HPCLK_OFFSET, SCTRL_PCIE_HPCLK_BIT);
> +
> +	ret = kirin_pcie_phy_init(kirin_pcie);
> +	if (ret)
> +		goto close_clk;
> +
> +	/* perst assert Endpoint */
> +	if (!gpio_request(kirin_pcie->gpio_id_reset, "pcie_perst")) {
> +		usleep_range(REF_2_PERST_MIN, REF_2_PERST_MAX);
> +		ret = gpio_direction_output(kirin_pcie->gpio_id_reset, 1);
> +		if (ret)
> +			goto close_clk;
> +		usleep_range(PERST_2_ACCESS_MIN, PERST_2_ACCESS_MAX);
> +
> +		return 0;
> +	}
> +
> +close_clk:
> +	kirin_pcie_clk_ctrl(kirin_pcie, false);
> +	return ret;
> +}
> +
> +static void kirin_pcie_sideband_dbi_w_mode(struct kirin_pcie *kirin_pcie,
> +		bool on)
> +{
> +	u32 val;
> +
> +	val = kirin_apb_ctrl_readl(kirin_pcie, SOC_PCIECTRL_CTRL0_ADDR);
> +	if (on)
> +		val = val | PCIE_ELBI_SLV_DBI_ENABLE;
> +	else
> +		val = val & ~PCIE_ELBI_SLV_DBI_ENABLE;
> +
> +	kirin_apb_ctrl_writel(kirin_pcie, val, SOC_PCIECTRL_CTRL0_ADDR);
> +}
> +
> +static void kirin_pcie_sideband_dbi_r_mode(struct kirin_pcie *kirin_pcie,
> +		bool on)
> +{
> +	u32 val;
> +
> +	val = kirin_apb_ctrl_readl(kirin_pcie, SOC_PCIECTRL_CTRL1_ADDR);
> +	if (on)
> +		val = val | PCIE_ELBI_SLV_DBI_ENABLE;
> +	else
> +		val = val & ~PCIE_ELBI_SLV_DBI_ENABLE;
> +
> +	kirin_apb_ctrl_writel(kirin_pcie, val, SOC_PCIECTRL_CTRL1_ADDR);
> +}
> +
> +static int kirin_pcie_rd_own_conf(struct pcie_port *pp,
> +		int where, int size, u32 *val)
> +{
> +	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +	int ret;
> +
> +	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, true);
> +	ret = dw_pcie_read(pci->dbi_base + where, size, val);
> +	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, false);
> +
> +	return ret;
> +}
> +
> +static int kirin_pcie_wr_own_conf(struct pcie_port *pp,
> +		int where, int size, u32 val)
> +{
> +	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +	int ret;
> +
> +	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, true);
> +	ret = dw_pcie_write(pci->dbi_base + where, size, val);
> +	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, false);
> +
> +	return ret;
> +}
> +
> +static u32 kirin_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base,
> +		u32 reg, size_t size)
> +{
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +	u32 ret;
> +
> +	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, true);
> +	dw_pcie_read(base + reg, size, &ret);
> +	kirin_pcie_sideband_dbi_r_mode(kirin_pcie, false);
> +
> +	return ret;
> +}
> +
> +static void kirin_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base,
> +		u32 reg, size_t size, u32 val)
> +{
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +
> +	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, true);
> +	dw_pcie_write(base + reg, size, val);
> +	kirin_pcie_sideband_dbi_w_mode(kirin_pcie, false);
> +}
> +
> +static int kirin_pcie_link_up(struct dw_pcie *pci)
> +{
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +	u32 val = kirin_apb_ctrl_readl(kirin_pcie, PCIE_APB_PHY_STATUS0);
> +
> +	if ((val & PCIE_LINKUP_ENABLE) == PCIE_LINKUP_ENABLE)
> +		return 1;
> +
> +	return 0;
> +}
> +
> +static int kirin_pcie_establish_link(struct pcie_port *pp)
> +{
> +	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> +	struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci);
> +	int count = 0;
> +
> +	if (kirin_pcie_link_up(pci))
> +		return 0;
> +
> +	dw_pcie_setup_rc(pp);
> +
> +	/* assert LTSSM enable */
> +	kirin_apb_ctrl_writel(kirin_pcie, PCIE_LTSSM_ENABLE_BIT,
> +		PCIE_APP_LTSSM_ENABLE);
> +
> +	/* check if the link is up or not */
> +	while (!kirin_pcie_link_up(pci)) {
> +		usleep_range(LINK_WAIT_MIN, LINK_WAIT_MAX);
> +		count++;
> +		if (count == 1000) {
> +			dev_err(pci->dev, "Link Fail\n");
> +			return -EINVAL;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static void kirin_pcie_host_init(struct pcie_port *pp)
> +{
> +	kirin_pcie_establish_link(pp);
> +}
> +
> +static struct dw_pcie_ops kirin_dw_pcie_ops = {
> +	.read_dbi = kirin_pcie_read_dbi,
> +	.write_dbi = kirin_pcie_write_dbi,
> +	.link_up = kirin_pcie_link_up,
> +};
> +
> +static struct dw_pcie_host_ops kirin_pcie_host_ops = {
> +	.rd_own_conf = kirin_pcie_rd_own_conf,
> +	.wr_own_conf = kirin_pcie_wr_own_conf,
> +	.host_init = kirin_pcie_host_init,
> +};
> +
> +static int __init kirin_add_pcie_port(struct dw_pcie *pci,
> +			struct platform_device *pdev)
> +{
> +	pci->pp.ops = &kirin_pcie_host_ops;
> +
> +	return dw_pcie_host_init(&pci->pp);
> +}
> +
> +static int kirin_pcie_probe(struct platform_device *pdev)
> +{
> +	struct kirin_pcie *kirin_pcie;
> +	struct dw_pcie *pci;
> +	struct device *dev = &pdev->dev;
> +	int ret;
> +
> +	if (!dev->of_node) {
> +		dev_err(&pdev->dev, "NULL node\n");
> +		return -EINVAL;
> +	}
> +
> +	kirin_pcie = devm_kzalloc(dev, sizeof(struct kirin_pcie),
> GFP_KERNEL);
> +	if (!kirin_pcie)
> +		return -ENOMEM;
> +
> +	pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
> +	if (!pci)
> +		return -ENOMEM;
> +
> +	pci->dev = dev;
> +	pci->ops = &kirin_dw_pcie_ops;
> +	kirin_pcie->pci = pci;
> +
> +	ret = kirin_pcie_get_clk(kirin_pcie, pdev);
> +	if (ret)
> +		return ret;
> +
> +	ret = kirin_pcie_get_resource(kirin_pcie, pdev);
> +	if (ret)
> +		return ret;
> +
> +	kirin_pcie->gpio_id_reset = of_get_named_gpio(dev->of_node,
> +			"reset-gpio", 0);
> +	if (kirin_pcie->gpio_id_reset < 0)
> +		return -ENODEV;
> +
> +	ret = kirin_pcie_power_on(kirin_pcie);
> +	if (ret)
> +		return ret;
> +
> +	platform_set_drvdata(pdev, kirin_pcie);
> +
> +	return kirin_add_pcie_port(pci, pdev);
> +}
> +
> +static const struct of_device_id kirin_pcie_match[] = {
> +	{ .compatible = "hisilicon,kirin960-pcie" },
> +	{},
> +};
> +
> +struct platform_driver kirin_pcie_driver = {
> +	.probe			= kirin_pcie_probe,
> +	.driver			= {
> +		.name			= "kirin-pcie",
> +		.of_match_table = kirin_pcie_match,
> +		.suppress_bind_attrs = true,
> +	},
> +};
> +
> +builtin_platform_driver(kirin_pcie_driver);
> --
> 2.11.GIT

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
  2017-05-31  7:01   ` Xiaowei Song
@ 2017-06-04  0:03     ` kbuild test robot
  -1 siblings, 0 replies; 32+ messages in thread
From: kbuild test robot @ 2017-06-04  0:03 UTC (permalink / raw)
  To: Xiaowei Song
  Cc: kbuild-all, bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon, chenyao11, puck.chen,
	songxiaowei, guodong.xu, wangbinghui, suzhuangluan, linux-pci,
	devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

Hi Xiaowei,

[auto build test ERROR on pci/next]
[also build test ERROR on v4.12-rc3 next-20170602]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm64-allnoconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
>> FATAL ERROR: Unable to parse input tree

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6654 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-04  0:03     ` kbuild test robot
  0 siblings, 0 replies; 32+ messages in thread
From: kbuild test robot @ 2017-06-04  0:03 UTC (permalink / raw)
  Cc: kbuild-all, bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni, robh+dt,
	mark.rutland, catalin.marinas, will.deacon, chenyao11, puck.chen,
	songxiaowei, guodong.xu, wangbinghui, suzhuangluan, linux-pci,
	devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

Hi Xiaowei,

[auto build test ERROR on pci/next]
[also build test ERROR on v4.12-rc3 next-20170602]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm64-allnoconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
>> FATAL ERROR: Unable to parse input tree

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6654 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-06  9:23       ` Arnd Bergmann
  0 siblings, 0 replies; 32+ messages in thread
From: Arnd Bergmann @ 2017-06-06  9:23 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Xiaowei Song, kbuild-all, Bjorn Helgaas, Kishon, Jingoo Han,
	Tomasz Nowicki, Keith Busch, niklas.cassel, Duc Dang,
	liudongdong3, Gabriele Paoloni, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon, chenyao11, Chen Feng, Guodong Xu,
	wangbinghui, suzhuangluan, linux-pci, devicetree,
	Linux Kernel Mailing List

On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp@intel.com> wrote:
> Hi Xiaowei,
>
> [auto build test ERROR on pci/next]
> [also build test ERROR on v4.12-rc3 next-20170602]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
> config: arm64-allnoconfig (attached as .config)
> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=arm64
>
> All errors (new ones prefixed by >>):
>
>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
>>> FATAL ERROR: Unable to parse input tree

We keep getting the build errors for patch submissions. Obviously the patch is
still broken and can't be merged as-is. What is the plan for merging the series?

The other patches all seem fine IIRC.

       Arnd

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-06  9:23       ` Arnd Bergmann
  0 siblings, 0 replies; 32+ messages in thread
From: Arnd Bergmann @ 2017-06-06  9:23 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Xiaowei Song, kbuild-all-JC7UmRfGjtg, Bjorn Helgaas, Kishon,
	Jingoo Han, Tomasz Nowicki, Keith Busch,
	niklas.cassel-VrBV9hrLPhE, Duc Dang,
	liudongdong3-hv44wF8Li93QT0dZR+AlfA, Gabriele Paoloni,
	Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon,
	chenyao11-hv44wF8Li93QT0dZR+AlfA, Chen Feng, Guodong Xu,
	wangbinghui-C8/M+/jPZTeaMJb+Lgu22Q,
	suzhuangluan-C8/M+/jPZTeaMJb+Lgu22Q, linux-pci,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Linux Kernel Mailing List

On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> Hi Xiaowei,
>
> [auto build test ERROR on pci/next]
> [also build test ERROR on v4.12-rc3 next-20170602]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
> config: arm64-allnoconfig (attached as .config)
> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=arm64
>
> All errors (new ones prefixed by >>):
>
>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
>>> FATAL ERROR: Unable to parse input tree

We keep getting the build errors for patch submissions. Obviously the patch is
still broken and can't be merged as-is. What is the plan for merging the series?

The other patches all seem fine IIRC.

       Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
  2017-06-06  9:23       ` Arnd Bergmann
@ 2017-06-06 11:19         ` Guodong Xu
  -1 siblings, 0 replies; 32+ messages in thread
From: Guodong Xu @ 2017-06-06 11:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: kbuild test robot, Xiaowei Song, kbuild-all, Bjorn Helgaas,
	Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch, Niklas Cassel,
	Duc Dang, liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao11, Chen Feng, Wangbinghui, Suzhuangluan,
	linux-pci, devicetree, Linux Kernel Mailing List

Hi, Arnd

On Tue, Jun 6, 2017 at 5:23 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp@intel.com> wrote:
>> Hi Xiaowei,
>>
>> [auto build test ERROR on pci/next]
>> [also build test ERROR on v4.12-rc3 next-20170602]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>
>> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
>> config: arm64-allnoconfig (attached as .config)
>> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
>> reproduce:
>>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # save the attached .config to linux build tree
>>         make.cross ARCH=arm64
>>
>> All errors (new ones prefixed by >>):
>>
>>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
>>>> FATAL ERROR: Unable to parse input tree
>
> We keep getting the build errors for patch submissions. Obviously the patch is
> still broken and can't be merged as-is. What is the plan for merging the series?
>

This dts patch can be applied to dts series [1]. For upstream review
purpose, hi3660-hikey960 dts patches, which don't have a related
driver changes, are sent in [1]. Other patches, which need driver
changes, like this one, are sent together with driver.

Patchset [1] is now at its v2 review. Rob Herring already gave his ACK
for some of them in v1. Hopefully I can get more ACK for remaining
ones, and make them ready for v4.13 merging window.

[1], http://www.spinics.net/lists/devicetree/msg178303.html

-Guodong

> The other patches all seem fine IIRC.
>
>        Arnd

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-06 11:19         ` Guodong Xu
  0 siblings, 0 replies; 32+ messages in thread
From: Guodong Xu @ 2017-06-06 11:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: kbuild test robot, Xiaowei Song, kbuild-all, Bjorn Helgaas,
	Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch, Niklas Cassel,
	Duc Dang, liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao11, Chen Feng, Wangbinghui, Suzhuangluan,
	linux-pci

Hi, Arnd

On Tue, Jun 6, 2017 at 5:23 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp@intel.com> wrote:
>> Hi Xiaowei,
>>
>> [auto build test ERROR on pci/next]
>> [also build test ERROR on v4.12-rc3 next-20170602]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>
>> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
>> config: arm64-allnoconfig (attached as .config)
>> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
>> reproduce:
>>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # save the attached .config to linux build tree
>>         make.cross ARCH=arm64
>>
>> All errors (new ones prefixed by >>):
>>
>>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
>>>> FATAL ERROR: Unable to parse input tree
>
> We keep getting the build errors for patch submissions. Obviously the patch is
> still broken and can't be merged as-is. What is the plan for merging the series?
>

This dts patch can be applied to dts series [1]. For upstream review
purpose, hi3660-hikey960 dts patches, which don't have a related
driver changes, are sent in [1]. Other patches, which need driver
changes, like this one, are sent together with driver.

Patchset [1] is now at its v2 review. Rob Herring already gave his ACK
for some of them in v1. Hopefully I can get more ACK for remaining
ones, and make them ready for v4.13 merging window.

[1], http://www.spinics.net/lists/devicetree/msg178303.html

-Guodong

> The other patches all seem fine IIRC.
>
>        Arnd

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 1/4] PCI: hisi: Add DT binding for PCIe of Kirin SoC series
@ 2017-06-07 21:23     ` Rob Herring
  0 siblings, 0 replies; 32+ messages in thread
From: Rob Herring @ 2017-06-07 21:23 UTC (permalink / raw)
  To: Xiaowei Song
  Cc: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang, liudongdong3, gabriele.paoloni,
	mark.rutland, catalin.marinas, will.deacon, chenyao11, puck.chen,
	guodong.xu, wangbinghui, suzhuangluan, linux-pci, devicetree,
	linux-kernel

On Wed, May 31, 2017 at 03:01:06PM +0800, Xiaowei Song wrote:
> Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
> ---
>  .../devicetree/bindings/pci/kirin-pcie.txt         | 50 ++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pci/kirin-pcie.txt

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 1/4] PCI: hisi: Add DT binding for PCIe of Kirin SoC series
@ 2017-06-07 21:23     ` Rob Herring
  0 siblings, 0 replies; 32+ messages in thread
From: Rob Herring @ 2017-06-07 21:23 UTC (permalink / raw)
  To: Xiaowei Song
  Cc: bhelgaas-hpIqsD4AKlfQT0dZR+AlfA, kishon-l0cyMroinI0,
	jingoohan1-Re5JQEeQqe8AvxtiuMwx3w, arnd-r2nGTMty4D4,
	tn-nYOzD4b6Jr9Wk0Htik3J/w, keith.busch-ral2JQCrhuEAvxtiuMwx3w,
	niklas.cassel-VrBV9hrLPhE, dhdang-qTEPVZfXA3Y,
	liudongdong3-hv44wF8Li93QT0dZR+AlfA,
	gabriele.paoloni-hv44wF8Li93QT0dZR+AlfA,
	mark.rutland-5wv7dgnIgG8, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, chenyao11-hv44wF8Li93QT0dZR+AlfA,
	puck.chen-C8/M+/jPZTeaMJb+Lgu22Q,
	guodong.xu-QSEj5FYQhm4dnm+yROfE0A,
	wangbinghui-C8/M+/jPZTeaMJb+Lgu22Q,
	suzhuangluan-C8/M+/jPZTeaMJb+Lgu22Q,
	linux-pci-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, May 31, 2017 at 03:01:06PM +0800, Xiaowei Song wrote:
> Signed-off-by: Xiaowei Song <songxiaowei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
> ---
>  .../devicetree/bindings/pci/kirin-pcie.txt         | 50 ++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pci/kirin-pcie.txt

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 32+ messages in thread

* 答复: [PATCH v9 1/4] PCI: hisi: Add DT binding for PCIe of Kirin SoC series
  2017-06-07 21:23     ` Rob Herring
  (?)
@ 2017-06-08  1:04     ` songxiaowei
  -1 siblings, 0 replies; 32+ messages in thread
From: songxiaowei @ 2017-06-08  1:04 UTC (permalink / raw)
  To: Rob Herring
  Cc: bhelgaas, kishon, jingoohan1, arnd, tn, keith.busch,
	niklas.cassel, dhdang,
	liudongdong  <liudongdong3@huawei.com>,
	Gabriele Paoloni (C),
	mark.rutland, catalin.marinas, will.deacon, chenyao (F),
	Chenfeng  <puck.chen@hisilicon.com>,
	guodong.xu@linaro.org (puck),
	Wangbinghui, Suzhuangluan, linux-pci, devicetree, linux-kernel

Hi Rob,

Thanks a lot

Best regards,
Xiaowei

-----邮件原件-----
发件人: Rob Herring [mailto:robh@kernel.org] 
发送时间: 2017年6月8日 5:23
收件人: songxiaowei
抄送: bhelgaas@google.com; kishon@ti.com; jingoohan1@gmail.com; arnd@arndb.de; tn@semihalf.com; keith.busch@intel.com; niklas.cassel@axis.com; dhdang@apm.com; liudongdong (C); Gabriele Paoloni; mark.rutland@arm.com; catalin.marinas@arm.com; will.deacon@arm.com; chenyao (F); Chenfeng (puck); guodong.xu@linaro.org; Wangbinghui; Suzhuangluan; linux-pci@vger.kernel.org; devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
主题: Re: [PATCH v9 1/4] PCI: hisi: Add DT binding for PCIe of Kirin SoC series

On Wed, May 31, 2017 at 03:01:06PM +0800, Xiaowei Song wrote:
> Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
> ---
>  .../devicetree/bindings/pci/kirin-pcie.txt         | 50 ++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pci/kirin-pcie.txt

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-16 21:11           ` Bjorn Helgaas
  0 siblings, 0 replies; 32+ messages in thread
From: Bjorn Helgaas @ 2017-06-16 21:11 UTC (permalink / raw)
  To: Guodong Xu
  Cc: Arnd Bergmann, kbuild test robot, Xiaowei Song, kbuild-all,
	Bjorn Helgaas, Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch,
	Niklas Cassel, Duc Dang, liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao11, Chen Feng, Wangbinghui, Suzhuangluan,
	linux-pci, devicetree, Linux Kernel Mailing List

On Tue, Jun 06, 2017 at 07:19:53PM +0800, Guodong Xu wrote:
> Hi, Arnd
> 
> On Tue, Jun 6, 2017 at 5:23 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp@intel.com> wrote:
> >> Hi Xiaowei,
> >>
> >> [auto build test ERROR on pci/next]
> >> [also build test ERROR on v4.12-rc3 next-20170602]
> >> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> >>
> >> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
> >> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
> >> config: arm64-allnoconfig (attached as .config)
> >> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> >> reproduce:
> >>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>         chmod +x ~/bin/make.cross
> >>         # save the attached .config to linux build tree
> >>         make.cross ARCH=arm64
> >>
> >> All errors (new ones prefixed by >>):
> >>
> >>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
> >>>> FATAL ERROR: Unable to parse input tree
> >
> > We keep getting the build errors for patch submissions. Obviously the patch is
> > still broken and can't be merged as-is. What is the plan for merging the series?
> >
> 
> This dts patch can be applied to dts series [1]. For upstream review
> purpose, hi3660-hikey960 dts patches, which don't have a related
> driver changes, are sent in [1]. Other patches, which need driver
> changes, like this one, are sent together with driver.
> 
> Patchset [1] is now at its v2 review. Rob Herring already gave his ACK
> for some of them in v1. Hopefully I can get more ACK for remaining
> ones, and make them ready for v4.13 merging window.
> 
> [1], http://www.spinics.net/lists/devicetree/msg178303.html

I don't know how you want to deal with the DTS build failure.  From a
PCI perspective, I think I could apply patches 1 and 3 pretty easily
by themselves.

If/when you post these again, please incorporate the following
incremental diff to clean up various whitespace and capitalization
nits (these are spread across several of your patches).


diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
index 68ffa0fbcd73..20357d840af1 100644
--- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
@@ -24,8 +24,8 @@ Example based on kirin960:
 
 	pcie@f4000000 {
 		compatible = "hisilicon,kirin-pcie";
-		reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
-		      <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
+		reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
+		      <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;
 		reg-names = "dbi","apb","phy", "config";
 		bus-range = <0x0  0x1>;
 		#address-cells = <3>;
@@ -46,5 +46,5 @@ Example based on kirin960:
 			 <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
 		clock-names = "pcie_phy_ref", "pcie_aux",
 			      "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
-		reset-gpios = <&gpio11 1 0 >;
+		reset-gpios = <&gpio11 1 0>;
 	};
diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index e8feb2fb4d53..7bc89baa40ba 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -159,12 +159,12 @@
 
 		pcie@f4000000 {
 			compatible = "hisilicon,kirin960-pcie";
-			reg = <0x0 0xf4000000 0x0 0x1000>,
-			      <0x0 0xff3fe000 0x0 0x1000>,
+			reg = <0x0 0xf4000000 0x0  0x1000>,
+			      <0x0 0xff3fe000 0x0  0x1000>,
 			      <0x0 0xf3f20000 0x0 0x40000>,
-			      <0x0 0xF5000000 0x0 0x2000>;
+			      <0x0 0xf5000000 0x0  0x2000>;
 			reg-names = "dbi", "apb", "phy", "config";
-			bus-range = <0x0  0x1>;
+			bus-range = <0x0 0x1>;
 			#address-cells = <3>;
 			#size-cells = <2>;
 			device_type = "pci";
@@ -173,7 +173,7 @@
 			num-lanes = <1>;
 			#interrupt-cells = <1>;
 			interrupt-map-mask = <0xf800 0 0 7>;
-			interrupt-map = <0x0 0 0 1 &gic 0 0 0 282 4>,
+			interrupt-map = <0x0 0 0 1 &gic 0 0 0  282 4>,
 					<0x0 0 0 2 &gic 0 0 0  283 4>,
 					<0x0 0 0 3 &gic 0 0 0  284 4>,
 					<0x0 0 0 4 &gic 0 0 0  285 4>;
@@ -183,8 +183,9 @@
 				 <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
 				 <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
 			clock-names = "pcie_phy_ref", "pcie_aux",
-				      "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
-			reset-gpios = <&gpio11 1 0 >;
+				      "pcie_apb_phy", "pcie_apb_sys",
+				      "pcie_aclk";
+			reset-gpios = <&gpio11 1 0>;
 			status = "ok";
 		};
 	};
diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
index f63e6548efae..41520dd1d5e5 100644
--- a/drivers/pci/dwc/pcie-kirin.c
+++ b/drivers/pci/dwc/pcie-kirin.c
@@ -35,8 +35,8 @@
 #define REF_CLK_FREQ			100000000
 
 /* PCIe ELBI registers */
-#define SOC_PCIECTRL_CTRL0_ADDR	0x000
-#define SOC_PCIECTRL_CTRL1_ADDR	0x004
+#define SOC_PCIECTRL_CTRL0_ADDR		0x000
+#define SOC_PCIECTRL_CTRL1_ADDR		0x004
 #define SOC_PCIEPHY_CTRL2_ADDR		0x008
 #define SOC_PCIEPHY_CTRL3_ADDR		0x00c
 #define PCIE_ELBI_SLV_DBI_ENABLE	(0x1 << 21)
@@ -48,30 +48,30 @@
 #define PCIE_APB_PHY_STATUS0		0x400
 #define PCIE_LINKUP_ENABLE		(0x8020)
 #define PCIE_LTSSM_ENABLE_BIT		(0x1 << 11)
-#define PIPE_CLK_STABLE		(0x1 << 19)
+#define PIPE_CLK_STABLE			(0x1 << 19)
 #define PIPE_CLK_MAX_TRY_TIMES		10
-#define PHY_REF_PAD_BIT		(0x1 << 8)
+#define PHY_REF_PAD_BIT			(0x1 << 8)
 #define PHY_PWR_DOWN_BIT		(0x1 << 22)
-#define PHY_RST_ACK_BIT		(0x1 << 16)
+#define PHY_RST_ACK_BIT			(0x1 << 16)
 
 /* info located in sysctrl */
 #define SCTRL_PCIE_CMOS_OFFSET		0x60
 #define SCTRL_PCIE_CMOS_BIT		0x10
 #define SCTRL_PCIE_ISO_OFFSET		0x44
 #define SCTRL_PCIE_ISO_BIT		0x30
-#define SCTRL_PCIE_HPCLK_OFFSET	0x190
+#define SCTRL_PCIE_HPCLK_OFFSET		0x190
 #define SCTRL_PCIE_HPCLK_BIT		0x184000
 #define SCTRL_PCIE_OE_OFFSET		0x14a
-#define PCIE_DEBOUNCE_PARAM		0xF0F400
+#define PCIE_DEBOUNCE_PARAM		0xf0f400
 #define PCIE_OE_BYPASS			(0x3 << 28)
 
 /* peri_crg ctrl */
 #define CRGCTRL_PCIE_ASSERT_OFFSET	0x88
-#define CRGCTRL_PCIE_ASSERT_BIT	0x8c000000
+#define CRGCTRL_PCIE_ASSERT_BIT		0x8c000000
 
 /* Time for delay */
-#define REF_2_PERST_MIN		20000
-#define REF_2_PERST_MAX		25000
+#define REF_2_PERST_MIN			20000
+#define REF_2_PERST_MAX			25000
 #define PERST_2_ACCESS_MIN		10000
 #define PERST_2_ACCESS_MAX		12000
 #define LINK_WAIT_MIN			900
@@ -80,22 +80,22 @@
 #define PIPE_CLK_WAIT_MAX		600
 
 struct kirin_pcie {
-	struct dw_pcie		*pci;
-	void __iomem		*apb_base;
-	void __iomem		*phy_base;
-	struct regmap		*crgctrl;
-	struct regmap 		*sysctrl;
-	struct clk		*apb_sys_clk;
-	struct clk		*apb_phy_clk;
-	struct clk		*phy_ref_clk;
-	struct clk		*pcie_aclk;
-	struct clk		*pcie_aux_clk;
-	int			gpio_id_reset;
+	struct dw_pcie	*pci;
+	void __iomem	*apb_base;
+	void __iomem	*phy_base;
+	struct regmap	*crgctrl;
+	struct regmap 	*sysctrl;
+	struct clk	*apb_sys_clk;
+	struct clk	*apb_phy_clk;
+	struct clk	*phy_ref_clk;
+	struct clk	*pcie_aclk;
+	struct clk	*pcie_aux_clk;
+	int		gpio_id_reset;
 };
 
 /* Registers in PCIeCTRL */
 static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,
-		u32 val, u32 reg)
+					 u32 val, u32 reg)
 {
 	writel(val, kirin_pcie->apb_base + reg);
 }
@@ -107,7 +107,7 @@ static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32 reg)
 
 /* Registers in PCIePHY */
 static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,
-		u32 val, u32 reg)
+					u32 val, u32 reg)
 {
 	writel(val, kirin_pcie->phy_base + reg);
 }
@@ -118,7 +118,7 @@ static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32 reg)
 }
 
 static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
-		struct platform_device *pdev)
+			       struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 
@@ -146,7 +146,7 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
 }
 
 static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
-		struct platform_device *pdev)
+				    struct platform_device *pdev)
 {
 	struct resource *apb;
 	struct resource *phy;
@@ -184,7 +184,6 @@ static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
 static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
 {
 	u32 reg_val;
-	u32 time = PIPE_CLK_MAX_TRY_TIMES;
 
 	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
 	reg_val &= ~PHY_REF_PAD_BIT;
@@ -459,7 +458,7 @@ static int kirin_pcie_probe(struct platform_device *pdev)
 	int ret;
 
 	if (!dev->of_node) {
-		dev_err(&pdev->dev, "NULL node\n");
+		dev_err(dev, "NULL node\n");
 		return -EINVAL;
 	}
 

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-16 21:11           ` Bjorn Helgaas
  0 siblings, 0 replies; 32+ messages in thread
From: Bjorn Helgaas @ 2017-06-16 21:11 UTC (permalink / raw)
  To: Guodong Xu
  Cc: Arnd Bergmann, kbuild test robot, Xiaowei Song,
	kbuild-all-JC7UmRfGjtg, Bjorn Helgaas, Kishon, Jingoo Han,
	Tomasz Nowicki, Keith Busch, Niklas Cassel, Duc Dang,
	liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao11-hv44wF8Li93QT0dZR+AlfA, Chen Feng,
	Wangbinghui, Suzhuangluan

On Tue, Jun 06, 2017 at 07:19:53PM +0800, Guodong Xu wrote:
> Hi, Arnd
> 
> On Tue, Jun 6, 2017 at 5:23 PM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:
> > On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> >> Hi Xiaowei,
> >>
> >> [auto build test ERROR on pci/next]
> >> [also build test ERROR on v4.12-rc3 next-20170602]
> >> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> >>
> >> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
> >> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
> >> config: arm64-allnoconfig (attached as .config)
> >> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> >> reproduce:
> >>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>         chmod +x ~/bin/make.cross
> >>         # save the attached .config to linux build tree
> >>         make.cross ARCH=arm64
> >>
> >> All errors (new ones prefixed by >>):
> >>
> >>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
> >>>> FATAL ERROR: Unable to parse input tree
> >
> > We keep getting the build errors for patch submissions. Obviously the patch is
> > still broken and can't be merged as-is. What is the plan for merging the series?
> >
> 
> This dts patch can be applied to dts series [1]. For upstream review
> purpose, hi3660-hikey960 dts patches, which don't have a related
> driver changes, are sent in [1]. Other patches, which need driver
> changes, like this one, are sent together with driver.
> 
> Patchset [1] is now at its v2 review. Rob Herring already gave his ACK
> for some of them in v1. Hopefully I can get more ACK for remaining
> ones, and make them ready for v4.13 merging window.
> 
> [1], http://www.spinics.net/lists/devicetree/msg178303.html

I don't know how you want to deal with the DTS build failure.  From a
PCI perspective, I think I could apply patches 1 and 3 pretty easily
by themselves.

If/when you post these again, please incorporate the following
incremental diff to clean up various whitespace and capitalization
nits (these are spread across several of your patches).


diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
index 68ffa0fbcd73..20357d840af1 100644
--- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
@@ -24,8 +24,8 @@ Example based on kirin960:
 
 	pcie@f4000000 {
 		compatible = "hisilicon,kirin-pcie";
-		reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
-		      <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
+		reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
+		      <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;
 		reg-names = "dbi","apb","phy", "config";
 		bus-range = <0x0  0x1>;
 		#address-cells = <3>;
@@ -46,5 +46,5 @@ Example based on kirin960:
 			 <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
 		clock-names = "pcie_phy_ref", "pcie_aux",
 			      "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
-		reset-gpios = <&gpio11 1 0 >;
+		reset-gpios = <&gpio11 1 0>;
 	};
diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index e8feb2fb4d53..7bc89baa40ba 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -159,12 +159,12 @@
 
 		pcie@f4000000 {
 			compatible = "hisilicon,kirin960-pcie";
-			reg = <0x0 0xf4000000 0x0 0x1000>,
-			      <0x0 0xff3fe000 0x0 0x1000>,
+			reg = <0x0 0xf4000000 0x0  0x1000>,
+			      <0x0 0xff3fe000 0x0  0x1000>,
 			      <0x0 0xf3f20000 0x0 0x40000>,
-			      <0x0 0xF5000000 0x0 0x2000>;
+			      <0x0 0xf5000000 0x0  0x2000>;
 			reg-names = "dbi", "apb", "phy", "config";
-			bus-range = <0x0  0x1>;
+			bus-range = <0x0 0x1>;
 			#address-cells = <3>;
 			#size-cells = <2>;
 			device_type = "pci";
@@ -173,7 +173,7 @@
 			num-lanes = <1>;
 			#interrupt-cells = <1>;
 			interrupt-map-mask = <0xf800 0 0 7>;
-			interrupt-map = <0x0 0 0 1 &gic 0 0 0 282 4>,
+			interrupt-map = <0x0 0 0 1 &gic 0 0 0  282 4>,
 					<0x0 0 0 2 &gic 0 0 0  283 4>,
 					<0x0 0 0 3 &gic 0 0 0  284 4>,
 					<0x0 0 0 4 &gic 0 0 0  285 4>;
@@ -183,8 +183,9 @@
 				 <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
 				 <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
 			clock-names = "pcie_phy_ref", "pcie_aux",
-				      "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
-			reset-gpios = <&gpio11 1 0 >;
+				      "pcie_apb_phy", "pcie_apb_sys",
+				      "pcie_aclk";
+			reset-gpios = <&gpio11 1 0>;
 			status = "ok";
 		};
 	};
diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
index f63e6548efae..41520dd1d5e5 100644
--- a/drivers/pci/dwc/pcie-kirin.c
+++ b/drivers/pci/dwc/pcie-kirin.c
@@ -35,8 +35,8 @@
 #define REF_CLK_FREQ			100000000
 
 /* PCIe ELBI registers */
-#define SOC_PCIECTRL_CTRL0_ADDR	0x000
-#define SOC_PCIECTRL_CTRL1_ADDR	0x004
+#define SOC_PCIECTRL_CTRL0_ADDR		0x000
+#define SOC_PCIECTRL_CTRL1_ADDR		0x004
 #define SOC_PCIEPHY_CTRL2_ADDR		0x008
 #define SOC_PCIEPHY_CTRL3_ADDR		0x00c
 #define PCIE_ELBI_SLV_DBI_ENABLE	(0x1 << 21)
@@ -48,30 +48,30 @@
 #define PCIE_APB_PHY_STATUS0		0x400
 #define PCIE_LINKUP_ENABLE		(0x8020)
 #define PCIE_LTSSM_ENABLE_BIT		(0x1 << 11)
-#define PIPE_CLK_STABLE		(0x1 << 19)
+#define PIPE_CLK_STABLE			(0x1 << 19)
 #define PIPE_CLK_MAX_TRY_TIMES		10
-#define PHY_REF_PAD_BIT		(0x1 << 8)
+#define PHY_REF_PAD_BIT			(0x1 << 8)
 #define PHY_PWR_DOWN_BIT		(0x1 << 22)
-#define PHY_RST_ACK_BIT		(0x1 << 16)
+#define PHY_RST_ACK_BIT			(0x1 << 16)
 
 /* info located in sysctrl */
 #define SCTRL_PCIE_CMOS_OFFSET		0x60
 #define SCTRL_PCIE_CMOS_BIT		0x10
 #define SCTRL_PCIE_ISO_OFFSET		0x44
 #define SCTRL_PCIE_ISO_BIT		0x30
-#define SCTRL_PCIE_HPCLK_OFFSET	0x190
+#define SCTRL_PCIE_HPCLK_OFFSET		0x190
 #define SCTRL_PCIE_HPCLK_BIT		0x184000
 #define SCTRL_PCIE_OE_OFFSET		0x14a
-#define PCIE_DEBOUNCE_PARAM		0xF0F400
+#define PCIE_DEBOUNCE_PARAM		0xf0f400
 #define PCIE_OE_BYPASS			(0x3 << 28)
 
 /* peri_crg ctrl */
 #define CRGCTRL_PCIE_ASSERT_OFFSET	0x88
-#define CRGCTRL_PCIE_ASSERT_BIT	0x8c000000
+#define CRGCTRL_PCIE_ASSERT_BIT		0x8c000000
 
 /* Time for delay */
-#define REF_2_PERST_MIN		20000
-#define REF_2_PERST_MAX		25000
+#define REF_2_PERST_MIN			20000
+#define REF_2_PERST_MAX			25000
 #define PERST_2_ACCESS_MIN		10000
 #define PERST_2_ACCESS_MAX		12000
 #define LINK_WAIT_MIN			900
@@ -80,22 +80,22 @@
 #define PIPE_CLK_WAIT_MAX		600
 
 struct kirin_pcie {
-	struct dw_pcie		*pci;
-	void __iomem		*apb_base;
-	void __iomem		*phy_base;
-	struct regmap		*crgctrl;
-	struct regmap 		*sysctrl;
-	struct clk		*apb_sys_clk;
-	struct clk		*apb_phy_clk;
-	struct clk		*phy_ref_clk;
-	struct clk		*pcie_aclk;
-	struct clk		*pcie_aux_clk;
-	int			gpio_id_reset;
+	struct dw_pcie	*pci;
+	void __iomem	*apb_base;
+	void __iomem	*phy_base;
+	struct regmap	*crgctrl;
+	struct regmap 	*sysctrl;
+	struct clk	*apb_sys_clk;
+	struct clk	*apb_phy_clk;
+	struct clk	*phy_ref_clk;
+	struct clk	*pcie_aclk;
+	struct clk	*pcie_aux_clk;
+	int		gpio_id_reset;
 };
 
 /* Registers in PCIeCTRL */
 static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,
-		u32 val, u32 reg)
+					 u32 val, u32 reg)
 {
 	writel(val, kirin_pcie->apb_base + reg);
 }
@@ -107,7 +107,7 @@ static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32 reg)
 
 /* Registers in PCIePHY */
 static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,
-		u32 val, u32 reg)
+					u32 val, u32 reg)
 {
 	writel(val, kirin_pcie->phy_base + reg);
 }
@@ -118,7 +118,7 @@ static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32 reg)
 }
 
 static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
-		struct platform_device *pdev)
+			       struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 
@@ -146,7 +146,7 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
 }
 
 static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
-		struct platform_device *pdev)
+				    struct platform_device *pdev)
 {
 	struct resource *apb;
 	struct resource *phy;
@@ -184,7 +184,6 @@ static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
 static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
 {
 	u32 reg_val;
-	u32 time = PIPE_CLK_MAX_TRY_TIMES;
 
 	reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
 	reg_val &= ~PHY_REF_PAD_BIT;
@@ -459,7 +458,7 @@ static int kirin_pcie_probe(struct platform_device *pdev)
 	int ret;
 
 	if (!dev->of_node) {
-		dev_err(&pdev->dev, "NULL node\n");
+		dev_err(dev, "NULL node\n");
 		return -EINVAL;
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
  2017-06-16 21:11           ` Bjorn Helgaas
@ 2017-06-16 22:31             ` Guodong Xu
  -1 siblings, 0 replies; 32+ messages in thread
From: Guodong Xu @ 2017-06-16 22:31 UTC (permalink / raw)
  To: Bjorn Helgaas, xuwei (O)
  Cc: Arnd Bergmann, kbuild test robot, Xiaowei Song, kbuild-all,
	Bjorn Helgaas, Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch,
	Niklas Cassel, Duc Dang, liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao11, Chen Feng, Wangbinghui, Suzhuangluan,
	linux-pci, devicetree, Linux Kernel Mailing List

Hi, Bjorn

On Sat, Jun 17, 2017 at 5:11 AM, Bjorn Helgaas <helgaas@kernel.org> wrote:
> On Tue, Jun 06, 2017 at 07:19:53PM +0800, Guodong Xu wrote:
>> Hi, Arnd
>>
>> On Tue, Jun 6, 2017 at 5:23 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> > On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp@intel.com> wrote:
>> >> Hi Xiaowei,
>> >>
>> >> [auto build test ERROR on pci/next]
>> >> [also build test ERROR on v4.12-rc3 next-20170602]
>> >> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>> >>
>> >> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
>> >> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
>> >> config: arm64-allnoconfig (attached as .config)
>> >> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
>> >> reproduce:
>> >>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> >>         chmod +x ~/bin/make.cross
>> >>         # save the attached .config to linux build tree
>> >>         make.cross ARCH=arm64
>> >>
>> >> All errors (new ones prefixed by >>):
>> >>
>> >>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
>> >>>> FATAL ERROR: Unable to parse input tree
>> >
>> > We keep getting the build errors for patch submissions. Obviously the patch is
>> > still broken and can't be merged as-is. What is the plan for merging the series?
>> >
>>
>> This dts patch can be applied to dts series [1]. For upstream review
>> purpose, hi3660-hikey960 dts patches, which don't have a related
>> driver changes, are sent in [1]. Other patches, which need driver
>> changes, like this one, are sent together with driver.
>>
>> Patchset [1] is now at its v2 review. Rob Herring already gave his ACK
>> for some of them in v1. Hopefully I can get more ACK for remaining
>> ones, and make them ready for v4.13 merging window.
>>
>> [1], http://www.spinics.net/lists/devicetree/msg178303.html
>
> I don't know how you want to deal with the DTS build failure.

DTS part of this is also included in a broader Hi3660 dts patchset [1], and
was ACK'ed [2] today by HiSilicon SoC maintainer Xu Wei. Hopefully
they can land in next merge window.

[1] https://www.spinics.net/lists/arm-kernel/msg588232.html
[2] https://www.spinics.net/lists/arm-kernel/msg588686.html

-Guodong

> From a
> PCI perspective, I think I could apply patches 1 and 3 pretty easily
> by themselves.
>
> If/when you post these again, please incorporate the following
> incremental diff to clean up various whitespace and capitalization
> nits (these are spread across several of your patches).
>
>
> diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> index 68ffa0fbcd73..20357d840af1 100644
> --- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> +++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> @@ -24,8 +24,8 @@ Example based on kirin960:
>
>         pcie@f4000000 {
>                 compatible = "hisilicon,kirin-pcie";
> -               reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> -                     <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
> +               reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> +                     <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;
>                 reg-names = "dbi","apb","phy", "config";
>                 bus-range = <0x0  0x1>;
>                 #address-cells = <3>;
> @@ -46,5 +46,5 @@ Example based on kirin960:
>                          <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
>                 clock-names = "pcie_phy_ref", "pcie_aux",
>                               "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
> -               reset-gpios = <&gpio11 1 0 >;
> +               reset-gpios = <&gpio11 1 0>;
>         };
> diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> index e8feb2fb4d53..7bc89baa40ba 100644
> --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> @@ -159,12 +159,12 @@
>
>                 pcie@f4000000 {
>                         compatible = "hisilicon,kirin960-pcie";
> -                       reg = <0x0 0xf4000000 0x0 0x1000>,
> -                             <0x0 0xff3fe000 0x0 0x1000>,
> +                       reg = <0x0 0xf4000000 0x0  0x1000>,
> +                             <0x0 0xff3fe000 0x0  0x1000>,
>                               <0x0 0xf3f20000 0x0 0x40000>,
> -                             <0x0 0xF5000000 0x0 0x2000>;
> +                             <0x0 0xf5000000 0x0  0x2000>;
>                         reg-names = "dbi", "apb", "phy", "config";
> -                       bus-range = <0x0  0x1>;
> +                       bus-range = <0x0 0x1>;
>                         #address-cells = <3>;
>                         #size-cells = <2>;
>                         device_type = "pci";
> @@ -173,7 +173,7 @@
>                         num-lanes = <1>;
>                         #interrupt-cells = <1>;
>                         interrupt-map-mask = <0xf800 0 0 7>;
> -                       interrupt-map = <0x0 0 0 1 &gic 0 0 0 282 4>,
> +                       interrupt-map = <0x0 0 0 1 &gic 0 0 0  282 4>,
>                                         <0x0 0 0 2 &gic 0 0 0  283 4>,
>                                         <0x0 0 0 3 &gic 0 0 0  284 4>,
>                                         <0x0 0 0 4 &gic 0 0 0  285 4>;
> @@ -183,8 +183,9 @@
>                                  <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
>                                  <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
>                         clock-names = "pcie_phy_ref", "pcie_aux",
> -                                     "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
> -                       reset-gpios = <&gpio11 1 0 >;
> +                                     "pcie_apb_phy", "pcie_apb_sys",
> +                                     "pcie_aclk";
> +                       reset-gpios = <&gpio11 1 0>;
>                         status = "ok";
>                 };
>         };
> diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
> index f63e6548efae..41520dd1d5e5 100644
> --- a/drivers/pci/dwc/pcie-kirin.c
> +++ b/drivers/pci/dwc/pcie-kirin.c
> @@ -35,8 +35,8 @@
>  #define REF_CLK_FREQ                   100000000
>
>  /* PCIe ELBI registers */
> -#define SOC_PCIECTRL_CTRL0_ADDR        0x000
> -#define SOC_PCIECTRL_CTRL1_ADDR        0x004
> +#define SOC_PCIECTRL_CTRL0_ADDR                0x000
> +#define SOC_PCIECTRL_CTRL1_ADDR                0x004
>  #define SOC_PCIEPHY_CTRL2_ADDR         0x008
>  #define SOC_PCIEPHY_CTRL3_ADDR         0x00c
>  #define PCIE_ELBI_SLV_DBI_ENABLE       (0x1 << 21)
> @@ -48,30 +48,30 @@
>  #define PCIE_APB_PHY_STATUS0           0x400
>  #define PCIE_LINKUP_ENABLE             (0x8020)
>  #define PCIE_LTSSM_ENABLE_BIT          (0x1 << 11)
> -#define PIPE_CLK_STABLE                (0x1 << 19)
> +#define PIPE_CLK_STABLE                        (0x1 << 19)
>  #define PIPE_CLK_MAX_TRY_TIMES         10
> -#define PHY_REF_PAD_BIT                (0x1 << 8)
> +#define PHY_REF_PAD_BIT                        (0x1 << 8)
>  #define PHY_PWR_DOWN_BIT               (0x1 << 22)
> -#define PHY_RST_ACK_BIT                (0x1 << 16)
> +#define PHY_RST_ACK_BIT                        (0x1 << 16)
>
>  /* info located in sysctrl */
>  #define SCTRL_PCIE_CMOS_OFFSET         0x60
>  #define SCTRL_PCIE_CMOS_BIT            0x10
>  #define SCTRL_PCIE_ISO_OFFSET          0x44
>  #define SCTRL_PCIE_ISO_BIT             0x30
> -#define SCTRL_PCIE_HPCLK_OFFSET        0x190
> +#define SCTRL_PCIE_HPCLK_OFFSET                0x190
>  #define SCTRL_PCIE_HPCLK_BIT           0x184000
>  #define SCTRL_PCIE_OE_OFFSET           0x14a
> -#define PCIE_DEBOUNCE_PARAM            0xF0F400
> +#define PCIE_DEBOUNCE_PARAM            0xf0f400
>  #define PCIE_OE_BYPASS                 (0x3 << 28)
>
>  /* peri_crg ctrl */
>  #define CRGCTRL_PCIE_ASSERT_OFFSET     0x88
> -#define CRGCTRL_PCIE_ASSERT_BIT        0x8c000000
> +#define CRGCTRL_PCIE_ASSERT_BIT                0x8c000000
>
>  /* Time for delay */
> -#define REF_2_PERST_MIN                20000
> -#define REF_2_PERST_MAX                25000
> +#define REF_2_PERST_MIN                        20000
> +#define REF_2_PERST_MAX                        25000
>  #define PERST_2_ACCESS_MIN             10000
>  #define PERST_2_ACCESS_MAX             12000
>  #define LINK_WAIT_MIN                  900
> @@ -80,22 +80,22 @@
>  #define PIPE_CLK_WAIT_MAX              600
>
>  struct kirin_pcie {
> -       struct dw_pcie          *pci;
> -       void __iomem            *apb_base;
> -       void __iomem            *phy_base;
> -       struct regmap           *crgctrl;
> -       struct regmap           *sysctrl;
> -       struct clk              *apb_sys_clk;
> -       struct clk              *apb_phy_clk;
> -       struct clk              *phy_ref_clk;
> -       struct clk              *pcie_aclk;
> -       struct clk              *pcie_aux_clk;
> -       int                     gpio_id_reset;
> +       struct dw_pcie  *pci;
> +       void __iomem    *apb_base;
> +       void __iomem    *phy_base;
> +       struct regmap   *crgctrl;
> +       struct regmap   *sysctrl;
> +       struct clk      *apb_sys_clk;
> +       struct clk      *apb_phy_clk;
> +       struct clk      *phy_ref_clk;
> +       struct clk      *pcie_aclk;
> +       struct clk      *pcie_aux_clk;
> +       int             gpio_id_reset;
>  };
>
>  /* Registers in PCIeCTRL */
>  static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,
> -               u32 val, u32 reg)
> +                                        u32 val, u32 reg)
>  {
>         writel(val, kirin_pcie->apb_base + reg);
>  }
> @@ -107,7 +107,7 @@ static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32 reg)
>
>  /* Registers in PCIePHY */
>  static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,
> -               u32 val, u32 reg)
> +                                       u32 val, u32 reg)
>  {
>         writel(val, kirin_pcie->phy_base + reg);
>  }
> @@ -118,7 +118,7 @@ static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32 reg)
>  }
>
>  static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
> -               struct platform_device *pdev)
> +                              struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
>
> @@ -146,7 +146,7 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
>  }
>
>  static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
> -               struct platform_device *pdev)
> +                                   struct platform_device *pdev)
>  {
>         struct resource *apb;
>         struct resource *phy;
> @@ -184,7 +184,6 @@ static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
>  static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
>  {
>         u32 reg_val;
> -       u32 time = PIPE_CLK_MAX_TRY_TIMES;
>
>         reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
>         reg_val &= ~PHY_REF_PAD_BIT;
> @@ -459,7 +458,7 @@ static int kirin_pcie_probe(struct platform_device *pdev)
>         int ret;
>
>         if (!dev->of_node) {
> -               dev_err(&pdev->dev, "NULL node\n");
> +               dev_err(dev, "NULL node\n");
>                 return -EINVAL;
>         }
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-16 22:31             ` Guodong Xu
  0 siblings, 0 replies; 32+ messages in thread
From: Guodong Xu @ 2017-06-16 22:31 UTC (permalink / raw)
  To: Bjorn Helgaas, xuwei (O)
  Cc: Arnd Bergmann, kbuild test robot, Xiaowei Song, kbuild-all,
	Bjorn Helgaas, Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch,
	Niklas Cassel, Duc Dang, liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao11, Chen Feng, Wangbinghui, Suzhuangluan

Hi, Bjorn

On Sat, Jun 17, 2017 at 5:11 AM, Bjorn Helgaas <helgaas@kernel.org> wrote:
> On Tue, Jun 06, 2017 at 07:19:53PM +0800, Guodong Xu wrote:
>> Hi, Arnd
>>
>> On Tue, Jun 6, 2017 at 5:23 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> > On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp@intel.com> wrote:
>> >> Hi Xiaowei,
>> >>
>> >> [auto build test ERROR on pci/next]
>> >> [also build test ERROR on v4.12-rc3 next-20170602]
>> >> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>> >>
>> >> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
>> >> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
>> >> config: arm64-allnoconfig (attached as .config)
>> >> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
>> >> reproduce:
>> >>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> >>         chmod +x ~/bin/make.cross
>> >>         # save the attached .config to linux build tree
>> >>         make.cross ARCH=arm64
>> >>
>> >> All errors (new ones prefixed by >>):
>> >>
>> >>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
>> >>>> FATAL ERROR: Unable to parse input tree
>> >
>> > We keep getting the build errors for patch submissions. Obviously the patch is
>> > still broken and can't be merged as-is. What is the plan for merging the series?
>> >
>>
>> This dts patch can be applied to dts series [1]. For upstream review
>> purpose, hi3660-hikey960 dts patches, which don't have a related
>> driver changes, are sent in [1]. Other patches, which need driver
>> changes, like this one, are sent together with driver.
>>
>> Patchset [1] is now at its v2 review. Rob Herring already gave his ACK
>> for some of them in v1. Hopefully I can get more ACK for remaining
>> ones, and make them ready for v4.13 merging window.
>>
>> [1], http://www.spinics.net/lists/devicetree/msg178303.html
>
> I don't know how you want to deal with the DTS build failure.

DTS part of this is also included in a broader Hi3660 dts patchset [1], and
was ACK'ed [2] today by HiSilicon SoC maintainer Xu Wei. Hopefully
they can land in next merge window.

[1] https://www.spinics.net/lists/arm-kernel/msg588232.html
[2] https://www.spinics.net/lists/arm-kernel/msg588686.html

-Guodong

> From a
> PCI perspective, I think I could apply patches 1 and 3 pretty easily
> by themselves.
>
> If/when you post these again, please incorporate the following
> incremental diff to clean up various whitespace and capitalization
> nits (these are spread across several of your patches).
>
>
> diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> index 68ffa0fbcd73..20357d840af1 100644
> --- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> +++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> @@ -24,8 +24,8 @@ Example based on kirin960:
>
>         pcie@f4000000 {
>                 compatible = "hisilicon,kirin-pcie";
> -               reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> -                     <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
> +               reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> +                     <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;
>                 reg-names = "dbi","apb","phy", "config";
>                 bus-range = <0x0  0x1>;
>                 #address-cells = <3>;
> @@ -46,5 +46,5 @@ Example based on kirin960:
>                          <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
>                 clock-names = "pcie_phy_ref", "pcie_aux",
>                               "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
> -               reset-gpios = <&gpio11 1 0 >;
> +               reset-gpios = <&gpio11 1 0>;
>         };
> diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> index e8feb2fb4d53..7bc89baa40ba 100644
> --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> @@ -159,12 +159,12 @@
>
>                 pcie@f4000000 {
>                         compatible = "hisilicon,kirin960-pcie";
> -                       reg = <0x0 0xf4000000 0x0 0x1000>,
> -                             <0x0 0xff3fe000 0x0 0x1000>,
> +                       reg = <0x0 0xf4000000 0x0  0x1000>,
> +                             <0x0 0xff3fe000 0x0  0x1000>,
>                               <0x0 0xf3f20000 0x0 0x40000>,
> -                             <0x0 0xF5000000 0x0 0x2000>;
> +                             <0x0 0xf5000000 0x0  0x2000>;
>                         reg-names = "dbi", "apb", "phy", "config";
> -                       bus-range = <0x0  0x1>;
> +                       bus-range = <0x0 0x1>;
>                         #address-cells = <3>;
>                         #size-cells = <2>;
>                         device_type = "pci";
> @@ -173,7 +173,7 @@
>                         num-lanes = <1>;
>                         #interrupt-cells = <1>;
>                         interrupt-map-mask = <0xf800 0 0 7>;
> -                       interrupt-map = <0x0 0 0 1 &gic 0 0 0 282 4>,
> +                       interrupt-map = <0x0 0 0 1 &gic 0 0 0  282 4>,
>                                         <0x0 0 0 2 &gic 0 0 0  283 4>,
>                                         <0x0 0 0 3 &gic 0 0 0  284 4>,
>                                         <0x0 0 0 4 &gic 0 0 0  285 4>;
> @@ -183,8 +183,9 @@
>                                  <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
>                                  <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
>                         clock-names = "pcie_phy_ref", "pcie_aux",
> -                                     "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
> -                       reset-gpios = <&gpio11 1 0 >;
> +                                     "pcie_apb_phy", "pcie_apb_sys",
> +                                     "pcie_aclk";
> +                       reset-gpios = <&gpio11 1 0>;
>                         status = "ok";
>                 };
>         };
> diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
> index f63e6548efae..41520dd1d5e5 100644
> --- a/drivers/pci/dwc/pcie-kirin.c
> +++ b/drivers/pci/dwc/pcie-kirin.c
> @@ -35,8 +35,8 @@
>  #define REF_CLK_FREQ                   100000000
>
>  /* PCIe ELBI registers */
> -#define SOC_PCIECTRL_CTRL0_ADDR        0x000
> -#define SOC_PCIECTRL_CTRL1_ADDR        0x004
> +#define SOC_PCIECTRL_CTRL0_ADDR                0x000
> +#define SOC_PCIECTRL_CTRL1_ADDR                0x004
>  #define SOC_PCIEPHY_CTRL2_ADDR         0x008
>  #define SOC_PCIEPHY_CTRL3_ADDR         0x00c
>  #define PCIE_ELBI_SLV_DBI_ENABLE       (0x1 << 21)
> @@ -48,30 +48,30 @@
>  #define PCIE_APB_PHY_STATUS0           0x400
>  #define PCIE_LINKUP_ENABLE             (0x8020)
>  #define PCIE_LTSSM_ENABLE_BIT          (0x1 << 11)
> -#define PIPE_CLK_STABLE                (0x1 << 19)
> +#define PIPE_CLK_STABLE                        (0x1 << 19)
>  #define PIPE_CLK_MAX_TRY_TIMES         10
> -#define PHY_REF_PAD_BIT                (0x1 << 8)
> +#define PHY_REF_PAD_BIT                        (0x1 << 8)
>  #define PHY_PWR_DOWN_BIT               (0x1 << 22)
> -#define PHY_RST_ACK_BIT                (0x1 << 16)
> +#define PHY_RST_ACK_BIT                        (0x1 << 16)
>
>  /* info located in sysctrl */
>  #define SCTRL_PCIE_CMOS_OFFSET         0x60
>  #define SCTRL_PCIE_CMOS_BIT            0x10
>  #define SCTRL_PCIE_ISO_OFFSET          0x44
>  #define SCTRL_PCIE_ISO_BIT             0x30
> -#define SCTRL_PCIE_HPCLK_OFFSET        0x190
> +#define SCTRL_PCIE_HPCLK_OFFSET                0x190
>  #define SCTRL_PCIE_HPCLK_BIT           0x184000
>  #define SCTRL_PCIE_OE_OFFSET           0x14a
> -#define PCIE_DEBOUNCE_PARAM            0xF0F400
> +#define PCIE_DEBOUNCE_PARAM            0xf0f400
>  #define PCIE_OE_BYPASS                 (0x3 << 28)
>
>  /* peri_crg ctrl */
>  #define CRGCTRL_PCIE_ASSERT_OFFSET     0x88
> -#define CRGCTRL_PCIE_ASSERT_BIT        0x8c000000
> +#define CRGCTRL_PCIE_ASSERT_BIT                0x8c000000
>
>  /* Time for delay */
> -#define REF_2_PERST_MIN                20000
> -#define REF_2_PERST_MAX                25000
> +#define REF_2_PERST_MIN                        20000
> +#define REF_2_PERST_MAX                        25000
>  #define PERST_2_ACCESS_MIN             10000
>  #define PERST_2_ACCESS_MAX             12000
>  #define LINK_WAIT_MIN                  900
> @@ -80,22 +80,22 @@
>  #define PIPE_CLK_WAIT_MAX              600
>
>  struct kirin_pcie {
> -       struct dw_pcie          *pci;
> -       void __iomem            *apb_base;
> -       void __iomem            *phy_base;
> -       struct regmap           *crgctrl;
> -       struct regmap           *sysctrl;
> -       struct clk              *apb_sys_clk;
> -       struct clk              *apb_phy_clk;
> -       struct clk              *phy_ref_clk;
> -       struct clk              *pcie_aclk;
> -       struct clk              *pcie_aux_clk;
> -       int                     gpio_id_reset;
> +       struct dw_pcie  *pci;
> +       void __iomem    *apb_base;
> +       void __iomem    *phy_base;
> +       struct regmap   *crgctrl;
> +       struct regmap   *sysctrl;
> +       struct clk      *apb_sys_clk;
> +       struct clk      *apb_phy_clk;
> +       struct clk      *phy_ref_clk;
> +       struct clk      *pcie_aclk;
> +       struct clk      *pcie_aux_clk;
> +       int             gpio_id_reset;
>  };
>
>  /* Registers in PCIeCTRL */
>  static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,
> -               u32 val, u32 reg)
> +                                        u32 val, u32 reg)
>  {
>         writel(val, kirin_pcie->apb_base + reg);
>  }
> @@ -107,7 +107,7 @@ static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32 reg)
>
>  /* Registers in PCIePHY */
>  static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,
> -               u32 val, u32 reg)
> +                                       u32 val, u32 reg)
>  {
>         writel(val, kirin_pcie->phy_base + reg);
>  }
> @@ -118,7 +118,7 @@ static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32 reg)
>  }
>
>  static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
> -               struct platform_device *pdev)
> +                              struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
>
> @@ -146,7 +146,7 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
>  }
>
>  static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
> -               struct platform_device *pdev)
> +                                   struct platform_device *pdev)
>  {
>         struct resource *apb;
>         struct resource *phy;
> @@ -184,7 +184,6 @@ static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
>  static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
>  {
>         u32 reg_val;
> -       u32 time = PIPE_CLK_MAX_TRY_TIMES;
>
>         reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
>         reg_val &= ~PHY_REF_PAD_BIT;
> @@ -459,7 +458,7 @@ static int kirin_pcie_probe(struct platform_device *pdev)
>         int ret;
>
>         if (!dev->of_node) {
> -               dev_err(&pdev->dev, "NULL node\n");
> +               dev_err(dev, "NULL node\n");
>                 return -EINVAL;
>         }
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-16 23:01               ` Bjorn Helgaas
  0 siblings, 0 replies; 32+ messages in thread
From: Bjorn Helgaas @ 2017-06-16 23:01 UTC (permalink / raw)
  To: Guodong Xu
  Cc: xuwei (O),
	Arnd Bergmann, kbuild test robot, Xiaowei Song, kbuild-all,
	Bjorn Helgaas, Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch,
	Niklas Cassel, Duc Dang, liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao11, Chen Feng, Wangbinghui, Suzhuangluan,
	linux-pci, devicetree, Linux Kernel Mailing List

On Sat, Jun 17, 2017 at 06:31:59AM +0800, Guodong Xu wrote:
> Hi, Bjorn
> 
> On Sat, Jun 17, 2017 at 5:11 AM, Bjorn Helgaas <helgaas@kernel.org> wrote:
> > On Tue, Jun 06, 2017 at 07:19:53PM +0800, Guodong Xu wrote:
> >> Hi, Arnd
> >>
> >> On Tue, Jun 6, 2017 at 5:23 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> >> > On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp@intel.com> wrote:
> >> >> Hi Xiaowei,
> >> >>
> >> >> [auto build test ERROR on pci/next]
> >> >> [also build test ERROR on v4.12-rc3 next-20170602]
> >> >> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> >> >>
> >> >> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
> >> >> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
> >> >> config: arm64-allnoconfig (attached as .config)
> >> >> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> >> >> reproduce:
> >> >>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >> >>         chmod +x ~/bin/make.cross
> >> >>         # save the attached .config to linux build tree
> >> >>         make.cross ARCH=arm64
> >> >>
> >> >> All errors (new ones prefixed by >>):
> >> >>
> >> >>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
> >> >>>> FATAL ERROR: Unable to parse input tree
> >> >
> >> > We keep getting the build errors for patch submissions. Obviously the patch is
> >> > still broken and can't be merged as-is. What is the plan for merging the series?
> >> >
> >>
> >> This dts patch can be applied to dts series [1]. For upstream review
> >> purpose, hi3660-hikey960 dts patches, which don't have a related
> >> driver changes, are sent in [1]. Other patches, which need driver
> >> changes, like this one, are sent together with driver.
> >>
> >> Patchset [1] is now at its v2 review. Rob Herring already gave his ACK
> >> for some of them in v1. Hopefully I can get more ACK for remaining
> >> ones, and make them ready for v4.13 merging window.
> >>
> >> [1], http://www.spinics.net/lists/devicetree/msg178303.html
> >
> > I don't know how you want to deal with the DTS build failure.
> 
> DTS part of this is also included in a broader Hi3660 dts patchset [1], and
> was ACK'ed [2] today by HiSilicon SoC maintainer Xu Wei. Hopefully
> they can land in next merge window.
> 
> [1] https://www.spinics.net/lists/arm-kernel/msg588232.html
> [2] https://www.spinics.net/lists/arm-kernel/msg588686.html

This sounds good, but doesn't help me make progress.  I don't want to
apply [PATCH v9 2/4] because it didn't build.  I haven't seen an
updated series that *does* build.  And it probably doesn't make sense
for me to apply the arch/arm64 changes anyway because they aren't
really in the PCI purview.

If you want me to apply something, post patches 1 and 3 by themselves
with the trival updates I included.  Those are really only PCI and
should build without error.

> > From a
> > PCI perspective, I think I could apply patches 1 and 3 pretty easily
> > by themselves.
> >
> > If/when you post these again, please incorporate the following
> > incremental diff to clean up various whitespace and capitalization
> > nits (these are spread across several of your patches).
> >
> >
> > diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> > index 68ffa0fbcd73..20357d840af1 100644
> > --- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> > +++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> > @@ -24,8 +24,8 @@ Example based on kirin960:
> >
> >         pcie@f4000000 {
> >                 compatible = "hisilicon,kirin-pcie";
> > -               reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> > -                     <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
> > +               reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> > +                     <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;
> >                 reg-names = "dbi","apb","phy", "config";
> >                 bus-range = <0x0  0x1>;
> >                 #address-cells = <3>;
> > @@ -46,5 +46,5 @@ Example based on kirin960:
> >                          <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
> >                 clock-names = "pcie_phy_ref", "pcie_aux",
> >                               "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
> > -               reset-gpios = <&gpio11 1 0 >;
> > +               reset-gpios = <&gpio11 1 0>;
> >         };
> > diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> > index e8feb2fb4d53..7bc89baa40ba 100644
> > --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> > +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> > @@ -159,12 +159,12 @@
> >
> >                 pcie@f4000000 {
> >                         compatible = "hisilicon,kirin960-pcie";
> > -                       reg = <0x0 0xf4000000 0x0 0x1000>,
> > -                             <0x0 0xff3fe000 0x0 0x1000>,
> > +                       reg = <0x0 0xf4000000 0x0  0x1000>,
> > +                             <0x0 0xff3fe000 0x0  0x1000>,
> >                               <0x0 0xf3f20000 0x0 0x40000>,
> > -                             <0x0 0xF5000000 0x0 0x2000>;
> > +                             <0x0 0xf5000000 0x0  0x2000>;
> >                         reg-names = "dbi", "apb", "phy", "config";
> > -                       bus-range = <0x0  0x1>;
> > +                       bus-range = <0x0 0x1>;
> >                         #address-cells = <3>;
> >                         #size-cells = <2>;
> >                         device_type = "pci";
> > @@ -173,7 +173,7 @@
> >                         num-lanes = <1>;
> >                         #interrupt-cells = <1>;
> >                         interrupt-map-mask = <0xf800 0 0 7>;
> > -                       interrupt-map = <0x0 0 0 1 &gic 0 0 0 282 4>,
> > +                       interrupt-map = <0x0 0 0 1 &gic 0 0 0  282 4>,
> >                                         <0x0 0 0 2 &gic 0 0 0  283 4>,
> >                                         <0x0 0 0 3 &gic 0 0 0  284 4>,
> >                                         <0x0 0 0 4 &gic 0 0 0  285 4>;
> > @@ -183,8 +183,9 @@
> >                                  <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
> >                                  <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
> >                         clock-names = "pcie_phy_ref", "pcie_aux",
> > -                                     "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
> > -                       reset-gpios = <&gpio11 1 0 >;
> > +                                     "pcie_apb_phy", "pcie_apb_sys",
> > +                                     "pcie_aclk";
> > +                       reset-gpios = <&gpio11 1 0>;
> >                         status = "ok";
> >                 };
> >         };
> > diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
> > index f63e6548efae..41520dd1d5e5 100644
> > --- a/drivers/pci/dwc/pcie-kirin.c
> > +++ b/drivers/pci/dwc/pcie-kirin.c
> > @@ -35,8 +35,8 @@
> >  #define REF_CLK_FREQ                   100000000
> >
> >  /* PCIe ELBI registers */
> > -#define SOC_PCIECTRL_CTRL0_ADDR        0x000
> > -#define SOC_PCIECTRL_CTRL1_ADDR        0x004
> > +#define SOC_PCIECTRL_CTRL0_ADDR                0x000
> > +#define SOC_PCIECTRL_CTRL1_ADDR                0x004
> >  #define SOC_PCIEPHY_CTRL2_ADDR         0x008
> >  #define SOC_PCIEPHY_CTRL3_ADDR         0x00c
> >  #define PCIE_ELBI_SLV_DBI_ENABLE       (0x1 << 21)
> > @@ -48,30 +48,30 @@
> >  #define PCIE_APB_PHY_STATUS0           0x400
> >  #define PCIE_LINKUP_ENABLE             (0x8020)
> >  #define PCIE_LTSSM_ENABLE_BIT          (0x1 << 11)
> > -#define PIPE_CLK_STABLE                (0x1 << 19)
> > +#define PIPE_CLK_STABLE                        (0x1 << 19)
> >  #define PIPE_CLK_MAX_TRY_TIMES         10
> > -#define PHY_REF_PAD_BIT                (0x1 << 8)
> > +#define PHY_REF_PAD_BIT                        (0x1 << 8)
> >  #define PHY_PWR_DOWN_BIT               (0x1 << 22)
> > -#define PHY_RST_ACK_BIT                (0x1 << 16)
> > +#define PHY_RST_ACK_BIT                        (0x1 << 16)
> >
> >  /* info located in sysctrl */
> >  #define SCTRL_PCIE_CMOS_OFFSET         0x60
> >  #define SCTRL_PCIE_CMOS_BIT            0x10
> >  #define SCTRL_PCIE_ISO_OFFSET          0x44
> >  #define SCTRL_PCIE_ISO_BIT             0x30
> > -#define SCTRL_PCIE_HPCLK_OFFSET        0x190
> > +#define SCTRL_PCIE_HPCLK_OFFSET                0x190
> >  #define SCTRL_PCIE_HPCLK_BIT           0x184000
> >  #define SCTRL_PCIE_OE_OFFSET           0x14a
> > -#define PCIE_DEBOUNCE_PARAM            0xF0F400
> > +#define PCIE_DEBOUNCE_PARAM            0xf0f400
> >  #define PCIE_OE_BYPASS                 (0x3 << 28)
> >
> >  /* peri_crg ctrl */
> >  #define CRGCTRL_PCIE_ASSERT_OFFSET     0x88
> > -#define CRGCTRL_PCIE_ASSERT_BIT        0x8c000000
> > +#define CRGCTRL_PCIE_ASSERT_BIT                0x8c000000
> >
> >  /* Time for delay */
> > -#define REF_2_PERST_MIN                20000
> > -#define REF_2_PERST_MAX                25000
> > +#define REF_2_PERST_MIN                        20000
> > +#define REF_2_PERST_MAX                        25000
> >  #define PERST_2_ACCESS_MIN             10000
> >  #define PERST_2_ACCESS_MAX             12000
> >  #define LINK_WAIT_MIN                  900
> > @@ -80,22 +80,22 @@
> >  #define PIPE_CLK_WAIT_MAX              600
> >
> >  struct kirin_pcie {
> > -       struct dw_pcie          *pci;
> > -       void __iomem            *apb_base;
> > -       void __iomem            *phy_base;
> > -       struct regmap           *crgctrl;
> > -       struct regmap           *sysctrl;
> > -       struct clk              *apb_sys_clk;
> > -       struct clk              *apb_phy_clk;
> > -       struct clk              *phy_ref_clk;
> > -       struct clk              *pcie_aclk;
> > -       struct clk              *pcie_aux_clk;
> > -       int                     gpio_id_reset;
> > +       struct dw_pcie  *pci;
> > +       void __iomem    *apb_base;
> > +       void __iomem    *phy_base;
> > +       struct regmap   *crgctrl;
> > +       struct regmap   *sysctrl;
> > +       struct clk      *apb_sys_clk;
> > +       struct clk      *apb_phy_clk;
> > +       struct clk      *phy_ref_clk;
> > +       struct clk      *pcie_aclk;
> > +       struct clk      *pcie_aux_clk;
> > +       int             gpio_id_reset;
> >  };
> >
> >  /* Registers in PCIeCTRL */
> >  static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,
> > -               u32 val, u32 reg)
> > +                                        u32 val, u32 reg)
> >  {
> >         writel(val, kirin_pcie->apb_base + reg);
> >  }
> > @@ -107,7 +107,7 @@ static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32 reg)
> >
> >  /* Registers in PCIePHY */
> >  static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,
> > -               u32 val, u32 reg)
> > +                                       u32 val, u32 reg)
> >  {
> >         writel(val, kirin_pcie->phy_base + reg);
> >  }
> > @@ -118,7 +118,7 @@ static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32 reg)
> >  }
> >
> >  static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
> > -               struct platform_device *pdev)
> > +                              struct platform_device *pdev)
> >  {
> >         struct device *dev = &pdev->dev;
> >
> > @@ -146,7 +146,7 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
> >  }
> >
> >  static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
> > -               struct platform_device *pdev)
> > +                                   struct platform_device *pdev)
> >  {
> >         struct resource *apb;
> >         struct resource *phy;
> > @@ -184,7 +184,6 @@ static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
> >  static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
> >  {
> >         u32 reg_val;
> > -       u32 time = PIPE_CLK_MAX_TRY_TIMES;
> >
> >         reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
> >         reg_val &= ~PHY_REF_PAD_BIT;
> > @@ -459,7 +458,7 @@ static int kirin_pcie_probe(struct platform_device *pdev)
> >         int ret;
> >
> >         if (!dev->of_node) {
> > -               dev_err(&pdev->dev, "NULL node\n");
> > +               dev_err(dev, "NULL node\n");
> >                 return -EINVAL;
> >         }
> >

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-16 23:01               ` Bjorn Helgaas
  0 siblings, 0 replies; 32+ messages in thread
From: Bjorn Helgaas @ 2017-06-16 23:01 UTC (permalink / raw)
  To: Guodong Xu
  Cc: xuwei (O),
	Arnd Bergmann, kbuild test robot, Xiaowei Song,
	kbuild-all-JC7UmRfGjtg, Bjorn Helgaas, Kishon, Jingoo Han,
	Tomasz Nowicki, Keith Busch, Niklas Cassel, Duc Dang,
	liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao11-hv44wF8Li93QT0dZR+AlfA, Chen Feng,
	Wangbinghui, Suzhuangluan

On Sat, Jun 17, 2017 at 06:31:59AM +0800, Guodong Xu wrote:
> Hi, Bjorn
> 
> On Sat, Jun 17, 2017 at 5:11 AM, Bjorn Helgaas <helgaas-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> > On Tue, Jun 06, 2017 at 07:19:53PM +0800, Guodong Xu wrote:
> >> Hi, Arnd
> >>
> >> On Tue, Jun 6, 2017 at 5:23 PM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:
> >> > On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> >> >> Hi Xiaowei,
> >> >>
> >> >> [auto build test ERROR on pci/next]
> >> >> [also build test ERROR on v4.12-rc3 next-20170602]
> >> >> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> >> >>
> >> >> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118
> >> >> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
> >> >> config: arm64-allnoconfig (attached as .config)
> >> >> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> >> >> reproduce:
> >> >>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >> >>         chmod +x ~/bin/make.cross
> >> >>         # save the attached .config to linux build tree
> >> >>         make.cross ARCH=arm64
> >> >>
> >> >> All errors (new ones prefixed by >>):
> >> >>
> >> >>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax error
> >> >>>> FATAL ERROR: Unable to parse input tree
> >> >
> >> > We keep getting the build errors for patch submissions. Obviously the patch is
> >> > still broken and can't be merged as-is. What is the plan for merging the series?
> >> >
> >>
> >> This dts patch can be applied to dts series [1]. For upstream review
> >> purpose, hi3660-hikey960 dts patches, which don't have a related
> >> driver changes, are sent in [1]. Other patches, which need driver
> >> changes, like this one, are sent together with driver.
> >>
> >> Patchset [1] is now at its v2 review. Rob Herring already gave his ACK
> >> for some of them in v1. Hopefully I can get more ACK for remaining
> >> ones, and make them ready for v4.13 merging window.
> >>
> >> [1], http://www.spinics.net/lists/devicetree/msg178303.html
> >
> > I don't know how you want to deal with the DTS build failure.
> 
> DTS part of this is also included in a broader Hi3660 dts patchset [1], and
> was ACK'ed [2] today by HiSilicon SoC maintainer Xu Wei. Hopefully
> they can land in next merge window.
> 
> [1] https://www.spinics.net/lists/arm-kernel/msg588232.html
> [2] https://www.spinics.net/lists/arm-kernel/msg588686.html

This sounds good, but doesn't help me make progress.  I don't want to
apply [PATCH v9 2/4] because it didn't build.  I haven't seen an
updated series that *does* build.  And it probably doesn't make sense
for me to apply the arch/arm64 changes anyway because they aren't
really in the PCI purview.

If you want me to apply something, post patches 1 and 3 by themselves
with the trival updates I included.  Those are really only PCI and
should build without error.

> > From a
> > PCI perspective, I think I could apply patches 1 and 3 pretty easily
> > by themselves.
> >
> > If/when you post these again, please incorporate the following
> > incremental diff to clean up various whitespace and capitalization
> > nits (these are spread across several of your patches).
> >
> >
> > diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> > index 68ffa0fbcd73..20357d840af1 100644
> > --- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> > +++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> > @@ -24,8 +24,8 @@ Example based on kirin960:
> >
> >         pcie@f4000000 {
> >                 compatible = "hisilicon,kirin-pcie";
> > -               reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> > -                     <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
> > +               reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> > +                     <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;
> >                 reg-names = "dbi","apb","phy", "config";
> >                 bus-range = <0x0  0x1>;
> >                 #address-cells = <3>;
> > @@ -46,5 +46,5 @@ Example based on kirin960:
> >                          <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
> >                 clock-names = "pcie_phy_ref", "pcie_aux",
> >                               "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
> > -               reset-gpios = <&gpio11 1 0 >;
> > +               reset-gpios = <&gpio11 1 0>;
> >         };
> > diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> > index e8feb2fb4d53..7bc89baa40ba 100644
> > --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> > +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> > @@ -159,12 +159,12 @@
> >
> >                 pcie@f4000000 {
> >                         compatible = "hisilicon,kirin960-pcie";
> > -                       reg = <0x0 0xf4000000 0x0 0x1000>,
> > -                             <0x0 0xff3fe000 0x0 0x1000>,
> > +                       reg = <0x0 0xf4000000 0x0  0x1000>,
> > +                             <0x0 0xff3fe000 0x0  0x1000>,
> >                               <0x0 0xf3f20000 0x0 0x40000>,
> > -                             <0x0 0xF5000000 0x0 0x2000>;
> > +                             <0x0 0xf5000000 0x0  0x2000>;
> >                         reg-names = "dbi", "apb", "phy", "config";
> > -                       bus-range = <0x0  0x1>;
> > +                       bus-range = <0x0 0x1>;
> >                         #address-cells = <3>;
> >                         #size-cells = <2>;
> >                         device_type = "pci";
> > @@ -173,7 +173,7 @@
> >                         num-lanes = <1>;
> >                         #interrupt-cells = <1>;
> >                         interrupt-map-mask = <0xf800 0 0 7>;
> > -                       interrupt-map = <0x0 0 0 1 &gic 0 0 0 282 4>,
> > +                       interrupt-map = <0x0 0 0 1 &gic 0 0 0  282 4>,
> >                                         <0x0 0 0 2 &gic 0 0 0  283 4>,
> >                                         <0x0 0 0 3 &gic 0 0 0  284 4>,
> >                                         <0x0 0 0 4 &gic 0 0 0  285 4>;
> > @@ -183,8 +183,9 @@
> >                                  <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
> >                                  <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
> >                         clock-names = "pcie_phy_ref", "pcie_aux",
> > -                                     "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
> > -                       reset-gpios = <&gpio11 1 0 >;
> > +                                     "pcie_apb_phy", "pcie_apb_sys",
> > +                                     "pcie_aclk";
> > +                       reset-gpios = <&gpio11 1 0>;
> >                         status = "ok";
> >                 };
> >         };
> > diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
> > index f63e6548efae..41520dd1d5e5 100644
> > --- a/drivers/pci/dwc/pcie-kirin.c
> > +++ b/drivers/pci/dwc/pcie-kirin.c
> > @@ -35,8 +35,8 @@
> >  #define REF_CLK_FREQ                   100000000
> >
> >  /* PCIe ELBI registers */
> > -#define SOC_PCIECTRL_CTRL0_ADDR        0x000
> > -#define SOC_PCIECTRL_CTRL1_ADDR        0x004
> > +#define SOC_PCIECTRL_CTRL0_ADDR                0x000
> > +#define SOC_PCIECTRL_CTRL1_ADDR                0x004
> >  #define SOC_PCIEPHY_CTRL2_ADDR         0x008
> >  #define SOC_PCIEPHY_CTRL3_ADDR         0x00c
> >  #define PCIE_ELBI_SLV_DBI_ENABLE       (0x1 << 21)
> > @@ -48,30 +48,30 @@
> >  #define PCIE_APB_PHY_STATUS0           0x400
> >  #define PCIE_LINKUP_ENABLE             (0x8020)
> >  #define PCIE_LTSSM_ENABLE_BIT          (0x1 << 11)
> > -#define PIPE_CLK_STABLE                (0x1 << 19)
> > +#define PIPE_CLK_STABLE                        (0x1 << 19)
> >  #define PIPE_CLK_MAX_TRY_TIMES         10
> > -#define PHY_REF_PAD_BIT                (0x1 << 8)
> > +#define PHY_REF_PAD_BIT                        (0x1 << 8)
> >  #define PHY_PWR_DOWN_BIT               (0x1 << 22)
> > -#define PHY_RST_ACK_BIT                (0x1 << 16)
> > +#define PHY_RST_ACK_BIT                        (0x1 << 16)
> >
> >  /* info located in sysctrl */
> >  #define SCTRL_PCIE_CMOS_OFFSET         0x60
> >  #define SCTRL_PCIE_CMOS_BIT            0x10
> >  #define SCTRL_PCIE_ISO_OFFSET          0x44
> >  #define SCTRL_PCIE_ISO_BIT             0x30
> > -#define SCTRL_PCIE_HPCLK_OFFSET        0x190
> > +#define SCTRL_PCIE_HPCLK_OFFSET                0x190
> >  #define SCTRL_PCIE_HPCLK_BIT           0x184000
> >  #define SCTRL_PCIE_OE_OFFSET           0x14a
> > -#define PCIE_DEBOUNCE_PARAM            0xF0F400
> > +#define PCIE_DEBOUNCE_PARAM            0xf0f400
> >  #define PCIE_OE_BYPASS                 (0x3 << 28)
> >
> >  /* peri_crg ctrl */
> >  #define CRGCTRL_PCIE_ASSERT_OFFSET     0x88
> > -#define CRGCTRL_PCIE_ASSERT_BIT        0x8c000000
> > +#define CRGCTRL_PCIE_ASSERT_BIT                0x8c000000
> >
> >  /* Time for delay */
> > -#define REF_2_PERST_MIN                20000
> > -#define REF_2_PERST_MAX                25000
> > +#define REF_2_PERST_MIN                        20000
> > +#define REF_2_PERST_MAX                        25000
> >  #define PERST_2_ACCESS_MIN             10000
> >  #define PERST_2_ACCESS_MAX             12000
> >  #define LINK_WAIT_MIN                  900
> > @@ -80,22 +80,22 @@
> >  #define PIPE_CLK_WAIT_MAX              600
> >
> >  struct kirin_pcie {
> > -       struct dw_pcie          *pci;
> > -       void __iomem            *apb_base;
> > -       void __iomem            *phy_base;
> > -       struct regmap           *crgctrl;
> > -       struct regmap           *sysctrl;
> > -       struct clk              *apb_sys_clk;
> > -       struct clk              *apb_phy_clk;
> > -       struct clk              *phy_ref_clk;
> > -       struct clk              *pcie_aclk;
> > -       struct clk              *pcie_aux_clk;
> > -       int                     gpio_id_reset;
> > +       struct dw_pcie  *pci;
> > +       void __iomem    *apb_base;
> > +       void __iomem    *phy_base;
> > +       struct regmap   *crgctrl;
> > +       struct regmap   *sysctrl;
> > +       struct clk      *apb_sys_clk;
> > +       struct clk      *apb_phy_clk;
> > +       struct clk      *phy_ref_clk;
> > +       struct clk      *pcie_aclk;
> > +       struct clk      *pcie_aux_clk;
> > +       int             gpio_id_reset;
> >  };
> >
> >  /* Registers in PCIeCTRL */
> >  static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,
> > -               u32 val, u32 reg)
> > +                                        u32 val, u32 reg)
> >  {
> >         writel(val, kirin_pcie->apb_base + reg);
> >  }
> > @@ -107,7 +107,7 @@ static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32 reg)
> >
> >  /* Registers in PCIePHY */
> >  static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,
> > -               u32 val, u32 reg)
> > +                                       u32 val, u32 reg)
> >  {
> >         writel(val, kirin_pcie->phy_base + reg);
> >  }
> > @@ -118,7 +118,7 @@ static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32 reg)
> >  }
> >
> >  static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
> > -               struct platform_device *pdev)
> > +                              struct platform_device *pdev)
> >  {
> >         struct device *dev = &pdev->dev;
> >
> > @@ -146,7 +146,7 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
> >  }
> >
> >  static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
> > -               struct platform_device *pdev)
> > +                                   struct platform_device *pdev)
> >  {
> >         struct resource *apb;
> >         struct resource *phy;
> > @@ -184,7 +184,6 @@ static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
> >  static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
> >  {
> >         u32 reg_val;
> > -       u32 time = PIPE_CLK_MAX_TRY_TIMES;
> >
> >         reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);
> >         reg_val &= ~PHY_REF_PAD_BIT;
> > @@ -459,7 +458,7 @@ static int kirin_pcie_probe(struct platform_device *pdev)
> >         int ret;
> >
> >         if (!dev->of_node) {
> > -               dev_err(&pdev->dev, "NULL node\n");
> > +               dev_err(dev, "NULL node\n");
> >                 return -EINVAL;
> >         }
> >
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 32+ messages in thread

* 答复: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
  2017-06-16 21:11           ` Bjorn Helgaas
  (?)
  (?)
@ 2017-06-17  8:33           ` songxiaowei
  2017-06-17 13:39               ` Bjorn Helgaas
  -1 siblings, 1 reply; 32+ messages in thread
From: songxiaowei @ 2017-06-17  8:33 UTC (permalink / raw)
  To: Bjorn Helgaas, Guodong Xu
  Cc: Arnd Bergmann, kbuild test robot, kbuild-all, Bjorn Helgaas,
	Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch, Niklas Cassel,
	Duc Dang, liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao (F), Chenfeng (puck),
	Wangbinghui, Suzhuangluan, linux-pci, devicetree,
	Linux Kernel Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 13085 bytes --]

Hi Bjorn,



There are serval comments I can not understand, please help me to give more details.



-----邮件原件-----
发件人: Bjorn Helgaas [mailto:helgaas@kernel.org]
发送时间: 2017年6月17日 5:11
收件人: Guodong Xu
抄送: Arnd Bergmann; kbuild test robot; songxiaowei; kbuild-all@01.org; Bjorn Helgaas; Kishon; Jingoo Han; Tomasz Nowicki; Keith Busch; Niklas Cassel; Duc Dang; liudongdong (C); Gabriele Paoloni; Rob Herring; Mark Rutland; Catalin Marinas; Will Deacon; chenyao (F); Chenfeng (puck); Wangbinghui; Suzhuangluan; linux-pci; devicetree@vger.kernel.org; Linux Kernel Mailing List
主题: Re: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node



On Tue, Jun 06, 2017 at 07:19:53PM +0800, Guodong Xu wrote:

> Hi, Arnd

>

> On Tue, Jun 6, 2017 at 5:23 PM, Arnd Bergmann <arnd@arndb.de<mailto:arnd@arndb.de>> wrote:

> > On Sun, Jun 4, 2017 at 2:03 AM, kbuild test robot <lkp@intel.com<mailto:lkp@intel.com>> wrote:

> >> Hi Xiaowei,

> >>

> >> [auto build test ERROR on pci/next] [also build test ERROR on

> >> v4.12-rc3 next-20170602] [if your patch is applied to the wrong git

> >> tree, please drop us a note to help improve the system]

> >>

> >> url:    https://github.com/0day-ci/linux/commits/Xiaowei-Song/add-PCIe-driver-for-Kirin-PCIe/20170531-182118

> >> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next

> >> config: arm64-allnoconfig (attached as .config)

> >> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705

> >> reproduce:

> >>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross

> >>         chmod +x ~/bin/make.cross

> >>         # save the attached .config to linux build tree

> >>         make.cross ARCH=arm64

> >>

> >> All errors (new ones prefixed by >>):

> >>

> >>>> Error: arch/arm64/boot/dts/hisilicon/hi3660.dtsi:180.24-25 syntax

> >>>> error FATAL ERROR: Unable to parse input tree

> >

> > We keep getting the build errors for patch submissions. Obviously

> > the patch is still broken and can't be merged as-is. What is the plan for merging the series?

> >

>

> This dts patch can be applied to dts series [1]. For upstream review

> purpose, hi3660-hikey960 dts patches, which don't have a related

> driver changes, are sent in [1]. Other patches, which need driver

> changes, like this one, are sent together with driver.

>

> Patchset [1] is now at its v2 review. Rob Herring already gave his ACK

> for some of them in v1. Hopefully I can get more ACK for remaining

> ones, and make them ready for v4.13 merging window.

>

> [1], http://www.spinics.net/lists/devicetree/msg178303.html



I don't know how you want to deal with the DTS build failure.  From a PCI perspective, I think I could apply patches 1 and 3 pretty easily by themselves.



If/when you post these again, please incorporate the following incremental diff to clean up various whitespace and capitalization nits (these are spread across several of your patches).





diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt

index 68ffa0fbcd73..20357d840af1 100644

--- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt

+++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt

@@ -24,8 +24,8 @@ Example based on kirin960:

        pcie@f4000000 {

                compatible = "hisilicon,kirin-pcie";

-                 reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,

-                       <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;

+                reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,

+                      <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;

[songxiaowei] The difference is add one more space between "0x0" and "0x1000" in the first element.

             But, I can't get your mind.

                reg-names = "dbi","apb","phy", "config";

                bus-range = <0x0  0x1>;

                #address-cells = <3>;

@@ -46,5 +46,5 @@ Example based on kirin960:

                           <&crg_ctrl HI3660_ACLK_GATE_PCIE>;

                clock-names = "pcie_phy_ref", "pcie_aux",

                                "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";

-                 reset-gpios = <&gpio11 1 0 >;

+                reset-gpios = <&gpio11 1 0>;

[songxiaowei] Will do.

       };

diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi

index e8feb2fb4d53..7bc89baa40ba 100644

--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi

+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi

@@ -159,12 +159,12 @@

                 pcie@f4000000 {

                          compatible = "hisilicon,kirin960-pcie";

-                           reg = <0x0 0xf4000000 0x0 0x1000>,

-                                 <0x0 0xff3fe000 0x0 0x1000>,

+                          reg = <0x0 0xf4000000 0x0  0x1000>,

+                                <0x0 0xff3fe000 0x0  0x1000>,

[songxiaowei] Can your tell why using two spaces? Reg is listed as <addr_hi addr_lo size_hi size_lo>.

                                <0x0 0xf3f20000 0x0 0x40000>,

-                                 <0x0 0xF5000000 0x0 0x2000>;

+                                <0x0 0xf5000000 0x0  0x2000>;

                          reg-names = "dbi", "apb", "phy", "config";

-                           bus-range = <0x0  0x1>;

+                          bus-range = <0x0 0x1>;

[songxiaowei] Will do.

                          #address-cells = <3>;

                          #size-cells = <2>;

                          device_type = "pci";

@@ -173,7 +173,7 @@

                          num-lanes = <1>;

                          #interrupt-cells = <1>;

                          interrupt-map-mask = <0xf800 0 0 7>;

-                           interrupt-map = <0x0 0 0 1 &gic 0 0 0 282 4>,

+                          interrupt-map = <0x0 0 0 1 &gic 0 0 0  282 4>,

[songxiaowei] Will do.

                                            <0x0 0 0 2 &gic 0 0 0  283 4>,

                                            <0x0 0 0 3 &gic 0 0 0  284 4>,

                                            <0x0 0 0 4 &gic 0 0 0  285 4>;

@@ -183,8 +183,9 @@

                                    <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,

                                    <&crg_ctrl HI3660_ACLK_GATE_PCIE>;

                          clock-names = "pcie_phy_ref", "pcie_aux",

-                                          "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";

-                           reset-gpios = <&gpio11 1 0 >;

+                                         "pcie_apb_phy", "pcie_apb_sys",

+                                         "pcie_aclk";

+                          reset-gpios = <&gpio11 1 0>;

[songxiaowei] Will do.

                          status = "ok";

                };

       };

diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c index f63e6548efae..41520dd1d5e5 100644

--- a/drivers/pci/dwc/pcie-kirin.c

+++ b/drivers/pci/dwc/pcie-kirin.c

@@ -35,8 +35,8 @@

#define REF_CLK_FREQ                    100000000

 /* PCIe ELBI registers */

-#define SOC_PCIECTRL_CTRL0_ADDR   0x000

-#define SOC_PCIECTRL_CTRL1_ADDR   0x004

+#define SOC_PCIECTRL_CTRL0_ADDR            0x000

+#define SOC_PCIECTRL_CTRL1_ADDR            0x004

#define SOC_PCIEPHY_CTRL2_ADDR             0x008

#define SOC_PCIEPHY_CTRL3_ADDR             0x00c

#define PCIE_ELBI_SLV_DBI_ENABLE   (0x1 << 21)

@@ -48,30 +48,30 @@

#define PCIE_APB_PHY_STATUS0           0x400

#define PCIE_LINKUP_ENABLE               (0x8020)

#define PCIE_LTSSM_ENABLE_BIT                  (0x1 << 11)

-#define PIPE_CLK_STABLE                (0x1 << 19)

+#define PIPE_CLK_STABLE                        (0x1 << 19)

#define PIPE_CLK_MAX_TRY_TIMES              10

-#define PHY_REF_PAD_BIT             (0x1 << 8)

+#define PHY_REF_PAD_BIT                      (0x1 << 8)

#define PHY_PWR_DOWN_BIT              (0x1 << 22)

-#define PHY_RST_ACK_BIT              (0x1 << 16)

+#define PHY_RST_ACK_BIT                      (0x1 << 16)

 /* info located in sysctrl */

#define SCTRL_PCIE_CMOS_OFFSET               0x60

#define SCTRL_PCIE_CMOS_BIT             0x10

#define SCTRL_PCIE_ISO_OFFSET           0x44

#define SCTRL_PCIE_ISO_BIT                  0x30

-#define SCTRL_PCIE_HPCLK_OFFSET      0x190

+#define SCTRL_PCIE_HPCLK_OFFSET              0x190

#define SCTRL_PCIE_HPCLK_BIT            0x184000

#define SCTRL_PCIE_OE_OFFSET            0x14a

-#define PCIE_DEBOUNCE_PARAM                   0xF0F400

+#define PCIE_DEBOUNCE_PARAM                  0xf0f400

#define PCIE_OE_BYPASS                         (0x3 << 28)

 /* peri_crg ctrl */

#define CRGCTRL_PCIE_ASSERT_OFFSET      0x88

-#define CRGCTRL_PCIE_ASSERT_BIT     0x8c000000

+#define CRGCTRL_PCIE_ASSERT_BIT              0x8c000000

 /* Time for delay */

-#define REF_2_PERST_MIN             20000

-#define REF_2_PERST_MAX            25000

+#define REF_2_PERST_MIN                     20000

+#define REF_2_PERST_MAX                    25000

#define PERST_2_ACCESS_MIN              10000

#define PERST_2_ACCESS_MAX              12000

#define LINK_WAIT_MIN                          900

@@ -80,22 +80,22 @@

#define PIPE_CLK_WAIT_MAX                600

[songxiaowei] The space of the name of these macro definition and

the value are really different from 1 to 3 Tab, but it seem likes as bellow opened by vim.

[cid:image001.png@01D2E786.14883370]

 struct kirin_pcie {

-        struct dw_pcie                   *pci;

-        void __iomem           *apb_base;

-        void __iomem           *phy_base;

-        struct regmap           *crgctrl;

-        struct regmap                   *sysctrl;

-        struct clk           *apb_sys_clk;

-        struct clk           *apb_phy_clk;

-        struct clk           *phy_ref_clk;

-        struct clk           *pcie_aclk;

-        struct clk           *pcie_aux_clk;

-        int                       gpio_id_reset;

+       struct dw_pcie          *pci;

+       void __iomem  *apb_base;

+       void __iomem  *phy_base;

+       struct regmap *crgctrl;

+       struct regmap         *sysctrl;

+       struct clk  *apb_sys_clk;

+       struct clk  *apb_phy_clk;

+       struct clk  *phy_ref_clk;

+       struct clk  *pcie_aclk;

+       struct clk  *pcie_aux_clk;

+       int              gpio_id_reset;

};

[songxiaowei] it seems the variables list in the same coloumn with vim.

 /* Registers in PCIeCTRL */

static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie,

-                 u32 val, u32 reg)

+                                            u32 val, u32 reg)

[songxiaowei] Will do.

{

       writel(val, kirin_pcie->apb_base + reg);  } @@ -107,7 +107,7 @@ static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32 reg)

 /* Registers in PCIePHY */

static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie,

-                 u32 val, u32 reg)

+                                            u32 val, u32 reg)

[songxiaowei] Will do.

{

       writel(val, kirin_pcie->phy_base + reg);  } @@ -118,7 +118,7 @@ static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32 reg)  }

 static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,

-                 struct platform_device *pdev)

+                                 struct platform_device *pdev)

[songxiaowei] Will do.

{

       struct device *dev = &pdev->dev;

@@ -146,7 +146,7 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,  }

 static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,

-                 struct platform_device *pdev)

+                                       struct platform_device *pdev)

[songxiaowei] Will do.

{

       struct resource *apb;

       struct resource *phy;

@@ -184,7 +184,6 @@ static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,  static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)  {

       u32 reg_val;

-        u32 time = PIPE_CLK_MAX_TRY_TIMES;

[songxiaowei] Will do.

        reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1);

       reg_val &= ~PHY_REF_PAD_BIT;

@@ -459,7 +458,7 @@ static int kirin_pcie_probe(struct platform_device *pdev)

       int ret;

        if (!dev->of_node) {

-                 dev_err(&pdev->dev, "NULL node\n");

+                dev_err(dev, "NULL node\n");

[songxiaowei] Will do.

                return -EINVAL;

       }

Thanks a lot and Best wishes.

Xiaowei Song.

[-- Attachment #1.2: Type: text/html, Size: 47591 bytes --]

[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 34496 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: 答复: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
  2017-06-17  8:33           ` 答复: " songxiaowei
@ 2017-06-17 13:39               ` Bjorn Helgaas
  0 siblings, 0 replies; 32+ messages in thread
From: Bjorn Helgaas @ 2017-06-17 13:39 UTC (permalink / raw)
  To: songxiaowei
  Cc: Guodong Xu, Arnd Bergmann, kbuild test robot, kbuild-all,
	Bjorn Helgaas, Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch,
	Niklas Cassel, Duc Dang, liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao (F), Chenfeng (puck),
	Wangbinghui, Suzhuangluan, linux-pci, devicetree,
	Linux Kernel Mailing List

On Sat, Jun 17, 2017 at 08:33:08AM +0000, songxiaowei wrote:
> Hi Bjorn,
> 
> There are serval comments I can not understand, please help me to give more details.

Sure.  BTW, for some reason your response is all double-spaced, which
makes it a little hard to read.  Also, it includes HTML and an image,
which means the mailing list probably rejected it:
http://vger.kernel.org/majordomo-info.html#taboo

> diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> 
> index 68ffa0fbcd73..20357d840af1 100644
> 
> --- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> 
> +++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> 
> @@ -24,8 +24,8 @@ Example based on kirin960:
> 
>         pcie@f4000000 {
> 
>                 compatible = "hisilicon,kirin-pcie";
> 
> -                 reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> 
> -                       <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
> 
> +                reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> 
> +                      <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;
> 
> [songxiaowei] The difference is add one more space between "0x0" and "0x1000" in the first element.
> 
>              But, I can't get your mind.

It changes from this:

        reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
              <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;

to this:

        reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
              <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;

The extra space makes the elements align vertically.  Columns of
numbers are conventionally right-aligned, which makes it easier to
compare their sizes.

This hunk also changed 0xF4000000 to 0xf4000000 in the second line, so
hex constants use lower-case consistently.

> --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> 
> +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> 
> @@ -159,12 +159,12 @@
> 
>                  pcie@f4000000 {
> 
>                           compatible = "hisilicon,kirin960-pcie";
> 
> -                           reg = <0x0 0xf4000000 0x0 0x1000>,
> 
> -                                 <0x0 0xff3fe000 0x0 0x1000>,
> 
> +                          reg = <0x0 0xf4000000 0x0  0x1000>,
> 
> +                                <0x0 0xff3fe000 0x0  0x1000>,
> 
> [songxiaowei] Can your tell why using two spaces? Reg is listed as <addr_hi addr_lo size_hi size_lo>.

Again, just to make the sizes right-aligned so it's easier to compare
the sizes.

You can ignore this one if you want.  There are lots of examples in
the tree that don't align these.  I just think it looks sloppy when
things are almost but not quite aligned.

> -                                 <0x0 0xF5000000 0x0 0x2000>;
> +                                <0x0 0xf5000000 0x0  0x2000>;

Another case of making hex constants consistently lower-case.

> diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c index f63e6548efae..41520dd1d5e5 100644
> 
> --- a/drivers/pci/dwc/pcie-kirin.c
> 
> +++ b/drivers/pci/dwc/pcie-kirin.c
> 
> @@ -35,8 +35,8 @@
> 
> #define REF_CLK_FREQ                    100000000
> 
>  /* PCIe ELBI registers */
> 
> -#define SOC_PCIECTRL_CTRL0_ADDR   0x000
> 
> -#define SOC_PCIECTRL_CTRL1_ADDR   0x004
> 
> +#define SOC_PCIECTRL_CTRL0_ADDR            0x000
> 
> +#define SOC_PCIECTRL_CTRL1_ADDR            0x004
> 
> #define SOC_PCIEPHY_CTRL2_ADDR             0x008
> 
> #define SOC_PCIEPHY_CTRL3_ADDR             0x00c
> ... 
> [songxiaowei] The space of the name of these macro definition and
> 
> the value are really different from 1 to 3 Tab, but it seem likes as bellow opened by vim.
> 
> [cid:image001.png@01D2E786.14883370]

The image shows this:

  +#define REF_CLK_FREQ                   100000000
  +
  +/* PCIe ELBI registers */
  +#define SOC_PCIECTRL_CTRL0_ADDR        0x000
  +#define SOC_PCIECTRL_CTRL1_ADDR        0x004
  +#define SOC_PCIEPHY_CTRL2_ADDR         0x008
  +#define SOC_PCIEPHY_CTRL3_ADDR         0x00c

So things are nicely aligned in the *patch*.  But we don't care about
alignment in the patch.  What we want is alignment in the *file*,
which ends up looking like this with your original patch:

  #define REF_CLK_FREQ                    100000000

  /* PCIe ELBI registers */
  #define SOC_PCIECTRL_CTRL0_ADDR 0x000
  #define SOC_PCIECTRL_CTRL1_ADDR 0x004
  #define SOC_PCIEPHY_CTRL2_ADDR          0x008
  #define SOC_PCIEPHY_CTRL3_ADDR          0x00c

My incremental diff probably makes the patch look ugly, but the
resulting file looks nicer.

>  struct kirin_pcie {
> 
> -        struct dw_pcie                   *pci;
> 
> -        void __iomem           *apb_base;
> ...
> +       struct dw_pcie          *pci;
> 
> +       void __iomem  *apb_base;
> ...
> [songxiaowei] it seems the variables list in the same coloumn with vim.

Yes, these variables were aligned in your original patch; it's just
that they used two or three tabs, when one or two was sufficient.  So
there's extra separation.  Not a big deal.

Bjorn

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: 答复: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-17 13:39               ` Bjorn Helgaas
  0 siblings, 0 replies; 32+ messages in thread
From: Bjorn Helgaas @ 2017-06-17 13:39 UTC (permalink / raw)
  To: songxiaowei
  Cc: Guodong Xu, Arnd Bergmann, kbuild test robot, kbuild-all,
	Bjorn Helgaas, Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch,
	Niklas Cassel, Duc Dang, liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao (F), Chenfeng (puck),
	Wangbinghui, Suzhuangl

On Sat, Jun 17, 2017 at 08:33:08AM +0000, songxiaowei wrote:
> Hi Bjorn,
> 
> There are serval comments I can not understand, please help me to give more details.

Sure.  BTW, for some reason your response is all double-spaced, which
makes it a little hard to read.  Also, it includes HTML and an image,
which means the mailing list probably rejected it:
http://vger.kernel.org/majordomo-info.html#taboo

> diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> 
> index 68ffa0fbcd73..20357d840af1 100644
> 
> --- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> 
> +++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> 
> @@ -24,8 +24,8 @@ Example based on kirin960:
> 
>         pcie@f4000000 {
> 
>                 compatible = "hisilicon,kirin-pcie";
> 
> -                 reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> 
> -                       <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
> 
> +                reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> 
> +                      <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;
> 
> [songxiaowei] The difference is add one more space between "0x0" and "0x1000" in the first element.
> 
>              But, I can't get your mind.

It changes from this:

        reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
              <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;

to this:

        reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
              <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;

The extra space makes the elements align vertically.  Columns of
numbers are conventionally right-aligned, which makes it easier to
compare their sizes.

This hunk also changed 0xF4000000 to 0xf4000000 in the second line, so
hex constants use lower-case consistently.

> --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> 
> +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> 
> @@ -159,12 +159,12 @@
> 
>                  pcie@f4000000 {
> 
>                           compatible = "hisilicon,kirin960-pcie";
> 
> -                           reg = <0x0 0xf4000000 0x0 0x1000>,
> 
> -                                 <0x0 0xff3fe000 0x0 0x1000>,
> 
> +                          reg = <0x0 0xf4000000 0x0  0x1000>,
> 
> +                                <0x0 0xff3fe000 0x0  0x1000>,
> 
> [songxiaowei] Can your tell why using two spaces? Reg is listed as <addr_hi addr_lo size_hi size_lo>.

Again, just to make the sizes right-aligned so it's easier to compare
the sizes.

You can ignore this one if you want.  There are lots of examples in
the tree that don't align these.  I just think it looks sloppy when
things are almost but not quite aligned.

> -                                 <0x0 0xF5000000 0x0 0x2000>;
> +                                <0x0 0xf5000000 0x0  0x2000>;

Another case of making hex constants consistently lower-case.

> diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c index f63e6548efae..41520dd1d5e5 100644
> 
> --- a/drivers/pci/dwc/pcie-kirin.c
> 
> +++ b/drivers/pci/dwc/pcie-kirin.c
> 
> @@ -35,8 +35,8 @@
> 
> #define REF_CLK_FREQ                    100000000
> 
>  /* PCIe ELBI registers */
> 
> -#define SOC_PCIECTRL_CTRL0_ADDR   0x000
> 
> -#define SOC_PCIECTRL_CTRL1_ADDR   0x004
> 
> +#define SOC_PCIECTRL_CTRL0_ADDR            0x000
> 
> +#define SOC_PCIECTRL_CTRL1_ADDR            0x004
> 
> #define SOC_PCIEPHY_CTRL2_ADDR             0x008
> 
> #define SOC_PCIEPHY_CTRL3_ADDR             0x00c
> ... 
> [songxiaowei] The space of the name of these macro definition and
> 
> the value are really different from 1 to 3 Tab, but it seem likes as bellow opened by vim.
> 
> [cid:image001.png@01D2E786.14883370]

The image shows this:

  +#define REF_CLK_FREQ                   100000000
  +
  +/* PCIe ELBI registers */
  +#define SOC_PCIECTRL_CTRL0_ADDR        0x000
  +#define SOC_PCIECTRL_CTRL1_ADDR        0x004
  +#define SOC_PCIEPHY_CTRL2_ADDR         0x008
  +#define SOC_PCIEPHY_CTRL3_ADDR         0x00c

So things are nicely aligned in the *patch*.  But we don't care about
alignment in the patch.  What we want is alignment in the *file*,
which ends up looking like this with your original patch:

  #define REF_CLK_FREQ                    100000000

  /* PCIe ELBI registers */
  #define SOC_PCIECTRL_CTRL0_ADDR 0x000
  #define SOC_PCIECTRL_CTRL1_ADDR 0x004
  #define SOC_PCIEPHY_CTRL2_ADDR          0x008
  #define SOC_PCIEPHY_CTRL3_ADDR          0x00c

My incremental diff probably makes the patch look ugly, but the
resulting file looks nicer.

>  struct kirin_pcie {
> 
> -        struct dw_pcie                   *pci;
> 
> -        void __iomem           *apb_base;
> ...
> +       struct dw_pcie          *pci;
> 
> +       void __iomem  *apb_base;
> ...
> [songxiaowei] it seems the variables list in the same coloumn with vim.

Yes, these variables were aligned in your original patch; it's just
that they used two or three tabs, when one or two was sufficient.  So
there's extra separation.  Not a big deal.

Bjorn

^ permalink raw reply	[flat|nested] 32+ messages in thread

* 答复: 答复: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
  2017-06-17 13:39               ` Bjorn Helgaas
@ 2017-06-19  1:02                 ` songxiaowei
  -1 siblings, 0 replies; 32+ messages in thread
From: songxiaowei @ 2017-06-19  1:02 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Guodong Xu, Arnd Bergmann, kbuild test robot, kbuild-all,
	Bjorn Helgaas, Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch,
	Niklas Cassel, Duc Dang, liudongdong (C),
	Gabriele Paoloni  <gabriele.paoloni@huawei.com>,
	Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon,
	chenyao (F), Chenfeng (puck),
	Wangbinghui, Suzhuangluan, linux-pci, devicetree,
	Linux Kernel Mailing List

Hi Bjorn,

Thank you so much, and I'll fix these issues as soon as possible.

Best wishes,

Xiaowei.

-----邮件原件-----
发件人: Bjorn Helgaas [mailto:helgaas@kernel.org] 
发送时间: 2017年6月17日 21:40
收件人: songxiaowei
抄送: Guodong Xu; Arnd Bergmann; kbuild test robot; kbuild-all@01.org; Bjorn Helgaas; Kishon; Jingoo Han; Tomasz Nowicki; Keith Busch; Niklas Cassel; Duc Dang; liudongdong (C); Gabriele Paoloni; Rob Herring; Mark Rutland; Catalin Marinas; Will Deacon; chenyao (F); Chenfeng (puck); Wangbinghui; Suzhuangluan; linux-pci; devicetree@vger.kernel.org; Linux Kernel Mailing List
主题: Re: 答复: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node

On Sat, Jun 17, 2017 at 08:33:08AM +0000, songxiaowei wrote:
> Hi Bjorn,
> 
> There are serval comments I can not understand, please help me to give more details.

Sure.  BTW, for some reason your response is all double-spaced, which makes it a little hard to read.  Also, it includes HTML and an image, which means the mailing list probably rejected it:
http://vger.kernel.org/majordomo-info.html#taboo

> diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt 
> b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> 
> index 68ffa0fbcd73..20357d840af1 100644
> 
> --- a/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> 
> +++ b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
> 
> @@ -24,8 +24,8 @@ Example based on kirin960:
> 
>         pcie@f4000000 {
> 
>                 compatible = "hisilicon,kirin-pcie";
> 
> -                 reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
> 
> -                       <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
> 
> +                reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 
> + 0x0 0x1000>,
> 
> +                      <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 
> + 0x0 0x2000>;
> 
> [songxiaowei] The difference is add one more space between "0x0" and "0x1000" in the first element.
> 
>              But, I can't get your mind.

It changes from this:

        reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
              <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;

to this:

        reg = <0x0 0xf4000000 0x0  0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
              <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xf4000000 0x0 0x2000>;

The extra space makes the elements align vertically.  Columns of numbers are conventionally right-aligned, which makes it easier to compare their sizes.

This hunk also changed 0xF4000000 to 0xf4000000 in the second line, so hex constants use lower-case consistently.

> --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> 
> +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> 
> @@ -159,12 +159,12 @@
> 
>                  pcie@f4000000 {
> 
>                           compatible = "hisilicon,kirin960-pcie";
> 
> -                           reg = <0x0 0xf4000000 0x0 0x1000>,
> 
> -                                 <0x0 0xff3fe000 0x0 0x1000>,
> 
> +                          reg = <0x0 0xf4000000 0x0  0x1000>,
> 
> +                                <0x0 0xff3fe000 0x0  0x1000>,
> 
> [songxiaowei] Can your tell why using two spaces? Reg is listed as <addr_hi addr_lo size_hi size_lo>.

Again, just to make the sizes right-aligned so it's easier to compare the sizes.

You can ignore this one if you want.  There are lots of examples in the tree that don't align these.  I just think it looks sloppy when things are almost but not quite aligned.

> -                                 <0x0 0xF5000000 0x0 0x2000>;
> +                                <0x0 0xf5000000 0x0  0x2000>;

Another case of making hex constants consistently lower-case.

> diff --git a/drivers/pci/dwc/pcie-kirin.c 
> b/drivers/pci/dwc/pcie-kirin.c index f63e6548efae..41520dd1d5e5 100644
> 
> --- a/drivers/pci/dwc/pcie-kirin.c
> 
> +++ b/drivers/pci/dwc/pcie-kirin.c
> 
> @@ -35,8 +35,8 @@
> 
> #define REF_CLK_FREQ                    100000000
> 
>  /* PCIe ELBI registers */
> 
> -#define SOC_PCIECTRL_CTRL0_ADDR   0x000
> 
> -#define SOC_PCIECTRL_CTRL1_ADDR   0x004
> 
> +#define SOC_PCIECTRL_CTRL0_ADDR            0x000
> 
> +#define SOC_PCIECTRL_CTRL1_ADDR            0x004
> 
> #define SOC_PCIEPHY_CTRL2_ADDR             0x008
> 
> #define SOC_PCIEPHY_CTRL3_ADDR             0x00c
> ... 
> [songxiaowei] The space of the name of these macro definition and
> 
> the value are really different from 1 to 3 Tab, but it seem likes as bellow opened by vim.
> 
> [cid:image001.png@01D2E786.14883370]

The image shows this:

  +#define REF_CLK_FREQ                   100000000
  +
  +/* PCIe ELBI registers */
  +#define SOC_PCIECTRL_CTRL0_ADDR        0x000
  +#define SOC_PCIECTRL_CTRL1_ADDR        0x004
  +#define SOC_PCIEPHY_CTRL2_ADDR         0x008
  +#define SOC_PCIEPHY_CTRL3_ADDR         0x00c

So things are nicely aligned in the *patch*.  But we don't care about alignment in the patch.  What we want is alignment in the *file*, which ends up looking like this with your original patch:

  #define REF_CLK_FREQ                    100000000

  /* PCIe ELBI registers */
  #define SOC_PCIECTRL_CTRL0_ADDR 0x000
  #define SOC_PCIECTRL_CTRL1_ADDR 0x004
  #define SOC_PCIEPHY_CTRL2_ADDR          0x008
  #define SOC_PCIEPHY_CTRL3_ADDR          0x00c

My incremental diff probably makes the patch look ugly, but the resulting file looks nicer.

>  struct kirin_pcie {
> 
> -        struct dw_pcie                   *pci;
> 
> -        void __iomem           *apb_base;
> ...
> +       struct dw_pcie          *pci;
> 
> +       void __iomem  *apb_base;
> ...
> [songxiaowei] it seems the variables list in the same coloumn with vim.

Yes, these variables were aligned in your original patch; it's just that they used two or three tabs, when one or two was sufficient.  So there's extra separation.  Not a big deal.

Bjorn

^ permalink raw reply	[flat|nested] 32+ messages in thread

* 答复: 答复: [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node
@ 2017-06-19  1:02                 ` songxiaowei
  0 siblings, 0 replies; 32+ messages in thread
From: songxiaowei @ 2017-06-19  1:02 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Guodong Xu, Arnd Bergmann, kbuild test robot, kbuild-all,
	Bjorn Helgaas, Kishon, Jingoo Han, Tomasz Nowicki, Keith Busch,
	Niklas Cassel, Duc Dang, liudongdong (C),
	Gabriele Paoloni, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, chenyao (F), Chenfeng (puck),
	Wangbinghui, Suzhuangluan, linux-pci, devicetree,
	Linux Kernel Mailing List

SGkgQmpvcm4sDQoNClRoYW5rIHlvdSBzbyBtdWNoLCBhbmQgSSdsbCBmaXggdGhlc2UgaXNzdWVz
IGFzIHNvb24gYXMgcG9zc2libGUuDQoNCkJlc3Qgd2lzaGVzLA0KDQpYaWFvd2VpLg0KDQotLS0t
LdPKvP7Urbz+LS0tLS0NCreivP7IyzogQmpvcm4gSGVsZ2FhcyBbbWFpbHRvOmhlbGdhYXNAa2Vy
bmVsLm9yZ10gDQq3osvNyrG85DogMjAxN8TqNtTCMTfI1SAyMTo0MA0KytW8/sjLOiBzb25neGlh
b3dlaQ0Ks63LzTogR3VvZG9uZyBYdTsgQXJuZCBCZXJnbWFubjsga2J1aWxkIHRlc3Qgcm9ib3Q7
IGtidWlsZC1hbGxAMDEub3JnOyBCam9ybiBIZWxnYWFzOyBLaXNob247IEppbmdvbyBIYW47IFRv
bWFzeiBOb3dpY2tpOyBLZWl0aCBCdXNjaDsgTmlrbGFzIENhc3NlbDsgRHVjIERhbmc7IGxpdWRv
bmdkb25nIChDKTsgR2FicmllbGUgUGFvbG9uaTsgUm9iIEhlcnJpbmc7IE1hcmsgUnV0bGFuZDsg
Q2F0YWxpbiBNYXJpbmFzOyBXaWxsIERlYWNvbjsgY2hlbnlhbyAoRik7IENoZW5mZW5nIChwdWNr
KTsgV2FuZ2JpbmdodWk7IFN1emh1YW5nbHVhbjsgbGludXgtcGNpOyBkZXZpY2V0cmVlQHZnZXIu
a2VybmVsLm9yZzsgTGludXggS2VybmVsIE1haWxpbmcgTGlzdA0K1vfM4jogUmU6ILTwuLQ6IFtQ
QVRDSCB2OSAyLzRdIGFybTY0OiBkdHM6IGhpc2k6IGFkZCBraXJpbiBwY2llIG5vZGUNCg0KT24g
U2F0LCBKdW4gMTcsIDIwMTcgYXQgMDg6MzM6MDhBTSArMDAwMCwgc29uZ3hpYW93ZWkgd3JvdGU6
DQo+IEhpIEJqb3JuLA0KPiANCj4gVGhlcmUgYXJlIHNlcnZhbCBjb21tZW50cyBJIGNhbiBub3Qg
dW5kZXJzdGFuZCwgcGxlYXNlIGhlbHAgbWUgdG8gZ2l2ZSBtb3JlIGRldGFpbHMuDQoNClN1cmUu
ICBCVFcsIGZvciBzb21lIHJlYXNvbiB5b3VyIHJlc3BvbnNlIGlzIGFsbCBkb3VibGUtc3BhY2Vk
LCB3aGljaCBtYWtlcyBpdCBhIGxpdHRsZSBoYXJkIHRvIHJlYWQuICBBbHNvLCBpdCBpbmNsdWRl
cyBIVE1MIGFuZCBhbiBpbWFnZSwgd2hpY2ggbWVhbnMgdGhlIG1haWxpbmcgbGlzdCBwcm9iYWJs
eSByZWplY3RlZCBpdDoNCmh0dHA6Ly92Z2VyLmtlcm5lbC5vcmcvbWFqb3Jkb21vLWluZm8uaHRt
bCN0YWJvbw0KDQo+IGRpZmYgLS1naXQgYS9Eb2N1bWVudGF0aW9uL2RldmljZXRyZWUvYmluZGlu
Z3MvcGNpL2tpcmluLXBjaWUudHh0IA0KPiBiL0RvY3VtZW50YXRpb24vZGV2aWNldHJlZS9iaW5k
aW5ncy9wY2kva2lyaW4tcGNpZS50eHQNCj4gDQo+IGluZGV4IDY4ZmZhMGZiY2Q3My4uMjAzNTdk
ODQwYWYxIDEwMDY0NA0KPiANCj4gLS0tIGEvRG9jdW1lbnRhdGlvbi9kZXZpY2V0cmVlL2JpbmRp
bmdzL3BjaS9raXJpbi1wY2llLnR4dA0KPiANCj4gKysrIGIvRG9jdW1lbnRhdGlvbi9kZXZpY2V0
cmVlL2JpbmRpbmdzL3BjaS9raXJpbi1wY2llLnR4dA0KPiANCj4gQEAgLTI0LDggKzI0LDggQEAg
RXhhbXBsZSBiYXNlZCBvbiBraXJpbjk2MDoNCj4gDQo+ICAgICAgICAgcGNpZUBmNDAwMDAwMCB7
DQo+IA0KPiAgICAgICAgICAgICAgICAgY29tcGF0aWJsZSA9ICJoaXNpbGljb24sa2lyaW4tcGNp
ZSI7DQo+IA0KPiAtICAgICAgICAgICAgICAgICByZWcgPSA8MHgwIDB4ZjQwMDAwMDAgMHgwIDB4
MTAwMD4sIDwweDAgMHhmZjNmZTAwMCAweDAgMHgxMDAwPiwNCj4gDQo+IC0gICAgICAgICAgICAg
ICAgICAgICAgIDwweDAgMHhmM2YyMDAwMCAweDAgMHg0MDAwMD4sIDwweDAgMHhGNDAwMDAwMCAw
IDB4MjAwMD47DQo+IA0KPiArICAgICAgICAgICAgICAgIHJlZyA9IDwweDAgMHhmNDAwMDAwMCAw
eDAgIDB4MTAwMD4sIDwweDAgMHhmZjNmZTAwMCANCj4gKyAweDAgMHgxMDAwPiwNCj4gDQo+ICsg
ICAgICAgICAgICAgICAgICAgICAgPDB4MCAweGYzZjIwMDAwIDB4MCAweDQwMDAwPiwgPDB4MCAw
eGY0MDAwMDAwIA0KPiArIDB4MCAweDIwMDA+Ow0KPiANCj4gW3Nvbmd4aWFvd2VpXSBUaGUgZGlm
ZmVyZW5jZSBpcyBhZGQgb25lIG1vcmUgc3BhY2UgYmV0d2VlbiAiMHgwIiBhbmQgIjB4MTAwMCIg
aW4gdGhlIGZpcnN0IGVsZW1lbnQuDQo+IA0KPiAgICAgICAgICAgICAgQnV0LCBJIGNhbid0IGdl
dCB5b3VyIG1pbmQuDQoNCkl0IGNoYW5nZXMgZnJvbSB0aGlzOg0KDQogICAgICAgIHJlZyA9IDww
eDAgMHhmNDAwMDAwMCAweDAgMHgxMDAwPiwgPDB4MCAweGZmM2ZlMDAwIDB4MCAweDEwMDA+LA0K
ICAgICAgICAgICAgICA8MHgwIDB4ZjNmMjAwMDAgMHgwIDB4NDAwMDA+LCA8MHgwIDB4RjQwMDAw
MDAgMCAweDIwMDA+Ow0KDQp0byB0aGlzOg0KDQogICAgICAgIHJlZyA9IDwweDAgMHhmNDAwMDAw
MCAweDAgIDB4MTAwMD4sIDwweDAgMHhmZjNmZTAwMCAweDAgMHgxMDAwPiwNCiAgICAgICAgICAg
ICAgPDB4MCAweGYzZjIwMDAwIDB4MCAweDQwMDAwPiwgPDB4MCAweGY0MDAwMDAwIDB4MCAweDIw
MDA+Ow0KDQpUaGUgZXh0cmEgc3BhY2UgbWFrZXMgdGhlIGVsZW1lbnRzIGFsaWduIHZlcnRpY2Fs
bHkuICBDb2x1bW5zIG9mIG51bWJlcnMgYXJlIGNvbnZlbnRpb25hbGx5IHJpZ2h0LWFsaWduZWQs
IHdoaWNoIG1ha2VzIGl0IGVhc2llciB0byBjb21wYXJlIHRoZWlyIHNpemVzLg0KDQpUaGlzIGh1
bmsgYWxzbyBjaGFuZ2VkIDB4RjQwMDAwMDAgdG8gMHhmNDAwMDAwMCBpbiB0aGUgc2Vjb25kIGxp
bmUsIHNvIGhleCBjb25zdGFudHMgdXNlIGxvd2VyLWNhc2UgY29uc2lzdGVudGx5Lg0KDQo+IC0t
LSBhL2FyY2gvYXJtNjQvYm9vdC9kdHMvaGlzaWxpY29uL2hpMzY2MC5kdHNpDQo+IA0KPiArKysg
Yi9hcmNoL2FybTY0L2Jvb3QvZHRzL2hpc2lsaWNvbi9oaTM2NjAuZHRzaQ0KPiANCj4gQEAgLTE1
OSwxMiArMTU5LDEyIEBADQo+IA0KPiAgICAgICAgICAgICAgICAgIHBjaWVAZjQwMDAwMDAgew0K
PiANCj4gICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wYXRpYmxlID0gImhpc2lsaWNvbixr
aXJpbjk2MC1wY2llIjsNCj4gDQo+IC0gICAgICAgICAgICAgICAgICAgICAgICAgICByZWcgPSA8
MHgwIDB4ZjQwMDAwMDAgMHgwIDB4MTAwMD4sDQo+IA0KPiAtICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgPDB4MCAweGZmM2ZlMDAwIDB4MCAweDEwMDA+LA0KPiANCj4gKyAgICAgICAg
ICAgICAgICAgICAgICAgICAgcmVnID0gPDB4MCAweGY0MDAwMDAwIDB4MCAgMHgxMDAwPiwNCj4g
DQo+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwweDAgMHhmZjNmZTAwMCAweDAg
IDB4MTAwMD4sDQo+IA0KPiBbc29uZ3hpYW93ZWldIENhbiB5b3VyIHRlbGwgd2h5IHVzaW5nIHR3
byBzcGFjZXM/IFJlZyBpcyBsaXN0ZWQgYXMgPGFkZHJfaGkgYWRkcl9sbyBzaXplX2hpIHNpemVf
bG8+Lg0KDQpBZ2FpbiwganVzdCB0byBtYWtlIHRoZSBzaXplcyByaWdodC1hbGlnbmVkIHNvIGl0
J3MgZWFzaWVyIHRvIGNvbXBhcmUgdGhlIHNpemVzLg0KDQpZb3UgY2FuIGlnbm9yZSB0aGlzIG9u
ZSBpZiB5b3Ugd2FudC4gIFRoZXJlIGFyZSBsb3RzIG9mIGV4YW1wbGVzIGluIHRoZSB0cmVlIHRo
YXQgZG9uJ3QgYWxpZ24gdGhlc2UuICBJIGp1c3QgdGhpbmsgaXQgbG9va3Mgc2xvcHB5IHdoZW4g
dGhpbmdzIGFyZSBhbG1vc3QgYnV0IG5vdCBxdWl0ZSBhbGlnbmVkLg0KDQo+IC0gICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICA8MHgwIDB4RjUwMDAwMDAgMHgwIDB4MjAwMD47DQo+ICsg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwweDAgMHhmNTAwMDAwMCAweDAgIDB4MjAw
MD47DQoNCkFub3RoZXIgY2FzZSBvZiBtYWtpbmcgaGV4IGNvbnN0YW50cyBjb25zaXN0ZW50bHkg
bG93ZXItY2FzZS4NCg0KPiBkaWZmIC0tZ2l0IGEvZHJpdmVycy9wY2kvZHdjL3BjaWUta2lyaW4u
YyANCj4gYi9kcml2ZXJzL3BjaS9kd2MvcGNpZS1raXJpbi5jIGluZGV4IGY2M2U2NTQ4ZWZhZS4u
NDE1MjBkZDFkNWU1IDEwMDY0NA0KPiANCj4gLS0tIGEvZHJpdmVycy9wY2kvZHdjL3BjaWUta2ly
aW4uYw0KPiANCj4gKysrIGIvZHJpdmVycy9wY2kvZHdjL3BjaWUta2lyaW4uYw0KPiANCj4gQEAg
LTM1LDggKzM1LDggQEANCj4gDQo+ICNkZWZpbmUgUkVGX0NMS19GUkVRICAgICAgICAgICAgICAg
ICAgICAxMDAwMDAwMDANCj4gDQo+ICAvKiBQQ0llIEVMQkkgcmVnaXN0ZXJzICovDQo+IA0KPiAt
I2RlZmluZSBTT0NfUENJRUNUUkxfQ1RSTDBfQUREUiAgIDB4MDAwDQo+IA0KPiAtI2RlZmluZSBT
T0NfUENJRUNUUkxfQ1RSTDFfQUREUiAgIDB4MDA0DQo+IA0KPiArI2RlZmluZSBTT0NfUENJRUNU
UkxfQ1RSTDBfQUREUiAgICAgICAgICAgIDB4MDAwDQo+IA0KPiArI2RlZmluZSBTT0NfUENJRUNU
UkxfQ1RSTDFfQUREUiAgICAgICAgICAgIDB4MDA0DQo+IA0KPiAjZGVmaW5lIFNPQ19QQ0lFUEhZ
X0NUUkwyX0FERFIgICAgICAgICAgICAgMHgwMDgNCj4gDQo+ICNkZWZpbmUgU09DX1BDSUVQSFlf
Q1RSTDNfQUREUiAgICAgICAgICAgICAweDAwYw0KPiAuLi4gDQo+IFtzb25neGlhb3dlaV0gVGhl
IHNwYWNlIG9mIHRoZSBuYW1lIG9mIHRoZXNlIG1hY3JvIGRlZmluaXRpb24gYW5kDQo+IA0KPiB0
aGUgdmFsdWUgYXJlIHJlYWxseSBkaWZmZXJlbnQgZnJvbSAxIHRvIDMgVGFiLCBidXQgaXQgc2Vl
bSBsaWtlcyBhcyBiZWxsb3cgb3BlbmVkIGJ5IHZpbS4NCj4gDQo+IFtjaWQ6aW1hZ2UwMDEucG5n
QDAxRDJFNzg2LjE0ODgzMzcwXQ0KDQpUaGUgaW1hZ2Ugc2hvd3MgdGhpczoNCg0KICArI2RlZmlu
ZSBSRUZfQ0xLX0ZSRVEgICAgICAgICAgICAgICAgICAgMTAwMDAwMDAwDQogICsNCiAgKy8qIFBD
SWUgRUxCSSByZWdpc3RlcnMgKi8NCiAgKyNkZWZpbmUgU09DX1BDSUVDVFJMX0NUUkwwX0FERFIg
ICAgICAgIDB4MDAwDQogICsjZGVmaW5lIFNPQ19QQ0lFQ1RSTF9DVFJMMV9BRERSICAgICAgICAw
eDAwNA0KICArI2RlZmluZSBTT0NfUENJRVBIWV9DVFJMMl9BRERSICAgICAgICAgMHgwMDgNCiAg
KyNkZWZpbmUgU09DX1BDSUVQSFlfQ1RSTDNfQUREUiAgICAgICAgIDB4MDBjDQoNClNvIHRoaW5n
cyBhcmUgbmljZWx5IGFsaWduZWQgaW4gdGhlICpwYXRjaCouICBCdXQgd2UgZG9uJ3QgY2FyZSBh
Ym91dCBhbGlnbm1lbnQgaW4gdGhlIHBhdGNoLiAgV2hhdCB3ZSB3YW50IGlzIGFsaWdubWVudCBp
biB0aGUgKmZpbGUqLCB3aGljaCBlbmRzIHVwIGxvb2tpbmcgbGlrZSB0aGlzIHdpdGggeW91ciBv
cmlnaW5hbCBwYXRjaDoNCg0KICAjZGVmaW5lIFJFRl9DTEtfRlJFUSAgICAgICAgICAgICAgICAg
ICAgMTAwMDAwMDAwDQoNCiAgLyogUENJZSBFTEJJIHJlZ2lzdGVycyAqLw0KICAjZGVmaW5lIFNP
Q19QQ0lFQ1RSTF9DVFJMMF9BRERSIDB4MDAwDQogICNkZWZpbmUgU09DX1BDSUVDVFJMX0NUUkwx
X0FERFIgMHgwMDQNCiAgI2RlZmluZSBTT0NfUENJRVBIWV9DVFJMMl9BRERSICAgICAgICAgIDB4
MDA4DQogICNkZWZpbmUgU09DX1BDSUVQSFlfQ1RSTDNfQUREUiAgICAgICAgICAweDAwYw0KDQpN
eSBpbmNyZW1lbnRhbCBkaWZmIHByb2JhYmx5IG1ha2VzIHRoZSBwYXRjaCBsb29rIHVnbHksIGJ1
dCB0aGUgcmVzdWx0aW5nIGZpbGUgbG9va3MgbmljZXIuDQoNCj4gIHN0cnVjdCBraXJpbl9wY2ll
IHsNCj4gDQo+IC0gICAgICAgIHN0cnVjdCBkd19wY2llICAgICAgICAgICAgICAgICAgICpwY2k7
DQo+IA0KPiAtICAgICAgICB2b2lkIF9faW9tZW0gICAgICAgICAgICphcGJfYmFzZTsNCj4gLi4u
DQo+ICsgICAgICAgc3RydWN0IGR3X3BjaWUgICAgICAgICAgKnBjaTsNCj4gDQo+ICsgICAgICAg
dm9pZCBfX2lvbWVtICAqYXBiX2Jhc2U7DQo+IC4uLg0KPiBbc29uZ3hpYW93ZWldIGl0IHNlZW1z
IHRoZSB2YXJpYWJsZXMgbGlzdCBpbiB0aGUgc2FtZSBjb2xvdW1uIHdpdGggdmltLg0KDQpZZXMs
IHRoZXNlIHZhcmlhYmxlcyB3ZXJlIGFsaWduZWQgaW4geW91ciBvcmlnaW5hbCBwYXRjaDsgaXQn
cyBqdXN0IHRoYXQgdGhleSB1c2VkIHR3byBvciB0aHJlZSB0YWJzLCB3aGVuIG9uZSBvciB0d28g
d2FzIHN1ZmZpY2llbnQuICBTbyB0aGVyZSdzIGV4dHJhIHNlcGFyYXRpb24uICBOb3QgYSBiaWcg
ZGVhbC4NCg0KQmpvcm4NCg==

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2017-06-19  1:02 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31  7:01 [PATCH v9 0/4] add PCIe driver for Kirin PCIe Xiaowei Song
2017-05-31  7:01 ` Xiaowei Song
2017-05-31  7:01 ` [PATCH v9 1/4] PCI: hisi: Add DT binding for PCIe of Kirin SoC series Xiaowei Song
2017-05-31  7:01   ` Xiaowei Song
2017-06-07 21:23   ` Rob Herring
2017-06-07 21:23     ` Rob Herring
2017-06-08  1:04     ` 答复: " songxiaowei
2017-05-31  7:01 ` [PATCH v9 2/4] arm64: dts: hisi: add kirin pcie node Xiaowei Song
2017-05-31  7:01   ` Xiaowei Song
2017-06-04  0:03   ` kbuild test robot
2017-06-04  0:03     ` kbuild test robot
2017-06-06  9:23     ` Arnd Bergmann
2017-06-06  9:23       ` Arnd Bergmann
2017-06-06 11:19       ` Guodong Xu
2017-06-06 11:19         ` Guodong Xu
2017-06-16 21:11         ` Bjorn Helgaas
2017-06-16 21:11           ` Bjorn Helgaas
2017-06-16 22:31           ` Guodong Xu
2017-06-16 22:31             ` Guodong Xu
2017-06-16 23:01             ` Bjorn Helgaas
2017-06-16 23:01               ` Bjorn Helgaas
2017-06-17  8:33           ` 答复: " songxiaowei
2017-06-17 13:39             ` Bjorn Helgaas
2017-06-17 13:39               ` Bjorn Helgaas
2017-06-19  1:02               ` 答复: " songxiaowei
2017-06-19  1:02                 ` songxiaowei
2017-05-31  7:01 ` [PATCH v9 3/4] PCI: dwc: kirin: add PCIe Driver for HiSilicon Kirin SoC Xiaowei Song
2017-05-31  7:01   ` Xiaowei Song
2017-05-31 17:00   ` Jingoo Han
2017-05-31 17:00     ` Jingoo Han
2017-05-31  7:01 ` [PATCH v9 4/4] ARM64: defconfig: Enable Kirin PCIe Xiaowei Song
2017-05-31  7:01   ` Xiaowei Song

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.