[U-Boot] [PATCH v2 1/3] USB: make usb_kbd obey USB DMA alignment requirements

Stephen Warren swarren at wwwdotorg.org
Tue Oct 23 18:31:27 CEST 2012


On 10/23/2012 01:26 AM, Marek Vasut wrote:
> Dear Allen Martin,
> 
>> Change usb_kbd driver to obey alignment requirements for USB DMA on
>> the buffer used for data transfer.  This is necessary for
>> architectures that enable dcache and enable USB DMA.

>> @@ -426,7 +426,7 @@ static int usb_kbd_probe(struct usb_device *dev,
>> unsigned int ifnum)
>>
>>  	USB_KBD_PRINTF("USB KBD: found set protocol...\n");
>>
>> -	data = malloc(sizeof(struct usb_kbd_pdata));
>> +	data = memalign(USB_DMA_MINALIGN, sizeof(struct usb_kbd_pdata));
> 
> Don't we have ALLOC_CACHE_ALIGN_BUFFER and such stuff in include/common.h for 
> this purpose ?

That's for stack-based data structures, whereas this data structure
sticks around for more than the duration of this function.


More information about the U-Boot mailing list