Skip to contentSkip to conversation

fsl/pci: fix leading whitespace of PCI_LTSSM_L0

PATCH New Bao Xiaowei 3 participants 11 messages Oct 20, 2017 – Feb 27, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 fsl/pci: fix leading whitespace of PCI_LTSSM_L0

Fix the whitespace of PCI_LTSSM_L0 in fsl_pci.h

---
 arch/powerpc/include/asm/fsl_pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/fsl_pci.h +1 -1
index cad341e72c..970f3a48d5 100644
@@ -23,7 +23,7 @@
 #define FSL_PROG_IF_AGENT	0x1
 
 #define PCI_LTSSM	0x404   /* PCIe Link Training, Status State Machine */
-#define  PCI_LTSSM_L0	0x16    /* L0 state */
+#define PCI_LTSSM_L0	0x16    /* L0 state */
 
 int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);
 int fsl_is_pci_agent(struct pci_controller *hose);
Signature · 1 line
2.14.1
#1 lore raw

PATCH 2/3 Powerpc: pcie: optmize the code of pci init function

Adjust the code structure, detail the function module function, remove the redundancy code.

---
 arch/powerpc/include/asm/fsl_pci.h |   1 +
 drivers/pci/fsl_pci_init.c         | 150 ++++++++++++++++++++-----------------
 2 files changed, 83 insertions(+), 68 deletions(-)
arch/powerpc/include/asm/fsl_pci.h +1 -0
index 970f3a48d5..70a5461709 100644
@@ -24,6 +24,7 @@
 
 #define PCI_LTSSM	0x404   /* PCIe Link Training, Status State Machine */
 #define PCI_LTSSM_L0	0x16    /* L0 state */
+#define PCI_LTSSM_L0_PEX_REV3  0x11    /* L0 state for pex rev3*/
 
 int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);
 int fsl_is_pci_agent(struct pci_controller *hose);
drivers/pci/fsl_pci_init.c +82 -68

183 lines not on this page · raw message

Signature · 1 line
2.14.1
#2 lore raw

PATCH 3/3 Powerpc: pcie: Make pcie link state judgement more specific

In reply to Bao Xiaowei

For some special reset times for longer pcie devices, the pcie device may on polling compliance state, the RC considers the pcie device is link up, but the pcie device is not link up, only the L0 state is link up state.

---
 arch/powerpc/include/asm/fsl_pci.h |  2 ++
 drivers/pci/fsl_pci_init.c         | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/fsl_pci.h +2 -0
index 70a5461..323b182 100644
@@ -25,6 +25,8 @@
 #define PCI_LTSSM	0x404   /* PCIe Link Training, Status State Machine */
 #define PCI_LTSSM_L0	0x16    /* L0 state */
 #define PCI_LTSSM_L0_PEX_REV3  0x11    /* L0 state for pex rev3*/
+#define LTSSM_PCIE_DETECT_QUIET		0x00    /* Detect state */
+#define LTSSM_PCIE_DETECT_ACTIVE	0x01    /* Detect state */
 
 int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);
 int fsl_is_pci_agent(struct pci_controller *hose);
drivers/pci/fsl_pci_init.c +6 -4
index be57e53..9b5f386 100644
@@ -335,15 +335,17 @@ static int fsl_pci_link_up(struct pci_controller *hose,
 		pci_ltssm_l0 = PCI_LTSSM_L0;
 
 	ltssm = fsl_get_ltssm(hose, pci_info);
-
-	if (ltssm == pci_ltssm_l0) {
+	if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
+		ltssm == LTSSM_PCIE_DETECT_ACTIVE) {
+		enabled = 0;
+	} else if (ltssm == pci_ltssm_l0) {
 		enabled = 1;
 	} else {
-		for (i = 0; i < 100 && ltssm < pci_ltssm_l0; i++) {
+		for (i = 0; i < 100 && ltssm != pci_ltssm_l0; i++) {
 			ltssm = fsl_get_ltssm(hose, pci_info);
 			udelay(1000);
 		}
-		enabled = ltssm >= pci_ltssm_l0;
+		enabled = (ltssm == pci_ltssm_l0) ? 1 : 0;
 	}
 
 	return enabled;
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/3 Powerpc: pcie: Make pcie link state judgement more specific

Quoted 37 lines · Bao Xiaowei

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

For some special reset times for longer pcie devices, the pcie device may on polling compliance state, the RC considers the pcie device is link up, but the pcie device is not link up, only the L0 state is link up state.

---
 arch/powerpc/include/asm/fsl_pci.h |  2 ++
 drivers/pci/fsl_pci_init.c         | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/fsl_pci.h +2 -0
index 70a5461..323b182 100644
@@ -25,6 +25,8 @@
 #define PCI_LTSSM      0x404   /* PCIe Link Training, Status State Machine */
 #define PCI_LTSSM_L0   0x16    /* L0 state */
 #define PCI_LTSSM_L0_PEX_REV3  0x11    /* L0 state for pex rev3*/
+#define LTSSM_PCIE_DETECT_QUIET                0x00    /* Detect state */
+#define LTSSM_PCIE_DETECT_ACTIVE       0x01    /* Detect state */
 
 int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);
 int fsl_is_pci_agent(struct pci_controller *hose);
drivers/pci/fsl_pci_init.c +0 -2
index be57e53..9b5f386 100644
@@ -335,15 +335,17 @@ static int fsl_pci_link_up(struct pci_controller *hose,
                pci_ltssm_l0 = PCI_LTSSM_L0;
 
        ltssm = fsl_get_ltssm(hose, pci_info);
-
-       if (ltssm == pci_ltssm_l0) {

drivers/pci/fsl_pci_init.c static int fsl_pci_link_up(struct pci_controller *hose, · line 346

Quoted 10 lines
drivers/pci/fsl_pci_init.c +5 -1
+       if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
+               ltssm == LTSSM_PCIE_DETECT_ACTIVE) {
+               enabled = 0;
+       } else if (ltssm == pci_ltssm_l0) {
                enabled = 1;
        } else {
-               for (i = 0; i < 100 && ltssm < pci_ltssm_l0; i++) {
+               for (i = 0; i < 100 && ltssm != pci_ltssm_l0; i++) {
                        ltssm = fsl_get_ltssm(hose, pci_info);
                        udelay(1000);

Do you really need this long loop here ? It causes a long delay in case the PCIe device is in permanent polling
state. Our device is in polling state until clocks is configured
and that will be done from user space in Linux

Quoted 13 lines
drivers/pci/fsl_pci_init.c +1 -2
                }
-               enabled = ltssm >= pci_ltssm_l0;
+               enabled = (ltssm == pci_ltssm_l0) ? 1 : 0;
        }
 
        return enabled;
--

2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#4 lore raw

PATCH 3/3 Powerpc: pcie: Make pcie link state judgement more specific

-----Original Message-----
From: Joakim Tjernlund [mailto:Joakim.Tjernlund at infinera.com]
Sent: Friday, October 20, 2017 9:13 PM
To: wd at denx.de; Mingkai Hu <[email protected]>; tony.obrien at alliedtelesis.co.nz; u-boot at lists.denx.de; Z.q. Hou <[email protected]>; York Sun <[email protected]>; Xiaowei Bao <[email protected]>; hamish.martin at alliedtelesis.co.nz; M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCH 3/3] Powerpc: pcie: Make pcie link state judgement more specific

Quoted 38 lines · Bao Xiaowei

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

For some special reset times for longer pcie devices, the pcie device may on polling compliance state, the RC considers the pcie device is link up, but the pcie device is not link up, only the L0 state is link up state.

---
 arch/powerpc/include/asm/fsl_pci.h |  2 ++
 drivers/pci/fsl_pci_init.c         | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/fsl_pci.h +2 -0
index 70a5461..323b182 100644
@@ -25,6 +25,8 @@
 #define PCI_LTSSM      0x404   /* PCIe Link Training, Status State Machine */
 #define PCI_LTSSM_L0   0x16    /* L0 state */
 #define PCI_LTSSM_L0_PEX_REV3  0x11    /* L0 state for pex rev3*/
+#define LTSSM_PCIE_DETECT_QUIET                0x00    /* Detect state */
+#define LTSSM_PCIE_DETECT_ACTIVE       0x01    /* Detect state */
 
 int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);  

int fsl_is_pci_agent(struct pci_controller *hose); diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c index be57e53..9b5f386 100644

drivers/pci/fsl_pci_init.c +0 -2
@@ -335,15 +335,17 @@ static int fsl_pci_link_up(struct pci_controller *hose,
                pci_ltssm_l0 = PCI_LTSSM_L0;
 
        ltssm = fsl_get_ltssm(hose, pci_info);
-
-       if (ltssm == pci_ltssm_l0) {

drivers/pci/fsl_pci_init.c static int fsl_pci_link_up(struct pci_controller *hose, · line 346

Quoted 10 lines
drivers/pci/fsl_pci_init.c +5 -1
+       if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
+               ltssm == LTSSM_PCIE_DETECT_ACTIVE) {
+               enabled = 0;
+       } else if (ltssm == pci_ltssm_l0) {
                enabled = 1;
        } else {
-               for (i = 0; i < 100 && ltssm < pci_ltssm_l0; i++) {
+               for (i = 0; i < 100 && ltssm != pci_ltssm_l0; i++) {
                        ltssm = fsl_get_ltssm(hose, pci_info);
                        udelay(1000);

Do you really need this long loop here ? It causes a long delay in case the PCIe device is in permanent polling state. Our device is in polling state until clocks is configured and that will be done from user space in Linux

Yes, if the pcie device is in permanent polling state, it will take probably 100ms delay, but this case is occur very few special devices, if we want to use the pcie device in uboot, we have to wait the device link up state is ok, so need some time to wait the pcie device ready. if the pcie slot have no device, the function will return at once, will not bring delay.

Quoted 13 lines
drivers/pci/fsl_pci_init.c +1 -2
                }
-               enabled = ltssm >= pci_ltssm_l0;
+               enabled = (ltssm == pci_ltssm_l0) ? 1 : 0;
        }
 
        return enabled;
--

2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#5 lore raw

PATCH 3/3 Powerpc: pcie: Make pcie link state judgement more specific

Quoted 58 lines · Xiaowei Bao

-----Original Message-----
From: Joakim Tjernlund [mailto:Joakim.Tjernlund at infinera.com]
Sent: Friday, October 20, 2017 9:13 PM
To: wd at denx.de; Mingkai Hu <[email protected]>; tony.obrien at alliedtelesis.co.nz; u-boot at lists.denx.de; Z.q. Hou <[email protected]>; York Sun <[email protected]>; Xiaowei Bao <[email protected]>; hamish.martin at alliedtelesis.co.nz; M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCH 3/3] Powerpc: pcie: Make pcie link state judgement more specific

Quoted 38 lines · Bao Xiaowei

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

For some special reset times for longer pcie devices, the pcie device may on polling compliance state, the RC considers the pcie device is link up, but the pcie device is not link up, only the L0 state is link up state.

---
 arch/powerpc/include/asm/fsl_pci.h |  2 ++
 drivers/pci/fsl_pci_init.c         | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/fsl_pci.h +2 -0
index 70a5461..323b182 100644
@@ -25,6 +25,8 @@
 #define PCI_LTSSM      0x404   /* PCIe Link Training, Status State Machine */
 #define PCI_LTSSM_L0   0x16    /* L0 state */
 #define PCI_LTSSM_L0_PEX_REV3  0x11    /* L0 state for pex rev3*/
+#define LTSSM_PCIE_DETECT_QUIET                0x00    /* Detect state */
+#define LTSSM_PCIE_DETECT_ACTIVE       0x01    /* Detect state */
 
 int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);  

int fsl_is_pci_agent(struct pci_controller *hose); diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c index be57e53..9b5f386 100644

drivers/pci/fsl_pci_init.c +0 -2
@@ -335,15 +335,17 @@ static int fsl_pci_link_up(struct pci_controller *hose,
                pci_ltssm_l0 = PCI_LTSSM_L0;
 
        ltssm = fsl_get_ltssm(hose, pci_info);
-
-       if (ltssm == pci_ltssm_l0) {

drivers/pci/fsl_pci_init.c static int fsl_pci_link_up(struct pci_controller *hose, · line 346

Quoted 10 lines
drivers/pci/fsl_pci_init.c +5 -1
+       if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
+               ltssm == LTSSM_PCIE_DETECT_ACTIVE) {
+               enabled = 0;
+       } else if (ltssm == pci_ltssm_l0) {
                enabled = 1;
        } else {
-               for (i = 0; i < 100 && ltssm < pci_ltssm_l0; i++) {
+               for (i = 0; i < 100 && ltssm != pci_ltssm_l0; i++) {
                        ltssm = fsl_get_ltssm(hose, pci_info);
                        udelay(1000);

Do you really need this long loop here ? It causes a long delay in case the PCIe device is in permanent polling state. Our device is in polling state until clocks is configured and that will be done from user space in Linux

Quoted 1 line

Yes, if the pcie device is in permanent polling state, it will take probably 100ms delay, but this case is occur very few special devices, if we want to use the pcie device in uboot, we have to wait the device link up state is ok, so need some time to wait the pcie device ready. if the pcie slot have no device, the function will return at once, will not bring delay.

Joakim,

Are we OK with this change? Can you test it to make sure no negative impact on your boards?

York

#6 lore raw

PATCH 3/3 Powerpc: pcie: Make pcie link state judgement more specific

Quoted 63 lines · York Sun

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 59 lines · Xiaowei Bao

-----Original Message-----
From: Joakim Tjernlund [mailto:Joakim.Tjernlund at infinera.com]
Sent: Friday, October 20, 2017 9:13 PM
To: wd at denx.de; Mingkai Hu <[email protected]>; tony.obrien at alliedtelesis.co.nz; u-boot at lists.denx.de; Z.q. Hou <[email protected]>; York Sun <[email protected]>; Xiaowei Bao <[email protected]>; hamish.martin at alliedtelesis.co.nz; M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCH 3/3] Powerpc: pcie: Make pcie link state judgement more specific

Quoted 38 lines · Bao Xiaowei

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

For some special reset times for longer pcie devices, the pcie device may on polling compliance state, the RC considers the pcie device is link up, but the pcie device is not link up, only the L0 state is link up state.

---
 arch/powerpc/include/asm/fsl_pci.h |  2 ++
 drivers/pci/fsl_pci_init.c         | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/fsl_pci.h +2 -0
index 70a5461..323b182 100644
@@ -25,6 +25,8 @@
 #define PCI_LTSSM      0x404   /* PCIe Link Training, Status State Machine */
 #define PCI_LTSSM_L0   0x16    /* L0 state */
 #define PCI_LTSSM_L0_PEX_REV3  0x11    /* L0 state for pex rev3*/
+#define LTSSM_PCIE_DETECT_QUIET                0x00    /* Detect state */
+#define LTSSM_PCIE_DETECT_ACTIVE       0x01    /* Detect state */
 
 int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);

int fsl_is_pci_agent(struct pci_controller *hose); diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c index be57e53..9b5f386 100644

drivers/pci/fsl_pci_init.c +0 -2
@@ -335,15 +335,17 @@ static int fsl_pci_link_up(struct pci_controller *hose,
                pci_ltssm_l0 = PCI_LTSSM_L0;
 
        ltssm = fsl_get_ltssm(hose, pci_info);
-
-       if (ltssm == pci_ltssm_l0) {

drivers/pci/fsl_pci_init.c static int fsl_pci_link_up(struct pci_controller *hose, · line 346

Quoted 10 lines
drivers/pci/fsl_pci_init.c +5 -1
+       if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
+               ltssm == LTSSM_PCIE_DETECT_ACTIVE) {
+               enabled = 0;
+       } else if (ltssm == pci_ltssm_l0) {
                enabled = 1;
        } else {
-               for (i = 0; i < 100 && ltssm < pci_ltssm_l0; i++) {
+               for (i = 0; i < 100 && ltssm != pci_ltssm_l0; i++) {
                        ltssm = fsl_get_ltssm(hose, pci_info);
                        udelay(1000);

Do you really need this long loop here ? It causes a long delay in case the PCIe device is in permanent polling state. Our device is in polling state until clocks is configured and that will be done from user space in Linux

Quoted 6 lines
Quoted 1 line

Yes, if the pcie device is in permanent polling state, it will take probably 100ms delay, but this case is occur very few special devices, if we want to use the pcie device in uboot, we have to wait the device link up state is ok, so need some time to wait the pcie device ready. if the pcie slot have no device, the function will return at once, will not bring delay.

Joakim,

Are we OK with this change? Can you test it to make sure no negative impact on your boards?

Not really happy, what device needs 100 ms extra to exit polling state?

#7 lore raw

PATCH 3/3 Powerpc: pcie: Make pcie link state judgement more specific

Quoted 64 lines · Joakim Tjernlund
Quoted 63 lines · York Sun

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 59 lines · Xiaowei Bao

-----Original Message-----
From: Joakim Tjernlund [mailto:Joakim.Tjernlund at infinera.com]
Sent: Friday, October 20, 2017 9:13 PM
To: wd at denx.de; Mingkai Hu <[email protected]>; tony.obrien at alliedtelesis.co.nz; u-boot at lists.denx.de; Z.q. Hou <[email protected]>; York Sun <[email protected]>; Xiaowei Bao <[email protected]>; hamish.martin at alliedtelesis.co.nz; M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCH 3/3] Powerpc: pcie: Make pcie link state judgement more specific

Quoted 38 lines · Bao Xiaowei

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

For some special reset times for longer pcie devices, the pcie device may on polling compliance state, the RC considers the pcie device is link up, but the pcie device is not link up, only the L0 state is link up state.

---
 arch/powerpc/include/asm/fsl_pci.h |  2 ++
 drivers/pci/fsl_pci_init.c         | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/fsl_pci.h +2 -0
index 70a5461..323b182 100644
@@ -25,6 +25,8 @@
 #define PCI_LTSSM      0x404   /* PCIe Link Training, Status State Machine */
 #define PCI_LTSSM_L0   0x16    /* L0 state */
 #define PCI_LTSSM_L0_PEX_REV3  0x11    /* L0 state for pex rev3*/
+#define LTSSM_PCIE_DETECT_QUIET                0x00    /* Detect state */
+#define LTSSM_PCIE_DETECT_ACTIVE       0x01    /* Detect state */
 
 int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);

int fsl_is_pci_agent(struct pci_controller *hose); diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c index be57e53..9b5f386 100644

drivers/pci/fsl_pci_init.c +0 -2
@@ -335,15 +335,17 @@ static int fsl_pci_link_up(struct pci_controller *hose,
                pci_ltssm_l0 = PCI_LTSSM_L0;
 
        ltssm = fsl_get_ltssm(hose, pci_info);
-
-       if (ltssm == pci_ltssm_l0) {

drivers/pci/fsl_pci_init.c static int fsl_pci_link_up(struct pci_controller *hose, · line 346

Quoted 10 lines
drivers/pci/fsl_pci_init.c +5 -1
+       if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
+               ltssm == LTSSM_PCIE_DETECT_ACTIVE) {
+               enabled = 0;
+       } else if (ltssm == pci_ltssm_l0) {
                enabled = 1;
        } else {
-               for (i = 0; i < 100 && ltssm < pci_ltssm_l0; i++) {
+               for (i = 0; i < 100 && ltssm != pci_ltssm_l0; i++) {
                        ltssm = fsl_get_ltssm(hose, pci_info);
                        udelay(1000);

Do you really need this long loop here ? It causes a long delay in case the PCIe device is in permanent polling state. Our device is in polling state until clocks is configured and that will be done from user space in Linux

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

Yes, if the pcie device is in permanent polling state, it will take probably 100ms delay, but this case is occur very few special devices, if we want to use the pcie device in uboot, we have to wait the device link up state is ok, so need some time to wait the pcie device ready. if the pcie slot have no device, the function will return at once, will not bring delay.

Joakim,

Are we OK with this change? Can you test it to make sure no negative impact on your boards?

Not really happy, what device needs 100 ms extra to exit polling state?

Joakim,

I understand your concern. I don't like the delay either.

Xiaowei,

You said this only occur for very few special devices. Can you explain more? How can you avoid this delay for general cases?

York

#8 lore raw

PATCH 3/3 Powerpc: pcie: Make pcie link state judgement more specific

Quoted 111 lines

-----Original Message-----
From: York Sun
Sent: Thursday, November 09, 2017 5:46 AM
To: Joakim Tjernlund <[email protected]>; Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Mingkai Hu <[email protected]>; tony.obrien at alliedtelesis.co.nz; u-boot at lists.denx.de; Z.q. Hou <[email protected]>; hamish.martin at alliedtelesis.co.nz; M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCH 3/3] Powerpc: pcie: Make pcie link state judgement more specific

Quoted 2 lines · Joakim Tjernlund
Quoted 1 line · York Sun

CAUTION: This email originated from outside of the organization. Do not

click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 15 lines
Quoted 15 lines · Xiaowei Bao
Quoted 12 lines

-----Original Message-----
From: Joakim Tjernlund [mailto:Joakim.Tjernlund at infinera.com]
Sent: Friday, October 20, 2017 9:13 PM
To: wd at denx.de; Mingkai Hu <[email protected]>; tony.obrien at alliedtelesis.co.nz; u-boot at lists.denx.de; Z.q. Hou <[email protected]>; York Sun <[email protected]>; Xiaowei Bao <[email protected]>; hamish.martin at alliedtelesis.co.nz; M.h. Lian <[email protected]>
Subject: Re: [U-Boot] [PATCH 3/3] Powerpc: pcie: Make pcie link state judgement more specific

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Bao Xiaowei
Quoted 1 line

CAUTION: This email originated from outside of the organization. Do not

click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

For some special reset times for longer pcie devices, the pcie device may on polling compliance state, the RC considers the pcie device is link up, but the pcie device is not link up, only the L0 state is link up state.

---
 arch/powerpc/include/asm/fsl_pci.h |  2 ++
 drivers/pci/fsl_pci_init.c         | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

arch/powerpc/include/asm/fsl_pci.h line 25

Quoted 7 lines
arch/powerpc/include/asm/fsl_pci.h +0 -0
index 70a5461..323b182 100644
@@ -25,6 +25,8 @@
 #define PCI_LTSSM      0x404   /* PCIe Link Training, Status State Machine

*/

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
arch/powerpc/include/asm/fsl_pci.h +2 -0
 #define PCI_LTSSM_L0   0x16    /* L0 state */
 #define PCI_LTSSM_L0_PEX_REV3  0x11    /* L0 state for pex rev3*/
+#define LTSSM_PCIE_DETECT_QUIET                0x00    /* Detect state */
+#define LTSSM_PCIE_DETECT_ACTIVE       0x01    /* Detect state */
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/pci/fsl_pci_init.c static int fsl_pci_link_up(struct pci_controller

Quoted 8 lines
arch/powerpc/include/asm/fsl_pci.h +0 -0
 int fsl_setup_hose(struct pci_controller *hose, unsigned long

addr); int fsl_is_pci_agent(struct pci_controller *hose); diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c index
be57e53..9b5f386 100644

drivers/pci/fsl_pci_init.c +0 -0
@@ -335,15 +335,17 @@ static int fsl_pci_link_up(struct pci_controller

*hose,

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
drivers/pci/fsl_pci_init.c +6 -3
                pci_ltssm_l0 = PCI_LTSSM_L0;
 
        ltssm = fsl_get_ltssm(hose, pci_info);
-
-       if (ltssm == pci_ltssm_l0) {
+       if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
+               ltssm == LTSSM_PCIE_DETECT_ACTIVE) {
+               enabled = 0;
+       } else if (ltssm == pci_ltssm_l0) {
                enabled = 1;
        } else {
-               for (i = 0; i < 100 && ltssm < pci_ltssm_l0; i++) {
+               for (i = 0; i < 100 && ltssm != pci_ltssm_l0; i++)
+ {
                        ltssm = fsl_get_ltssm(hose, pci_info);
                        udelay(1000);
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Do you really need this long loop here ? It causes a long delay in case the PCIe device is in permanent polling state. Our device is in polling state until clocks is configured and that will be done from user space in Linux

Yes, if the pcie device is in permanent polling state, it will take probably

100ms delay, but this case is occur very few special devices, if we want to use the pcie device in uboot, we have to wait the device link up state is ok, so need some time to wait the pcie device ready. if the pcie slot have no device, the function will return at once, will not bring delay.

Quoted 8 lines
Quoted 5 lines

Joakim,

Are we OK with this change? Can you test it to make sure no negative impact on your boards?

Not really happy, what device needs 100 ms extra to exit polling state?

Joakim,

Quoted 8 lines

I understand your concern. I don't like the delay either.

Xiaowei,

You said this only occur for very few special devices. Can you explain more? How can you avoid this delay for general cases?

York

Hi York,

For the general pcie devices, it will not bring delay, because the RC access these devices can get the link up state correctly, usually, if the slot have the device, return the L0 state, if the slot have not device, return DETECT state, but for a few device, the initial phase it may be polling state(this issue is feedback from customer, we have not this device), After a period of time, the device resume the L0 state, so for this type of device, we need wait a moment, and about the 1 ms delay, It is estimate value, in other words, if this type device resume the L0 state within the 1ms, we consider that it is link up.

#9 lore raw

PATCH 3/3 Powerpc: pcie: Make pcie link state judgement more specific

Quoted 12 lines · Xiaowei Bao

Hi York,

For the general pcie devices, it will not bring delay, because the RC access these devices can get the link up state correctly, usually, if the slot have the device, return the L0 state, if the slot have not device, return DETECT state, but for a few device, the initial phase it may be polling state(this issue is feedback from customer, we have not this device), After a period of time, the device resume the L0 state, so for this type of device, we need wait a moment, and about the 1 ms delay, It is estimate value, in other words, if this type device resume the L0 state within the 1ms, we consider that it is link up.

Joakim,

Do you accept this reasoning? Can you test on your hardware?

York

#10 lore raw

PATCH 3/3 Powerpc: pcie: Make pcie link state judgement more specific

Quoted 14 lines · York Sun
Quoted 12 lines · Xiaowei Bao

Hi York,

For the general pcie devices, it will not bring delay, because the RC access these devices can get the link up state correctly, usually, if the slot have the device, return the L0 state, if the slot have not device, return DETECT state, but for a few device, the initial phase it may be polling state(this issue is feedback from customer, we have not this device), After a period of time, the device resume the L0 state, so for this type of device, we need wait a moment, and about the 1 ms delay, It is estimate value, in other words, if this type device resume the L0 state within the 1ms, we consider that it is link up.

Quoted 4 lines

Joakim,

Do you accept this reasoning? Can you test on your hardware?

Guys,

I don't think we agreed on this patch. We either continue to discuss, or I will have to drop this set.

York