Add the Mobiveil EP and Layerscape Gen4 EP driver support
Subsystems (7)
v2 cover Add the Mobiveil EP and Layerscape Gen4 EP driver support
This patch set are for adding Mobiveil EP driver and adding PCIe Gen4 EP driver of NXP Layerscape platform.
This patch set depends on:
https://patchwork.kernel.org/project/linux-pci/list/?series=159139
Xiaowei Bao (6):
PCI: mobiveil: Add the EP driver support
dt-bindings: Add DT binding for PCIE GEN4 EP of the layerscape
PCI: mobiveil: Add PCIe Gen4 EP driver for NXP Layerscape SoCs
PCI: mobiveil: Add workaround for unsupported request error
arm64: dts: lx2160a: Add PCIe EP node
misc: pci_endpoint_test: Add the layerscape PCIe GEN4 EP device
support
.../bindings/pci/layerscape-pcie-gen4.txt | 27 +- MAINTAINERS | 3 + arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi | 56 ++ drivers/misc/pci_endpoint_test.c | 2 + drivers/pci/controller/mobiveil/Kconfig | 22 +- drivers/pci/controller/mobiveil/Makefile | 2 + .../controller/mobiveil/pcie-layerscape-gen4-ep.c | 169 ++++++ drivers/pci/controller/mobiveil/pcie-mobiveil-ep.c | 569 +++++++++++++++++++++ drivers/pci/controller/mobiveil/pcie-mobiveil.c | 99 +++- drivers/pci/controller/mobiveil/pcie-mobiveil.h | 72 +++ 10 files changed, 1009 insertions(+), 12 deletions(-) create mode 100644 drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c create mode 100644 drivers/pci/controller/mobiveil/pcie-mobiveil-ep.c
Signature · 1 line
2.9.5
PATCH v2 1/6 PCI: mobiveil: Add the EP driver support
Add the EP driver support for Mobiveil base on endpoint framework.
---
v2:
- Modify the Copyright.
MAINTAINERS | 1 + drivers/pci/controller/mobiveil/Kconfig | 5 + drivers/pci/controller/mobiveil/Makefile | 1 + drivers/pci/controller/mobiveil/pcie-mobiveil-ep.c | 569 +++++++++++++++++++++ drivers/pci/controller/mobiveil/pcie-mobiveil.c | 99 +++- drivers/pci/controller/mobiveil/pcie-mobiveil.h | 68 +++ 6 files changed, 735 insertions(+), 8 deletions(-) create mode 100644 drivers/pci/controller/mobiveil/pcie-mobiveil-ep.c
MAINTAINERS +1 -0
@@ -12409,6 +12409,7 @@ F: drivers/ntb/hw/mscc/ PCI DRIVER FOR MOBIVEIL PCIE IP M: Karthikeyan Mitran <[email protected]> M: Hou Zhiqiang <[email protected]> +M: Xiaowei Bao <[email protected]> L: [email protected] S: Supported F: Documentation/devicetree/bindings/pci/mobiveil-pcie.txt
drivers/pci/controller/mobiveil/Kconfig +5 -0
@@ -11,6 +11,11 @@ config PCIE_MOBIVEIL_HOST depends on PCI_MSI_IRQ_DOMAIN select PCIE_MOBIVEIL +config PCIE_MOBIVEIL_EP + bool + depends on PCI_ENDPOINT + select PCIE_MOBIVEIL + config PCIE_MOBIVEIL_PLAT bool "Mobiveil AXI PCIe controller" depends on ARCH_ZYNQMP || COMPILE_TEST
drivers/pci/controller/mobiveil/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_PCIE_MOBIVEIL) += pcie-mobiveil.o obj-$(CONFIG_PCIE_MOBIVEIL_HOST) += pcie-mobiveil-host.o +obj-$(CONFIG_PCIE_MOBIVEIL_EP) += pcie-mobiveil-ep.o obj-$(CONFIG_PCIE_MOBIVEIL_PLAT) += pcie-mobiveil-plat.o obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie-layerscape-gen4.o
drivers/pci/controller/mobiveil/pcie-mobiveil-ep.c new file +569 -0
569 lines not on this page · raw message
drivers/pci/controller/mobiveil/pcie-mobiveil.c +91 -8
125 lines not on this page · raw message
drivers/pci/controller/mobiveil/pcie-mobiveil.h +68 -0
124 lines not on this page · raw message
Signature · 1 line
2.9.5
PATCH v2 2/6 dt-bindings: Add DT binding for PCIE GEN4 EP of the layerscape
In reply to Xiaowei BaoAdd the documentation for the Device Tree binding of the layerscape PCIe GEN4 controller with EP mode.
---
v2:
- remove the status entry in EP Example.
.../bindings/pci/layerscape-pcie-gen4.txt | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +26 -1
@@ -3,6 +3,8 @@ NXP Layerscape PCIe Gen4 controller This PCIe controller is based on the Mobiveil PCIe IP and thus inherits all the common properties defined in mobiveil-pcie.txt. +HOST MODE +========= Required properties: - compatible: should contain the platform identifier such as: "fsl,lx2160a-pcie"
@@ -23,7 +25,20 @@ Required properties: - msi-parent : See the generic MSI binding described in Documentation/devicetree/bindings/interrupt-controller/msi.txt. -Example: +DEVICE MODE +========= +Required properties: +- compatible: should contain the platform identifier such as: + "fsl,lx2160a-pcie-ep" +- reg: base addresses and lengths of the PCIe controller register blocks. + "regs": PCIe controller registers. + "addr_space" EP device CPU address. +- apio-wins: number of requested apio outbound windows. + +Optional Property: +- max-functions: Maximum number of functions that can be configured (default 1). + +RC Example: pcie@3400000 { compatible = "fsl,lx2160a-pcie";
@@ -50,3 +65,13 @@ Example: <0000 0 0 3 &gic 0 0 GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>, <0000 0 0 4 &gic 0 0 GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>; }; + +EP Example: + + pcie_ep@3400000 { + compatible = "fsl,lx2160a-pcie-ep"; + reg = <0x00 0x03400000 0x0 0x00100000 + 0x80 0x00000000 0x8 0x00000000>; + reg-names = "regs", "addr_space"; + apio-wins = <8>; + };
Signature · 1 line
2.9.5
Rob Herring
maintainerRe: [PATCH v2 2/6] dt-bindings: Add DT binding for PCIE GEN4 EP of the layerscape
Quoted 47 lines · Xiaowei Bao
Add the documentation for the Device Tree binding of the layerscape PCIe GEN4 controller with EP mode.
Signed-off-by Xiaowei Bao <[email protected]>---
v2:
- remove the status entry in EP Example..../bindings/pci/layerscape-pcie-gen4.txt | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +16
-1@@ -3,6 +3,8 @@ NXP Layerscape PCIe Gen4 controller This PCIe controller is based on the Mobiveil PCIe IP and thus inherits all the common properties defined in mobiveil-pcie.txt. +HOST MODE +========= Required properties: - compatible: should contain the platform identifier such as: "fsl,lx2160a-pcie"@@ -23,7 +25,20 @@ Required properties: - msi-parent : See the generic MSI binding described in Documentation/devicetree/bindings/interrupt-controller/msi.txt. -Example: +DEVICE MODE +========= +Required properties: +- compatible: should contain the platform identifier such as: + "fsl,lx2160a-pcie-ep" +- reg: base addresses and lengths of the PCIe controller register blocks. + "regs": PCIe controller registers. + "addr_space" EP device CPU address. +- apio-wins: number of requested apio outbound windows. + +Optional Property: +- max-functions: Maximum number of functions that can be configured (default 1). + +RC Example: pcie@3400000 { compatible = "fsl,lx2160a-pcie";
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt Example: · line 71
Quoted 7 lines
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +4
-0@@ -50,3 +65,13 @@ Example: <0000 0 0 3 &gic 0 0 GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>, <0000 0 0 4 &gic 0 0 GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>; }; + +EP Example: + + pcie_ep@3400000 {
To repeat my previous comment:
pcie-endpoint@...
Quoted 9 lines
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +6
-0+ compatible = "fsl,lx2160a-pcie-ep"; + reg = <0x00 0x03400000 0x0 0x00100000 + 0x80 0x00000000 0x8 0x00000000>; + reg-names = "regs", "addr_space"; + apio-wins = <8>; + };Signature · 1 line
2.9.5
RE: [PATCH v2 2/6] dt-bindings: Add DT binding for PCIE GEN4 EP of the layerscape
Quoted 71 lines
-----Original Message-----
From: Rob Herring <[email protected]>
Sent: 2019年10月18日 3:03
To: Xiaowei Bao <[email protected]>
Cc: Z.q. Hou <[email protected]>; [email protected]; [email protected]; [email protected]; Leo Li <[email protected]>; [email protected]; [email protected];M.h. Lian <[email protected]>; [email protected]; Mingkai Hu <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v2 2/6] dt-bindings: Add DT binding for PCIE GEN4 EP of the layerscapeQuoted 9 lines · Xiaowei Bao
Add the documentation for the Device Tree binding of the layerscape PCIe GEN4 controller with EP mode.
Signed-off-by Xiaowei Bao <[email protected]>---
v2:
- remove the status entry in EP Example..../bindings/pci/layerscape-pcie-gen4.txt | 27+++++++++++++++++++++-
Quoted 24 lines
1 file changed, 26 insertions(+), 1 deletion(-)diff --git
a/Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txtb/Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txtindex b40fb5d..06f9309 100644Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +0
-0@@ -3,6 +3,8 @@ NXP Layerscape PCIe Gen4 controller This PCIecontroller is based on the Mobiveil PCIe IP and thus inherits all the common properties defined in mobiveil-pcie.txt.
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +4
-1+HOST MODE +========= Required properties: - compatible: should contain the platform identifier such as: "fsl,lx2160a-pcie"@@ -23,7 +25,20 @@ Required properties: - msi-parent : See the generic MSI binding described in Documentation/devicetree/bindings/interrupt-controller/msi.txt. -Example: +DEVICE MODE +=========Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt Required properties: · line 39
Quoted 10 lines
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +10
-0+Required properties: +- compatible: should contain the platform identifier such as: + "fsl,lx2160a-pcie-ep" +- reg: base addresses and lengths of the PCIe controller register blocks. + "regs": PCIe controller registers. + "addr_space" EP device CPU address. +- apio-wins: number of requested apio outbound windows. + +Optional Property: +- max-functions: Maximum number of functions that can be configured(default 1).
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt Example: · line 65
Quoted 7 lines
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +2
-0+ +RC Example: pcie@3400000 { compatible = "fsl,lx2160a-pcie";@@ -50,3 +65,13 @@ Example: <0000 0 0 3 &gic 0 0 GIC_SPI 111
IRQ_TYPE_LEVEL_HIGH>,Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt Example: · line 66
Quoted 1 line
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +0
-0<0000 0 0 4 &gic 0 0 GIC_SPI 112
Quoted 8 lines
IRQ_TYPE_LEVEL_HIGH>;Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt Example: · line 71
Quoted 5 lines
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +4
-0}; + +EP Example: + + pcie_ep@3400000 {To repeat my previous comment:
Sorry, I missed this comment.
Thanks
Xiaowei
Quoted 12 lines
pcie-endpoint@...
Quoted 9 lines
Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt +6
-1+ compatible = "fsl,lx2160a-pcie-ep"; + reg = <0x00 0x03400000 0x0 0x00100000 + 0x80 0x00000000 0x8 0x00000000>; + reg-names = "regs", "addr_space"; + apio-wins = <8>; + }; --2.9.5
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 3/6 PCI: mobiveil: Add PCIe Gen4 EP driver for NXP Layerscape SoCs
In reply to Xiaowei BaoThis PCIe controller is based on the Mobiveil GPEX IP, it work in EP mode if select this config opteration.
---
v2:
- Modify the Copyright.
MAINTAINERS | 2 + drivers/pci/controller/mobiveil/Kconfig | 17 ++- drivers/pci/controller/mobiveil/Makefile | 1 + .../controller/mobiveil/pcie-layerscape-gen4-ep.c | 156 +++++++++++++++++++++ 4 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c
MAINTAINERS +2 -0
@@ -12363,11 +12363,13 @@ F: drivers/pci/controller/dwc/*layerscape* PCI DRIVER FOR NXP LAYERSCAPE GEN4 CONTROLLER M: Hou Zhiqiang <[email protected]> +M: Xiaowei Bao <[email protected]> L: [email protected] L: [email protected] S: Maintained F: Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt F: drivers/pci/controller/mobibeil/pcie-layerscape-gen4.c +F: drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c PCI DRIVER FOR GENERIC OF HOSTS M: Will Deacon <[email protected]>
drivers/pci/controller/mobiveil/Kconfig +14 -3
@@ -27,13 +27,24 @@ config PCIE_MOBIVEIL_PLAT for address translation and it is a PCIe Gen4 IP. config PCIE_LAYERSCAPE_GEN4 - bool "Freescale Layerscape PCIe Gen4 controller" + bool "Freescale Layerscpe PCIe Gen4 controller in RC mode" depends on PCI depends on OF && (ARM64 || ARCH_LAYERSCAPE) depends on PCI_MSI_IRQ_DOMAIN select PCIE_MOBIVEIL_HOST help Say Y here if you want PCIe Gen4 controller support on - Layerscape SoCs. The PCIe controller can work in RC or - EP mode according to RCW[HOST_AGT_PEX] setting. + Layerscape SoCs. And the PCIe controller work in RC mode + by setting the RCW[HOST_AGT_PEX] to 0. + +config PCIE_LAYERSCAPE_GEN4_EP + bool "Freescale Layerscpe PCIe Gen4 controller in EP mode" + depends on PCI + depends on OF && (ARM64 || ARCH_LAYERSCAPE) + depends on PCI_ENDPOINT + select PCIE_MOBIVEIL_EP + help + Say Y here if you want PCIe Gen4 controller support on + Layerscape SoCs. And the PCIe controller work in EP mode + by setting the RCW[HOST_AGT_PEX] to 1. endmenu
drivers/pci/controller/mobiveil/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-$(CONFIG_PCIE_MOBIVEIL_HOST) += pcie-mobiveil-host.o obj-$(CONFIG_PCIE_MOBIVEIL_EP) += pcie-mobiveil-ep.o obj-$(CONFIG_PCIE_MOBIVEIL_PLAT) += pcie-mobiveil-plat.o obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie-layerscape-gen4.o +obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4_EP) += pcie-layerscape-gen4-ep.o
drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c new file +156 -0
156 lines not on this page · raw message
Signature · 1 line
2.9.5
PATCH v2 4/6 PCI: mobiveil: Add workaround for unsupported request error
In reply to Xiaowei BaoErrata: unsupported request error on inbound posted write transaction, PCIe controller reports advisory error instead of uncorrectable error message to RC.
---
v3:
- Use BIT replce the expression.
drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c | 13 +++++++++++++ drivers/pci/controller/mobiveil/pcie-mobiveil.h | 4 ++++ 2 files changed, 17 insertions(+)
drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c +13 -0
@@ -49,6 +49,19 @@ static void ls_pcie_g4_ep_init(struct mobiveil_pcie_ep *ep)struct mobiveil_pcie *mv_pci =to_mobiveil_pcie_from_ep (ep);int win_idx;u8 bar; +u32 val; + +/* +* Errata: unsupported request error on inbound posted write +* transaction, PCIe controller reports advisory error instead +* of uncorrectable error message to RC. +* workaround: set the bit20(unsupported_request_Error_severity) with +* value 1 in uncorrectable_Error_Severity_Register, make the +* unsupported request error generate the fatal error. +*/ + val =csr_readl (mv_pci,CFG_UNCORRECTABLE_ERROR_SEVERITY ); + val |=BIT (UNSUPPORTED_REQUEST_ERROR_SHIFT ); +csr_writel (mv_pci, val,CFG_UNCORRECTABLE_ERROR_SEVERITY ); ep->bar_num =PCIE_LX2_BAR_NUM ;
drivers/pci/controller/mobiveil/pcie-mobiveil.h +4 -0
@@ -123,6 +123,10 @@#define GPEX_BAR_SIZE_UDW 0x4DC#define GPEX_BAR_SELECT 0x4E0 +#define CFG_UNCORRECTABLE_ERROR_SEVERITY 0x10c +#define UNSUPPORTED_REQUEST_ERROR_SHIFT 20 +#define CFG_UNCORRECTABLE_ERROR_MASK 0x108 +/* starting offset of INTX bits in status register */ #define PAB_INTX_START 5
Signature · 1 line
2.9.5
PATCH v2 5/6 arm64: dts: lx2160a: Add PCIe EP node
In reply to Xiaowei BaoAdd the LX2160A PCIe EP node.
---
v2:
- No change.
arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi | 56 ++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi +56 -0
@@ -1005,6 +1005,15 @@ status = "disabled"; }; + pcie_ep@3400000 { + compatible = "fsl,lx2160a-pcie-ep"; + reg = <0x00 0x03400000 0x0 0x00100000 + 0x80 0x00000000 0x8 0x00000000>; + reg-names = "regs", "addr_space"; + apio-wins = <8>; + status = "disabled"; + }; + pcie@3500000 { compatible = "fsl,lx2160a-pcie"; reg = <0x00 0x03500000 0x0 0x00100000 /* controller registers */
@@ -1032,6 +1041,15 @@ status = "disabled"; }; + pcie_ep@3500000 { + compatible = "fsl,lx2160a-pcie-ep"; + reg = <0x00 0x03500000 0x0 0x00100000 + 0x88 0x00000000 0x8 0x00000000>; + reg-names = "regs", "addr_space"; + apio-wins = <8>; + status = "disabled"; + }; + pcie@3600000 { compatible = "fsl,lx2160a-pcie"; reg = <0x00 0x03600000 0x0 0x00100000 /* controller registers */
@@ -1059,6 +1077,16 @@ status = "disabled"; }; + pcie_ep@3600000 { + compatible = "fsl,lx2160a-pcie-ep"; + reg = <0x00 0x03600000 0x0 0x00100000 + 0x90 0x00000000 0x8 0x00000000>; + reg-names = "regs", "addr_space"; + apio-wins = <256>; + max-functions = /bits/ 8 <2>; + status = "disabled"; + }; + pcie@3700000 { compatible = "fsl,lx2160a-pcie"; reg = <0x00 0x03700000 0x0 0x00100000 /* controller registers */
@@ -1086,6 +1114,15 @@ status = "disabled"; }; + pcie_ep@3700000 { + compatible = "fsl,lx2160a-pcie-ep"; + reg = <0x00 0x03700000 0x0 0x00100000 + 0x98 0x00000000 0x8 0x00000000>; + reg-names = "regs", "addr_space"; + apio-wins = <8>; + status = "disabled"; + }; + pcie@3800000 { compatible = "fsl,lx2160a-pcie"; reg = <0x00 0x03800000 0x0 0x00100000 /* controller registers */
@@ -1113,6 +1150,16 @@ status = "disabled"; }; + pcie_ep@3800000 { + compatible = "fsl,lx2160a-pcie-ep"; + reg = <0x00 0x03800000 0x0 0x00100000 + 0xa0 0x00000000 0x8 0x00000000>; + reg-names = "regs", "addr_space"; + apio-wins = <256>; + max-functions = /bits/ 8 <2>; + status = "disabled"; + }; + pcie@3900000 { compatible = "fsl,lx2160a-pcie"; reg = <0x00 0x03900000 0x0 0x00100000 /* controller registers */
@@ -1140,5 +1187,14 @@ status = "disabled"; }; + pcie_ep@3900000 { + compatible = "fsl,lx2160a-pcie-ep"; + reg = <0x00 0x03900000 0x0 0x00100000 + 0xa8 0x00000000 0x8 0x00000000>; + reg-names = "regs", "addr_space"; + apio-wins = <8>; + status = "disabled"; + }; + }; };
Signature · 1 line
2.9.5
PATCH v2 6/6 misc: pci_endpoint_test: Add the layerscape PCIe GEN4 EP device support
In reply to Xiaowei BaoAdd the layerscape PCIE GEN4 EP device support in pci_endpoint_test driver.
---
v2:
- No change.
drivers/misc/pci_endpoint_test.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/pci_endpoint_test.c +2 -0
@@ -65,6 +65,7 @@#define PCI_ENDPOINT_TEST_IRQ_NUMBER 0x28#define PCI_DEVICE_ID_TI_AM654 0xb00c +#define PCI_DEVICE_ID_LX2160A 0x8d80#define is_am654_pci_dev (pdev) \ ((pdev)->device == PCI_DEVICE_ID_TI_AM654)
@@ -793,6 +794,7 @@ static const struct pci_device_id pci_endpoint_test_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_DRA74x) }, { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_DRA72x) }, { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, 0x81c0) }, + { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, PCI_DEVICE_ID_LX2160A) }, { PCI_DEVICE_DATA(SYNOPSYS, EDDA, NULL) }, { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_AM654), .driver_data = (kernel_ulong_t)&am654_data
Signature · 1 line
2.9.5