summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2012-09-06 08:00:13 +0200
committerMarek Vasut <marex@denx.de>2012-09-21 00:05:00 +0200
commit93ad908c43ed5d8e3e546dd22fa08b668c5090d9 (patch)
treeaf7d9ef75657572108bdc48f671010c82cbcfce3 /drivers/usb
parent81c1d7b605e1a48d3c02248c5e51fabcf42f5014 (diff)
downloadtalos-obmc-uboot-93ad908c43ed5d8e3e546dd22fa08b668c5090d9.tar.gz
talos-obmc-uboot-93ad908c43ed5d8e3e546dd22fa08b668c5090d9.zip
usb: do explicit unaligned accesses
usb_hub_descriptor has to be packed as it's used for communication with the device. Member wHubCharacteristics violates the natural alignment rules. Use explicit unaligned access functions for this member. Fixes ARMv7 traping while using USB. v2: fix typo found by Thomas Langer v3: rebased on top of u-boot-usb/master Signed-off-by: Lucas Stach <dev@lynxeye.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-hcd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 18b4bc6547..392e286224 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -22,6 +22,7 @@
*/
#include <common.h>
#include <asm/byteorder.h>
+#include <asm/unaligned.h>
#include <usb.h>
#include <asm/io.h>
#include <malloc.h>
@@ -866,10 +867,12 @@ int usb_lowlevel_init(void)
printf("Register %x NbrPorts %d\n", reg, descriptor.hub.bNbrPorts);
/* Port Indicators */
if (HCS_INDICATOR(reg))
- descriptor.hub.wHubCharacteristics |= 0x80;
+ put_unaligned(get_unaligned(&descriptor.hub.wHubCharacteristics)
+ | 0x80, &descriptor.hub.wHubCharacteristics);
/* Port Power Control */
if (HCS_PPC(reg))
- descriptor.hub.wHubCharacteristics |= 0x01;
+ put_unaligned(get_unaligned(&descriptor.hub.wHubCharacteristics)
+ | 0x01, &descriptor.hub.wHubCharacteristics);
/* Start the host controller. */
cmd = ehci_readl(&hcor->or_usbcmd);
OpenPOWER on IntegriCloud