Skip to contentSkip to conversation

PCI: brcmstb: Restore initial fundamental reset

PATCH In review Phil Elwell 5 participants 6 messages Nov 12, 2020 – Jan 18, 2021

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

PATCH v2 1/1 PCI: brcmstb: Restore initial fundamental reset

Commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support") replaced a single reset function with a pointer to one of two implementations, but also removed the call asserting the reset at the start of brcm_pcie_setup. Doing so breaks Raspberry Pis with VL805 XHCI controllers lacking dedicated SPI EEPROMs, which have been used for USB booting but then need to be reset so that the kernel can reconfigure them. The lack of a reset causes the firmware's loading of the EEPROM image to RAM to fail, breaking USB for the kernel.

Fixes commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support")

---
Changes in v2:
- Exclude BCM7278 from the initial reset
- Ack from Nicolas

---
 drivers/pci/controller/pcie-brcmstb.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/controller/pcie-brcmstb.c +5 -0
index bea86899bd5d..83aa85bfe8e3 100644
@@ -869,6 +869,11 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 
 	/* Reset the bridge */
 	pcie->bridge_sw_init_set(pcie, 1);
+
+	/* Assert the fundemental reset, except on BCM7278 */
+	if (pcie->type != BCM7278)
+		pcie->perst_set(pcie, 1);
+
 	usleep_range(100, 200);
 
 	/* Take the bridge out of reset */
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Am 12.11.20 um 18:27 schrieb Phil Elwell:

Quoted 26 lines

Commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support") replaced a single reset function with a pointer to one of two implementations, but also removed the call asserting the reset at the start of brcm_pcie_setup. Doing so breaks Raspberry Pis with VL805 XHCI controllers lacking dedicated SPI EEPROMs, which have been used for USB booting but then need to be reset so that the kernel can reconfigure them. The lack of a reset causes the firmware's loading of the EEPROM image to RAM to fail, breaking USB for the kernel.

Fixes commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support")

---
Changes in v2:
- Exclude BCM7278 from the initial reset
- Ack from Nicolas

---
 drivers/pci/controller/pcie-brcmstb.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/controller/pcie-brcmstb.c +0 -0
index bea86899bd5d..83aa85bfe8e3 100644

drivers/pci/controller/pcie-brcmstb.c static int brcm_pcie_setup(struct brcm_pcie *pcie) · line 875

Quoted 7 lines
drivers/pci/controller/pcie-brcmstb.c +4 -0
@@ -869,6 +869,11 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 
 	/* Reset the bridge */
 	pcie->bridge_sw_init_set(pcie, 1);
+
+	/* Assert the fundemental reset, except on BCM7278 */
+	if (pcie->type != BCM7278)
+		pcie->perst_set(pcie, 1);

since only the Raspberry Pi 4 requires the reset i had changed the logic to pcie->type == BCM2711. But this isn't totally clean, since we need this quirk only for the Raspberry Pi 4 and not for CM4 (which also has a BCM2711 SoC). So maybe we should introduce BCM2711_RPI4 to be on the safe side. Sorry for the bikeshedding.

Stefan

Quoted 4 lines
drivers/pci/controller/pcie-brcmstb.c +1 -0
+
 	usleep_range(100, 200);
 
 	/* Take the bridge out of reset */
#2 lore raw
In reply to Phil Elwell
Quoted 27 lines · Phil Elwell

Commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support") replaced a single reset function with a pointer to one of two implementations, but also removed the call asserting the reset at the start of brcm_pcie_setup. Doing so breaks Raspberry Pis with VL805 XHCI controllers lacking dedicated SPI EEPROMs, which have been used for USB booting but then need to be reset so that the kernel can reconfigure them. The lack of a reset causes the firmware's loading of the EEPROM image to RAM to fail, breaking USB for the kernel.

Fixes commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support")

---
Changes in v2:
- Exclude BCM7278 from the initial reset
- Ack from Nicolas

---
 drivers/pci/controller/pcie-brcmstb.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/controller/pcie-brcmstb.c +0 -0
index bea86899bd5d..83aa85bfe8e3 100644

drivers/pci/controller/pcie-brcmstb.c static int brcm_pcie_setup(struct brcm_pcie *pcie) · line 875

Quoted 7 lines
drivers/pci/controller/pcie-brcmstb.c +4 -0
@@ -869,6 +869,11 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 
        /* Reset the bridge */
        pcie->bridge_sw_init_set(pcie, 1);
+
+       /* Assert the fundemental reset, except on BCM7278 */
+       if (pcie->type != BCM7278)
+               pcie->perst_set(pcie, 1);

I'm okay with this although I would rather it not be needed. Regards,
Jim

Quoted 7 lines
drivers/pci/controller/pcie-brcmstb.c +1 -1
+
        usleep_range(100, 200);
 
        /* Take the bridge out of reset */
--

2.25.1

#3 lore raw
Quoted 29 lines · Jim Quinlan
Quoted 28 lines · Phil Elwell

Commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support") replaced a single reset function with a pointer to one of two implementations, but also removed the call asserting the reset at the start of brcm_pcie_setup. Doing so breaks Raspberry Pis with VL805 XHCI controllers lacking dedicated SPI EEPROMs, which have been used for USB booting but then need to be reset so that the kernel can reconfigure them. The lack of a reset causes the firmware's loading of the EEPROM image to RAM to fail, breaking USB for the kernel.

Fixes commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support")

---
Changes in v2:
- Exclude BCM7278 from the initial reset
- Ack from Nicolas

---
 drivers/pci/controller/pcie-brcmstb.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/controller/pcie-brcmstb.c +0 -0
index bea86899bd5d..83aa85bfe8e3 100644
@@ -869,6 +869,11 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 
Quoted 7 lines

drivers/pci/controller/pcie-brcmstb.c static int brcm_pcie_setup(struct brcm_pcie *pcie) · line 875

Quoted 6 lines
drivers/pci/controller/pcie-brcmstb.c +4 -0
        /* Reset the bridge */
        pcie->bridge_sw_init_set(pcie, 1);
+
+       /* Assert the fundemental reset, except on BCM7278 */
+       if (pcie->type != BCM7278)
+               pcie->perst_set(pcie, 1);

I'm okay with this although I would rather it not be needed.

Can I merge this patch as is then ?

Thanks,
Lorenzo

Quoted 9 lines

Regards,
Jim

Quoted 7 lines
drivers/pci/controller/pcie-brcmstb.c +1 -1
+
        usleep_range(100, 200);
 
        /* Take the bridge out of reset */
--

2.25.1

#4 lore raw
Quoted 38 lines · Lorenzo Pieralisi
Quoted 29 lines · Jim Quinlan
Quoted 28 lines · Phil Elwell

Commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support") replaced a single reset function with a pointer to one of two implementations, but also removed the call asserting the reset at the start of brcm_pcie_setup. Doing so breaks Raspberry Pis with VL805 XHCI controllers lacking dedicated SPI EEPROMs, which have been used for USB booting but then need to be reset so that the kernel can reconfigure them. The lack of a reset causes the firmware's loading of the EEPROM image to RAM to fail, breaking USB for the kernel.

Fixes commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support")

---
Changes in v2:
  - Exclude BCM7278 from the initial reset
  - Ack from Nicolas
---
 drivers/pci/controller/pcie-brcmstb.c | 5 +++++

 1 file changed, 5 insertions(+)
drivers/pci/controller/pcie-brcmstb.c +0 -0
index bea86899bd5d..83aa85bfe8e3 100644
@@ -869,6 +869,11 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 
Quoted 7 lines

drivers/pci/controller/pcie-brcmstb.c static int brcm_pcie_setup(struct brcm_pcie *pcie) · line 875

Quoted 6 lines
drivers/pci/controller/pcie-brcmstb.c +4 -0
         /* Reset the bridge */
         pcie->bridge_sw_init_set(pcie, 1);
+
+       /* Assert the fundemental reset, except on BCM7278 */
+       if (pcie->type != BCM7278)
+               pcie->perst_set(pcie, 1);

I'm okay with this although I would rather it not be needed.

Quoted 1 line

Can I merge this patch as is then ?

No. IIUC the consensus was to fix this in firmware. There is a u-boot fix available in their mailing list, and I think RPi's firmware was also patched accordingly (@Phil please confirm).

Regards,
Nicolas

#5 lore raw
Quoted 40 lines · Nicolas Saenz Julienne
Quoted 38 lines · Lorenzo Pieralisi
Quoted 36 lines · Jim Quinlan
Quoted 27 lines · Phil Elwell

Commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support") replaced a single reset function with a pointer to one of two implementations, but also removed the call asserting the reset at the start of brcm_pcie_setup. Doing so breaks Raspberry Pis with VL805 XHCI controllers lacking dedicated SPI EEPROMs, which have been used for USB booting but then need to be reset so that the kernel can reconfigure them. The lack of a reset causes the firmware's loading of the EEPROM image to RAM to fail, breaking USB for the kernel.

Fixes commit 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support")

---
Changes in v2:
- Exclude BCM7278 from the initial reset
- Ack from Nicolas

---
 drivers/pci/controller/pcie-brcmstb.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/pci/controller/pcie-brcmstb.c +0 -0
index bea86899bd5d..83aa85bfe8e3 100644

drivers/pci/controller/pcie-brcmstb.c static int brcm_pcie_setup(struct brcm_pcie *pcie) · line 875

Quoted 7 lines
drivers/pci/controller/pcie-brcmstb.c +4 -0
@@ -869,6 +869,11 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 
        /* Reset the bridge */
        pcie->bridge_sw_init_set(pcie, 1);
+
+       /* Assert the fundemental reset, except on BCM7278 */
+       if (pcie->type != BCM7278)
+               pcie->perst_set(pcie, 1);

I'm okay with this although I would rather it not be needed.

Quoted 5 lines
Quoted 1 line

Can I merge this patch as is then ?

No. IIUC the consensus was to fix this in firmware. There is a u-boot fix available in their mailing list, and I think RPi's firmware was also patched accordingly (@Phil please confirm).

Any users running firmware released since mid-November should not require the precautionary reset in order to have functioning USB. Having said that, we'll be keeping this patch in our repo for the benefit of everybody else.

Phil