Skip to contentSkip to conversation

PCI: layerscape: Add Support for ls2088 PCIe EP mode

PATCH New Xiaowei Bao 4 participants 17 messages May 16, 2019 – Dec 5, 2019 PCI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 PCI: layerscape: Add Support for ls2088 PCIe EP mode

From: Xiaowei Bao <[email protected]>

---
v2:
- Add the NXP copyright and make the function readability.

 drivers/pci/pcie_layerscape.c |  117 +++++++++++++++++++++++++++--------------
 drivers/pci/pcie_layerscape.h |   19 +++++--
 2 files changed, 91 insertions(+), 45 deletions(-)
drivers/pci/pcie_layerscape.c +77 -40
index db1375a..8f5ebda 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2017 NXP
+ * Copyright 2017, 2019 NXP
  * Copyright 2014-2015 Freescale Semiconductor, Inc.
  * Layerscape PCIe driver
  */
@@ -105,13 +105,14 @@ static void ls_pcie_atu_outbound_set(struct ls_pcie *pcie, int idx, int type,
 }
 
 /* Use bar match mode and MEM type as default */
-static void ls_pcie_atu_inbound_set(struct ls_pcie *pcie, int idx,
-				     int bar, u64 phys)
+static void ls_pcie_atu_inbound_set(struct ls_pcie *pcie, u32 pf, int idx,
+				    int bar, u64 phys)
 {
 	dbi_writel(pcie, PCIE_ATU_REGION_INBOUND | idx, PCIE_ATU_VIEWPORT);
 	dbi_writel(pcie, (u32)phys, PCIE_ATU_LOWER_TARGET);
 	dbi_writel(pcie, phys >> 32, PCIE_ATU_UPPER_TARGET);
-	dbi_writel(pcie, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1);
+	dbi_writel(pcie, PCIE_ATU_TYPE_MEM | PCIE_CTRL1_FUNC_NUM(pf),
+		   PCIE_ATU_CR1);
 	dbi_writel(pcie, PCIE_ATU_ENABLE | PCIE_ATU_BAR_MODE_ENABLE |
 		   PCIE_ATU_BAR_NUM(bar), PCIE_ATU_CR2);
 }
@@ -341,50 +342,61 @@ static void ls_pcie_setup_ctrl(struct ls_pcie *pcie)
 	ls_pcie_disable_bars(pcie);
 }
 
-static void ls_pcie_ep_setup_atu(struct ls_pcie *pcie)
+static void ls_pcie_ep_setup_atu(struct ls_pcie *pcie, u32 pf)
 {
-	u64 phys = CONFIG_SYS_PCI_EP_MEMORY_BASE;
+	pci_size_t atu_size = CONFIG_SYS_PCI_MEMORY_SIZE;
+	u64 phys = 0;
 
+	phys = CONFIG_SYS_PCI_EP_MEMORY_BASE + pf * SZ_2M;
+
+	phys = ALIGN(phys, PCIE_BAR0_SIZE);
 	/* ATU 0 : INBOUND : map BAR0 */
-	ls_pcie_atu_inbound_set(pcie, 0, 0, phys);
+	ls_pcie_atu_inbound_set(pcie, pf, 0 + pf * BAR_NUM, 0, phys);
 	/* ATU 1 : INBOUND : map BAR1 */
-	phys += PCIE_BAR1_SIZE;
-	ls_pcie_atu_inbound_set(pcie, 1, 1, phys);
+	phys = ALIGN(phys + PCIE_BAR0_SIZE, PCIE_BAR1_SIZE);
+	ls_pcie_atu_inbound_set(pcie, pf, 1 + pf * BAR_NUM, 1, phys);
 	/* ATU 2 : INBOUND : map BAR2 */
-	phys += PCIE_BAR2_SIZE;
-	ls_pcie_atu_inbound_set(pcie, 2, 2, phys);
-	/* ATU 3 : INBOUND : map BAR4 */
-	phys = CONFIG_SYS_PCI_EP_MEMORY_BASE + PCIE_BAR4_SIZE;
-	ls_pcie_atu_inbound_set(pcie, 3, 4, phys);
+	phys = ALIGN(phys + PCIE_BAR1_SIZE, PCIE_BAR2_SIZE);
+	ls_pcie_atu_inbound_set(pcie, pf, 2 + pf * BAR_NUM, 2, phys);
+	/* ATU 3 : INBOUND : map BAR2 */
+	phys = ALIGN(phys + PCIE_BAR2_SIZE, PCIE_BAR2_SIZE);
+	ls_pcie_atu_inbound_set(pcie, pf, 3 + pf * BAR_NUM, 4, phys);
 
 	/* ATU 0 : OUTBOUND : map MEM */
-	ls_pcie_atu_outbound_set(pcie, 0,
-				 PCIE_ATU_TYPE_MEM,
-				 pcie->cfg_res.start,
-				 0,
-				 CONFIG_SYS_PCI_MEMORY_SIZE);
+	ls_pcie_atu_outbound_set(pcie, PCIE_ATU_REGION_INDEX0,
+				 PCIE_ATU_TYPE_MEM, (u64)pcie->cfg_res.start,
+				 0, atu_size);
+
+	/* ATU 1 : OUTBOUND : map MEM */
+	ls_pcie_atu_outbound_set(pcie, PCIE_ATU_REGION_INDEX1,
+				 PCIE_ATU_TYPE_MEM, (u64)pcie->cfg_res.start
+				 + atu_size, atu_size, atu_size);
 }
 
 /* BAR0 and BAR1 are 32bit BAR2 and BAR4 are 64bit */
 static void ls_pcie_ep_setup_bar(void *bar_base, int bar, u32 size)
 {
+	u32 mask;
+
 	/* The least inbound window is 4KiB */
-	if (size < 4 * 1024)
-		return;
+	if (size < SZ_4K)
+		mask = 0;
+	else
+		mask = size - 1;
 
 	switch (bar) {
 	case 0:
-		writel(size - 1, bar_base + PCI_BASE_ADDRESS_0);
+		writel(mask, bar_base + PCI_BASE_ADDRESS_0);
 		break;
 	case 1:
-		writel(size - 1, bar_base + PCI_BASE_ADDRESS_1);
+		writel(mask, bar_base + PCI_BASE_ADDRESS_1);
 		break;
 	case 2:
-		writel(size - 1, bar_base + PCI_BASE_ADDRESS_2);
+		writel(mask, bar_base + PCI_BASE_ADDRESS_2);
 		writel(0, bar_base + PCI_BASE_ADDRESS_3);
 		break;
 	case 4:
-		writel(size - 1, bar_base + PCI_BASE_ADDRESS_4);
+		writel(mask, bar_base + PCI_BASE_ADDRESS_4);
 		writel(0, bar_base + PCI_BASE_ADDRESS_5);
 		break;
 	default:
@@ -394,13 +406,28 @@ static void ls_pcie_ep_setup_bar(void *bar_base, int bar, u32 size)
 
 static void ls_pcie_ep_setup_bars(void *bar_base)
 {
-	/* BAR0 - 32bit - 4K configuration */
+	/* BAR0 - 32bit - configuration */
+	ls_pcie_ep_setup_bar(bar_base, 0, PCIE_BAR0_SIZE);
+	/* BAR1 - 32bit - MSIX*/
+	ls_pcie_ep_setup_bar(bar_base, 1, PCIE_BAR1_SIZE);
+	/* BAR2 - 64bit - MEM descriptor */
+	ls_pcie_ep_setup_bar(bar_base, 2, PCIE_BAR2_SIZE);
+	/* BAR4 - 64bit - MEM*/
+	ls_pcie_ep_setup_bar(bar_base, 4, PCIE_BAR4_SIZE);
+}
+
+static void ls_pcie_ep_setup_vf_bars(void *bar_base)
+{
+	/* VF BAR0 MASK register@offset 0x19c*/
+	bar_base += PCIE_SRIOV_VFBAR0 - PCI_BASE_ADDRESS_0;
+
+	/* VF-BAR0 - 32bit - configuration */
 	ls_pcie_ep_setup_bar(bar_base, 0, PCIE_BAR0_SIZE);
-	/* BAR1 - 32bit - 8K MSIX*/
+	/* VF-BAR1 - 32bit - MSIX*/
 	ls_pcie_ep_setup_bar(bar_base, 1, PCIE_BAR1_SIZE);
-	/* BAR2 - 64bit - 4K MEM desciptor */
+	/* VF-BAR2 - 64bit - MEM descriptor */
 	ls_pcie_ep_setup_bar(bar_base, 2, PCIE_BAR2_SIZE);
-	/* BAR4 - 64bit - 1M MEM*/
+	/* VF-BAR4 - 64bit - MEM*/
 	ls_pcie_ep_setup_bar(bar_base, 4, PCIE_BAR4_SIZE);
 }
 
@@ -412,25 +439,33 @@ static void ls_pcie_ep_enable_cfg(struct ls_pcie *pcie)
 static void ls_pcie_setup_ep(struct ls_pcie *pcie)
 {
 	u32 sriov;
+	u32 pf, vf;
+	void *bar_base = NULL;
 
 	sriov = readl(pcie->dbi + PCIE_SRIOV);
 	if (PCI_EXT_CAP_ID(sriov) == PCI_EXT_CAP_ID_SRIOV) {
-		int pf, vf;
-
+		pcie->sriov_flag = 1;
 		for (pf = 0; pf < PCIE_PF_NUM; pf++) {
-			for (vf = 0; vf <= PCIE_VF_NUM; vf++) {
-				ctrl_writel(pcie, PCIE_LCTRL0_VAL(pf, vf),
-					    PCIE_PF_VF_CTRL);
-
-				ls_pcie_ep_setup_bars(pcie->dbi);
-				ls_pcie_ep_setup_atu(pcie);
+			if (pcie->cfg2_flag) {
+				for (vf = 0; vf <= PCIE_VF_NUM; vf++) {
+					ctrl_writel(pcie,
+						    PCIE_LCTRL0_VAL(pf, vf),
+						    PCIE_PF_VF_CTRL);
+				}
 			}
+			bar_base = pcie->dbi +
+				   PCIE_MASK_OFFSET(pcie->cfg2_flag, pf);
+			ls_pcie_ep_setup_bars(bar_base);
+			ls_pcie_ep_setup_vf_bars(bar_base);
+
+			ls_pcie_ep_setup_atu(pcie, pf);
 		}
-		/* Disable CFG2 */
-		ctrl_writel(pcie, 0, PCIE_PF_VF_CTRL);
+
+		if (pcie->cfg2_flag)  /* Disable CFG2 */
+			ctrl_writel(pcie, 0, PCIE_PF_VF_CTRL);
 	} else {
 		ls_pcie_ep_setup_bars(pcie->dbi + PCIE_NO_SRIOV_BAR_BASE);
-		ls_pcie_ep_setup_atu(pcie);
+		ls_pcie_ep_setup_atu(pcie, 0);
 	}
 
 	ls_pcie_ep_enable_cfg(pcie);
@@ -502,6 +537,7 @@ static int ls_pcie_probe(struct udevice *dev)
 	 * for LS2088A series SoCs
 	 */
 	svr = get_svr();
+	pcie->cfg2_flag = 1;
 	svr = (svr >> SVR_VAR_PER_SHIFT) & 0xFFFFFE;
 	if (svr == SVR_LS2088A || svr == SVR_LS2084A ||
 	    svr == SVR_LS2048A || svr == SVR_LS2044A ||
@@ -511,6 +547,7 @@ static int ls_pcie_probe(struct udevice *dev)
 					LS2088A_PCIE_PHYS_SIZE * pcie->idx;
 		pcie->cfg_res.end = pcie->cfg_res.start + cfg_size;
 		pcie->ctrl = pcie->lut + 0x40000;
+		pcie->cfg2_flag = 0;
 	}
 
 	pcie->cfg0 = map_physmem(pcie->cfg_res.start,
drivers/pci/pcie_layerscape.h +14 -5
index ddfbba6..eb910ba 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright 2017 NXP
+ * Copyright 2017, 2019 NXP
  * Copyright 2014-2015 Freescale Semiconductor, Inc.
  * Layerscape PCIe driver
  */
@@ -9,6 +9,7 @@
 #define _PCIE_LAYERSCAPE_H_
 #include <pci.h>
 #include <dm.h>
+#include <linux/sizes.h>
 
 #ifndef CONFIG_SYS_PCI_MEMORY_BUS
 #define CONFIG_SYS_PCI_MEMORY_BUS CONFIG_SYS_SDRAM_BASE
@@ -85,11 +86,17 @@
 
 #define PCIE_PF_NUM		2
 #define PCIE_VF_NUM		64
+#define BAR_NUM			4
 
-#define PCIE_BAR0_SIZE		(4 * 1024) /* 4K */
-#define PCIE_BAR1_SIZE		(8 * 1024) /* 8K for MSIX */
-#define PCIE_BAR2_SIZE		(4 * 1024) /* 4K */
-#define PCIE_BAR4_SIZE		(1 * 1024 * 1024) /* 1M */
+#define PCIE_BAR0_SIZE		SZ_4K /* 4K */
+#define PCIE_BAR1_SIZE		SZ_8K /* 8K for MSIX */
+#define PCIE_BAR2_SIZE		SZ_4K /* 4K */
+#define PCIE_BAR4_SIZE		SZ_1M /* 1M */
+
+#define PCIE_SRIOV_VFBAR0	0x19C
+#define PCIE_CTRL1_FUNC_NUM(pf)	(pf << 20)
+
+#define PCIE_MASK_OFFSET(flag, pf) ((flag) ? 0 : (0x1000 + 0x20000 * (pf)))
 
 /* LUT registers */
 #define PCIE_LUT_UDR(n)		(0x800 + (n) * 8)
@@ -144,6 +151,8 @@ struct ls_pcie {
 	bool big_endian;
 	bool enabled;
 	int next_lut_index;
+	uint sriov_flag;
+	uint cfg2_flag;
 	int mode;
 };
 
Signature · 1 line
1.7.1
#1 lore raw

PATCH v2 2/2 pci: layerscape: Add the workaround for errata A-009460

From: Xiaowei Bao <[email protected]>

The VF_BARn_REG register's Prefetchable and Type bit fields are overwritten by a write to VF's BAR Mask register.
workaround: Before writing to the VF_BARn_MASK_REG register, write 0b to the PCIE_MISC_CONTROL_1_OFF register.

---
v2:
- Add the NXP copyright.

 drivers/pci/pcie_layerscape.c |    9 +++++++++
 drivers/pci/pcie_layerscape.h |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)
drivers/pci/pcie_layerscape.c +9 -0
index 8f5ebda..25c5a0c 100644
@@ -446,6 +446,15 @@ static void ls_pcie_setup_ep(struct ls_pcie *pcie)
 	if (PCI_EXT_CAP_ID(sriov) == PCI_EXT_CAP_ID_SRIOV) {
 		pcie->sriov_flag = 1;
 		for (pf = 0; pf < PCIE_PF_NUM; pf++) {
+			/*
+			 * The VF_BARn_REG register's Prefetchable and Type bit
+			 * fields are overwritten by a write to VF's BAR Mask
+			 * register. Before writing to the VF_BARn_MASK_REG
+			 * register, write 0b to the PCIE_MISC_CONTROL_1_OFF
+			 * register.
+			 */
+			writel(0, pcie->dbi + PCIE_MISC_CONTROL_1_OFF);
+
 			if (pcie->cfg2_flag) {
 				for (vf = 0; vf <= PCIE_VF_NUM; vf++) {
 					ctrl_writel(pcie,
drivers/pci/pcie_layerscape.h +1 -0
index eb910ba..c6f1cb2 100644
@@ -94,6 +94,7 @@
 #define PCIE_BAR4_SIZE		SZ_1M /* 1M */
 
 #define PCIE_SRIOV_VFBAR0	0x19C
+#define PCIE_MISC_CONTROL_1_OFF	0x8BC
 #define PCIE_CTRL1_FUNC_NUM(pf)	(pf << 20)
 
 #define PCIE_MASK_OFFSET(flag, pf) ((flag) ? 0 : (0x1000 + 0x20000 * (pf)))
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 1/2 PCI: layerscape: Add Support for ls2088 PCIe EP mode

In reply to Xiaowei Bao

Hi,

Quoted 6 lines · Xiaowei Bao

From: Xiaowei Bao <[email protected]>

Quoted 8 lines

---
v2:
- Add the NXP copyright and make the function readability.

 drivers/pci/pcie_layerscape.c |  117 +++++++++++++++++++++++++++--------------
 drivers/pci/pcie_layerscape.h |   19 +++++--
 2 files changed, 91 insertions(+), 45 deletions(-)

Could you please support the PCIe EP mode using driver model?

Regards,
Bin

#3 lore raw

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月16日 19:58
To: Xiaowei Bao <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi,

Quoted 6 lines · Xiaowei Bao

From: Xiaowei Bao <[email protected]>

Quoted 8 lines

---
v2:
- Add the NXP copyright and make the function readability.

 drivers/pci/pcie_layerscape.c |  117 +++++++++++++++++++++++++++--------------
 drivers/pci/pcie_layerscape.h |   19 +++++--
 2 files changed, 91 insertions(+), 45 deletions(-)

Could you please support the PCIe EP mode using driver model?
[Xiaowei Bao] do you mean that add a EP driver model to separate the RC and EP with their respective drivers?
The purpose of adding EP support under u-boot is to configure the size of the BAR when the PCIE controller is used as an EP device, and to ensure that the configuration space of the EP can be accessed, so that when the RC scans the bus, the EP device can be scanned, and we also can do simple MEM read and write verification through the md command in u-boot shell. When entering the kernel, the kernel has its own PCIE EP framework, which will reinitialize the EP device, contain of the inbound and outbound window configure, MSI configuration and so no.

Regards,
Bin

#4 lore raw

Hi Xiaowei,

Quoted 25 lines · Xiaowei Bao

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月16日 19:58
To: Xiaowei Bao <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi,

Quoted 10 lines · Xiaowei Bao

From: Xiaowei Bao <[email protected]>

---
v2:
- Add the NXP copyright and make the function readability.

Quoted 7 lines
Quoted 4 lines
 drivers/pci/pcie_layerscape.c |  117 +++++++++++++++++++++++++++--------------
 drivers/pci/pcie_layerscape.h |   19 +++++--
 2 files changed, 91 insertions(+), 45 deletions(-)

Could you please support the PCIe EP mode using driver model?
[Xiaowei Bao] do you mean that add a EP driver model to separate the RC and EP with their respective drivers?

That's correct.

Quoted 3 lines

The purpose of adding EP support under u-boot is to configure the size of the BAR when the PCIE controller is used as an EP device, and to ensure that the configuration space of the EP can be accessed, so that when the RC scans the bus, the EP device can be scanned, and we also can do simple MEM read and write verification through the md command in u-boot shell. When entering the kernel, the kernel has its own PCIE EP framework, which will reinitialize the EP device, contain of the inbound and outbound window configure, MSI configuration and so no.

It's not kernel PCIe EP framework. Ramon Fried recently added PCIe EP uclass support to U-Boot and you should add NXP layerscape PCIe EP driver using the new EP uclass.

See http://patchwork.ozlabs.org/project/uboot/list/?series=104952

Regards,
Bin

#5 lore raw

Hi Bin,

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月17日 10:31
To: Xiaowei Bao <[email protected]>; Ramon Fried <[email protected]>; Simon Glass <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: Re: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi Xiaowei,

Quoted 29 lines · Xiaowei Bao

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月16日 19:58
To: Xiaowei Bao <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>;
u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi,

Quoted 10 lines · Xiaowei Bao

From: Xiaowei Bao <[email protected]>

---
v2:
- Add the NXP copyright and make the function readability.

Quoted 7 lines
Quoted 4 lines
 drivers/pci/pcie_layerscape.c |  117 +++++++++++++++++++++++++++--------------
 drivers/pci/pcie_layerscape.h |   19 +++++--
 2 files changed, 91 insertions(+), 45 deletions(-)

Could you please support the PCIe EP mode using driver model?
[Xiaowei Bao] do you mean that add a EP driver model to separate the RC and EP with their respective drivers?

That's correct.

Quoted 3 lines

The purpose of adding EP support under u-boot is to configure the size of the BAR when the PCIE controller is used as an EP device, and to ensure that the configuration space of the EP can be accessed, so that when the RC scans the bus, the EP device can be scanned, and we also can do simple MEM read and write verification through the md command in u-boot shell. When entering the kernel, the kernel has its own PCIE EP framework, which will reinitialize the EP device, contain of the inbound and outbound window configure, MSI configuration and so no.

It's not kernel PCIe EP framework. Ramon Fried recently added PCIe EP uclass support to U-Boot and you should add NXP layerscape PCIe EP driver using the new EP uclass. [Xiaowei Bao] OK, thanks, I will add NXP layerscape PCIe EP driver using the new EP uclass.

See https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D104952&amp;data=02%7C01%7Cxiaowei.bao%40nxp.com%7Ca1e3da7d57a54520bd3008d6da6fbc4d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C636936570769296107&amp;sdata=5CnEujEtYGbeiBEyv4iY5dXAapdQ65wCh1vs0quSVTY%3D&amp;reserved=0

Regards,
Bin

#6 lore raw
Quoted 87 lines

-----Original Message-----
From: Xiaowei Bao
Sent: 2019年5月22日 18:19
To: Bin Meng <[email protected]>; Ramon Fried <[email protected]>; Simon Glass <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>;
u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: RE: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Hi Bin,

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月17日 10:31
To: Xiaowei Bao <[email protected]>; Ramon Fried <[email protected]>; Simon Glass <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>;
u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: Re: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi Xiaowei,

Quoted 9 lines · Xiaowei Bao

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月16日 19:58
To: Xiaowei Bao <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo

Wang

Quoted 10 lines

<[email protected]>; York Sun <[email protected]>;
u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi,

On Thu, May 16, 2019 at 7:02 PM Xiaowei Bao <[email protected]>

Quoted 11 lines · wrote:
Quoted 11 lines

From: Xiaowei Bao <[email protected]>

---
v2:
- Add the NXP copyright and make the function readability.

 drivers/pci/pcie_layerscape.c |  117

+++++++++++++++++++++++++++--------------

Quoted 6 lines
Quoted 3 lines
 drivers/pci/pcie_layerscape.h |   19 +++++--
 2 files changed, 91 insertions(+), 45 deletions(-)

Could you please support the PCIe EP mode using driver model? [Xiaowei Bao] do you mean that add a EP driver model to separate the RC

and EP with their respective drivers?

That's correct.

Quoted 1 line

The purpose of adding EP support under u-boot is to configure the size of the

BAR when the PCIE controller is used as an EP device, and to ensure that the configuration space of the EP can be accessed, so that when the RC scans the bus, the EP device can be scanned, and we also can do simple MEM read and write verification through the md command in u-boot shell.

Quoted 1 line

When entering the kernel, the kernel has its own PCIE EP framework, which

will reinitialize the EP device, contain of the inbound and outbound window configure, MSI configuration and so no.

Quoted 1 line
Quoted 5 lines

It's not kernel PCIe EP framework. Ramon Fried recently added PCIe EP uclass support to U-Boot and you should add NXP layerscape PCIe EP driver using the new EP uclass.
[Xiaowei Bao] OK, thanks, I will add NXP layerscape PCIe EP driver using the new EP uclass.

Hi Bin and Ramon,

Do you know how to test the EP device when use Ramon Fried EP framework patch,
I don't know how to use it in u-boot, take our board as an example, we use the RCW to configure the PCIe controller work as EP or RC, never use the DTS, another issue, when our PCIe controller work in EP mode, we must set this controller is ready before RC scan the bus, our main purpose is that set the BAR size and make it ready in u-boot, ensure that the EP controller is ready when enter the kernel or other RC can scan the bus which the EP link, I am not sure whether should separate the EP and RC driver. Do you have any advice?

Thanks
Xiaowei

Quoted 11 lines

See
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchw
ork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D104952&amp;da ta=02%7C01%7Cxiaowei.bao%40nxp.com%7Ca1e3da7d57a54520bd3008d6d a6fbc4d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C63693657 0769296107&amp;sdata=5CnEujEtYGbeiBEyv4iY5dXAapdQ65wCh1vs0quSVT Y%3D&amp;reserved=0

Regards,
Bin

#7 lore raw
Quoted 96 lines · Xiaowei Bao
Quoted 88 lines

-----Original Message-----
From: Xiaowei Bao
Sent: 2019年5月22日 18:19
To: Bin Meng <[email protected]>; Ramon Fried <[email protected]>; Simon Glass <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>;
u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: RE: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Hi Bin,

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月17日 10:31
To: Xiaowei Bao <[email protected]>; Ramon Fried <[email protected]>; Simon Glass <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>;
u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: Re: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi Xiaowei,

Quoted 9 lines · Xiaowei Bao

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月16日 19:58
To: Xiaowei Bao <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo

Wang

Quoted 10 lines

<[email protected]>; York Sun <[email protected]>;
u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi,

On Thu, May 16, 2019 at 7:02 PM Xiaowei Bao <[email protected]>

Quoted 11 lines · wrote:
Quoted 11 lines

From: Xiaowei Bao <[email protected]>

---
v2:
- Add the NXP copyright and make the function readability.

 drivers/pci/pcie_layerscape.c |  117

+++++++++++++++++++++++++++--------------

Quoted 6 lines
Quoted 3 lines
 drivers/pci/pcie_layerscape.h |   19 +++++--
 2 files changed, 91 insertions(+), 45 deletions(-)

Could you please support the PCIe EP mode using driver model? [Xiaowei Bao] do you mean that add a EP driver model to separate the RC

and EP with their respective drivers?

That's correct.

Quoted 1 line

The purpose of adding EP support under u-boot is to configure the size of the

BAR when the PCIE controller is used as an EP device, and to ensure that the configuration space of the EP can be accessed, so that when the RC scans the bus, the EP device can be scanned, and we also can do simple MEM read and write verification through the md command in u-boot shell.

Quoted 1 line

When entering the kernel, the kernel has its own PCIE EP framework, which

will reinitialize the EP device, contain of the inbound and outbound window configure, MSI configuration and so no.

Quoted 1 line
Quoted 5 lines

It's not kernel PCIe EP framework. Ramon Fried recently added PCIe EP uclass support to U-Boot and you should add NXP layerscape PCIe EP driver using the new EP uclass.
[Xiaowei Bao] OK, thanks, I will add NXP layerscape PCIe EP driver using the new EP uclass.

Hi Bin and Ramon,

Quoted 8 lines

Do you know how to test the EP device when use Ramon Fried EP framework patch,
I don't know how to use it in u-boot, take our board as an example, we use the RCW to configure the PCIe controller work as EP or RC, never use the DTS, another issue, when our PCIe controller work in EP mode, we must set this controller is ready before RC scan the bus, our main purpose is that set the BAR size and make it ready in u-boot, ensure that the EP controller is ready when enter the kernel or other RC can scan the bus which the EP link, I am not sure whether should separate the EP and RC driver. Do you have any advice?

In this case, where you need to initialize the EP as fast as possible, you should define the dts node and probably add ""u-boot, dm-pre-reloc".
The you need to forcefully probe the EP in one of the pre-relocation board callbacks.
This can be done by something like:
rc = uclass_get_device_by_name(UCLASS_PCI_EP, "pcie_ep at 4800000", &dev);

root complex and endpoint are totally different drivers, I don't see how you can combine them together.

Thanks,
Ramon.

Quoted 14 lines

Thanks
Xiaowei

Quoted 11 lines

See
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchw
ork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D104952&amp;da ta=02%7C01%7Cxiaowei.bao%40nxp.com%7Ca1e3da7d57a54520bd3008d6d a6fbc4d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C63693657 0769296107&amp;sdata=5CnEujEtYGbeiBEyv4iY5dXAapdQ65wCh1vs0quSVT Y%3D&amp;reserved=0

Regards,
Bin

#8 lore raw
Quoted 128 lines

-----Original Message-----
From: Ramon Fried <[email protected]>
Sent: 2019年11月20日 2:50
To: Xiaowei Bao <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass <[email protected]>; M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>;
u-boot at lists.denx.de
Subject: Re: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Quoted 10 lines · Xiaowei Bao
Quoted 10 lines

-----Original Message-----
From: Xiaowei Bao
Sent: 2019年5月22日 18:19
To: Bin Meng <[email protected]>; Ramon Fried <[email protected]>; Simon Glass <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo

Wang

Quoted 7 lines
Quoted 7 lines

<[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: RE: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Hi Bin,

Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月17日 10:31
To: Xiaowei Bao <[email protected]>; Ramon Fried <[email protected]>; Simon Glass <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo

Wang

Quoted 53 lines
Quoted 53 lines

<[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: Re: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi Xiaowei,

Quoted 9 lines · Xiaowei Bao

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月16日 19:58
To: Xiaowei Bao <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo

Wang

Quoted 10 lines

<[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi,

On Thu, May 16, 2019 at 7:02 PM Xiaowei Bao <[email protected]>

Quoted 11 lines · wrote:
Quoted 11 lines

From: Xiaowei Bao <[email protected]>

---
v2:
- Add the NXP copyright and make the function readability.

 drivers/pci/pcie_layerscape.c |  117

+++++++++++++++++++++++++++--------------

Quoted 7 lines
Quoted 3 lines
 drivers/pci/pcie_layerscape.h |   19 +++++--
 2 files changed, 91 insertions(+), 45 deletions(-)

Could you please support the PCIe EP mode using driver model? [Xiaowei Bao] do you mean that add a EP driver model to separate the RC

and EP with their respective drivers?

Quoted 8 lines
Quoted 8 lines

That's correct.

Quoted 2 lines

The purpose of adding EP support under u-boot is to configure the size of the

BAR when the PCIE controller is used as an EP device, and to ensure that the configuration space of the EP can be accessed, so that when the RC scans the bus, the EP device can be scanned, and we also can do simple MEM read and write verification through the md command in

u-boot shell.

Quoted 14 lines
Quoted 11 lines
Quoted 2 lines

When entering the kernel, the kernel has its own PCIE EP framework, which

will reinitialize the EP device, contain of the inbound and outbound window configure, MSI configuration and so no.

Quoted 1 line

It's not kernel PCIe EP framework. Ramon Fried recently added PCIe EP uclass support to U-Boot and you should add NXP layerscape PCIe EP driver using the new EP uclass.
[Xiaowei Bao] OK, thanks, I will add NXP layerscape PCIe EP driver using the new EP uclass.

Hi Bin and Ramon,

Quoted 7 lines

Do you know how to test the EP device when use Ramon Fried EP framework patch, I don't know how to use it in u-boot, take our board as an example, we use the RCW to configure the PCIe controller work as EP or RC, never use the DTS, another issue, when our PCIe controller work in EP mode, we must set this controller is ready before RC scan the bus, our main purpose is that set the BAR size and make it ready in u-boot, ensure that the EP controller is ready when enter the kernel or

other RC can scan the bus which the EP link, I am not sure whether should separate the EP and RC driver. Do you have any advice?

Quoted 1 line
Quoted 7 lines

In this case, where you need to initialize the EP as fast as possible, you should define the dts node and probably add ""u-boot, dm-pre-reloc".
The you need to forcefully probe the EP in one of the pre-relocation board callbacks.
This can be done by something like:
rc = uclass_get_device_by_name(UCLASS_PCI_EP, "pcie_ep at 4800000", &dev);:q

Thanks a lot, could you tell me when call the uclass_get_device_by_name function?

Actually, I am not very clear how to run the DM_TEST in test/dm/pci_ep.c maybe I need to learn more DM and UCLASS knowledge, if you can explain it, I will be very appreciate.

Quoted 3 lines

root complex and endpoint are totally different drivers, I don't see how you can combine them together.

Thanks a lot form your comments, we combine the RC and EP driver in one file(drivers/pci/pcie_layerscape.c), and we run the different initialize code of EP and RC by reading PCI_HEADER_TYPE register. Like this:

pcie->mode = readb(pcie->dbi + PCI_HEADER_TYPE) & 0x7f;

if (pcie->mode == PCI_HEADER_TYPE_NORMAL) {
        printf("PCIe%u: %s %s", pcie->idx, dev->name, "Endpoint");
             ls_pcie_setup_ep(pcie);
} else {
        printf("PCIe%u: %s %s", pcie->idx, dev->name, "Root Complex");
             ls_pcie_setup_ctrl(pcie);
} 

Another issue is that, there are many share function will used by RC and EP driver, so, if I separate the RC and EP driver, there will have many duplicate code. Like this:
dbi_readl, dbi_writel, ctrl_readl, ctrl_writel and so on.

Quoted 24 lines

Thanks,
Ramon.

Quoted 8 lines

Thanks
Xiaowei

Quoted 5 lines

See
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpat
chw

ork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D104952&amp;da

Quoted 1 line
Quoted 1 line

ta=02%7C01%7Cxiaowei.bao%40nxp.com%7Ca1e3da7d57a54520bd3008d6d

Quoted 1 line
Quoted 1 line

a6fbc4d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C63693657

Quoted 1 line
Quoted 1 line

0769296107&amp;sdata=5CnEujEtYGbeiBEyv4iY5dXAapdQ65wCh1vs0quSVT

Quoted 4 lines
Quoted 4 lines

Y%3D&amp;reserved=0

Regards,
Bin

#9 lore raw
Quoted 154 lines

-----Original Message-----
From: Xiaowei Bao
Sent: 2019年11月20日 11:28
To: Ramon Fried <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass <[email protected]>; M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>;
u-boot at lists.denx.de
Subject: RE: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Quoted 7 lines

-----Original Message-----
From: Ramon Fried <[email protected]>
Sent: 2019年11月20日 2:50
To: Xiaowei Bao <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass <[email protected]>; M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang

<[email protected]>;

Quoted 24 lines

York Sun <[email protected]>; u-boot at lists.denx.de
Subject: Re: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Quoted 10 lines · Xiaowei Bao
Quoted 10 lines

-----Original Message-----
From: Xiaowei Bao
Sent: 2019年5月22日 18:19
To: Bin Meng <[email protected]>; Ramon Fried <[email protected]>; Simon Glass <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo

Wang

Quoted 7 lines
Quoted 7 lines

<[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: RE: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Hi Bin,

Quoted 28 lines
Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月17日 10:31
To: Xiaowei Bao <[email protected]>; Ramon Fried <[email protected]>; Simon Glass <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo

Wang

Quoted 20 lines
Quoted 20 lines

<[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: Re: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi Xiaowei,

Quoted 9 lines · Xiaowei Bao

-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2019年5月16日 19:58
To: Xiaowei Bao <[email protected]>
Cc: M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>;

Hongbo

Quoted 69 lines
Quoted 36 lines
Quoted 36 lines

Wang

Quoted 11 lines

<[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>
Subject: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Caution: EXT Email

Hi,

On Thu, May 16, 2019 at 7:02 PM Xiaowei Bao
<[email protected]>

Quoted 11 lines · wrote:
Quoted 11 lines

From: Xiaowei Bao <[email protected]>

---
v2:
- Add the NXP copyright and make the function readability.

 drivers/pci/pcie_layerscape.c |  117

+++++++++++++++++++++++++++--------------

Quoted 7 lines
Quoted 3 lines
 drivers/pci/pcie_layerscape.h |   19 +++++--
 2 files changed, 91 insertions(+), 45 deletions(-)

Could you please support the PCIe EP mode using driver model? [Xiaowei Bao] do you mean that add a EP driver model to separate the RC

and EP with their respective drivers?

That's correct.

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

The purpose of adding EP support under u-boot is to configure the size of the

BAR when the PCIE controller is used as an EP device, and to ensure that the configuration space of the EP can be accessed, so that when the RC scans the bus, the EP device can be scanned, and we also can do simple MEM read and write verification through the md command in

u-boot shell.

Quoted 14 lines
Quoted 11 lines
Quoted 2 lines

When entering the kernel, the kernel has its own PCIE EP framework, which

will reinitialize the EP device, contain of the inbound and outbound window configure, MSI configuration and so no.

Quoted 1 line

It's not kernel PCIe EP framework. Ramon Fried recently added PCIe EP uclass support to U-Boot and you should add NXP layerscape PCIe EP driver using the new EP uclass.
[Xiaowei Bao] OK, thanks, I will add NXP layerscape PCIe EP driver using the new EP uclass.

Hi Bin and Ramon,

Quoted 8 lines

Do you know how to test the EP device when use Ramon Fried EP framework patch, I don't know how to use it in u-boot, take our board as an example, we use the RCW to configure the PCIe controller work as EP or RC, never use the DTS, another issue, when our PCIe controller work in EP mode, we must set this controller is ready before RC scan the bus, our main purpose is that set the BAR size and make it ready in u-boot, ensure that the EP controller is ready when enter the kernel or

other RC can scan the bus which the EP link, I am not sure whether should separate the EP and RC driver. Do you have any advice?

Quoted 1 line
Quoted 7 lines

In this case, where you need to initialize the EP as fast as possible, you should define the dts node and probably add ""u-boot, dm-pre-reloc". The you need to forcefully probe the EP in one of the pre-relocation board callbacks.
This can be done by something like:
rc = uclass_get_device_by_name(UCLASS_PCI_EP, "pcie_ep at 4800000", &dev);:q

Quoted 6 lines

Thanks a lot, could you tell me when call the uclass_get_device_by_name function?

Actually, I am not very clear how to run the DM_TEST in test/dm/pci_ep.c maybe I need to learn more DM and UCLASS knowledge, if you can explain it, I will be very appreciate.

Hi Ramon,

I need your help on this, could you help explain how to start the PCIe EP test in u-boot? Thanks a lot.

Quoted 52 lines
Quoted 4 lines

root complex and endpoint are totally different drivers, I don't see how you can combine them together.

Thanks a lot form your comments, we combine the RC and EP driver in one file(drivers/pci/pcie_layerscape.c), and we run the different initialize code of EP and RC by reading PCI_HEADER_TYPE register. Like this:

pcie->mode = readb(pcie->dbi + PCI_HEADER_TYPE) & 0x7f;

if (pcie->mode == PCI_HEADER_TYPE_NORMAL) {
        printf("PCIe%u: %s %s", pcie->idx, dev->name, "Endpoint");
             ls_pcie_setup_ep(pcie);
} else {
        printf("PCIe%u: %s %s", pcie->idx, dev->name, "Root Complex");
             ls_pcie_setup_ctrl(pcie);
}

Another issue is that, there are many share function will used by RC and EP driver, so, if I separate the RC and EP driver, there will have many duplicate code. Like this:
dbi_readl, dbi_writel, ctrl_readl, ctrl_writel and so on.

Quoted 15 lines

Thanks,
Ramon.

Quoted 9 lines

Thanks
Xiaowei

Quoted 6 lines

See
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fp
at
chw

ork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D104952&amp;da

Quoted 2 lines
Quoted 1 line
Quoted 1 line

ta=02%7C01%7Cxiaowei.bao%40nxp.com%7Ca1e3da7d57a54520bd3008d6d

Quoted 2 lines
Quoted 1 line
Quoted 1 line

a6fbc4d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C63693657

Quoted 2 lines
Quoted 1 line
Quoted 1 line

0769296107&amp;sdata=5CnEujEtYGbeiBEyv4iY5dXAapdQ65wCh1vs0quSVT

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Y%3D&amp;reserved=0

Regards,
Bin

#10 lore raw
Quoted 8 lines

Hi Ramon,

I need your help on this, could you help explain how to start the PCIe EP test in
u-boot? Thanks a lot.

Hi, you just need to run the test suite and it will test the PCIe EP

sandbox class automatically.
See test/README
Why do you care about the EP testing, it's testing the PCIe UCLASS implementation.
To test your implementation you need to test on actual device. Thanks,
Ramon.

#11 lore raw

H Ramon,

Thanks for your comments.
If we reimplement the PCIe EP driver base on PCIe UCLASS, we must test it in u-boot, but I have no idea how to test the actual device, do I need to implement our own test case, how to verify the cadence-ep actual device?

Best regards
Xiaowei

From: Ramon Fried <[email protected]>
Sent: 2019年11月25日 20:15
To: Xiaowei Bao <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass <[email protected]>; M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de
Subject: Re: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Hi Ramon,

I need your help on this, could you help explain how to start the PCIe EP test in u-boot? Thanks a lot.
Hi, you just need to run the test suite and it will test the PCIe EP sandbox class automatically. See test/README
Why do you care about the EP testing, it's testing the PCIe UCLASS implementation. To test your implementation you need to test on actual device.
Thanks,
Ramon.

#12 lore raw

Hi Ramon,

Do you have any comments about this? Thanks a lot.

Best regards
Xiaowei

From: Xiaowei Bao
Sent: 2019年11月26日 10:52
To: Ramon Fried <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass <[email protected]>; M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de
Subject: RE: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

H Ramon,

Thanks for your comments.
If we reimplement the PCIe EP driver base on PCIe UCLASS, we must test it in u-boot, but I have no idea how to test the actual device, do I need to implement our own test case, how to verify the cadence-ep actual device?

Best regards
Xiaowei

From: Ramon Fried <ramon.fried at gmail.com<mailto:[email protected]>>
Sent: 2019年11月25日 20:15
To: Xiaowei Bao <xiaowei.bao at nxp.com<mailto:[email protected]>>
Cc: Bin Meng <bmeng.cn at gmail.com<mailto:[email protected]>>; Simon Glass <sjg at chromium.org<mailto:[email protected]>>; M.h. Lian <minghuan.lian at nxp.com<mailto:[email protected]>>; Z.q. Hou <zhiqiang.hou at nxp.com<mailto:[email protected]>>; Mingkai Hu <mingkai.hu at nxp.com<mailto:[email protected]>>; Hongbo Wang <hongbo.wang at nxp.com<mailto:[email protected]>>; York Sun <york.sun at nxp.com<mailto:[email protected]>>; u-boot at lists.denx.de<mailto:[email protected]>
Subject: Re: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Hi Ramon,

I need your help on this, could you help explain how to start the PCIe EP test in u-boot? Thanks a lot.
Hi, you just need to run the test suite and it will test the PCIe EP sandbox class automatically. See test/README
Why do you care about the EP testing, it's testing the PCIe UCLASS implementation. To test your implementation you need to test on actual device.
Thanks,
Ramon.

#13 lore raw
Quoted 14 lines · Xiaowei Bao

Hi Ramon,

Do you have any comments about this? Thanks a lot.

Best regards
Xiaowei

From: Xiaowei Bao
Sent: 2019年11月26日 10:52
To: Ramon Fried <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass <[email protected]>; M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang <[email protected]>; York Sun <[email protected]>; u-boot at lists.denx.de
Subject: RE: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Quoted 5 lines

H Ramon,

Thanks for your comments.
If we reimplement the PCIe EP driver base on PCIe UCLASS, we must test it in u-boot, but I have no idea how to test the actual device, do I need to implement our own test case, how to verify the cadence-ep actual device?

I'm not sure I understand what you're trying to achieve and why you're referring to the cadence.
You're developing a driver, just test it against a client (IE. a real PCIe root-complex).
The cadence is irrelevant, it's just another implementation of endpoint driver. Thanks,
Ramon.

Quoted 4 lines

Best regards
Xiaowei
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#14 lore raw
Quoted 37 lines

-----Original Message-----
From: Ramon Fried <[email protected]>
Sent: 2019年12月4日 4:01
To: Xiaowei Bao <[email protected]>
Cc: Ramon Fried <[email protected]>; Hongbo Wang <[email protected]>; u-boot at lists.denx.de; York Sun <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>
Subject: Re: [U-Boot] [EXT] Re: [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Quoted 8 lines · Xiaowei Bao

Hi Ramon,

Do you have any comments about this? Thanks a lot.

Best regards
Xiaowei

Quoted 6 lines

From: Xiaowei Bao
Sent: 2019年11月26日 10:52
To: Ramon Fried <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass <[email protected]>; M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang

<[email protected]>;

Quoted 8 lines

York Sun <[email protected]>; u-boot at lists.denx.de
Subject: RE: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

H Ramon,

Thanks for your comments.
If we reimplement the PCIe EP driver base on PCIe UCLASS, we must test it

Quoted 8 lines

in u-boot, but I have no idea how to test the actual device, do I need to implement our own test case, how to verify the cadence-ep actual device?

Quoted 1 line

I'm not sure I understand what you're trying to achieve and why you're referring to the cadence.
You're developing a driver, just test it against a client (IE. a real PCIe root-complex).
The cadence is irrelevant, it's just another implementation of endpoint driver.

Thanks for your comments, do you mean that we can use the 'pci' and 'md' command of u-boot to test the EP device when the controller which work as a EP device connect to a RC port, we can access the BAR base on the "pci header" command, yes? but if I want to test memory access from EP to RC, what should I do, because there is not a command which similar to 'pci' to test.

Another issue is that, due to the history reason of Layerscape PCIe controller driver, the EP and RC codes are combined, if I separate the EP and RC code, there will have many duplicate code.

Thanks
Xiaowei

Quoted 14 lines

Thanks,
Ramon.

Quoted 5 lines

Best regards
Xiaowei
U-Boot at lists.denx.de
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist

s.denx.de%2Flistinfo%2Fu-boot&amp;data=02%7C01%7Cxiaowei.bao%40nxp .com

Quoted 1 line

%7Cad7a366db91f4e40273308d7782b7fc8%7C686ea1d3bc2b4c6fa92cd99

c5c301635

Quoted 1 line

%7C0%7C0%7C637110000532938430&amp;sdata=T0D3QR5RzdFv96syOlG

VK7OEBQyNdl

Quoted 1 line

8M9pfd%2F4vxOIg%3D&amp;reserved=0

#15 lore raw
Quoted 47 lines · Xiaowei Bao
Quoted 38 lines

-----Original Message-----
From: Ramon Fried <[email protected]>
Sent: 2019年12月4日 4:01
To: Xiaowei Bao <[email protected]>
Cc: Ramon Fried <[email protected]>; Hongbo Wang <[email protected]>; u-boot at lists.denx.de; York Sun <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>
Subject: Re: [U-Boot] [EXT] Re: [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Quoted 8 lines · Xiaowei Bao

Hi Ramon,

Do you have any comments about this? Thanks a lot.

Best regards
Xiaowei

Quoted 6 lines

From: Xiaowei Bao
Sent: 2019年11月26日 10:52
To: Ramon Fried <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass <[email protected]>; M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang

<[email protected]>;

Quoted 8 lines

York Sun <[email protected]>; u-boot at lists.denx.de
Subject: RE: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

H Ramon,

Thanks for your comments.
If we reimplement the PCIe EP driver base on PCIe UCLASS, we must test it

Quoted 8 lines

in u-boot, but I have no idea how to test the actual device, do I need to implement our own test case, how to verify the cadence-ep actual device?

Quoted 1 line

I'm not sure I understand what you're trying to achieve and why you're referring to the cadence.
You're developing a driver, just test it against a client (IE. a real PCIe root-complex).
The cadence is irrelevant, it's just another implementation of endpoint driver.

Quoted 6 lines

Thanks for your comments, do you mean that we can use the 'pci' and 'md' command of u-boot to test the EP device when the controller which work as a EP device connect to a RC port, we can access the BAR base on the "pci header" command, yes? but if I want to test memory access from EP to RC, what should I do, because there is not a command which similar to 'pci' to test.

No, I don't mean that. Currently there's no cmd line interface for PCIe endpoint (patches welcome).
You should test the driver against a *real* setup, where you configure the endpoint using some init function
in the board startup sequence.

Quoted 3 lines

Another issue is that, due to the history reason of Layerscape PCIe controller driver, the EP and RC codes are combined, if I separate the EP and RC code, there will have many duplicate code.

So create a common.c file for both of them.

Quoted 20 lines

Thanks
Xiaowei

Quoted 14 lines

Thanks,
Ramon.

Quoted 5 lines

Best regards
Xiaowei
U-Boot at lists.denx.de
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist

s.denx.de%2Flistinfo%2Fu-boot&amp;data=02%7C01%7Cxiaowei.bao%40nxp .com

Quoted 1 line

%7Cad7a366db91f4e40273308d7782b7fc8%7C686ea1d3bc2b4c6fa92cd99

c5c301635

Quoted 1 line

%7C0%7C0%7C637110000532938430&amp;sdata=T0D3QR5RzdFv96syOlG

VK7OEBQyNdl

Quoted 1 line

8M9pfd%2F4vxOIg%3D&amp;reserved=0

#16 lore raw
Quoted 73 lines

-----Original Message-----
From: Ramon Fried <[email protected]>
Sent: 2019年12月4日 15:34
To: Xiaowei Bao <[email protected]>
Cc: Ramon Fried <[email protected]>; Hongbo Wang <[email protected]>; u-boot at lists.denx.de; York Sun <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>
Subject: Re: [U-Boot] [EXT] Re: [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Quoted 15 lines · Xiaowei Bao
Quoted 15 lines

-----Original Message-----
From: Ramon Fried <[email protected]>
Sent: 2019年12月4日 4:01
To: Xiaowei Bao <[email protected]>
Cc: Ramon Fried <[email protected]>; Hongbo Wang <[email protected]>; u-boot at lists.denx.de; York Sun <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>
Subject: Re: [U-Boot] [EXT] Re: [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

On Tue, Dec 3, 2019 at 4:32 AM Xiaowei Bao <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines

Hi Ramon,

Do you have any comments about this? Thanks a lot.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards
Xiaowei

From: Xiaowei Bao
Sent: 2019年11月26日 10:52
To: Ramon Fried <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass

<[email protected]>;

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

M.h. Lian <[email protected]>; Z.q. Hou <[email protected]>; Mingkai Hu <[email protected]>; Hongbo Wang

<[email protected]>;

Quoted 4 lines

York Sun <[email protected]>; u-boot at lists.denx.de
Subject: RE: [EXT] Re: [U-Boot] [PATCHv2 1/2] PCI: layerscape: Add Support for ls2088 PCIe EP mode

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

H Ramon,

Thanks for your comments.
If we reimplement the PCIe EP driver base on PCIe UCLASS, we must test it

in u-boot, but I have no idea how to test the actual device, do I need to implement our own test case, how to verify the cadence-ep

actual device?

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

I'm not sure I understand what you're trying to achieve and why you're referring to the cadence.
You're developing a driver, just test it against a client (IE. a real PCIe root-complex).
The cadence is irrelevant, it's just another implementation of endpoint

driver.

Quoted 6 lines

Thanks for your comments, do you mean that we can use the 'pci' and 'md' command of u-boot to test the EP device when the controller which work as a EP device connect to a RC port, we can access the BAR base on the "pci header" command, yes? but if I want to test memory access from EP to RC, what should I do, because there is not a command which

Quoted 6 lines

similar to 'pci' to test.

Quoted 1 line

No, I don't mean that. Currently there's no cmd line interface for PCIe endpoint (patches welcome).
You should test the driver against a *real* setup, where you configure the endpoint using some init function in the board startup sequence.

OK, thanks for your comments.

Quoted 30 lines
Quoted 5 lines

Another issue is that, due to the history reason of Layerscape PCIe controller driver, the EP and RC codes are combined, if I separate the EP and RC code, there will have many duplicate code.

So create a common.c file for both of them.

Quoted 15 lines

Thanks
Xiaowei

Quoted 9 lines

Thanks,
Ramon.

Quoted 6 lines

Best regards
Xiaowei
U-Boot at lists.denx.de
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
list

s.denx.de%2Flistinfo%2Fu-boot&amp;data=02%7C01%7Cxiaowei.bao%40nxp

Quoted 2 lines
Quoted 2 lines

.com

Quoted 1 line

%7Cad7a366db91f4e40273308d7782b7fc8%7C686ea1d3bc2b4c6fa92c

d99

Quoted 2 lines
Quoted 2 lines

c5c301635

Quoted 1 line

%7C0%7C0%7C637110000532938430&amp;sdata=T0D3QR5RzdFv96sy

OlG

Quoted 2 lines
Quoted 2 lines

VK7OEBQyNdl

Quoted 1 line

8M9pfd%2F4vxOIg%3D&amp;reserved=0