projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MAINTAINERS: Add myself as the FPGA maintainer
[oweals/u-boot.git]
/
common
/
usb_storage.c
diff --git
a/common/usb_storage.c
b/common/usb_storage.c
index 957ccdb29730eafa9ad5aed456f82b555d47fbc4..9cd64744f8ab9c5c4bf07ab08b4d1702e6cf4094 100644
(file)
--- a/
common/usb_storage.c
+++ b/
common/usb_storage.c
@@
-1,3
+1,4
@@
+// SPDX-License-Identifier: GPL-2.0+
/*
* Most of this source has been derived from the Linux USB
* project:
/*
* Most of this source has been derived from the Linux USB
* project:
@@
-17,8
+18,6
@@
*
* BBB support based on /sys/dev/usb/umass.c from
* FreeBSD.
*
* BBB support based on /sys/dev/usb/umass.c from
* FreeBSD.
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
/* Note:
*/
/* Note:
@@
-939,10
+938,14
@@
do_retry:
return USB_STOR_TRANSPORT_FAILED;
}
return USB_STOR_TRANSPORT_FAILED;
}
-static void usb_stor_set_max_xfer_blk(struct us_data *us)
+static void usb_stor_set_max_xfer_blk(struct usb_device *udev,
+ struct us_data *us)
{
unsigned short blk;
{
unsigned short blk;
+ size_t __maybe_unused size;
+ int __maybe_unused ret;
+#ifndef CONFIG_DM_USB
#ifdef CONFIG_USB_EHCI_HCD
/*
* The U-Boot EHCI driver can handle any transfer length as long as
#ifdef CONFIG_USB_EHCI_HCD
/*
* The U-Boot EHCI driver can handle any transfer length as long as
@@
-953,6
+956,17
@@
static void usb_stor_set_max_xfer_blk(struct us_data *us)
#else
blk = 20;
#endif
#else
blk = 20;
#endif
+#else
+ ret = usb_get_max_xfer_size(udev, (size_t *)&size);
+ if (ret < 0) {
+ /* unimplemented, let's use default 20 */
+ blk = 20;
+ } else {
+ if (size > USHRT_MAX * 512)
+ size = USHRT_MAX * 512;
+ blk = size / 512;
+ }
+#endif
us->max_xfer_blk = blk;
}
us->max_xfer_blk = blk;
}
@@
-1393,7
+1407,7
@@
int usb_storage_probe(struct usb_device *dev, unsigned int ifnum,
}
/* Set the maximum transfer size per host controller setting */
}
/* Set the maximum transfer size per host controller setting */
- usb_stor_set_max_xfer_blk(ss);
+ usb_stor_set_max_xfer_blk(
dev,
ss);
dev->privptr = (void *)ss;
return 1;
dev->privptr = (void *)ss;
return 1;