]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
USB: make usb_kbd obey USB DMA alignment requirements
authorAllen Martin <amartin@nvidia.com>
Wed, 24 Oct 2012 08:32:04 +0000 (08:32 +0000)
committerMarek Vasut <marex@denx.de>
Mon, 19 Nov 2012 23:16:05 +0000 (00:16 +0100)
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.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
common/usb_kbd.c

index 19f01db1caa299f8217b778b12772fd789fc013f..24467cec143663a96c7c8eddcf1645e8b2db2efe 100644 (file)
@@ -112,7 +112,7 @@ struct usb_kbd_pdata {
        uint32_t        usb_out_pointer;
        uint8_t         usb_kbd_buffer[USB_KBD_BUFFER_LEN];
 
-       uint8_t         new[8];
+       uint8_t         *new;
        uint8_t         old[8];
 
        uint8_t         flags;
@@ -435,6 +435,9 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum)
        /* Clear private data */
        memset(data, 0, sizeof(struct usb_kbd_pdata));
 
+       /* allocate input buffer aligned and sized to USB DMA alignment */
+       data->new = memalign(USB_DMA_MINALIGN, roundup(8, USB_DMA_MINALIGN));
+
        /* Insert private data into USB device structure */
        dev->privptr = data;