[RFC PATCH 1/9] usb: xhci: Add missing cache flush in the scratchpad array initialization

Bin Meng bmeng.cn at gmail.com
Wed Apr 22 11:21:18 CEST 2020


Hi Nicolas,

On Wed, Apr 22, 2020 at 4:53 PM Nicolas Saenz Julienne
<nsaenzjulienne at suse.de> wrote:
>
> Hi Sylwester, Marek
>
> On Tue, 2020-04-21 at 18:50 +0200, Sylwester Nawrocki wrote:
> > In current code there is no cache flush after initializing the scratchpad
> > buffer array with the scratchpad buffer pointers. This leads to a failure
> > of the "slot enable" command on the rpi4 board (Broadcom STB PCIe
> > controller + VL805 USB hub) - the very first TRB transfer on the command
> > ring fails and there is a timeout while waiting for the command completion
> > event. After adding the missing cache flush everything seems to be working
> > as expected.
> >
> > Signed-off-by: Sylwester Nawrocki <s.nawrocki at samsung.com>
> > Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
> > ---
>
> I've been trying to get this working on my own and got stuck with this specific
> issue. I'm glad you found a solution, it was driving me crazy.
>
> Out of curiosity how did you found the solution?
>
> >  drivers/usb/host/xhci-mem.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> > index 93450ee..729bdc3 100644
> > --- a/drivers/usb/host/xhci-mem.c
> > +++ b/drivers/usb/host/xhci-mem.c
> > @@ -393,6 +393,9 @@ static int xhci_scratchpad_alloc(struct xhci_ctrl *ctrl)
> >               scratchpad->sp_array[i] = cpu_to_le64(ptr);
> >       }
> >
> > +     xhci_flush_cache((uintptr_t)scratchpad->sp_array,
> > +                      sizeof(u64) * num_sp);
> > +
>
> Marek, souldn't running 'dcache off; icache off' be equivalent to this (which
> didn't do the trick for me)? or am I missing somthing?

I guess something is wrong with RPi4's "dcache off" command ..

Regards,
Bin


More information about the U-Boot mailing list