From: Nicolas Saenz Julienne <hidden> Date: 2020-03-06 11:44:14
On the Raspberry Pi 4, after a PCI reset, VL805's firmware may either be
loaded directly from an EEPROM or, if not present, by the SoC's
VideCore. This series adds support for the later.
Note that there are a set of constraints we have to consider (some of
them I missed on v1):
- We need to make sure the VideoCore firmware interface is up and
running before running the VL805 firmware load call.
- There is no way to discern RPi4's VL805 chip from other platforms',
so we need the firmware load to happen *before* running
quirk_usb_handoff_xhci(). Failure to do so results in an unwarranted
5 second wait while the fixup code polls xHC's unexisting state.
As per Stefan Wahren's comments I tested the behaviour on outdated
firmware. Boards dependent on this will not boot if firmware is not
up-to-date. Older boards with outdated firmware will fail to execute the
VideoCore firmware call, but xHCI will perform reliably. I added a
warning printout in case of failure.
I'm aware that Florian Fianelli noted on the previous revision that
waiting on the VideoCore firmware interface during PCIe's probe is far
from ideal. But this was before taking into account the second
constraint mentioned above. Impact on non RPi4 boards is minimal.
---
Changes since v3:
- Addressed Greg's comments
There was no v2, my bad.
Changes since v1:
- Addressed Floarians comments
Nicolas Saenz Julienne (4):
soc: bcm2835: Sync xHCI reset firmware property with downstream
firmware: raspberrypi: Introduce vl805 init routine
PCI: brcmstb: Wait for Raspberry Pi's firmware when present
USB: pci-quirks: Add Raspberry Pi 4 quirk
drivers/firmware/Kconfig | 1 +
drivers/firmware/raspberrypi.c | 38 ++++++++++++++++++++++
drivers/pci/controller/pcie-brcmstb.c | 15 +++++++++
drivers/usb/host/pci-quirks.c | 16 +++++++++
include/soc/bcm2835/raspberrypi-firmware.h | 9 ++++-
5 files changed, 78 insertions(+), 1 deletion(-)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Nicolas Saenz Julienne <hidden> Date: 2020-03-06 11:44:00
The property is needed in order to trigger VL805's firmware load. Note
that there is a gap between the property introduced and the previous
one. This is also the case downstream.
Signed-off-by: Nicolas Saenz Julienne <redacted>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/soc/bcm2835/raspberrypi-firmware.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Nicolas Saenz Julienne <hidden> Date: 2020-03-06 11:44:01
On the Raspberry Pi 4, after a PCI reset, VL805's firmware may either be
loaded directly from an EEPROM or, if not present, by the SoC's
VideCore. The function informs VideCore that VL805 was just reset, or
requests for a probe defer.
Based on Tim Gover's downstream implementation.
Signed-off-by: Nicolas Saenz Julienne <redacted>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes since v1:
- Move include into .c file and add forward declaration to .h
drivers/firmware/raspberrypi.c | 38 ++++++++++++++++++++++
include/soc/bcm2835/raspberrypi-firmware.h | 7 ++++
2 files changed, 45 insertions(+)
From: Nicolas Saenz Julienne <hidden> Date: 2020-03-06 11:44:04
xHCI's PCI fixup, run at the end of pcie-brcmstb's probe, depends on
RPi4's VideoCore firmware interface to be up and running. It's possible
for both initializations to race, so make sure it's available prior
starting.
Signed-off-by: Nicolas Saenz Julienne <redacted>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/pci/controller/pcie-brcmstb.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
From: Nicolas Saenz Julienne <hidden> Date: 2020-03-06 11:44:08
On the Raspberry Pi 4, after a PCI reset, VL805's firmware may either be
loaded directly from an EEPROM or, if not present, by the SoC's
VideCore. Inform VideCore that VL805 was just reset.
Also, as this creates a dependency between XHCI_PCI and VideoCore's
firmware interface, reflect that on the firmware interface Kconfg.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
Changes since v3:
- Add more complete error message.
- Add braces around if statement
Changes since v1:
- Make RASPBERRYPI_FIRMWARE dependent on this quirk to make sure it
gets compiled when needed.
drivers/firmware/Kconfig | 1 +
drivers/usb/host/pci-quirks.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
@@ -1243,11 +1246,24 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)staticvoidquirk_usb_early_handoff(structpci_dev*pdev){+intret;+/* Skip Netlogic mips SoC's internal PCI USB controller.*Thisdevicedoesnotneed/supportEHCI/OHCIhandoff*/if(pdev->vendor==0x184e)/* vendor Netlogic */return;++if(pdev->vendor==PCI_VENDOR_ID_VIA&&pdev->device==0x3483){+ret=rpi_firmware_init_vl805(pdev);+if(ret){+/* Firmware might be outdated, or something failed */+dev_warn(&pdev->dev,"Failed to load VL805's firmware: %d\n",ret);+dev_warn(&pdev->dev,"Will continue to attempt to work, "+"but bad things might happen. You should fix this...\n");+}+}+if(pdev->class!=PCI_CLASS_SERIAL_USB_UHCI&&pdev->class!=PCI_CLASS_SERIAL_USB_OHCI&&pdev->class!=PCI_CLASS_SERIAL_USB_EHCI&&
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Sergei Shtylyov <hidden> Date: 2020-03-07 09:55:51
Hello!
On 06.03.2020 14:43, Nicolas Saenz Julienne wrote:
On the Raspberry Pi 4, after a PCI reset, VL805's firmware may either be
loaded directly from an EEPROM or, if not present, by the SoC's
VideCore. Inform VideCore that VL805 was just reset.
Also, as this creates a dependency between XHCI_PCI and VideoCore's
firmware interface, reflect that on the firmware interface Kconfg.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
Changes since v3:
- Add more complete error message.
- Add braces around if statement
Changes since v1:
- Make RASPBERRYPI_FIRMWARE dependent on this quirk to make sure it
gets compiled when needed.
drivers/firmware/Kconfig | 1 +
drivers/usb/host/pci-quirks.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
@@ -1243,11 +1246,24 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)staticvoidquirk_usb_early_handoff(structpci_dev*pdev){+intret;+/* Skip Netlogic mips SoC's internal PCI USB controller.*Thisdevicedoesnotneed/supportEHCI/OHCIhandoff*/if(pdev->vendor==0x184e)/* vendor Netlogic */return;++if(pdev->vendor==PCI_VENDOR_ID_VIA&&pdev->device==0x3483){+ret=rpi_firmware_init_vl805(pdev);+if(ret){+/* Firmware might be outdated, or something failed */+dev_warn(&pdev->dev,"Failed to load VL805's firmware: %d\n",ret);+dev_warn(&pdev->dev,"Will continue to attempt to work, "+"but bad things might happen. You should fix this...\n");
Don't break up the long kernel messages (checkpatch.pl should not complain
about them).
[...]
MBR, Sergei
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Sergei Shtylyov <hidden> Date: 2020-03-07 09:55:53
On 06.03.2020 14:43, Nicolas Saenz Julienne wrote:
xHCI's PCI fixup, run at the end of pcie-brcmstb's probe, depends on
RPi4's VideoCore firmware interface to be up and running. It's possible
for both initializations to race, so make sure it's available prior
starting.
Prior to starting?
Signed-off-by: Nicolas Saenz Julienne <redacted>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
From: Nicolas Saenz Julienne <hidden> Date: 2020-03-09 10:56:05
On Sat, 2020-03-07 at 12:55 +0300, Sergei Shtylyov wrote:
On 06.03.2020 14:43, Nicolas Saenz Julienne wrote:
quoted
xHCI's PCI fixup, run at the end of pcie-brcmstb's probe, depends on
RPi4's VideoCore firmware interface to be up and running. It's possible
for both initializations to race, so make sure it's available prior
starting.
From: Nicolas Saenz Julienne <hidden> Date: 2020-03-09 11:09:31
On Sat, 2020-03-07 at 12:54 +0300, Sergei Shtylyov wrote:
Hello!
On 06.03.2020 14:43, Nicolas Saenz Julienne wrote:
quoted
On the Raspberry Pi 4, after a PCI reset, VL805's firmware may either be
loaded directly from an EEPROM or, if not present, by the SoC's
VideCore. Inform VideCore that VL805 was just reset.
Also, as this creates a dependency between XHCI_PCI and VideoCore's
firmware interface, reflect that on the firmware interface Kconfg.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
Changes since v3:
- Add more complete error message.
- Add braces around if statement
Changes since v1:
- Make RASPBERRYPI_FIRMWARE dependent on this quirk to make sure it
gets compiled when needed.
drivers/firmware/Kconfig | 1 +
drivers/usb/host/pci-quirks.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
*pdev)
static void quirk_usb_early_handoff(struct pci_dev *pdev)
{
+ int ret;
+
/* Skip Netlogic mips SoC's internal PCI USB controller.
* This device does not need/support EHCI/OHCI handoff
*/
if (pdev->vendor == 0x184e) /* vendor Netlogic */
return;
+
+ if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) {
+ ret = rpi_firmware_init_vl805(pdev);
+ if (ret) {
+ /* Firmware might be outdated, or something failed */
+ dev_warn(&pdev->dev, "Failed to load VL805's firmware:
%d\n", ret);
+ dev_warn(&pdev->dev, "Will continue to attempt to work,
"
+ "but bad things might happen. You should fix
this...\n");
Don't break up the long kernel messages (checkpatch.pl should not
complain
about them).
I generally don't, but in this specific case IMO it went way too long, as in
140 charaters long, so I figured it'd be better to split it. That said, I don't
really care, so I'll happily change it for v5.
Regards,
Nicolas