pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCs
Subsystems (2)
v3 cover pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCs
From: Hou Zhiqiang <[email protected]>
Add PCIe Gen4 driver for the NXP Layerscape series SoCs.
Hou Zhiqiang (11):
armv8: fsl-layerscpae: correct the PCIe controllers' region size
armv8: lx2160a: add MMU table entries for PCIe
pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCs
kconfig: add dependency PCIE_LAYERSCAPE_GEN4 for FSL_PCIE_COMPAT
pci: ls_pcie_g4: add device tree fixups for PCI Stream IDs
armv8: lx2160a: add PCIe controller DT nodes
armv8: lx2160a: enable PCIe support on RDB defconfig
armv8: lx2160a: enable the pci command
pci: ls_pcie_g4: add Workaround for A-011577
pci: ls_pcie_g4: Add Workaround for A-011451
pci: ls_pcie_g4: add Workaround for A-011452
Depends on the following patches:
https://patchwork.ozlabs.org/patch/990088/
https://patchwork.ozlabs.org/patch/990093/
https://patchwork.ozlabs.org/patch/990097/
https://patchwork.ozlabs.org/patch/990098/
arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 2 +- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 12 + arch/arm/dts/fsl-lx2160a.dtsi | 85 +++ .../arm/include/asm/arch-fsl-layerscape/cpu.h | 9 + .../asm/arch-fsl-layerscape/immap_lsch3.h | 14 +- configs/lx2160ardb_tfa_defconfig | 5 + drivers/pci/Kconfig | 8 + drivers/pci/Makefile | 2 + drivers/pci/pci_auto.c | 34 + drivers/pci/pcie_layerscape_gen4.c | 593 ++++++++++++++++++ drivers/pci/pcie_layerscape_gen4.h | 273 ++++++++ drivers/pci/pcie_layerscape_gen4_fixup.c | 249 ++++++++ include/configs/lx2160a_common.h | 1 + include/pci.h | 9 + include/pci_ids.h | 1 + 15 files changed, 1295 insertions(+), 2 deletions(-) create mode 100644 drivers/pci/pcie_layerscape_gen4.c create mode 100644 drivers/pci/pcie_layerscape_gen4.h create mode 100644 drivers/pci/pcie_layerscape_gen4_fixup.c
Signature · 1 line
2.17.1
PATCH v3 1/11 armv8: fsl-layerscpae: correct the PCIe controllers' region size
From: Hou Zhiqiang <[email protected]>
The LS2080A has 8GB region for each PCIe controller, while the other platforms have 32GB.
---
V3:
- No change
arch/arm/include/asm/arch-fsl-layerscape/cpu.h | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/include/asm/arch-fsl-layerscape/cpu.h +7 -0
@@ -34,10 +34,17 @@#define CONFIG_SYS_FSL_QBMAN_BASE 0x818000000#define CONFIG_SYS_FSL_QBMAN_SIZE 0x8000000#define CONFIG_SYS_FSL_QBMAN_SIZE_1 0x4000000 +#ifdef CONFIG_ARCH_LS2080A #define CONFIG_SYS_PCIE1_PHYS_SIZE 0x200000000#define CONFIG_SYS_PCIE2_PHYS_SIZE 0x200000000#define CONFIG_SYS_PCIE3_PHYS_SIZE 0x200000000#define CONFIG_SYS_PCIE4_PHYS_SIZE 0x200000000 +#else +#define CONFIG_SYS_PCIE1_PHYS_SIZE 0x800000000 +#define CONFIG_SYS_PCIE2_PHYS_SIZE 0x800000000 +#define CONFIG_SYS_PCIE3_PHYS_SIZE 0x800000000 +#define CONFIG_SYS_PCIE4_PHYS_SIZE 0x800000000 +#endif #define CONFIG_SYS_FSL_WRIOP1_BASE 0x4300000000#define CONFIG_SYS_FSL_WRIOP1_SIZE 0x100000000#define CONFIG_SYS_FSL_AIOP1_BASE 0x4b00000000
Signature · 1 line
2.17.1
PATCH v3 2/11 armv8: lx2160a: add MMU table entries for PCIe
In reply to Z.q. HouFrom: Hou Zhiqiang <[email protected]>
The lx2160a have up to 6 PCIe controllers and have different address and size of PCIe region.
---
V3:
- No change
arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 12 ++++++++++++ arch/arm/include/asm/arch-fsl-layerscape/cpu.h | 2 ++ .../include/asm/arch-fsl-layerscape/immap_lsch3.h | 14 +++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-)
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +12 -0
@@ -257,6 +257,18 @@ static struct mm_region final_map[] = { PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE | PTE_BLOCK_PXN | PTE_BLOCK_UXN }, +#endif +#ifdef CONFIG_ARCH_LX2160A + {SYS_PCIE5_PHYS_ADDR ,SYS_PCIE5_PHYS_ADDR , +SYS_PCIE5_PHYS_SIZE , +PTE_BLOCK_MEMTYPE (MT_DEVICE_NGNRNE ) | +PTE_BLOCK_NON_SHARE |PTE_BLOCK_PXN |PTE_BLOCK_UXN + }, + { SYS_PCIE6_PHYS_ADDR, SYS_PCIE6_PHYS_ADDR, +SYS_PCIE6_PHYS_SIZE , +PTE_BLOCK_MEMTYPE (MT_DEVICE_NGNRNE ) | +PTE_BLOCK_NON_SHARE |PTE_BLOCK_PXN |PTE_BLOCK_UXN + }, #endif { CONFIG_SYS_FSL_WRIOP1_BASE, CONFIG_SYS_FSL_WRIOP1_BASE, CONFIG_SYS_FSL_WRIOP1_SIZE,
arch/arm/include/asm/arch-fsl-layerscape/cpu.h +2 -0
@@ -44,6 +44,8 @@#define CONFIG_SYS_PCIE2_PHYS_SIZE 0x800000000#define CONFIG_SYS_PCIE3_PHYS_SIZE 0x800000000#define CONFIG_SYS_PCIE4_PHYS_SIZE 0x800000000 +#define SYS_PCIE5_PHYS_SIZE 0x800000000 +#define SYS_PCIE6_PHYS_SIZE 0x800000000#endif #define CONFIG_SYS_FSL_WRIOP1_BASE 0x4300000000#define CONFIG_SYS_FSL_WRIOP1_SIZE 0x100000000
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h +13 -1
@@ -167,7 +167,19 @@#define CONFIG_SYS_PCIE2_ADDR (CONFIG_SYS_IMMR + 0x2500000)#define CONFIG_SYS_PCIE3_ADDR (CONFIG_SYS_IMMR + 0x2600000)#define CONFIG_SYS_PCIE4_ADDR (CONFIG_SYS_IMMR + 0x2700000) -#ifdef CONFIG_ARCH_LS1088A +#ifdef CONFIG_ARCH_LX2160A +#define SYS_PCIE5_ADDR (CONFIG_SYS_IMMR + 0x2800000) +#define SYS_PCIE6_ADDR (CONFIG_SYS_IMMR + 0x2900000) +#endif + +#ifdef CONFIG_ARCH_LX2160A +#define CONFIG_SYS_PCIE1_PHYS_ADDR 0x8000000000ULL +#define CONFIG_SYS_PCIE2_PHYS_ADDR 0x8800000000ULL +#define CONFIG_SYS_PCIE3_PHYS_ADDR 0x9000000000ULL +#define CONFIG_SYS_PCIE4_PHYS_ADDR 0x9800000000ULL +#define SYS_PCIE5_PHYS_ADDR 0xa000000000ULL +#define SYS_PCIE6_PHYS_ADDR 0xa800000000ULL +#elif CONFIG_ARCH_LS1088A #define CONFIG_SYS_PCIE1_PHYS_ADDR 0x2000000000ULL#define CONFIG_SYS_PCIE2_PHYS_ADDR 0x2800000000ULL#define CONFIG_SYS_PCIE3_PHYS_ADDR 0x3000000000ULL
Signature · 1 line
2.17.1
PATCH v3 3/11 pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCs
In reply to Z.q. HouFrom: Hou Zhiqiang <[email protected]>
Add PCIe Gen4 driver for the NXP Layerscape SoCs. This PCIe controller is based on the Mobiveil IP, which is compatible with the PCI Expressâ„¢ Base Specification, Revision 4.0.
---
V3:
- Refactored the EP mode code.
drivers/pci/Kconfig | 8 + drivers/pci/Makefile | 1 + drivers/pci/pcie_layerscape_gen4.c | 577 +++++++++++++++++++++++++++++ drivers/pci/pcie_layerscape_gen4.h | 264 +++++++++++++ 4 files changed, 850 insertions(+) create mode 100644 drivers/pci/pcie_layerscape_gen4.c create mode 100644 drivers/pci/pcie_layerscape_gen4.h
drivers/pci/Kconfig +8 -0
@@ -69,6 +69,14 @@ config PCI_RCAR_GEN2 Renesas RCar Gen2 SoCs. The PCIe controller on RCar Gen2 is also used to access EHCI USB controller on the SoC. +config PCIE_LAYERSCAPE_GEN4 + bool "Layerscape Gen4 PCIe support" + depends on DM_PCI + help + Support PCIe Gen4 on NXP Layerscape SoCs, which may have one or + several PCIe controllers. The PCIe controller can work in RC or + EP mode according to RCW[HOST_AGT_PEX] setting. + config PCI_SANDBOX bool "Sandbox PCI support" depends on SANDBOX && DM_PCI
drivers/pci/Makefile +1 -0
@@ -32,5 +32,6 @@ obj-$(CONFIG_PCI_AARDVARK) += pci-aardvark.o obj-$(CONFIG_PCIE_DW_MVEBU) += pcie_dw_mvebu.o obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape.o obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape_fixup.o +obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie_layerscape_gen4.o obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o
drivers/pci/pcie_layerscape_gen4.c new file +577 -0
577 lines not on this page · raw message
drivers/pci/pcie_layerscape_gen4.h new file +264 -0
264 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 4/11 kconfig: add dependency PCIE_LAYERSCAPE_GEN4 for FSL_PCIE_COMPAT
In reply to Z.q. HouFrom: Hou Zhiqiang <[email protected]>
The LX2160A PCIe is using driver PCIE_LAYERSCAPE_GEN4 instead of PCIE_LAYERSCAPE.
---
V3:
- No change
arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +1 -1
@@ -232,7 +232,7 @@ menu "Layerscape architecture" config FSL_PCIE_COMPAT string "PCIe compatible of Kernel DT" - depends on PCIE_LAYERSCAPE + depends on PCIE_LAYERSCAPE || PCIE_LAYERSCAPE_GEN4 default "fsl,ls1012a-pcie" if ARCH_LS1012A default "fsl,ls1043a-pcie" if ARCH_LS1043A default "fsl,ls1046a-pcie" if ARCH_LS1046A
Signature · 1 line
2.17.1
PATCH v3 5/11 pci: ls_pcie_g4: add device tree fixups for PCI Stream IDs
In reply to Z.q. HouFrom: Hou Zhiqiang <[email protected]>
Add the infrastructure for Layerscape SoCs PCIe Gen4 controller to update device tree nodes to convey SMMU stream IDs in the device tree.
---
V3:
- Added EP DT node fixup.
drivers/pci/Makefile | 3 +- drivers/pci/pcie_layerscape_gen4.c | 5 - drivers/pci/pcie_layerscape_gen4_fixup.c | 249 +++++++++++++++++++++++ 3 files changed, 251 insertions(+), 6 deletions(-) create mode 100644 drivers/pci/pcie_layerscape_gen4_fixup.c
drivers/pci/Makefile +2 -1
@@ -32,6 +32,7 @@ obj-$(CONFIG_PCI_AARDVARK) += pci-aardvark.o obj-$(CONFIG_PCIE_DW_MVEBU) += pcie_dw_mvebu.o obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape.o obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape_fixup.o -obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie_layerscape_gen4.o +obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie_layerscape_gen4.o \ + pcie_layerscape_gen4_fixup.o obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o
drivers/pci/pcie_layerscape_gen4.c +0 -5
@@ -570,8 +570,3 @@ U_BOOT_DRIVER(pcie_layerscape_gen4) = { .probe = ls_pcie_g4_probe, .priv_auto_alloc_size = sizeof(struct ls_pcie_g4), }; - -/* No any fixup so far */ -void ft_pci_setup (void *blob,bd_t *bd) -{ -}
drivers/pci/pcie_layerscape_gen4_fixup.c new file +249 -0
249 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 6/11 armv8: lx2160a: add PCIe controller DT nodes
In reply to Z.q. HouFrom: Hou Zhiqiang <[email protected]>
The LX2160A integrated 6 PCIe Gen4 controllers.
---
V3:
- No change
arch/arm/dts/fsl-lx2160a.dtsi | 85 +++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+)
arch/arm/dts/fsl-lx2160a.dtsi +85 -0
@@ -115,4 +115,89 @@ interrupts = <0 81 0x4>; /* Level high type */ dr_mode = "host"; }; + + pcie at 3400000 { + compatible = "fsl,lx2160a-pcie"; + reg = <0x00 0x03400000 0x0 0x80000 /* PAB registers */ + 0x00 0x03480000 0x0 0x40000 /* LUT registers */ + 0x00 0x034c0000 0x0 0x40000 /* PF control registers */ + 0x80 0x00000000 0x0 0x1000>; /* configuration space */ + reg-names = "ccsr", "lut", "pf_ctrl", "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0x0 0xff>; + ranges = <0x82000000 0x0 0x40000000 0x80 0x40000000 0x0 0x40000000>; /* non-prefetchable memory */ + }; + + pcie at 3500000 { + compatible = "fsl,lx2160a-pcie"; + reg = <0x00 0x03500000 0x0 0x80000 /* PAB registers */ + 0x00 0x03580000 0x0 0x40000 /* LUT registers */ + 0x00 0x035c0000 0x0 0x40000 /* PF control registers */ + 0x88 0x00000000 0x0 0x1000>; /* configuration space */ + reg-names = "ccsr", "lut", "pf_ctrl", "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + num-lanes = <2>; + bus-range = <0x0 0xff>; + ranges = <0x82000000 0x0 0x40000000 0x88 0x40000000 0x0 0x40000000>; /* non-prefetchable memory */ + }; + + pcie at 3600000 { + compatible = "fsl,lx2160a-pcie"; + reg = <0x00 0x03600000 0x0 0x80000 /* PAB registers */ + 0x00 0x03680000 0x0 0x40000 /* LUT registers */ + 0x00 0x036c0000 0x0 0x40000 /* PF control registers */ + 0x90 0x00000000 0x0 0x1000>; /* configuration space */ + reg-names = "ccsr", "lut", "pf_ctrl", "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0x0 0xff>; + ranges = <0x82000000 0x0 0x40000000 0x90 0x40000000 0x0 0x40000000>; /* non-prefetchable memory */ + }; + + pcie at 3700000 { + compatible = "fsl,lx2160a-pcie"; + reg = <0x00 0x03700000 0x0 0x80000 /* PAB registers */ + 0x00 0x03780000 0x0 0x40000 /* LUT registers */ + 0x00 0x037c0000 0x0 0x40000 /* PF control registers */ + 0x98 0x00000000 0x0 0x1000>; /* configuration space */ + reg-names = "ccsr", "lut", "pf_ctrl", "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0x0 0xff>; + ranges = <0x82000000 0x0 0x40000000 0x98 0x40000000 0x0 0x40000000>; /* non-prefetchable memory */ + }; + + pcie at 3800000 { + compatible = "fsl,lx2160a-pcie"; + reg = <0x00 0x03800000 0x0 0x80000 /* PAB registers */ + 0x00 0x03880000 0x0 0x40000 /* LUT registers */ + 0x00 0x038c0000 0x0 0x40000 /* PF control registers */ + 0xa0 0x00000000 0x0 0x1000>; /* configuration space */ + reg-names = "ccsr", "lut", "pf_ctrl", "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0x0 0xff>; + ranges = <0x82000000 0x0 0x40000000 0xa0 0x40000000 0x0 0x40000000>; /* non-prefetchable memory */ + }; + + pcie at 3900000 { + compatible = "fsl,lx2160a-pcie"; + reg = <0x00 0x03900000 0x0 0x80000 /* PAB registers */ + 0x00 0x03980000 0x0 0x40000 /* LUT registers */ + 0x00 0x039c0000 0x0 0x40000 /* PF control registers */ + 0xa8 0x00000000 0x0 0x1000>; /* configuration space */ + reg-names = "ccsr", "lut", "pf_ctrl", "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0x0 0xff>; + ranges = <0x82000000 0x0 0x40000000 0xa8 0x40000000 0x0 0x40000000>; /* non-prefetchable memory */ + }; };
Signature · 1 line
2.17.1
PATCH v3 7/11 armv8: lx2160a: enable PCIe support on RDB defconfig
In reply to Z.q. HouFrom: Hou Zhiqiang <[email protected]>
Enable the PCIe Gen4 controller driver and e1000 for LX2160ARDB.
---
V3:
- No change
configs/lx2160ardb_tfa_defconfig | 5 +++++ 1 file changed, 5 insertions(+)
configs/lx2160ardb_tfa_defconfig +5 -0
@@ -51,6 +51,11 @@ CONFIG_CMD_MII=y CONFIG_CMD_DHCP=y CONFIG_CMD_FAT=y CONFIG_CMD_EXT2=y +CONFIG_PCI=y +CONFIG_DM_PCI=y +CONFIG_DM_PCI_COMPAT=y +CONFIG_PCIE_LAYERSCAPE_GEN4=y +CONFIG_E1000=y CONFIG_NET=y CONFIG_USB=y CONFIG_DM_USB=y
Signature · 1 line
2.17.1
PATCH v3 8/11 armv8: lx2160a: enable the pci command
In reply to Z.q. HouFrom: Hou Zhiqiang <[email protected]>
---
V3:
- No change
include/configs/lx2160a_common.h | 1 + 1 file changed, 1 insertion(+)
include/configs/lx2160a_common.h +1 -0
@@ -129,6 +129,7 @@#ifdef CONFIG_PCI #define CONFIG_SYS_PCI_64BIT #define CONFIG_PCI_SCAN_SHOW +#define CONFIG_CMD_PCI #endif /* MMC */
Signature · 1 line
2.17.1
PATCH v3 8/11 armv8: lx2160a: enable the pci command
Quoted 16 lines · Z.q. Hou
From: Hou Zhiqiang <[email protected]>
Signed-off-by Hou Zhiqiang <[email protected]>---
V3:
- No changeinclude/configs/lx2160a_common.h | 1 + 1 file changed, 1 insertion(+)include/configs/lx2160a_common.h +0
-0
include/configs/lx2160a_common.h line 132
Quoted 4 lines
include/configs/lx2160a_common.h +1
-0@@ -129,6 +129,7 @@#ifdef CONFIG_PCI #define CONFIG_SYS_PCI_64BIT #define CONFIG_PCI_SCAN_SHOW +#define CONFIG_CMD_PCI
This is already a Kconfig option. Please update Kconfig instead.
include/configs/lx2160a_common.h line 134
Quoted 2 lines
include/configs/lx2160a_common.h +0
-0#endif
Regards,
Bin
PATCH v3 8/11 armv8: lx2160a: enable the pci command
Hi Bin,
Thanks a lot for your comments!
Quoted 26 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月12日 11:38
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 08/11] armv8: lx2160a: enable the pci commandQuoted 4 lines · Z.q. Hou
From: Hou Zhiqiang <[email protected]>
Signed-off-by Hou Zhiqiang <[email protected]>Review
Quoted 8 lines
---
V3:
- No changeinclude/configs/lx2160a_common.h | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/include/configs/lx2160a_common.h
Quoted 10 lines
include/configs/lx2160a_common.h line 132
Quoted 8 lines
index
41931e5b53..19053b43a1100644include/configs/lx2160a_common.h +1
-0@@ -129,6 +129,7 @@#ifdef CONFIG_PCI #define CONFIG_SYS_PCI_64BIT #define CONFIG_PCI_SCAN_SHOW +#define CONFIG_CMD_PCI This is already a
Kconfigoption. Please updateKconfiginstead.
Yes, will add it to the defconfig.
Quoted 6 lines
include/configs/lx2160a_common.h line 134
Quoted 3 lines
include/configs/lx2160a_common.h +0
-0#endif Regards,
Bin
Thanks,
Zhiqiang
PATCH v3 9/11 pci: ls_pcie_g4: add Workaround for A-011577
In reply to Z.q. HouFrom: Hou Zhiqiang <[email protected]>
PCIe configuration access to non-existent function triggered SERROR interrupt exception.
Workaround:
Disable error reporting on AXI bus during the Vendor ID read transactions in enumeration.
This ERRATA is only for LX2160A Rev1.0 and will be fixed in Rev2.0.
---
V3:
- New patch.
drivers/pci/pcie_layerscape_gen4.c | 8 ++++++++ drivers/pci/pcie_layerscape_gen4.h | 5 +++++ 2 files changed, 13 insertions(+)
drivers/pci/pcie_layerscape_gen4.c +8 -0
@@ -242,6 +242,9 @@ static int ls_pcie_g4_read_config(struct udevice *bus, pci_dev_t bdf, address =ls_pcie_g4_conf_address (pcie, bdf, offset); +if (pcie->rev ==REV_1_0 && offset ==PCI_VENDOR_ID ) +lut_writel (pcie,0x0 <<PCIE_LUT_GCR_RRE ,PCIE_LUT_GCR ); +switch (size) {case PCI_SIZE_8 : *valuep =readb (address);
@@ -257,6 +260,9 @@ static int ls_pcie_g4_read_config(struct udevice *bus, pci_dev_t bdf,break ; } +if (pcie->rev ==REV_1_0 && offset ==PCI_VENDOR_ID ) +lut_writel (pcie,0x1 <<PCIE_LUT_GCR_RRE ,PCIE_LUT_GCR ); +return ret; }
@@ -518,6 +524,8 @@ static int ls_pcie_g4_probe(struct udevice *dev) dev->name, (unsigned long )pcie->ccsr, (unsigned long )pcie->cfg, pcie->big_endian); + pcie->rev =readb (pcie->ccsr +PCI_REVISION_ID ); + pcie->mode =readb (pcie->ccsr +PCI_HEADER_TYPE ) &0x7f ;if (pcie->mode ==PCI_HEADER_TYPE_NORMAL ) {
drivers/pci/pcie_layerscape_gen4.h +5 -0
@@ -11,6 +11,8 @@#include <pci.h> #include <dm.h> +#define REV_1_0 (0x10) +#ifndef CONFIG_SYS_PCI_MEMORY_SIZE #define CONFIG_SYS_PCI_MEMORY_SIZE (4 * 1024 * 1024 * 1024ULL)#endif
@@ -161,6 +163,8 @@#define PCIE_LUT_LDR (n) (0x804 + (n) * 8)#define PCIE_LUT_ENABLE BIT(31)#define PCIE_LUT_ENTRY_COUNT 32 +#define PCIE_LUT_GCR (0x28) +#define PCIE_LUT_GCR_RRE (0)/* PF control registers */ #define PCIE_LTSSM_STA 0x7fc
@@ -190,6 +194,7 @@ struct ls_pcie_g4 {int stream_id_cur;int mode;int sriov_support; +u8 rev; };extern struct list_head ls_pcie_g4_list;
Signature · 1 line
2.17.1
PATCH v3 10/11 pci: ls_pcie_g4: Add Workaround for A-011451
In reply to Z.q. HouFrom: Hou Zhiqiang <[email protected]>
When LAYERSCAPE Gen4 PCIe controller is sending multiple split completions and ACK latency expires indicating that ACK should be send at priority. But because of large number of split completions and FC update DLLP, the controller does not give priority to ACK transmission. This results into ACK latency timer timeout error at the link partner and the pending TLPs are replayed by the link partner again.
Workaround:
1. Reduce the ACK latency timeout value to a very small value.
2. Restrict the number of completions from the PCIe controller to 1, by changing the Max Read Request Size (MRRS) of link partner to the same value as Max Packet size (MPS).
This ERRATA is only for LX2160A Rev1.0 and will be fixed in Rev2.0.
---
V3:
- New patch.
drivers/pci/pci_auto.c | 34 ++++++++++++++++++++++++++++++ drivers/pci/pcie_layerscape_gen4.c | 8 +++++++ drivers/pci/pcie_layerscape_gen4.h | 4 ++++ include/pci.h | 9 ++++++++ include/pci_ids.h | 1 + 5 files changed, 56 insertions(+)
drivers/pci/pci_auto.c +34 -0
@@ -22,6 +22,7 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num, struct pci_region *prefetch, struct pci_region *io, bool enum_only) { + struct udevice *rp = pci_get_controller(dev);u32 bar_response;pci_size_t bar_size;u16 cmdstat =0 ;
@@ -32,6 +33,9 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,struct pci_region *bar_res =NULL ;int found_mem64 =0 ;u16 class; +int pos; +u16 val, vendor, dev_id; +u8 rev;dm_pci_read_config16 (dev,PCI_COMMAND , &cmdstat); cmdstat = (cmdstat & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) |
@@ -161,6 +165,36 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,dm_pci_write_config8 (dev,PCI_CACHE_LINE_SIZE ,CONFIG_SYS_PCI_CACHE_LINE_SIZE );dm_pci_write_config8 (dev,PCI_LATENCY_TIMER ,0x80 ); + +/* +* When NXP LAYERSCAPE Gen4 PCIe controller is sending multiple split +* completions and ACK latency expires indicating that ACK should be +* send at priority. But because of large number of split completions +* and FC update DLLP, the controller does not give priority to ACK +* transmission. This results into ACK latency timer timeout error at +* the link partner and the pending TLPs are replayed by the link +* partner again. +* +* The workaround: +* Restrict the number of completions from the PCIe controller to 1, +* by changing the Max Read Request Size (MRRS) of link partner to the +* same value as Max Packet size (MPS). +* +* So, set both the MPS and MRRS to the minimum 128B. +*/ +dm_pci_read_config16 (rp,PCI_VENDOR_ID , &vendor); +dm_pci_read_config16 (rp,PCI_DEVICE_ID , &dev_id); +dm_pci_read_config8 (rp,PCI_REVISION_ID , &rev); +if (vendor ==PCI_VENDOR_ID_FREESCALE && + dev_id ==PCI_DEVICE_ID_LX2160A && rev ==0x10 ) { + pos =dm_pci_find_capability (dev,PCI_CAP_ID_EXP ); +if (pos) { +dm_pci_read_config16 (dev, pos +PCI_EXP_DEVCTL , &val); + val &= ~(PCI_EXP_DEVCTL_READRQ | +PCI_EXP_DEVCTL_PAYLOAD ); +dm_pci_write_config16 (dev, pos +PCI_EXP_DEVCTL , val); + } + } }void dm_pciauto_prescan_setup_bridge (struct udevice *dev,int sub_bus)
drivers/pci/pcie_layerscape_gen4.c +8 -0
@@ -526,6 +526,14 @@ static int ls_pcie_g4_probe(struct udevice *dev) pcie->rev =readb (pcie->ccsr +PCI_REVISION_ID ); +/* Set ACK latency timeout */ +if (pcie->rev ==REV_1_0 ) { + val =ccsr_readl (pcie,GPEX_ACK_REPLAY_TO ); + val &= ~(ACK_LAT_TO_VAL_MASK <<ACK_LAT_TO_VAL_SHIFT ); + val |= (4 <<ACK_LAT_TO_VAL_SHIFT ); +ccsr_writel (pcie,GPEX_ACK_REPLAY_TO , val); + } + pcie->mode =readb (pcie->ccsr +PCI_HEADER_TYPE ) &0x7f ;if (pcie->mode ==PCI_HEADER_TYPE_NORMAL ) {
drivers/pci/pcie_layerscape_gen4.h +4 -0
@@ -58,6 +58,10 @@#define INI_VF_SHIFT 0#define GPEX_SRIOV_VF_OFFSET_STRIDE (pf) (0x704 + (pf) * 4) +#define GPEX_ACK_REPLAY_TO 0x438 +#define ACK_LAT_TO_VAL_SHIFT 0 +#define ACK_LAT_TO_VAL_MASK 0x1fff +/* PAB CSR */ #define PAB_CTRL 0x808#define PAB_CTRL_APIO_EN BIT(0)
include/pci.h +9 -0
@@ -414,6 +414,15 @@#define PCI_MAX_PCI_DEVICES 32#define PCI_MAX_PCI_FUNCTIONS 8 +/* PCI Express capability registers */ +#define PCI_EXP_DEVCTL 8/* Device Control */ +#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0/* Max_Payload_Size */ +#define PCI_EXP_DEVCTL_READRQ 0x7000/* Max_Read_Request_Size */ +#define PCI_EXP_DEVCTL_READRQ_128B 0x0000/* 128 Bytes */ +#define PCI_EXP_DEVCTL_READRQ_256B 0x1000/* 256 Bytes */ +#define PCI_EXP_DEVCTL_READRQ_512B 0x2000/* 512 Bytes */ +#define PCI_EXP_DEVCTL_READRQ_1024B 0x3000/* 1024 Bytes */ +#define PCI_FIND_CAP_TTL 0x48#define CAP_START_POS 0x40
include/pci_ids.h +1 -0
@@ -2481,6 +2481,7 @@#define PCI_DEVICE_ID_MPC8641 0x7010#define PCI_DEVICE_ID_MPC8641D 0x7011#define PCI_DEVICE_ID_MPC8610 0x7018 +#define PCI_DEVICE_ID_LX2160A 0x8D80#define PCI_VENDOR_ID_PASEMI 0x1959
Signature · 1 line
2.17.1
PATCH v3 10/11 pci: ls_pcie_g4: Add Workaround for A-011451
Hi,
Quoted 77 lines · Z.q. Hou
From: Hou Zhiqiang <[email protected]>
When LAYERSCAPE Gen4 PCIe controller is sending multiple split completions and ACK latency expires indicating that ACK should be send at priority. But because of large number of split completions and FC update DLLP, the controller does not give priority to ACK transmission. This results into ACK latency timer timeout error at the link partner and the pending TLPs are replayed by the link partner again.
Workaround:
1. Reduce the ACK latency timeout value to a very small value.
2. Restrict the number of completions from the PCIe controller to 1, by changing the Max Read Request Size (MRRS) of link partner to the same value as Max Packet size (MPS).This ERRATA is only for LX2160A Rev1.0 and will be fixed in Rev2.0.
Signed-off-by Hou Zhiqiang <[email protected]>---
V3:
- New patch.drivers/pci/pci_auto.c | 34 ++++++++++++++++++++++++++++++ drivers/pci/pcie_layerscape_gen4.c | 8 +++++++ drivers/pci/pcie_layerscape_gen4.h | 4 ++++ include/pci.h | 9 ++++++++ include/pci_ids.h | 1 + 5 files changed, 56 insertions(+)drivers/pci/pci_auto.c +24
-0@@ -22,6 +22,7 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num, struct pci_region *prefetch, struct pci_region *io, bool enum_only) { + struct udevice *rp = pci_get_controller(dev);u32 bar_response;pci_size_t bar_size;u16 cmdstat =0 ;@@ -32,6 +33,9 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,struct pci_region *bar_res =NULL ;int found_mem64 =0 ;u16 class; +int pos; +u16 val, vendor, dev_id; +u8 rev;dm_pci_read_config16 (dev,PCI_COMMAND , &cmdstat); cmdstat = (cmdstat & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) |@@ -161,6 +165,36 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,dm_pci_write_config8 (dev,PCI_CACHE_LINE_SIZE ,CONFIG_SYS_PCI_CACHE_LINE_SIZE );dm_pci_write_config8 (dev,PCI_LATENCY_TIMER ,0x80 ); + +/* +* When NXP LAYERSCAPE Gen4 PCIe controller is sending multiple split +* completions and ACK latency expires indicating that ACK should be +* send at priority. But because of large number of split completions +* and FC update DLLP, the controller does not give priority to ACK +* transmission. This results into ACK latency timer timeout error at +* the link partner and the pending TLPs are replayed by the link +* partner again. +* +* The workaround: +* Restrict the number of completions from the PCIe controller to 1, +* by changing the Max Read Request Size (MRRS) of link partner to the +* same value as Max Packet size (MPS). +* +* So, set both the MPS and MRRS to the minimum 128B. +*/ +dm_pci_read_config16 (rp,PCI_VENDOR_ID , &vendor); +dm_pci_read_config16 (rp,PCI_DEVICE_ID , &dev_id); +dm_pci_read_config8 (rp,PCI_REVISION_ID , &rev);
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num, · line 197
Quoted 10 lines
drivers/pci/pci_auto.c +10
-0+if (vendor ==PCI_VENDOR_ID_FREESCALE && + dev_id ==PCI_DEVICE_ID_LX2160A && rev ==0x10 ) { + pos =dm_pci_find_capability (dev,PCI_CAP_ID_EXP ); +if (pos) { +dm_pci_read_config16 (dev, pos +PCI_EXP_DEVCTL , &val); + val &= ~(PCI_EXP_DEVCTL_READRQ | +PCI_EXP_DEVCTL_PAYLOAD ); +dm_pci_write_config16 (dev, pos +PCI_EXP_DEVCTL , val); + } + }
Can this be done in the probe() routine of the driver codes?
Quoted 62 lines
drivers/pci/pci_auto.c +0
-0}void dm_pciauto_prescan_setup_bridge (struct udevice *dev,int sub_bus)drivers/pci/pcie_layerscape_gen4.c +8
-0@@ -526,6 +526,14 @@ static int ls_pcie_g4_probe(struct udevice *dev) pcie->rev =readb (pcie->ccsr +PCI_REVISION_ID ); +/* Set ACK latency timeout */ +if (pcie->rev ==REV_1_0 ) { + val =ccsr_readl (pcie,GPEX_ACK_REPLAY_TO ); + val &= ~(ACK_LAT_TO_VAL_MASK <<ACK_LAT_TO_VAL_SHIFT ); + val |= (4 <<ACK_LAT_TO_VAL_SHIFT ); +ccsr_writel (pcie,GPEX_ACK_REPLAY_TO , val); + } + pcie->mode =readb (pcie->ccsr +PCI_HEADER_TYPE ) &0x7f ;if (pcie->mode ==PCI_HEADER_TYPE_NORMAL ) {drivers/pci/pcie_layerscape_gen4.h +4
-0@@ -58,6 +58,10 @@#define INI_VF_SHIFT 0#define GPEX_SRIOV_VF_OFFSET_STRIDE (pf) (0x704 + (pf) * 4) +#define GPEX_ACK_REPLAY_TO 0x438 +#define ACK_LAT_TO_VAL_SHIFT 0 +#define ACK_LAT_TO_VAL_MASK 0x1fff +/* PAB CSR */ #define PAB_CTRL 0x808#define PAB_CTRL_APIO_EN BIT(0)include/pci.h +9
-0@@ -414,6 +414,15 @@#define PCI_MAX_PCI_DEVICES 32#define PCI_MAX_PCI_FUNCTIONS 8 +/* PCI Express capability registers */ +#define PCI_EXP_DEVCTL 8/* Device Control */ +#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0/* Max_Payload_Size */ +#define PCI_EXP_DEVCTL_READRQ 0x7000/* Max_Read_Request_Size */ +#define PCI_EXP_DEVCTL_READRQ_128B 0x0000/* 128 Bytes */ +#define PCI_EXP_DEVCTL_READRQ_256B 0x1000/* 256 Bytes */ +#define PCI_EXP_DEVCTL_READRQ_512B 0x2000/* 512 Bytes */ +#define PCI_EXP_DEVCTL_READRQ_1024B 0x3000/* 1024 Bytes */ +#define PCI_FIND_CAP_TTL 0x48#define CAP_START_POS 0x40include/pci_ids.h +0
-0
include/pci_ids.h
Quoted 8 lines
include/pci_ids.h +1
-1@@ -2481,6 +2481,7 @@#define PCI_DEVICE_ID_MPC8641 0x7010#define PCI_DEVICE_ID_MPC8641D 0x7011#define PCI_DEVICE_ID_MPC8610 0x7018 +#define PCI_DEVICE_ID_LX2160A 0x8D80#define PCI_VENDOR_ID_PASEMI 0x1959 --
Regards,
Bin
PATCH v3 10/11 pci: ls_pcie_g4: Add Workaround for A-011451
Hi Bin,
Thanks a lot for your comments!
Quoted 109 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月12日 11:45
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for A-011451Hi,
Quoted 17 lines · Z.q. Hou
From: Hou Zhiqiang <[email protected]>
When LAYERSCAPE Gen4 PCIe controller is sending multiple split completions and ACK latency expires indicating that ACK should be send at priority. But because of large number of split completions and FC update DLLP, the controller does not give priority to ACK transmission. This results into ACK latency timer timeout error at the link partner and the pending TLPs are replayed by the link partner again.
Workaround:
1. Reduce the ACK latency timeout value to a very small value.
2. Restrict the number of completions from the PCIe controller to 1, by changing the Max Read Request Size (MRRS) of link partner to the same value as Max Packet size (MPS).Quoted 8 lines
This ERRATA is only for LX2160A Rev1.0 and will be fixed in Rev2.0.
Signed-off-by Hou Zhiqiang <[email protected]>---
V3:
- New patch.drivers/pci/pci_auto.c | 34++++++++++++++++++++++++++++++
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev,
Quoted 11 lines
drivers/pci/pcie_layerscape_gen4.c | 8 +++++++ drivers/pci/pcie_layerscape_gen4.h | 4 ++++ include/pci.h | 9 ++++++++ include/pci_ids.h | 1 + 5 files changed, 56 insertions(+)drivers/pci/pci_auto.c index renamed from drivers/pci/pci_auto.c +0
-0
d7237f6eee..37307bd54b100644drivers/pci/pci_auto.c +0
-0@@ -22,6 +22,7 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, · line 22
Quoted 1 line
drivers/pci/pci_auto.c +0
-0struct pci_region *prefetch, struct
pci_region*io,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev,
Quoted 6 lines
drivers/pci/pci_auto.c +1
-0bool enum_only) { +struct udevice *rp =pci_get_controller (dev);u32 bar_response;pci_size_t bar_size;u16 cmdstat =0 ;@@ -32,6 +33,9 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 9 lines
drivers/pci/pci_auto.c +3
-0struct pci_region *bar_res =NULL ;int found_mem64 =0 ;u16 class; +int pos; +u16 val, vendor, dev_id; +u8 rev;dm_pci_read_config16 (dev,PCI_COMMAND , &cmdstat); cmdstat = (cmdstat & ~(PCI_COMMAND_IO |
PCI_COMMAND_MEMORY)) |drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice
Quoted 1 line
drivers/pci/pci_auto.c +0
-0@@ -161,6 +165,36 @@ void dm_pciauto_setup_device(struct udevice*dev, int
bars_num,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 6 lines
drivers/pci/pci_auto.c +3
-0dm_pci_write_config8 (dev,PCI_CACHE_LINE_SIZE ,CONFIG_SYS_PCI_CACHE_LINE_SIZE );dm_pci_write_config8 (dev,PCI_LATENCY_TIMER ,0x80 ); + +/* +* When NXP LAYERSCAPE Gen4 PCIe controller is sending multiple split
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 171
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* completions and ACK latency expires indicating that ACK should be
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 172
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* send at priority. But because of large number of split completions
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 174
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+* and FC update DLLP, the controller does not give priority to ACK +* transmission. This results into ACK latency timer timeout error at
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 5 lines
drivers/pci/pci_auto.c +5
-0+* the link partner and the pending TLPs are replayed by the link +* partner again. +* +* The workaround: +* Restrict the number of completions from the PCIe controller to 1,
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 180
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* by changing the Max Read Request Size (MRRS) of link partner to the
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 12 lines
drivers/pci/pci_auto.c +12
-0+* same value as Max Packet size (MPS). +* +* So, set both the MPS and MRRS to the minimum 128B. +*/ +dm_pci_read_config16 (rp,PCI_VENDOR_ID , &vendor); +dm_pci_read_config16 (rp,PCI_DEVICE_ID , &dev_id); +dm_pci_read_config8 (rp,PCI_REVISION_ID , &rev); +if (vendor ==PCI_VENDOR_ID_FREESCALE && + dev_id ==PCI_DEVICE_ID_LX2160A && rev ==0x10 ) { + pos =dm_pci_find_capability (dev,PCI_CAP_ID_EXP ); +if (pos) { + dm_pci_read_config16(dev, pos +
PCI_EXP_DEVCTL, &val);
Quoted 8 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 3 lines
drivers/pci/pci_auto.c +3
-0+ val &= ~(PCI_EXP_DEVCTL_READRQ | +PCI_EXP_DEVCTL_PAYLOAD ); + dm_pci_write_config16(dev, pos +
PCI_EXP_DEVCTL, val);drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num, · line 197
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ } + }Can this be done in the
probe()routine of the driver codes?
No, not only the RC itself but also all the EP devices need to setup the same MPS and MRRS, it is hard to scan the PCIe EP devices in the RC driver (a platform driver).
Quoted 76 lines
Quoted 10 lines
drivers/pci/pci_auto.c +0
-0} void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int
sub_bus) diff --gita/drivers/pci/pcie_layerscape_gen4.cb/drivers/pci/pcie_layerscape_gen4.c
index799da2f7df..b530a9979c100644drivers/pci/pcie_layerscape_gen4.c static int ls_pcie_g4_probe(struct udevice *dev) · line 532
Quoted 7 lines
drivers/pci/pcie_layerscape_gen4.c +4
-0@@ -526,6 +526,14 @@ static int ls_pcie_g4_probe(struct udevice *dev) pcie->rev =readb (pcie->ccsr +PCI_REVISION_ID ); +/* Set ACK latency timeout */ +if (pcie->rev ==REV_1_0 ) { + val =ccsr_readl (pcie,GPEX_ACK_REPLAY_TO ); + val &= ~(ACK_LAT_TO_VAL_MASK <<
ACK_LAT_TO_VAL_SHIFT);Quoted 13 lines
drivers/pci/pcie_layerscape_gen4.c +4
-0+ val |= (4 <<ACK_LAT_TO_VAL_SHIFT ); +ccsr_writel (pcie,GPEX_ACK_REPLAY_TO , val); + } + pcie->mode =readb (pcie->ccsr +PCI_HEADER_TYPE ) &0x7f ; if (pcie->mode == PCI_HEADER_TYPE_NORMAL) { diff --git
a/drivers/pci/pcie_layerscape_gen4.hb/drivers/pci/pcie_layerscape_gen4.h
index137768cae7..ebde52e49a100644drivers/pci/pcie_layerscape_gen4.h line 59
Quoted 2 lines
drivers/pci/pcie_layerscape_gen4.h +0
-0@@ -58,6 +58,10 @@#define INI_VF_SHIFT 0#define GPEX_SRIOV_VF_OFFSET_STRIDE (pf) (0x704 +(pf) * 4)
Quoted 13 lines
drivers/pci/pcie_layerscape_gen4.h +4
-0+#define GPEX_ACK_REPLAY_TO 0x438 +#define ACK_LAT_TO_VAL_SHIFT 0 +#define ACK_LAT_TO_VAL_MASK 0x1fff +/* PAB CSR */ #define PAB_CTRL 0x808#define PAB_CTRL_APIO_EN BIT(0)include/pci.h index renamed from include/pci.h +0
-0
785d7d28b7..c4d3bccc5b100644include/pci.h line 418
Quoted 5 lines
include/pci.h +2
-0@@ -414,6 +414,15 @@#define PCI_MAX_PCI_DEVICES 32#define PCI_MAX_PCI_FUNCTIONS 8 +/* PCI Express capability registers */ +#define PCI_EXP_DEVCTL 8/* Device Control */
include/pci.h line 419
Quoted 1 line
include/pci.h +1
-0+#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0/*
Max_Payload_Size*/include/pci.h line 420
Quoted 1 line
include/pci.h +1
-0+#define PCI_EXP_DEVCTL_READRQ 0x7000/*
Max_Read_Request_Size*/include/pci.h
Quoted 4 lines
include/pci.h +4
-0+#define PCI_EXP_DEVCTL_READRQ_128B 0x0000/* 128 Bytes */ +#define PCI_EXP_DEVCTL_READRQ_256B 0x1000/* 256 Bytes */ +#define PCI_EXP_DEVCTL_READRQ_512B 0x2000/* 512 Bytes */ +#define PCI_EXP_DEVCTL_READRQ_1024B 0x3000/* 1024 Bytes */
Quoted 14 lines
include/pci.h +1
-0+#define PCI_FIND_CAP_TTL 0x48#define CAP_START_POS 0x40include/pci_ids.h index renamed from include/pci_ids.h +0
-0
fdda679cc0..92a4339e3e100644include/pci_ids.h +1
-0@@ -2481,6 +2481,7 @@#define PCI_DEVICE_ID_MPC8641 0x7010#define PCI_DEVICE_ID_MPC8641D 0x7011#define PCI_DEVICE_ID_MPC8610 0x7018 +#define PCI_DEVICE_ID_LX2160A 0x8D80
Quoted 6 lines
include/pci_ids.h
Quoted 3 lines
include/pci_ids.h +0
-1#define PCI_VENDOR_ID_PASEMI 0x1959 --Regards,
Bin
Thanks,
Zhiqiang
PATCH v3 10/11 pci: ls_pcie_g4: Add Workaround for A-011451
Hi Zhiqiang,
Quoted 117 lines · Z.q. Hou
Hi Bin,
Thanks a lot for your comments!
Quoted 112 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月12日 11:45
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for A-011451Hi,
Quoted 17 lines · Z.q. Hou
From: Hou Zhiqiang <[email protected]>
When LAYERSCAPE Gen4 PCIe controller is sending multiple split completions and ACK latency expires indicating that ACK should be send at priority. But because of large number of split completions and FC update DLLP, the controller does not give priority to ACK transmission. This results into ACK latency timer timeout error at the link partner and the pending TLPs are replayed by the link partner again.
Workaround:
1. Reduce the ACK latency timeout value to a very small value.
2. Restrict the number of completions from the PCIe controller to 1, by changing the Max Read Request Size (MRRS) of link partner to the same value as Max Packet size (MPS).Quoted 8 lines
This ERRATA is only for LX2160A Rev1.0 and will be fixed in Rev2.0.
Signed-off-by Hou Zhiqiang <[email protected]>---
V3:
- New patch.drivers/pci/pci_auto.c | 34++++++++++++++++++++++++++++++
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev,
Quoted 11 lines
drivers/pci/pcie_layerscape_gen4.c | 8 +++++++ drivers/pci/pcie_layerscape_gen4.h | 4 ++++ include/pci.h | 9 ++++++++ include/pci_ids.h | 1 + 5 files changed, 56 insertions(+)drivers/pci/pci_auto.c index renamed from drivers/pci/pci_auto.c +0
-0
d7237f6eee..37307bd54b100644drivers/pci/pci_auto.c +0
-0@@ -22,6 +22,7 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, · line 22
Quoted 1 line
drivers/pci/pci_auto.c +0
-0struct pci_region *prefetch, struct
pci_region*io,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev,
Quoted 6 lines
drivers/pci/pci_auto.c +1
-0bool enum_only) { +struct udevice *rp =pci_get_controller (dev);u32 bar_response;pci_size_t bar_size;u16 cmdstat =0 ;@@ -32,6 +33,9 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 9 lines
drivers/pci/pci_auto.c +3
-0struct pci_region *bar_res =NULL ;int found_mem64 =0 ;u16 class; +int pos; +u16 val, vendor, dev_id; +u8 rev;dm_pci_read_config16 (dev,PCI_COMMAND , &cmdstat); cmdstat = (cmdstat & ~(PCI_COMMAND_IO |
PCI_COMMAND_MEMORY)) |drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice
Quoted 1 line
drivers/pci/pci_auto.c +0
-0@@ -161,6 +165,36 @@ void dm_pciauto_setup_device(struct udevice*dev, int
bars_num,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 6 lines
drivers/pci/pci_auto.c +3
-0dm_pci_write_config8 (dev,PCI_CACHE_LINE_SIZE ,CONFIG_SYS_PCI_CACHE_LINE_SIZE );dm_pci_write_config8 (dev,PCI_LATENCY_TIMER ,0x80 ); + +/* +* When NXP LAYERSCAPE Gen4 PCIe controller is sending multiple split
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 171
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* completions and ACK latency expires indicating that ACK should be
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 172
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* send at priority. But because of large number of split completions
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 174
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+* and FC update DLLP, the controller does not give priority to ACK +* transmission. This results into ACK latency timer timeout error at
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 5 lines
drivers/pci/pci_auto.c +5
-0+* the link partner and the pending TLPs are replayed by the link +* partner again. +* +* The workaround: +* Restrict the number of completions from the PCIe controller to 1,
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 180
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* by changing the Max Read Request Size (MRRS) of link partner to the
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 12 lines
drivers/pci/pci_auto.c +12
-0+* same value as Max Packet size (MPS). +* +* So, set both the MPS and MRRS to the minimum 128B. +*/ +dm_pci_read_config16 (rp,PCI_VENDOR_ID , &vendor); +dm_pci_read_config16 (rp,PCI_DEVICE_ID , &dev_id); +dm_pci_read_config8 (rp,PCI_REVISION_ID , &rev); +if (vendor ==PCI_VENDOR_ID_FREESCALE && + dev_id ==PCI_DEVICE_ID_LX2160A && rev ==0x10 ) { + pos =dm_pci_find_capability (dev,PCI_CAP_ID_EXP ); +if (pos) { + dm_pci_read_config16(dev, pos +
PCI_EXP_DEVCTL, &val);Quoted 3 lines
drivers/pci/pci_auto.c +3
-0+ val &= ~(PCI_EXP_DEVCTL_READRQ | +PCI_EXP_DEVCTL_PAYLOAD ); + dm_pci_write_config16(dev, pos +
Quoted 8 lines
Quoted 5 lines
PCI_EXP_DEVCTL, val);drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num, · line 197
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ } + }Can this be done in the
probe()routine of the driver codes?No, not only the RC itself but also all the EP devices need to setup the same MPS and MRRS, it is hard to scan the PCIe EP devices in the RC driver (a platform driver).
If this is the case, I think we need split the patch into 2 commits:
- 1 commit to update the PCI library to program MPS and MRRS. This can be generic though.
- 1 commit to update the gen4 PCIe driver for the workaround
BTW: the default MPS and MRRS should be 128B per the PCIe spec. I am wondering why the gen4 PCIe RC does not follow the spec.
Regards,
Bin
PATCH v3 10/11 pci: ls_pcie_g4: Add Workaround for A-011451
Hi Bin,
Thanks a lot for your comments!
Quoted 154 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月14日 14:17
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for A-011451Hi Zhiqiang,
Quoted 84 lines · Z.q. Hou
Hi Bin,
Thanks a lot for your comments!
Quoted 79 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月12日 11:45
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for
A-011451Hi,
Quoted 17 lines · Z.q. Hou
From: Hou Zhiqiang <[email protected]>
When LAYERSCAPE Gen4 PCIe controller is sending multiple split completions and ACK latency expires indicating that ACK should be send at priority. But because of large number of split completions and FC update DLLP, the controller does not give priority to ACK transmission. This results into ACK latency timer timeout error at the link partner and the pending TLPs are replayed by the link partner again.
Workaround:
1. Reduce the ACK latency timeout value to a very small value.
2. Restrict the number of completions from the PCIe controller to 1, by changing the Max Read Request Size (MRRS) of link partner to the same value as Max Packet size (MPS).Quoted 8 lines
This ERRATA is only for LX2160A Rev1.0 and will be fixed in Rev2.0.
Signed-off-by Hou Zhiqiang <[email protected]>---
V3:
- New patch.drivers/pci/pci_auto.c | 34++++++++++++++++++++++++++++++
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 22
Quoted 12 lines
drivers/pci/pcie_layerscape_gen4.c | 8 +++++++ drivers/pci/pcie_layerscape_gen4.h | 4 ++++ include/pci.h | 9 ++++++++ include/pci_ids.h | 1 + 5 files changed, 56 insertions(+)drivers/pci/pci_auto.c index renamed from drivers/pci/pci_auto.c +0
-0
d7237f6eee..37307bd54b100644drivers/pci/pci_auto.c +0
-0@@ -22,6 +22,7 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 23
Quoted 1 line
drivers/pci/pci_auto.c +0
-0struct pci_region *prefetch, struct
pci_region*io,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 33
Quoted 7 lines
drivers/pci/pci_auto.c +1
-0bool enum_only) { +struct udevice *rp =pci_get_controller (dev);u32 bar_response;pci_size_t bar_size;u16 cmdstat =0 ;@@ -32,6 +33,9 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,Quoted 9 lines
drivers/pci/pci_auto.c +3
-0struct pci_region *bar_res =NULL ;int found_mem64 =0 ;u16 class; +int pos; +u16 val, vendor, dev_id; +u8 rev;dm_pci_read_config16 (dev,PCI_COMMAND , &cmdstat);cmdstat = (cmdstat & ~(PCI_COMMAND_IO |
PCI_COMMAND_MEMORY)) |drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice
Quoted 1 line
drivers/pci/pci_auto.c +0
-0@@ -161,6 +165,36 @@ void dm_pciauto_setup_device(struct udevice*dev, int
bars_num,Quoted 2 lines
drivers/pci/pci_auto.c +0
-0dm_pci_write_config8(dev, PCI_CACHE_LINE_SIZE,
CONFIG_SYS_PCI_CACHE_LINE_SIZE);Quoted 11 lines
Quoted 11 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 4 lines
drivers/pci/pci_auto.c +3
-0dm_pci_write_config8 (dev,PCI_LATENCY_TIMER ,0x80 ); + +/* +* When NXP LAYERSCAPE Gen4 PCIe controller is sending multiple split
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 172
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ * completions and ACK latency expires indicating that ACK + shouldbe
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 173
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* send at priority. But because of large number of split completions
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* and FC update DLLP, the controller does not give priority to ACK
Quoted 4 lines
Quoted 4 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 176
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ * transmission. This results into ACK latency timer +timeout errorat
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* the link partner and the pending TLPs are replayed by the link
Quoted 9 lines
Quoted 9 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 5 lines
drivers/pci/pci_auto.c +5
-0+* partner again. +* +* The workaround: +* Restrict the number of completions from the PCIe +controller to 1,
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 184
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ * by changing the Max Read Request Size (MRRS) of link + partnerto the
Quoted 10 lines
Quoted 10 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 10 lines
drivers/pci/pci_auto.c +10
-0+* same value as Max Packet size (MPS). +* +* So, set both the MPS and MRRS to the minimum 128B. +*/ +dm_pci_read_config16 (rp,PCI_VENDOR_ID , &vendor); +dm_pci_read_config16 (rp,PCI_DEVICE_ID , &dev_id); +dm_pci_read_config8 (rp,PCI_REVISION_ID , &rev); +if (vendor ==PCI_VENDOR_ID_FREESCALE && + dev_id ==PCI_DEVICE_ID_LX2160A && rev ==0x10 ) { + pos = dm_pci_find_capability(dev,
PCI_CAP_ID_EXP);Quoted 6 lines
Quoted 6 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 196
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+if (pos) { + dm_pci_read_config16(dev, pos +
PCI_EXP_DEVCTL, &val);Quoted 3 lines
drivers/pci/pci_auto.c +3
-0+ val &= ~(PCI_EXP_DEVCTL_READRQ | +PCI_EXP_DEVCTL_PAYLOAD ); + dm_pci_write_config16(dev, pos +Quoted 7 lines
Quoted 5 lines
PCI_EXP_DEVCTL, val);drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num, · line 197
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ } + }Can this be done in the
probe()routine of the driver codes?No, not only the RC itself but also all the EP devices need to setup the same
MPS and MRRS, it is hard to scan the PCIe EP devices in the RC driver (a platform driver).
Quoted 1 line
Quoted 5 lines
If this is the case, I think we need split the patch into 2 commits:
- 1 commit to update the PCI library to program MPS and MRRS. This can be generic though.
- 1 commit to update the gen4 PCIe driver for the workaround
Thanks for your suggestion! Will split it.
Quoted 3 lines
BTW: the default MPS and MRRS should be 128B per the PCIe spec. I am wondering why the gen4 PCIe RC does not follow the spec.
The default MPS is 128B but default MRRS is 512B in the spec. And this is a NXP Gen4 PCIe controller's ERRATA as descripted in the comments that result in the NXP RC does not work well with the default value.
Quoted 3 lines
Regards,
Bin
Thanks,
Zhiqiang
PATCH v3 10/11 pci: ls_pcie_g4: Add Workaround for A-011451
Hi Zhiqiang,
Quoted 159 lines · Z.q. Hou
Hi Bin,
Thanks a lot for your comments!
Quoted 154 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月14日 14:17
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for A-011451Hi Zhiqiang,
Quoted 84 lines · Z.q. Hou
Hi Bin,
Thanks a lot for your comments!
Quoted 79 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月12日 11:45
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for
A-011451Hi,
Quoted 17 lines · Z.q. Hou
From: Hou Zhiqiang <[email protected]>
When LAYERSCAPE Gen4 PCIe controller is sending multiple split completions and ACK latency expires indicating that ACK should be send at priority. But because of large number of split completions and FC update DLLP, the controller does not give priority to ACK transmission. This results into ACK latency timer timeout error at the link partner and the pending TLPs are replayed by the link partner again.
Workaround:
1. Reduce the ACK latency timeout value to a very small value.
2. Restrict the number of completions from the PCIe controller to 1, by changing the Max Read Request Size (MRRS) of link partner to the same value as Max Packet size (MPS).Quoted 8 lines
This ERRATA is only for LX2160A Rev1.0 and will be fixed in Rev2.0.
Signed-off-by Hou Zhiqiang <[email protected]>---
V3:
- New patch.drivers/pci/pci_auto.c | 34++++++++++++++++++++++++++++++
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 22
Quoted 12 lines
drivers/pci/pcie_layerscape_gen4.c | 8 +++++++ drivers/pci/pcie_layerscape_gen4.h | 4 ++++ include/pci.h | 9 ++++++++ include/pci_ids.h | 1 + 5 files changed, 56 insertions(+)drivers/pci/pci_auto.c index renamed from drivers/pci/pci_auto.c +0
-0
d7237f6eee..37307bd54b100644drivers/pci/pci_auto.c +0
-0@@ -22,6 +22,7 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 23
Quoted 1 line
drivers/pci/pci_auto.c +0
-0struct pci_region *prefetch, struct
pci_region*io,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 33
Quoted 7 lines
drivers/pci/pci_auto.c +1
-0bool enum_only) { +struct udevice *rp =pci_get_controller (dev);u32 bar_response;pci_size_t bar_size;u16 cmdstat =0 ;@@ -32,6 +33,9 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,Quoted 9 lines
drivers/pci/pci_auto.c +3
-0struct pci_region *bar_res =NULL ;int found_mem64 =0 ;u16 class; +int pos; +u16 val, vendor, dev_id; +u8 rev;dm_pci_read_config16 (dev,PCI_COMMAND , &cmdstat);cmdstat = (cmdstat & ~(PCI_COMMAND_IO |
PCI_COMMAND_MEMORY)) |drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice
Quoted 1 line
drivers/pci/pci_auto.c +0
-0@@ -161,6 +165,36 @@ void dm_pciauto_setup_device(struct udevice*dev, int
bars_num,Quoted 2 lines
drivers/pci/pci_auto.c +0
-0dm_pci_write_config8(dev, PCI_CACHE_LINE_SIZE,
CONFIG_SYS_PCI_CACHE_LINE_SIZE);Quoted 11 lines
Quoted 11 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 4 lines
drivers/pci/pci_auto.c +3
-0dm_pci_write_config8 (dev,PCI_LATENCY_TIMER ,0x80 ); + +/* +* When NXP LAYERSCAPE Gen4 PCIe controller is sending multiple split
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 172
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ * completions and ACK latency expires indicating that ACK + shouldbe
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 173
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* send at priority. But because of large number of split completions
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* and FC update DLLP, the controller does not give priority to ACK
Quoted 4 lines
Quoted 4 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 176
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ * transmission. This results into ACK latency timer +timeout errorat
Quoted 1 line
drivers/pci/pci_auto.c +1
-0+* the link partner and the pending TLPs are replayed by the link
Quoted 9 lines
Quoted 9 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 5 lines
drivers/pci/pci_auto.c +5
-0+* partner again. +* +* The workaround: +* Restrict the number of completions from the PCIe +controller to 1,
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 184
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ * by changing the Max Read Request Size (MRRS) of link + partnerto the
Quoted 10 lines
Quoted 10 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 10 lines
drivers/pci/pci_auto.c +10
-0+* same value as Max Packet size (MPS). +* +* So, set both the MPS and MRRS to the minimum 128B. +*/ +dm_pci_read_config16 (rp,PCI_VENDOR_ID , &vendor); +dm_pci_read_config16 (rp,PCI_DEVICE_ID , &dev_id); +dm_pci_read_config8 (rp,PCI_REVISION_ID , &rev); +if (vendor ==PCI_VENDOR_ID_FREESCALE && + dev_id ==PCI_DEVICE_ID_LX2160A && rev ==0x10 ) { + pos = dm_pci_find_capability(dev,
PCI_CAP_ID_EXP);Quoted 6 lines
Quoted 6 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 196
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+if (pos) { + dm_pci_read_config16(dev, pos +
PCI_EXP_DEVCTL, &val);Quoted 3 lines
drivers/pci/pci_auto.c +3
-0+ val &= ~(PCI_EXP_DEVCTL_READRQ | +PCI_EXP_DEVCTL_PAYLOAD ); + dm_pci_write_config16(dev, pos +Quoted 7 lines
Quoted 5 lines
PCI_EXP_DEVCTL, val);drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num, · line 197
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ } + }Can this be done in the
probe()routine of the driver codes?No, not only the RC itself but also all the EP devices need to setup the same
MPS and MRRS, it is hard to scan the PCIe EP devices in the RC driver (a platform driver).
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
If this is the case, I think we need split the patch into 2 commits:
- 1 commit to update the PCI library to program MPS and MRRS. This can be generic though.
- 1 commit to update the gen4 PCIe driver for the workaroundThanks for your suggestion! Will split it.
I was wondering whether we can introduce a quirk settings support in the PCI bus codes, something like how Linux handles.
For this errata, is the timing of programming MPS and MRRS required to be happen in the middle of enumeration progress? If not, we can do it later by using the quirk settings (VID, DID).
Quoted 6 lines
Quoted 3 lines
BTW: the default MPS and MRRS should be 128B per the PCIe spec. I am wondering why the gen4 PCIe RC does not follow the spec.
The default MPS is 128B but default MRRS is 512B in the spec. And this is a NXP Gen4 PCIe controller's ERRATA as descripted in the comments that result in the NXP RC does not work well with the default value.
OK, thanks for the clarification. So both MPS and MRRS have to be 128B on the NXP Gen3 PCIe controller in order to get it work.
Regards,
Bin
PATCH v3 10/11 pci: ls_pcie_g4: Add Workaround for A-011451
Hi Bin,
Thanks a lot for your comments!
Quoted 194 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月21日 18:26
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for A-011451Hi Zhiqiang,
Quoted 21 lines · Z.q. Hou
Hi Bin,
Thanks a lot for your comments!
Quoted 16 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月14日 14:17
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for
A-011451Hi Zhiqiang,
On Thu, Feb 14, 2019 at 11:52 AM Z.q. Hou <[email protected]>
Quoted 21 lines · wrote:
Quoted 21 lines
Quoted 21 lines
Hi Bin,
Thanks a lot for your comments!
Quoted 16 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月12日 11:45
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for
A-011451Hi,
On Fri, Jan 25, 2019 at 6:07 PM Z.q. Hou <[email protected]>
Quoted 95 lines · wrote:
Quoted 95 lines
Quoted 57 lines
Quoted 57 lines
Quoted 17 lines
From: Hou Zhiqiang <[email protected]>
When LAYERSCAPE Gen4 PCIe controller is sending multiple split completions and ACK latency expires indicating that ACK should be send at priority. But because of large number of split completions and FC update DLLP, the controller does not give priority to ACK transmission. This results into ACK latency timer timeout error at the link partner and the pending TLPs are replayed by the link partner again.
Workaround:
1. Reduce the ACK latency timeout value to a very small value.
2. Restrict the number of completions from the PCIe controller to 1, by changing the Max Read Request Size (MRRS) of link partner to the same value as Max Packet size (MPS).Quoted 8 lines
This ERRATA is only for LX2160A Rev1.0 and will be fixed in Rev2.0.
Signed-off-by Hou Zhiqiang <[email protected]>---
V3:
- New patch.drivers/pci/pci_auto.c | 34++++++++++++++++++++++++++++++
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 22
Quoted 12 lines
drivers/pci/pcie_layerscape_gen4.c | 8 +++++++ drivers/pci/pcie_layerscape_gen4.h | 4 ++++ include/pci.h | 9 ++++++++ include/pci_ids.h | 1 + 5 files changed, 56 insertions(+)drivers/pci/pci_auto.c +0
-0@@ -22,6 +22,7 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,Quoted 2 lines
drivers/pci/pci_auto.c +0
-0struct pci_region *prefetch,struct
pci_region*io,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 33
Quoted 7 lines
bool enum_only) {drivers/pci/pci_auto.c +1
-0+struct udevice *rp =pci_get_controller (dev);u32 bar_response;pci_size_t bar_size;u16 cmdstat =0 ;@@ -32,6 +33,9 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,Quoted 7 lines
drivers/pci/pci_auto.c +3
-0struct pci_region *bar_res =NULL ;int found_mem64 =0 ;u16 class; +int pos; +u16 val, vendor, dev_id; +u8 rev;Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
drivers/pci/pci_auto.c +0
-0dm_pci_read_config16 (dev,PCI_COMMAND , &cmdstat);cmdstat = (cmdstat & ~(PCI_COMMAND_IO |
PCI_COMMAND_MEMORY)) |Quoted 2 lines
drivers/pci/pci_auto.c +0
-0@@ -161,6 +165,36 @@ void dm_pciauto_setup_device(structudevice
*dev, int
bars_num,Quoted 2 lines
dm_pci_write_config8(dev,
PCI_CACHE_LINE_SIZE,
CONFIG_SYS_PCI_CACHE_LINE_SIZE);Quoted 5 lines
Quoted 5 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 4 lines
dm_pci_write_config8(dev, PCI_LATENCY_TIMER, 0x80);drivers/pci/pci_auto.c +3
-0+ +/* +* When NXP LAYERSCAPE Gen4 PCIe controller is sending multiple split
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
+ * completions and ACK latency expires indicating that
+ ACK shouldbe
Quoted 2 lines
+ * send at priority. But because of large number of
+ splitcompletions
Quoted 2 lines
+ * and FC update DLLP, the controller does not give
+ priority toACK
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
+ * transmission. This results into ACK latency timer
+ timeout errorat
Quoted 2 lines
+ * the link partner and the pending TLPs are replayed
+ by thelink
Quoted 9 lines
Quoted 9 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 5 lines
drivers/pci/pci_auto.c +5
-0+* partner again. +* +* The workaround: +* Restrict the number of completions from the PCIe +controller to 1,
Quoted 2 lines
+ * by changing the Max Read Request Size (MRRS) of
+ link partnerto the
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
Quoted 9 lines
drivers/pci/pci_auto.c +9
-0+* same value as Max Packet size (MPS). +* +* So, set both the MPS and MRRS to the minimum 128B. +*/ +dm_pci_read_config16 (rp,PCI_VENDOR_ID , &vendor); +dm_pci_read_config16 (rp,PCI_DEVICE_ID , &dev_id); +dm_pci_read_config8 (rp,PCI_REVISION_ID , &rev); +if (vendor ==PCI_VENDOR_ID_FREESCALE && + dev_id ==PCI_DEVICE_ID_LX2160A && rev ==0x10 ){
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ pos = dm_pci_find_capability(dev,
PCI_CAP_ID_EXP);Quoted 5 lines
Quoted 5 lines
drivers/pci/pci_auto.c
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+if (pos) { + dm_pci_read_config16(dev, pos +
PCI_EXP_DEVCTL, &val);Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ val &= ~(PCI_EXP_DEVCTL_READRQ | +
PCI_EXP_DEVCTL_PAYLOAD);Quoted 13 lines
Quoted 13 lines
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
+ dm_pci_write_config16(dev, pos +
PCI_EXP_DEVCTL, val);drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice *dev, int bars_num, · line 197
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ } + }Can this be done in the
probe()routine of the driver codes?No, not only the RC itself but also all the EP devices need to setup the same
MPS and MRRS, it is hard to scan the PCIe EP devices in the RC driver (a platform driver).
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
If this is the case, I think we need split the patch into 2 commits:
- 1 commit to update the PCI library to program MPS and MRRS. This can be generic though.
- 1 commit to update the gen4 PCIe driver for the workaroundThanks for your suggestion! Will split it.
Quoted 6 lines
I was wondering whether we can introduce a quirk settings support in the PCI bus codes, something like how Linux handles.
For this errata, is the timing of programming MPS and MRRS required to be happen in the middle of enumeration progress? If not, we can do it later by using the quirk settings (VID, DID).
The problem is not the timing, it can be put anywhere before the enumeration complete, but the NXP Gen4 RC - PCI bridge - EP breadth, I mean the whole PCIe device tree's MPS and MRRS from RC to all the PCIe devices (PCI bridge and EP) need to be set, so the Linux quirk mode is not suitable for this.
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
BTW: the default MPS and MRRS should be 128B per the PCIe spec. I am wondering why the gen4 PCIe RC does not follow the spec.
The default MPS is 128B but default MRRS is 512B in the spec. And this is a
NXP Gen4 PCIe controller's ERRATA as descripted in the comments that result in the NXP RC does not work well with the default value.
Quoted 1 line
Quoted 5 lines
OK, thanks for the clarification. So both MPS and MRRS have to be 128B on the NXP Gen3 PCIe controller in order to get it work.
Regards,
Bin
Thanks,
Zhiqiang
PATCH v3 10/11 pci: ls_pcie_g4: Add Workaround for A-011451
Hi Zhiqiang,
Quoted 199 lines · Z.q. Hou
Hi Bin,
Thanks a lot for your comments!
Quoted 194 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月21日 18:26
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for A-011451Hi Zhiqiang,
Quoted 21 lines · Z.q. Hou
Hi Bin,
Thanks a lot for your comments!
Quoted 16 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月14日 14:17
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for
A-011451Hi Zhiqiang,
On Thu, Feb 14, 2019 at 11:52 AM Z.q. Hou <[email protected]>
Quoted 21 lines · wrote:
Quoted 21 lines
Quoted 21 lines
Hi Bin,
Thanks a lot for your comments!
Quoted 16 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月12日 11:45
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for
A-011451Hi,
On Fri, Jan 25, 2019 at 6:07 PM Z.q. Hou <[email protected]>
Quoted 95 lines · wrote:
Quoted 95 lines
Quoted 57 lines
Quoted 57 lines
Quoted 17 lines
From: Hou Zhiqiang <[email protected]>
When LAYERSCAPE Gen4 PCIe controller is sending multiple split completions and ACK latency expires indicating that ACK should be send at priority. But because of large number of split completions and FC update DLLP, the controller does not give priority to ACK transmission. This results into ACK latency timer timeout error at the link partner and the pending TLPs are replayed by the link partner again.
Workaround:
1. Reduce the ACK latency timeout value to a very small value.
2. Restrict the number of completions from the PCIe controller to 1, by changing the Max Read Request Size (MRRS) of link partner to the same value as Max Packet size (MPS).Quoted 8 lines
This ERRATA is only for LX2160A Rev1.0 and will be fixed in Rev2.0.
Signed-off-by Hou Zhiqiang <[email protected]>---
V3:
- New patch.drivers/pci/pci_auto.c | 34++++++++++++++++++++++++++++++
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 22
Quoted 12 lines
drivers/pci/pcie_layerscape_gen4.c | 8 +++++++ drivers/pci/pcie_layerscape_gen4.h | 4 ++++ include/pci.h | 9 ++++++++ include/pci_ids.h | 1 + 5 files changed, 56 insertions(+)drivers/pci/pci_auto.c +0
-0@@ -22,6 +22,7 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,Quoted 2 lines
drivers/pci/pci_auto.c +0
-0struct pci_region *prefetch,struct
pci_region*io,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct udevice · line 33
Quoted 7 lines
bool enum_only) {drivers/pci/pci_auto.c +1
-0+struct udevice *rp =pci_get_controller (dev);u32 bar_response;pci_size_t bar_size;u16 cmdstat =0 ;@@ -32,6 +33,9 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,Quoted 7 lines
drivers/pci/pci_auto.c +3
-0struct pci_region *bar_res =NULL ;int found_mem64 =0 ;u16 class; +int pos; +u16 val, vendor, dev_id; +u8 rev;Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
drivers/pci/pci_auto.c +0
-0dm_pci_read_config16 (dev,PCI_COMMAND , &cmdstat);cmdstat = (cmdstat & ~(PCI_COMMAND_IO |
PCI_COMMAND_MEMORY)) |Quoted 2 lines
drivers/pci/pci_auto.c +0
-0@@ -161,6 +165,36 @@ void dm_pciauto_setup_device(structudevice
*dev, int
bars_num,Quoted 2 lines
dm_pci_write_config8(dev,
PCI_CACHE_LINE_SIZE,
CONFIG_SYS_PCI_CACHE_LINE_SIZE);Quoted 5 lines
Quoted 5 lines
drivers/pci/pci_auto.c
Quoted 4 lines
dm_pci_write_config8(dev, PCI_LATENCY_TIMER, 0x80);drivers/pci/pci_auto.c +3
-0+ +/* +* When NXP LAYERSCAPE Gen4 PCIe controller is sending multiple split
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
+ * completions and ACK latency expires indicating that
+ ACK shouldbe
Quoted 2 lines
+ * send at priority. But because of large number of
+ splitcompletions
Quoted 2 lines
+ * and FC update DLLP, the controller does not give
+ priority toACK
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
+ * transmission. This results into ACK latency timer
+ timeout errorat
Quoted 2 lines
+ * the link partner and the pending TLPs are replayed
+ by thelink
Quoted 9 lines
Quoted 9 lines
drivers/pci/pci_auto.c
Quoted 5 lines
drivers/pci/pci_auto.c +5
-0+* partner again. +* +* The workaround: +* Restrict the number of completions from the PCIe +controller to 1,
Quoted 2 lines
+ * by changing the Max Read Request Size (MRRS) of
+ link partnerto the
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/pci/pci_auto.c
Quoted 9 lines
drivers/pci/pci_auto.c +9
-0+* same value as Max Packet size (MPS). +* +* So, set both the MPS and MRRS to the minimum 128B. +*/ +dm_pci_read_config16 (rp,PCI_VENDOR_ID , &vendor); +dm_pci_read_config16 (rp,PCI_DEVICE_ID , &dev_id); +dm_pci_read_config8 (rp,PCI_REVISION_ID , &rev); +if (vendor ==PCI_VENDOR_ID_FREESCALE && + dev_id ==PCI_DEVICE_ID_LX2160A && rev ==0x10 ){
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ pos = dm_pci_find_capability(dev,
PCI_CAP_ID_EXP);Quoted 5 lines
Quoted 5 lines
drivers/pci/pci_auto.c
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+if (pos) { + dm_pci_read_config16(dev, pos +
PCI_EXP_DEVCTL, &val);Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ val &= ~(PCI_EXP_DEVCTL_READRQ | +
PCI_EXP_DEVCTL_PAYLOAD);Quoted 21 lines
Quoted 13 lines
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
+ dm_pci_write_config16(dev, pos +
PCI_EXP_DEVCTL, val);drivers/pci/pci_auto.c
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ } + }Can this be done in the
probe()routine of the driver codes?No, not only the RC itself but also all the EP devices need to setup the same
MPS and MRRS, it is hard to scan the PCIe EP devices in the RC driver (a platform driver).
Quoted 1 line
Quoted 5 lines
If this is the case, I think we need split the patch into 2 commits:
- 1 commit to update the PCI library to program MPS and MRRS. This can be generic though.
- 1 commit to update the gen4 PCIe driver for the workaroundThanks for your suggestion! Will split it.
Quoted 9 lines
Quoted 6 lines
I was wondering whether we can introduce a quirk settings support in the PCI bus codes, something like how Linux handles.
For this errata, is the timing of programming MPS and MRRS required to be happen in the middle of enumeration progress? If not, we can do it later by using the quirk settings (VID, DID).
The problem is not the timing, it can be put anywhere before the enumeration complete, but the NXP Gen4 RC - PCI bridge - EP breadth, I mean the whole PCIe device tree's MPS and MRRS from RC to all the PCIe devices (PCI bridge and EP) need to be set, so the Linux quirk mode is not suitable for this.
Yes, I understand all devices's MPS/MRRS on the path should be programmed. Actually I have an x86 board that expose such an issue too and I am sure we need introduce the MPS/MRRS support in U-Boot but I have not worked on this.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
BTW: the default MPS and MRRS should be 128B per the PCIe spec. I am wondering why the gen4 PCIe RC does not follow the spec.
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
The default MPS is 128B but default MRRS is 512B in the spec. And this is a
NXP Gen4 PCIe controller's ERRATA as descripted in the comments that result in the NXP RC does not work well with the default value.
Quoted 1 line
OK, thanks for the clarification. So both MPS and MRRS have to be 128B on the NXP Gen3 PCIe controller in order to get it work.
Regards,
Bin
PATCH v3 10/11 pci: ls_pcie_g4: Add Workaround for A-011451
Hi Bin,
Quoted 241 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月26日 10:48
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for A-011451Hi Zhiqiang,
Quoted 21 lines · Z.q. Hou
Hi Bin,
Thanks a lot for your comments!
Quoted 16 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月21日 18:26
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for
A-011451Hi Zhiqiang,
On Mon, Feb 18, 2019 at 9:34 AM Z.q. Hou <[email protected]>
Quoted 49 lines · wrote:
Quoted 49 lines
Quoted 21 lines
Hi Bin,
Thanks a lot for your comments!
Quoted 16 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月14日 14:17
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for
A-011451Hi Zhiqiang,
On Thu, Feb 14, 2019 at 11:52 AM Z.q. Hou <[email protected]>
Quoted 23 lines · wrote:
Quoted 23 lines
Quoted 23 lines
Hi Bin,
Thanks a lot for your comments!
Quoted 18 lines
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年2月12日 11:45
To: Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCHv3 10/11] pci:ls_pcie_g4: Add Workaround for
A-011451Hi,
On Fri, Jan 25, 2019 at 6:07 PM Z.q. Hou
<[email protected]>Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Hou Zhiqiang <[email protected]>
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
When LAYERSCAPE Gen4 PCIe controller is sending multiple split completions and ACK latency expires indicating that ACK should be send at priority. But because of large number of split completions and FC update DLLP, the controller does not give priority to ACK transmission. This results into ACK latency timer timeout error at the link partner and the pending TLPs are replayed by the link partner
again.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Workaround:
1. Reduce the ACK latency timeout value to a very small value.
2. Restrict the number of completions from the PCIe controller to 1, by changing the Max Read Request Size (MRRS) of link partner to the same value as Max Packet size (MPS).This ERRATA is only for LX2160A Rev1.0 and will be fixed in
Rev2.0.
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 7 lines
Signed-off-by Hou Zhiqiang <[email protected]>---
V3:
- New patch.drivers/pci/pci_auto.c | 34++++++++++++++++++++++++++++++
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct · line 22
Quoted 13 lines
drivers/pci/pcie_layerscape_gen4.c | 8 +++++++ drivers/pci/pcie_layerscape_gen4.h | 4 ++++ include/pci.h | 9 ++++++++ include/pci_ids.h | 1 + 5 files changed, 56 insertions(+)(quoted diff) +0
-0
b/drivers/pci/pci_auto.cindexd7237f6eee..37307bd54b100644drivers/pci/pci_auto.c +0
-0@@ -22,6 +22,7 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,Quoted 2 lines
drivers/pci/pci_auto.c +0
-0struct pci_region *prefetch,struct
pci_region*io,drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct · line 33
Quoted 7 lines
bool enum_only) {drivers/pci/pci_auto.c +1
-0+struct udevice *rp =pci_get_controller (dev);u32 bar_response;pci_size_t bar_size;u16 cmdstat =0 ;@@ -32,6 +33,9 @@ void dm_pciauto_setup_device(struct udevice *dev,int
bars_num,Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/pci/pci_auto.c void dm_pciauto_setup_device(struct · line 41
Quoted 8 lines
drivers/pci/pci_auto.c +3
-0struct pci_region *bar_res =NULL ;int found_mem64 =0 ;u16 class; +int pos; +u16 val, vendor, dev_id; +u8 rev; dm_pci_read_config16(dev, PCI_COMMAND,&cmdstat);
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
cmdstat = (cmdstat & ~(PCI_COMMAND_IO |
PCI_COMMAND_MEMORY)) |Quoted 2 lines
drivers/pci/pci_auto.c +0
-0@@ -161,6 +165,36 @@ void dm_pciauto_setup_device(structudevice
*dev, int
bars_num,Quoted 2 lines
dm_pci_write_config8(dev,
PCI_CACHE_LINE_SIZE,
CONFIG_SYS_PCI_CACHE_LINE_SIZE);Quoted 7 lines
Quoted 7 lines
drivers/pci/pci_auto.c
Quoted 6 lines
dm_pci_write_config8(dev,
PCI_LATENCY_TIMER,0x80);drivers/pci/pci_auto.c +4
-0+ +/* +* When NXP LAYERSCAPE Gen4 PCIe controller is +sending multiple split
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
+ * completions and ACK latency expires indicating
+ that ACK shouldbe
Quoted 2 lines
+ * send at priority. But because of large number
+ of splitcompletions
Quoted 2 lines
+ * and FC update DLLP, the controller does not
+ give priority toACK
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
+ * transmission. This results into ACK latency
+ timer timeout errorat
Quoted 2 lines
+ * the link partner and the pending TLPs are
+ replayed by thelink
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/pci/pci_auto.c +5
-0+* partner again. +* +* The workaround: +* Restrict the number of completions from the +PCIe controller to Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
1,
Quoted 2 lines
+ * by changing the Max Read Request Size (MRRS) of
+ link partnerto the
Quoted 3 lines
drivers/pci/pci_auto.c +3
-0+* same value as Max Packet size (MPS). +* +* So, set both the MPS and MRRS to the minimum 128B.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/pci/pci_auto.c +7
-0+*/ +dm_pci_read_config16 (rp,PCI_VENDOR_ID , &vendor); +dm_pci_read_config16 (rp,PCI_DEVICE_ID , &dev_id); +dm_pci_read_config8 (rp,PCI_REVISION_ID , &rev); +if (vendor ==PCI_VENDOR_ID_FREESCALE && + dev_id ==PCI_DEVICE_ID_LX2160A && rev == +0x10 )Quoted 7 lines
Quoted 7 lines
{
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ pos = dm_pci_find_capability(dev,
PCI_CAP_ID_EXP);Quoted 4 lines
Quoted 4 lines
drivers/pci/pci_auto.c
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+if (pos) { + dm_pci_read_config16(dev, pos +
PCI_EXP_DEVCTL, &val);Quoted 1 line
+ val &=
~(PCI_EXP_DEVCTL_READRQ |
Quoted 24 lines
Quoted 24 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+
PCI_EXP_DEVCTL_PAYLOAD);Quoted 21 lines
Quoted 13 lines
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
+ dm_pci_write_config16(dev, pos +
PCI_EXP_DEVCTL, val);drivers/pci/pci_auto.c
Quoted 2 lines
drivers/pci/pci_auto.c +2
-0+ } + }Can this be done in the
probe()routine of the driver codes?No, not only the RC itself but also all the EP devices need to setup the same
MPS and MRRS, it is hard to scan the PCIe EP devices in the RC driver (a platform driver).
Quoted 1 line
Quoted 5 lines
If this is the case, I think we need split the patch into 2 commits:
- 1 commit to update the PCI library to program MPS and MRRS. This can be generic though.
- 1 commit to update the gen4 PCIe driver for the workaroundThanks for your suggestion! Will split it.
Quoted 8 lines
Quoted 6 lines
I was wondering whether we can introduce a quirk settings support in the PCI bus codes, something like how Linux handles.
For this errata, is the timing of programming MPS and MRRS required to be happen in the middle of enumeration progress? If not, we can do it later by using the quirk settings (VID, DID).
The problem is not the timing, it can be put anywhere before the
enumeration complete, but the NXP Gen4 RC - PCI bridge - EP breadth, I mean the whole PCIe device tree's MPS and MRRS from RC to all the PCIe devices (PCI bridge and EP) need to be set, so the Linux quirk mode is not suitable for this.
Quoted 1 line
Quoted 4 lines
Yes, I understand all devices's MPS/MRRS on the path should be programmed. Actually I have an x86 board that expose such an issue too and I am sure we need introduce the MPS/MRRS support in U-Boot but I have not worked on this.
I'm working on this and will add the MPS/MRRS APIs in v4 patches, and you can work out the x86 patch base on that.
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines
BTW: the default MPS and MRRS should be 128B per the PCIe spec. I am wondering why the gen4 PCIe RC does not follow the spec.
The default MPS is 128B but default MRRS is 512B in the spec. And this is a
NXP Gen4 PCIe controller's ERRATA as descripted in the comments that result in the NXP RC does not work well with the default value.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
OK, thanks for the clarification. So both MPS and MRRS have to be 128B on the NXP Gen3 PCIe controller in order to get it work.
Regards,
Bin
Thanks,
Zhiqiang
PATCH v3 11/11 pci: ls_pcie_g4: add Workaround for A-011452
In reply to Z.q. HouFrom: Hou Zhiqiang <[email protected]>
For PCIe controllers with SRIOV, MSIx table entries of all the VFs are not accessible if BAR size is set to less than 8MB.
This ERRATA is only for LX2160A Rev1.0 and will be fixed in Rev2.0.
---
V3:
- New patch.
drivers/pci/pcie_layerscape_gen4.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/pci/pcie_layerscape_gen4.c +5 -0
@@ -378,6 +378,11 @@ static void ls_pcie_g4_ep_set_bar_size(struct ls_pcie_g4 *pcie, int pf,u32 mask_l =lower_32_bits (~(size -1 ));u32 mask_h =upper_32_bits (~(size -1 )); +/* A-011452 workaround: set the VF BAR1 to 8MB */ +if (pcie->rev ==REV_1_0 && vf_bar && bar ==1 ) { + mask_l =lower_32_bits (~(SZ_8M -1 )); + mask_h =upper_32_bits (~(SZ_8M -1 )); + }ccsr_writel (pcie,GPEX_BAR_SELECT , bar_pos);ccsr_writel (pcie,GPEX_BAR_SIZE_LDW , mask_l);ccsr_writel (pcie,GPEX_BAR_SIZE_UDW , mask_h);
Signature · 1 line
2.17.1
A message that is not in the archive (sent off-list or not yet received): VI1PR0402MB3854AB66BF4E8BA3680044EB97650@VI1PR0402MB3854.eurprd04.prod.outlook.com
v3 cover pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCs
[Re-sending after including mailing list]
Dear Tom,
Quoted 46 lines
-----Original Message-----
From: Z.q. Hou
Sent: Friday, January 25, 2019 3:33 PM
To: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Cc: Z.q. Hou <[email protected]>
Subject: [PATCHv3 00/11] pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCsFrom: Hou Zhiqiang <[email protected]>
Add PCIe Gen4 driver for the NXP Layerscape series SoCs.
Hou Zhiqiang (11):
armv8: fsl-layerscpae: correct the PCIe controllers' region size
armv8: lx2160a: add MMU table entries for PCIe
pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCs
kconfig: add dependencyPCIE_LAYERSCAPE_GEN4forFSL_PCIE_COMPAT
pci:ls_pcie_g4: add device tree fixups for PCI Stream IDs
armv8: lx2160a: add PCIe controller DT nodes
armv8: lx2160a: enable PCIe support on RDB defconfig
armv8: lx2160a: enable the pci command
pci:ls_pcie_g4: add Workaround for A-011577
pci:ls_pcie_g4: Add Workaround for A-011451
pci:ls_pcie_g4: add Workaround for A-011452Depends on the following patches:
https://patchwork.ozlabs.org/patch/990088/
https://patchwork.ozlabs.org/patch/990093/
https://patchwork.ozlabs.org/patch/990097/
https://patchwork.ozlabs.org/patch/990098/arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 2 +- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 12 + arch/arm/dts/fsl-lx2160a.dtsi | 85 +++ .../arm/include/asm/arch-fsl-layerscape/cpu.h | 9 + .../asm/arch-fsl-layerscape/immap_lsch3.h | 14 +- configs/lx2160ardb_tfa_defconfig | 5 + drivers/pci/Kconfig | 8 + drivers/pci/Makefile | 2 + drivers/pci/pci_auto.c | 34 + drivers/pci/pcie_layerscape_gen4.c | 593 ++++++++++++++++++ drivers/pci/pcie_layerscape_gen4.h | 273 ++++++++
Quoted 9 lines
drivers/pci/pcie_layerscape_gen4_fixup.c | 249 ++++++++ include/configs/lx2160a_common.h | 1 + include/pci.h | 9 + include/pci_ids.h | 1 + 15 files changed, 1295 insertions(+), 2 deletions(-) create mode 100644 drivers/pci/pcie_layerscape_gen4.c create mode 100644 drivers/pci/pcie_layerscape_gen4.h create mode 100644 drivers/pci/pcie_layerscape_gen4_fixup.c
Sorry for my unawareness, who is maintainer for driver/pci.
I am finding multiple names for driver pcie.
Simon Glass <[email protected]> (commit_signer:20/37=54%) Bin Meng <[email protected]> (commit_signer:19/37=51%,authored:11/37=30%) Stefan Roese <[email protected]> (commit_signer:4/37=11%,authored:2/37=5%)
York Sun <[email protected]> (commit_signer:4/37=11%) Tuomas Tynkkynen <[email protected]> (commit_signer:3/37=8%,authored:3/37=8%) Xiaowei Bao <[email protected]> (authored:3/37=8%) u-boot at lists.denx.de (open list)
considering this patch-set is touching driver/pci. I would like PCI maintainer to have a look. Patch related to arch/arm/../fsl-layerscape can be reviewed by me.
--pk
v3 cover pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCs
Hi,
Quoted 63 lines · Prabhakar Kushwaha
[Re-sending after including mailing list]
Dear Tom,
Quoted 46 lines
-----Original Message-----
From: Z.q. Hou
Sent: Friday, January 25, 2019 3:33 PM
To: u-boot at lists.denx.de; albert.u.boot at aribaud.net; Priyanka Jain <[email protected]>; York Sun <[email protected]>; sriram.dash at nxp.com; yamada.masahiro at socionext.com; Prabhakar Kushwaha <[email protected]>; Mingkai Hu <[email protected]>;M.h. Lian <[email protected]>
Cc: Z.q. Hou <[email protected]>
Subject: [PATCHv3 00/11] pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCsFrom: Hou Zhiqiang <[email protected]>
Add PCIe Gen4 driver for the NXP Layerscape series SoCs.
Hou Zhiqiang (11):
armv8: fsl-layerscpae: correct the PCIe controllers' region size
armv8: lx2160a: add MMU table entries for PCIe
pci: Add PCIe Gen4 controller driver for NXP Layerscape SoCs
kconfig: add dependencyPCIE_LAYERSCAPE_GEN4forFSL_PCIE_COMPAT
pci:ls_pcie_g4: add device tree fixups for PCI Stream IDs
armv8: lx2160a: add PCIe controller DT nodes
armv8: lx2160a: enable PCIe support on RDB defconfig
armv8: lx2160a: enable the pci command
pci:ls_pcie_g4: add Workaround for A-011577
pci:ls_pcie_g4: Add Workaround for A-011451
pci:ls_pcie_g4: add Workaround for A-011452Depends on the following patches:
https://patchwork.ozlabs.org/patch/990088/
https://patchwork.ozlabs.org/patch/990093/
https://patchwork.ozlabs.org/patch/990097/
https://patchwork.ozlabs.org/patch/990098/arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 2 +- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 12 + arch/arm/dts/fsl-lx2160a.dtsi | 85 +++ .../arm/include/asm/arch-fsl-layerscape/cpu.h | 9 + .../asm/arch-fsl-layerscape/immap_lsch3.h | 14 +- configs/lx2160ardb_tfa_defconfig | 5 + drivers/pci/Kconfig | 8 + drivers/pci/Makefile | 2 + drivers/pci/pci_auto.c | 34 + drivers/pci/pcie_layerscape_gen4.c | 593 ++++++++++++++++++ drivers/pci/pcie_layerscape_gen4.h | 273 ++++++++Quoted 9 lines
drivers/pci/pcie_layerscape_gen4_fixup.c | 249 ++++++++ include/configs/lx2160a_common.h | 1 + include/pci.h | 9 + include/pci_ids.h | 1 + 15 files changed, 1295 insertions(+), 2 deletions(-) create mode 100644 drivers/pci/pcie_layerscape_gen4.c create mode 100644 drivers/pci/pcie_layerscape_gen4.h create mode 100644 drivers/pci/pcie_layerscape_gen4_fixup.cSorry for my unawareness, who is maintainer for driver/pci.
Quoted 9 lines
I am finding multiple names for driver pcie.
Simon Glass <[email protected]> (commit_signer:20/37=54%) Bin Meng <[email protected]> (commit_signer:19/37=51%,authored:11/37=30%) Stefan Roese <[email protected]> (commit_signer:4/37=11%,authored:2/37=5%)
York Sun <[email protected]> (commit_signer:4/37=11%) Tuomas Tynkkynen <[email protected]> (commit_signer:3/37=8%,authored:3/37=8%) Xiaowei Bao <[email protected]> (authored:3/37=8%) u-boot at lists.denx.de (open list)considering this patch-set is touching driver/pci. I would like PCI maintainer to have a look. Patch related to
arch/arm/../fsl-layerscapecan be reviewed by me.
I will take a look.
Regards,
Bin