All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 1/3] USB: make usb_kbd obey USB DMA alignment requirements
@ 2012-10-24 18:32 Allen Martin
  2012-10-24 18:32 ` [U-Boot] [PATCH v4 2/3] tegra: move TEGRA_DEVICE_SETTINGS to tegra-common-post.h Allen Martin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Allen Martin @ 2012-10-24 18:32 UTC (permalink / raw)
  To: u-boot

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>
---
v4: dynamically allocate xfer buffer, add alignment and roundup to buffer
    instead of entire pdata struct
v3: add comment about alignemnt requirement
v2: use memalign instead of __align()
---
 common/usb_kbd.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 19f01db..24467ce 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -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;
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-24 18:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-24 18:32 [U-Boot] [PATCH v4 1/3] USB: make usb_kbd obey USB DMA alignment requirements Allen Martin
2012-10-24 18:32 ` [U-Boot] [PATCH v4 2/3] tegra: move TEGRA_DEVICE_SETTINGS to tegra-common-post.h Allen Martin
2012-10-24 18:32 ` [U-Boot] [PATCH v4 3/3] tegra: Enable USB keyboard Allen Martin
2012-10-24 18:54 ` [U-Boot] [PATCH v4 1/3] USB: make usb_kbd obey USB DMA alignment requirements Stephen Warren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.