Re: [PATCH v7 2/4] firmware: raspberrypi: Introduce vl805 init routine

Nicolas Saenz Julienne
2020-05-04T08:59:42Z

[-- Attachment #1.1: Type: text/plain, Size: 1384 bytes --]

Hi Stefan, thanks for the review!

On Sat, 2020-05-02 at 11:05 +0200, Stefan Wahren wrote:
> > + /* Make sure we don't trigger a firmware load unnecesarely *
> s/unnecesarely/unnecessarily/

Noted

> > + pci_read_config_dword(pdev, VL805_PCI_CONFIG_VERSION_OFFSET, &version);
> pci_read_config_dword() can fail, we might want to store the return value?

I planned on doing that, but realised that the vast majority of
pci_read_config_*() users pass on checking for errors.

Bjorn, any rule of thumb on when to check for errors here?

> > + if (version)
> > + goto exit;
> > +
> > + dev_addr = pdev->bus->number << 20 | PCI_SLOT(pdev->devfn) << 15 |
> > + PCI_FUNC(pdev->devfn) << 12;
> > +
> > + ret = rpi_firmware_property(fw, RPI_FIRMWARE_NOTIFY_XHCI_RESET,
> > + &dev_addr, sizeof(dev_addr));
> > + /* Wait for vl805 to startup */
> > + udelay(200);
>
> I know, it makes it harder to read but do we really want to wait
> unnecessarily if rpi_firmware_property failed?

Yes, I figured that it wouldn't hurt much at that faulty state, and you'll be
waiting some extra 5s further down the line in quirk_usb_handoff_xhci().

But if you feel it's more correct I'll be happy to change it.

> Btw i assume we are in non-atomic context, so maybe it's worth to use
> usleep_range() here?

Of course, I'll fix that.

Regards,
Nicolas

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]