[U-Boot] [PATCH V2 3/8] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment

Marek Vasut marex at denx.de
Sun Jul 15 16:59:56 CEST 2012


Dear Ilya Yanok,

[...]

> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> 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);

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.

> +	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 :)



More information about the U-Boot mailing list