[PATCH 2/2] usb: xhci: Load Raspberry Pi 4 VL805's firmware

Nicolas Saenz Julienne nsaenzjulienne at suse.de
Wed Apr 29 15:04:29 CEST 2020


On Wed, 2020-04-29 at 14:37 +0200, Marek Vasut wrote:
> On 4/29/20 2:36 PM, Nicolas Saenz Julienne wrote:
> > On Wed, 2020-04-29 at 14:05 +0200, Marek Vasut wrote:
> > > On 4/29/20 12:10 PM, Nicolas Saenz Julienne wrote:
> > > > On Tue, 2020-04-28 at 19:59 +0200, Marek Vasut wrote:
> > > > > On 4/28/20 7:44 PM, 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).
> > > > > > VideCore'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.
> > > > > > 
> > > > > > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne at suse.de>
> > > > > > ---
> > > > > >  drivers/usb/host/xhci-pci.c | 6 ++++++
> > > > > >  1 file changed, 6 insertions(+)
> > > > > > 
> > > > > > diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-
> > > > > > pci.c
> > > > > > index c1f60da541..5c17ea6932 100644
> > > > > > --- a/drivers/usb/host/xhci-pci.c
> > > > > > +++ b/drivers/usb/host/xhci-pci.c
> > > > > > @@ -11,6 +11,8 @@
> > > > > >  #include <usb.h>
> > > > > >  #include <usb/xhci.h>
> > > > > >  
> > > > > > +#include <asm/arch/msg.h>
> > > > > > +
> > > > > >  static void xhci_pci_init(struct udevice *dev, struct xhci_hccr
> > > > > > **ret_hccr,
> > > > > >  			  struct xhci_hcor **ret_hcor)
> > > > > >  {
> > > > > > @@ -18,6 +20,10 @@ static void xhci_pci_init(struct udevice *dev,
> > > > > > struct
> > > > > > xhci_hccr **ret_hccr,
> > > > > >  	struct xhci_hcor *hcor;
> > > > > >  	u32 cmd;
> > > > > >  
> > > > > > +#ifdef CONFIG_BCM2711
> > > > > > +	bcm2711_load_vl805_firmware();
> > > > > > +#endif
> > > > > > +
> > > > > >  	hccr = (struct xhci_hccr *)dm_pci_map_bar(dev,
> > > > > >  			PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
> > > > > >  	hcor = (struct xhci_hcor *)((uintptr_t) hccr +
> > > > > 
> > > > > I think socfpga arria10 has some firmware loader implementation that
> > > > > is
> > > > > generic, so can't we use that ?
> > > > 
> > > > I don't think so. I've been told the firmware upgrade protocol is
> > > > private
> > > > and
> > > > specific to the VL80X family of devices. The Raspberry Pi foundation
> > > > decided
> > > > to
> > > > implement it in their closed source VideoCore firmware.
> > > 
> > > What I meant was that U-Boot has a way to load files from various
> > > storage roughly the same way Linux firmware loader API does.
> > 
> > As far as generic APIs are concerned I've had a look at
> > request_firmware_into_buf() which socfpga uses in its spl_board_init(). But
> > sadly it doesn't help here.
> > 
> > What bcm2711_load_vl805_firmware() does here is just informing the co-
> > processor
> > that it's free to start the VL805 firmware load operation. I'm by no means
> > providing anything, think of it as a doorbell if you will. I'll try to find
> > an
> > alternative to 'load' in the function name so the distinction with regular
> > firmware loading is more explicit.
> 
> Oh, that's how it is, I see.
> 
> > Also bare in mind we have to time this operation in between PCIe
> > configuration
> > and xHCI init. Which, IIUC, blocks us from using board_init() and the likes
> > of
> > it (which would be way nicer IMO).
> 
> Maybe you need some callback there ?

Indeed, in Linux I'm using PCI fixups. I guess I could create a similar
concept, albeit simpler, that calls board specific code for fixups after
scanning and detecting PCI devices. Or even simpler if we do it after PCI bus
probes.

I'll look into it.

Regards,
Nicolas

-------------- 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: <https://lists.denx.de/pipermail/u-boot/attachments/20200429/0c87afbe/attachment.sig>


More information about the U-Boot mailing list