[U-Boot] [PATCH V2 3/8] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment
Ilya Yanok
ilya.yanok at cogentembedded.com
Sun Jul 15 17:51:46 CEST 2012
Dear Marek,
On Sun, Jul 15, 2012 at 6:59 PM, Marek Vasut <marex at denx.de> wrote:
> > index 04300be..59039f4 100644
> > --- a/drivers/usb/host/ehci-hcd.c
> > +++ b/drivers/usb/host/ehci-hcd.c
> > @@ -34,7 +34,10 @@ struct ehci_hccr *hccr; /* R/O registers, not need
> for
> > volatile */ volatile struct ehci_hcor *hcor;
> >
> > static uint16_t portreset;
> > -static struct QH qh_list __attribute__((aligned(32)));
> > +DEFINE_ALIGN_BUFFER(struct QH, qh_list, 1, USB_DMA_MINALIGN);
> > +
> > +#define ALIGN_END_ADDR(type, ptr, size) \
> > + ((uint32_t)(ptr) + roundup((size) * sizeof(type),
> USB_DMA_MINALIGN))
> >
> > static struct descriptor {
> > struct usb_hub_descriptor hub;
> > @@ -207,8 +210,9 @@ static int
> > ehci_submit_async(struct usb_device *dev, unsigned long pipe, void
> > *buffer, int length, struct devrequest *req)
> > {
> > - static struct QH qh __attribute__((aligned(32)));
> > - static struct qTD qtd[3] __attribute__((aligned (32)));
> > + /* for some reason this doesn't work with non-static qh */
> > + DEFINE_ALIGN_BUFFER(struct QH, qh, 1, USB_DMA_MINALIGN);
>
> > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> For some reason this doesn't work, but for obvious reason this is NAK. The
> rest
> is OK, but this is not. Let's investigate.
>
But this was static since the initial EHCI support introduction... the
patch just preserves the previous behavior.
I agree we need to find the reason it doesn't work with on-stack qh and fix
it but it's another problem, not the one these series try to address.
>
> > + ALLOC_ALIGN_BUFFER(struct qTD, qtd, 3, USB_DMA_MINALIGN);
> > int qtd_counter = 0;
> >
> > volatile struct qTD *vtd;
> [...]
>
> I'll poke into this hopefully later today, but if you can try finding
> something
> until then, that'd be great :)
>
Sorry, I've already lost too much time with this and I won't return to this
in the near future.
Regards, Ilya.
More information about the U-Boot
mailing list