summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/usb_hub.c14
-rw-r--r--drivers/dfu/dfu_mmc.c34
-rw-r--r--drivers/usb/host/ehci-hcd.c7
3 files changed, 41 insertions, 14 deletions
diff --git a/common/usb_hub.c b/common/usb_hub.c
index f35ad95..32750e8 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -43,6 +43,7 @@
#include <common.h>
#include <command.h>
#include <asm/processor.h>
+#include <asm/unaligned.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
@@ -269,6 +270,7 @@ static int usb_hub_configure(struct usb_device *dev)
int i;
ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, USB_BUFSIZ);
unsigned char *bitmap;
+ short hubCharacteristics;
struct usb_hub_descriptor *descriptor;
struct usb_hub_device *hub;
#ifdef USB_HUB_DEBUG
@@ -304,8 +306,9 @@ static int usb_hub_configure(struct usb_device *dev)
}
memcpy((unsigned char *)&hub->desc, buffer, descriptor->bLength);
/* adjust 16bit values */
- hub->desc.wHubCharacteristics =
- le16_to_cpu(descriptor->wHubCharacteristics);
+ put_unaligned(le16_to_cpu(get_unaligned(
+ &descriptor->wHubCharacteristics)),
+ &hub->desc.wHubCharacteristics);
/* set the bitmap */
bitmap = (unsigned char *)&hub->desc.DeviceRemovable[0];
/* devices not removable by default */
@@ -322,7 +325,8 @@ static int usb_hub_configure(struct usb_device *dev)
dev->maxchild = descriptor->bNbrPorts;
USB_HUB_PRINTF("%d ports detected\n", dev->maxchild);
- switch (hub->desc.wHubCharacteristics & HUB_CHAR_LPSM) {
+ hubCharacteristics = get_unaligned(&hub->desc.wHubCharacteristics);
+ switch (hubCharacteristics & HUB_CHAR_LPSM) {
case 0x00:
USB_HUB_PRINTF("ganged power switching\n");
break;
@@ -335,12 +339,12 @@ static int usb_hub_configure(struct usb_device *dev)
break;
}
- if (hub->desc.wHubCharacteristics & HUB_CHAR_COMPOUND)
+ if (hubCharacteristics & HUB_CHAR_COMPOUND)
USB_HUB_PRINTF("part of a compound device\n");
else
USB_HUB_PRINTF("standalone hub\n");
- switch (hub->desc.wHubCharacteristics & HUB_CHAR_OCPM) {
+ switch (hubCharacteristics & HUB_CHAR_OCPM) {
case 0x00:
USB_HUB_PRINTF("global over-current protection\n");
break;
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 060145b..5d504df 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -63,10 +63,23 @@ static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu,
char *str_env;
int ret;
- sprintf(cmd_buf, "fat%s mmc %d:%d 0x%x %s %lx",
- op == DFU_OP_READ ? "load" : "write",
- dfu->data.mmc.dev, dfu->data.mmc.part,
- (unsigned int) buf, dfu->name, *len);
+ switch (dfu->layout) {
+ case DFU_FS_FAT:
+ sprintf(cmd_buf, "fat%s mmc %d:%d 0x%x %s %lx",
+ op == DFU_OP_READ ? "load" : "write",
+ dfu->data.mmc.dev, dfu->data.mmc.part,
+ (unsigned int) buf, dfu->name, *len);
+ break;
+ case DFU_FS_EXT4:
+ sprintf(cmd_buf, "ext4%s mmc %d:%d /%s 0x%x %ld",
+ op == DFU_OP_READ ? "load" : "write",
+ dfu->data.mmc.dev, dfu->data.mmc.part,
+ dfu->name, (unsigned int) buf, *len);
+ break;
+ default:
+ printf("%s: Layout (%s) not (yet) supported!\n", __func__,
+ dfu_get_layout(dfu->layout));
+ }
debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf);
@@ -76,7 +89,7 @@ static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu,
return ret;
}
- if (dfu->layout != DFU_RAW_ADDR) {
+ if (dfu->layout != DFU_RAW_ADDR && op == DFU_OP_READ) {
str_env = getenv("filesize");
if (str_env == NULL) {
puts("dfu: Wrong file size!\n");
@@ -107,6 +120,7 @@ int dfu_write_medium_mmc(struct dfu_entity *dfu, void *buf, long *len)
ret = mmc_block_write(dfu, buf, len);
break;
case DFU_FS_FAT:
+ case DFU_FS_EXT4:
ret = mmc_file_write(dfu, buf, len);
break;
default:
@@ -126,6 +140,7 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, void *buf, long *len)
ret = mmc_block_read(dfu, buf, len);
break;
case DFU_FS_FAT:
+ case DFU_FS_EXT4:
ret = mmc_file_read(dfu, buf, len);
break;
default:
@@ -149,12 +164,17 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
dfu->data.mmc.lba_blk_size = get_mmc_blk_size(dfu->dev_num);
} else if (!strcmp(st, "fat")) {
dfu->layout = DFU_FS_FAT;
- dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
- dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
+ } else if (!strcmp(st, "ext4")) {
+ dfu->layout = DFU_FS_EXT4;
} else {
printf("%s: Memory layout (%s) not supported!\n", __func__, st);
}
+ if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {
+ dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
+ dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
+ }
+
dfu->read_medium = dfu_read_medium_mmc;
dfu->write_medium = dfu_write_medium_mmc;
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 18b4bc6..392e286 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);