
Dear Eric Nelson,
On 03/05/2012 12:16 AM, Puneet Saxena wrote:
As DMA expects the buffers to be equal and larger then cache lines, This aligns buffers at cacheline.
Signed-off-by: Puneet Saxenapuneets@nvidia.com
Changes for V4: - Added memcpy to copy local descriptor to global descriptor.
Without that, USB version, class, vendor, product Id...etc is not configured. This information is useful for loading correct device driver and possible configuration.
Changes for V5: - Aligned "usb_device_descriptor" using ARCH_DMA_MINALIGN
common/cmd_usb.c | 3 +- common/usb.c | 54 ++++++++++++++++++++++----------------- common/usb_storage.c | 59 ++++++++++++++++++++---------------------- disk/part_dos.c | 2 +- drivers/usb/host/ehci-hcd.c | 8 ++++++ include/scsi.h | 4 ++- include/usb.h | 6 +++- 7 files changed, 76 insertions(+), 60 deletions(-)
diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 320667f..bca9d94 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -150,7 +150,8 @@ void usb_display_class_sub(unsigned char dclass, unsigned char subclass,
void usb_display_string(struct usb_device *dev, int index) {
- char buffer[256];
ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
if (index != 0) {
if (usb_string(dev, index,&buffer[0], 256)> 0) printf("String: "%s"", buffer);
diff --git a/common/usb.c b/common/usb.c index 6e21ae2..3005012 100644 --- a/common/usb.c +++ b/common/usb.c @@ -73,7 +73,6 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];
static int dev_index; static int running; static int asynch_allowed;
-static struct devrequest setup_packet;
char usb_started; /* flag for the started/stopped USB status */
@@ -185,23 +184,25 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
unsigned short value, unsigned short index, void *data, unsigned short size, int timeout)
{
- ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet,
sizeof(struct devrequest));
sizeof(struct devrequest) should be 1, right?
See comment for usage: http://git.denx.de/?p=u-
boot.git;a=blob;f=include/common.h;h=a2c6b27d43cce
33d1a00a033e4b33c895c4e1d8d;hb=HEAD#l904
Oh! Nice catch :)
Best regards, Marek Vasut