]> git.sur5r.net Git - u-boot/blobdiff - drivers/usb/gadget/epautoconf.c
Merge branch 'master' of git://git.denx.de/u-boot-arm
[u-boot] / drivers / usb / gadget / epautoconf.c
index 18964894215f025063f66b69e6e8311ed19b7c34..5b8776e0b70b4e479cdb48aebfa8dacf22b9cf97 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/usb/ch9.h>
 #include <asm/errno.h>
 #include <linux/usb/gadget.h>
+#include <asm/unaligned.h>
 #include "gadget_chips.h"
 
 #define isdigit(c)      ('0' <= (c) && (c) <= '9')
@@ -127,7 +128,7 @@ static int ep_matches(
         * where it's an output parameter representing the full speed limit.
         * the usb spec fixes high speed bulk maxpacket at 512 bytes.
         */
-       max = 0x7ff & le16_to_cpu(desc->wMaxPacketSize);
+       max = 0x7ff & le16_to_cpu(get_unaligned(&desc->wMaxPacketSize));
        switch (type) {
        case USB_ENDPOINT_XFER_INT:
                /* INT:  limit 64 bytes full speed, 1024 high speed */
@@ -143,7 +144,8 @@ static int ep_matches(
                        return 0;
 
                /* BOTH:  "high bandwidth" works only at high speed */
-               if ((desc->wMaxPacketSize & __constant_cpu_to_le16(3<<11))) {
+               if ((get_unaligned(&desc->wMaxPacketSize) &
+                                       __constant_cpu_to_le16(3<<11))) {
                        if (!gadget->is_dualspeed)
                                return 0;
                        /* configure your hardware with enough buffering!! */
@@ -176,7 +178,7 @@ static int ep_matches(
                /* min() doesn't work on bitfields with gcc-3.5 */
                if (size > 64)
                        size = 64;
-               desc->wMaxPacketSize = cpu_to_le16(size);
+               put_unaligned(cpu_to_le16(size), &desc->wMaxPacketSize);
        }
        return 1;
 }