From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Tue, 23 Oct 2012 09:26:31 +0200 Subject: [U-Boot] [PATCH v2 1/3] USB: make usb_kbd obey USB DMA alignment requirements In-Reply-To: <1350971254-11412-1-git-send-email-amartin@nvidia.com> References: <1350971254-11412-1-git-send-email-amartin@nvidia.com> Message-ID: <201210230926.31221.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. > > Signed-off-by: Allen Martin > --- > common/usb_kbd.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/common/usb_kbd.c b/common/usb_kbd.c > index 19f01db..57928d9 100644 > --- a/common/usb_kbd.c > +++ b/common/usb_kbd.c > @@ -106,15 +106,15 @@ static const unsigned char usb_kbd_num_keypad[] = { > (USB_KBD_NUMLOCK | USB_KBD_CAPSLOCK | USB_KBD_SCROLLLOCK) > > struct usb_kbd_pdata { > + uint8_t new[8]; > + uint8_t old[8]; > + Some comment about the alignment won't hurt. > uint32_t repeat_delay; > > uint32_t usb_in_pointer; > uint32_t usb_out_pointer; > uint8_t usb_kbd_buffer[USB_KBD_BUFFER_LEN]; > > - uint8_t new[8]; > - uint8_t old[8]; > - > uint8_t flags; > }; > > @@ -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 ? > if (!data) { > printf("USB KBD: Error allocating private data\n"); > return 0; Best regards, Marek Vasut