From: Nicolas Saenz Julienne Date: Tue, 05 May 2020 15:47:00 +0200 Subject: [PATCH v2 2/2] usb: xhci: Load Raspberry Pi 4 VL805's firmware In-Reply-To: <38448831-9f22-f887-e938-065fed195414@suse.com> References: <20200430130433.11248-1-nsaenzjulienne@suse.de> <20200430130433.11248-3-nsaenzjulienne@suse.de> <0958ece3-feda-65c0-b0e2-893e2dfeb508@suse.com> <38448831-9f22-f887-e938-065fed195414@suse.com> Message-ID: <073b80ef4285a02729f5b06872474202d4ff2e3e.camel@suse.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 2020-05-05 at 15:39 +0200, Matthias Brugger wrote: > > On 05/05/2020 14:53, Nicolas Saenz Julienne wrote: > > Hi Matthias, > > > > On Tue, 2020-05-05 at 14:15 +0200, Matthias Brugger wrote: > > > On 30/04/2020 15:04, Nicolas Saenz Julienne wrote: > > > > When needed, RPi4's co-processor (called VideoCore) has to be instructed > > > > to load VL805's firmware (the chip providing xHCI support). VideoCore's > > > > firmware expects the board's PCIe bus to be already configured in order > > > > for it to load the xHCI chip firmware. So we have to make sure this > > > > happens in between the PCIe configuration and xHCI startup. > > > > > > > > Introduce a callback in xhci_pci_probe() to run this platform specific > > > > routine. > > > > > > > > Signed-off-by: Nicolas Saenz Julienne > > > > > > > > --- > > > > > > > > Changes since v1: > > > > - Create callback > > > > > > > > board/raspberrypi/rpi/rpi.c | 12 ++++++++++++ > > > > drivers/usb/host/xhci-pci.c | 6 ++++++ > > > > include/usb/xhci.h | 3 +++ > > > > 3 files changed, 21 insertions(+) > > > > > > > > diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c > > > > index e367ba3092..8aa78d1f48 100644 > > > > --- a/board/raspberrypi/rpi/rpi.c > > > > +++ b/board/raspberrypi/rpi/rpi.c > > > > @@ -14,6 +14,7 @@ > > > > #include > > > > #include > > > > #include > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -494,3 +495,14 @@ int ft_board_setup(void *blob, bd_t *bd) > > > > > > > > return 0; > > > > } > > > > + > > > > +#ifdef CONFIG_BCM2711 > > > > > > This won't work with rpi_arm64_defconfig. > > > Can't we just evaluate at runtime if we need to do anything in > > > xhci_pci_fixup. > > > > I can't see why, who is going to call xhci_pci_probe() in RPi3? > > > > If you do make rpi_arm64_defconfig and inspect the .config, you will see that > CONFIG_BCM2711 is not defined, so this code won't be called on RPi4. Oh! Understood. Well, given that only xhci_pci_probe() is called if we're running on RPi4, I think I can disregard those defines altogether. I'll double-check that. Regards, Nicolas > Regards, > Matthias > > > Regards, > > Nicolas > > > > > I wonder if the newer RPi4 have also a newer revision ID (see > > > get_board_rev). > > > If > > > so we could add another bool to struct rpi_model which will indicate us if > > > we > > > need to notify VideoCore about vl805's firmware. > > > > > > > +void xhci_pci_fixup(struct udevice *dev) > > > > +{ > > > > + int ret; > > > > + > > > > + ret = bcm2711_notify_vl805_reset(); > > > > + if (ret) > > > > + printf("RPI: Failed to notify VideoCore about vl805's > > > > firmware\n"); > > > > +} > > > > +#endif > > > > diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c > > > > index c1f60da541..1285dde1ef 100644 > > > > --- a/drivers/usb/host/xhci-pci.c > > > > +++ b/drivers/usb/host/xhci-pci.c > > > > @@ -11,6 +11,10 @@ > > > > #include > > > > #include > > > > > > > > +__weak void xhci_pci_fixup(struct udevice *dev) > > > > +{ > > > > +} > > > > + > > > > static void xhci_pci_init(struct udevice *dev, struct xhci_hccr > > > > **ret_hccr, > > > > struct xhci_hcor **ret_hcor) > > > > { > > > > @@ -40,6 +44,8 @@ static int xhci_pci_probe(struct udevice *dev) > > > > struct xhci_hccr *hccr; > > > > struct xhci_hcor *hcor; > > > > > > > > + xhci_pci_fixup(dev); > > > > + > > > > xhci_pci_init(dev, &hccr, &hcor); > > > > > > > > return xhci_register(dev, hccr, hcor); > > > > diff --git a/include/usb/xhci.h b/include/usb/xhci.h > > > > index c16106a2fc..57feed7603 100644 > > > > --- a/include/usb/xhci.h > > > > +++ b/include/usb/xhci.h > > > > @@ -16,6 +16,7 @@ > > > > #ifndef HOST_XHCI_H_ > > > > #define HOST_XHCI_H_ > > > > > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -1281,4 +1282,6 @@ extern struct dm_usb_ops xhci_usb_ops; > > > > > > > > struct xhci_ctrl *xhci_get_ctrl(struct usb_device *udev); > > > > > > > > +extern void xhci_pci_fixup(struct udevice *dev); > > > > + > > > > #endif /* HOST_XHCI_H_ */ > > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: