Commit 50d924b45911b24eeb7623bed11b9297d99b840a

Authored by Tom Rini
Exists in master and in 57 other branches 8qm-imx_v2020.04_5.4.70_2.3.0, emb_lf-6.6.52-2.2.0, emb_lf_v2022.04, emb_lf_v2023.04, emb_lf_v2024.04, imx_v2015.04_4.1.15_1.0.0_ga, pitx_8mp_lf_v2020.04, smarc-8m-android-10.0.0_2.6.0, smarc-8m-android-11.0.0_2.0.0, smarc-8mp-android-11.0.0_2.0.0, smarc-emmc-imx_v2014.04_3.10.53_1.1.0_ga, smarc-emmc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx-l5.0.0_1.0.0-ga, smarc-imx6_v2018.03_4.14.98_2.0.0_ga, smarc-imx7_v2017.03_4.9.11_1.0.0_ga, smarc-imx7_v2018.03_4.14.98_2.0.0_ga, smarc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx_v2015.04_4.1.15_1.0.0_ga, smarc-imx_v2017.03_4.9.11_1.0.0_ga, smarc-imx_v2017.03_4.9.88_2.0.0_ga, smarc-imx_v2017.03_o8.1.0_1.3.0_8m, smarc-imx_v2018.03_4.14.78_1.0.0_ga, smarc-m6.0.1_2.1.0-ga, smarc-n7.1.2_2.0.0-ga, smarc-rel_imx_4.1.15_2.0.0_ga, smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8m-imx_v2019.04_4.19.35_1.1.0, smarc_8m_00d0-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2019.04_4.19.35_1.1.0, smarc_8mm-imx_v2020.04_5.4.24_2.1.0, smarc_8mp_lf_v2020.04, smarc_8mq-imx_v2020.04_5.4.24_2.1.0, smarc_8mq_lf_v2020.04, ti-u-boot-2015.07, u-boot-2013.01.y, v2013.10, v2013.10-smarct33, v2013.10-smartmen, v2014.01, v2014.04, v2014.04-smarct33, v2014.04-smarct33-emmc, v2014.04-smartmen, v2014.07, v2014.07-smarct33, v2014.07-smartmen, v2015.07-smarct33, v2015.07-smarct33-emmc, v2015.07-smarct4x, v2016.05-dlt, v2016.05-smarct3x, v2016.05-smarct3x-emmc, v2016.05-smarct4x, v2017.01-smarct3x, v2017.01-smarct3x-emmc, v2017.01-smarct4x

Merge branch 'master' of git://git.denx.de/u-boot-usb

Showing 3 changed files Side-by-side Diff

... ... @@ -43,6 +43,7 @@
43 43 #include <common.h>
44 44 #include <command.h>
45 45 #include <asm/processor.h>
  46 +#include <asm/unaligned.h>
46 47 #include <linux/ctype.h>
47 48 #include <asm/byteorder.h>
48 49 #include <asm/unaligned.h>
... ... @@ -269,6 +270,7 @@
269 270 int i;
270 271 ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, USB_BUFSIZ);
271 272 unsigned char *bitmap;
  273 + short hubCharacteristics;
272 274 struct usb_hub_descriptor *descriptor;
273 275 struct usb_hub_device *hub;
274 276 #ifdef USB_HUB_DEBUG
... ... @@ -304,8 +306,9 @@
304 306 }
305 307 memcpy((unsigned char *)&hub->desc, buffer, descriptor->bLength);
306 308 /* adjust 16bit values */
307   - hub->desc.wHubCharacteristics =
308   - le16_to_cpu(descriptor->wHubCharacteristics);
  309 + put_unaligned(le16_to_cpu(get_unaligned(
  310 + &descriptor->wHubCharacteristics)),
  311 + &hub->desc.wHubCharacteristics);
309 312 /* set the bitmap */
310 313 bitmap = (unsigned char *)&hub->desc.DeviceRemovable[0];
311 314 /* devices not removable by default */
... ... @@ -322,7 +325,8 @@
322 325 dev->maxchild = descriptor->bNbrPorts;
323 326 USB_HUB_PRINTF("%d ports detected\n", dev->maxchild);
324 327  
325   - switch (hub->desc.wHubCharacteristics & HUB_CHAR_LPSM) {
  328 + hubCharacteristics = get_unaligned(&hub->desc.wHubCharacteristics);
  329 + switch (hubCharacteristics & HUB_CHAR_LPSM) {
326 330 case 0x00:
327 331 USB_HUB_PRINTF("ganged power switching\n");
328 332 break;
329 333  
... ... @@ -335,12 +339,12 @@
335 339 break;
336 340 }
337 341  
338   - if (hub->desc.wHubCharacteristics & HUB_CHAR_COMPOUND)
  342 + if (hubCharacteristics & HUB_CHAR_COMPOUND)
339 343 USB_HUB_PRINTF("part of a compound device\n");
340 344 else
341 345 USB_HUB_PRINTF("standalone hub\n");
342 346  
343   - switch (hub->desc.wHubCharacteristics & HUB_CHAR_OCPM) {
  347 + switch (hubCharacteristics & HUB_CHAR_OCPM) {
344 348 case 0x00:
345 349 USB_HUB_PRINTF("global over-current protection\n");
346 350 break;
drivers/dfu/dfu_mmc.c
... ... @@ -63,10 +63,23 @@
63 63 char *str_env;
64 64 int ret;
65 65  
66   - sprintf(cmd_buf, "fat%s mmc %d:%d 0x%x %s %lx",
67   - op == DFU_OP_READ ? "load" : "write",
68   - dfu->data.mmc.dev, dfu->data.mmc.part,
69   - (unsigned int) buf, dfu->name, *len);
  66 + switch (dfu->layout) {
  67 + case DFU_FS_FAT:
  68 + sprintf(cmd_buf, "fat%s mmc %d:%d 0x%x %s %lx",
  69 + op == DFU_OP_READ ? "load" : "write",
  70 + dfu->data.mmc.dev, dfu->data.mmc.part,
  71 + (unsigned int) buf, dfu->name, *len);
  72 + break;
  73 + case DFU_FS_EXT4:
  74 + sprintf(cmd_buf, "ext4%s mmc %d:%d /%s 0x%x %ld",
  75 + op == DFU_OP_READ ? "load" : "write",
  76 + dfu->data.mmc.dev, dfu->data.mmc.part,
  77 + dfu->name, (unsigned int) buf, *len);
  78 + break;
  79 + default:
  80 + printf("%s: Layout (%s) not (yet) supported!\n", __func__,
  81 + dfu_get_layout(dfu->layout));
  82 + }
70 83  
71 84 debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf);
72 85  
... ... @@ -76,7 +89,7 @@
76 89 return ret;
77 90 }
78 91  
79   - if (dfu->layout != DFU_RAW_ADDR) {
  92 + if (dfu->layout != DFU_RAW_ADDR && op == DFU_OP_READ) {
80 93 str_env = getenv("filesize");
81 94 if (str_env == NULL) {
82 95 puts("dfu: Wrong file size!\n");
... ... @@ -107,6 +120,7 @@
107 120 ret = mmc_block_write(dfu, buf, len);
108 121 break;
109 122 case DFU_FS_FAT:
  123 + case DFU_FS_EXT4:
110 124 ret = mmc_file_write(dfu, buf, len);
111 125 break;
112 126 default:
... ... @@ -126,6 +140,7 @@
126 140 ret = mmc_block_read(dfu, buf, len);
127 141 break;
128 142 case DFU_FS_FAT:
  143 + case DFU_FS_EXT4:
129 144 ret = mmc_file_read(dfu, buf, len);
130 145 break;
131 146 default:
132 147  
... ... @@ -149,10 +164,15 @@
149 164 dfu->data.mmc.lba_blk_size = get_mmc_blk_size(dfu->dev_num);
150 165 } else if (!strcmp(st, "fat")) {
151 166 dfu->layout = DFU_FS_FAT;
152   - dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
153   - dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
  167 + } else if (!strcmp(st, "ext4")) {
  168 + dfu->layout = DFU_FS_EXT4;
154 169 } else {
155 170 printf("%s: Memory layout (%s) not supported!\n", __func__, st);
  171 + }
  172 +
  173 + if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {
  174 + dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
  175 + dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
156 176 }
157 177  
158 178 dfu->read_medium = dfu_read_medium_mmc;
drivers/usb/host/ehci-hcd.c
... ... @@ -22,6 +22,7 @@
22 22 */
23 23 #include <common.h>
24 24 #include <asm/byteorder.h>
  25 +#include <asm/unaligned.h>
25 26 #include <usb.h>
26 27 #include <asm/io.h>
27 28 #include <malloc.h>
28 29  
... ... @@ -866,10 +867,12 @@
866 867 printf("Register %x NbrPorts %d\n", reg, descriptor.hub.bNbrPorts);
867 868 /* Port Indicators */
868 869 if (HCS_INDICATOR(reg))
869   - descriptor.hub.wHubCharacteristics |= 0x80;
  870 + put_unaligned(get_unaligned(&descriptor.hub.wHubCharacteristics)
  871 + | 0x80, &descriptor.hub.wHubCharacteristics);
870 872 /* Port Power Control */
871 873 if (HCS_PPC(reg))
872   - descriptor.hub.wHubCharacteristics |= 0x01;
  874 + put_unaligned(get_unaligned(&descriptor.hub.wHubCharacteristics)
  875 + | 0x01, &descriptor.hub.wHubCharacteristics);
873 876  
874 877 /* Start the host controller. */
875 878 cmd = ehci_readl(&hcor->or_usbcmd);